cardMixins.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // 收银台
  2. import Vue from 'vue'
  3. const cardMixins = {
  4. data() {
  5. return {
  6. popupShow: false, // 控制支付记录弹窗
  7. popupShow1: false, // 控制快捷支付银行弹窗
  8. tabCurrentIndex: 0,
  9. weChatFlag: false, // 微信支付开关
  10. B2BpayFlag: false, //企业网银支付开关
  11. QuickPayFlag: false, // 快捷支付开发
  12. buttonText: '微信支付',
  13. btnColor: '#0ABC64',
  14. cardsList:[],//查看银行列表
  15. defaultCards: null,
  16. }
  17. },
  18. filters:{
  19. bankNumeberFilter(value){
  20. return value.substring(value.length-4,value.length)
  21. }
  22. },
  23. computed: {
  24. showWeChatPayMode() {
  25. return this.weChatFlag
  26. },
  27. showB2BpayMode() {
  28. return this.B2BpayFlag
  29. },
  30. showQuickpayMode() {
  31. return this.QuickPayFlag
  32. }
  33. },
  34. methods: {
  35. handleChoiceaCards(data) {
  36. //选择的银行
  37. this.tabCurrentIndex = 3
  38. this.tabClick(3)
  39. this.defaultCards = data
  40. this.quickParams = { ...this.quickParams , ...data}
  41. },
  42. hanldeShowPopup(index) {
  43. switch (index) {
  44. case 0:
  45. this.popupShow = true
  46. break
  47. case 1:
  48. this.popupShow1 = true
  49. break
  50. default:
  51. break
  52. }
  53. },
  54. tabClick(index) { //tab切换
  55. this.tabCurrentIndex = index
  56. switch (index) {
  57. case 0:
  58. this.btnColor = '#0ABC64'
  59. this.buttonText = '微信支付'
  60. break
  61. case 1:
  62. this.btnColor = '#007ACC'
  63. this.buttonText = '企业网银支付'
  64. this.payType = 1
  65. break
  66. case 2:
  67. this.btnColor = '#16AFE8'
  68. this.buttonText = '个人网银支付'
  69. this.payType = 2
  70. break
  71. case 3:
  72. this.btnColor = 'linear-gradient(90deg, #FF9300 0%, #FF5B00 100%)'
  73. this.buttonText = '使用银行卡快捷支付'
  74. break
  75. }
  76. },
  77. checkPayMode(range,weChatFlag) {
  78. // 校验支付模式
  79. // test range = '4'
  80. // 1微信 2支付宝 3个人网银 4企业网银 5快捷支付
  81. if(range){
  82. if(weChatFlag === '2'){
  83. this.weChatFlag = false
  84. }else{
  85. this.weChatFlag = range.indexOf('1') > -1
  86. }
  87. this.B2BpayFlag = range.indexOf('4') > -1
  88. this.QuickPayFlag = range.indexOf('5') > -1
  89. // 设置默认支付方式
  90. if(this.QuickPayFlag){
  91. this.tabCurrentIndex = 3
  92. }else{
  93. this.tabCurrentIndex = this.weChatFlag ? 0 : this.B2BpayFlag ? 1 : 2
  94. }
  95. }else{
  96. this.tabCurrentIndex = 2
  97. }
  98. this.tabClick(this.tabCurrentIndex)
  99. }
  100. }
  101. }
  102. export default cardMixins