cardMixins.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. buttonText:'微信支付',
  12. btnColor:'#0ABC64',
  13. cards:{
  14. type: 1,
  15. flag: 0,
  16. B2B: 'CCB',
  17. name: '建设银行借记卡(0023)',
  18. code:'45454545454521212'
  19. },
  20. list: [
  21. {
  22. type: 1,
  23. flag: 0,
  24. B2B: 'CCB',
  25. name: '建设银行借记卡(0023)',
  26. code:'45454545454521212'
  27. },
  28. {
  29. type: 1,
  30. flag: 0,
  31. B2B: 'ICBC',
  32. name: '工商银行借记卡(0023)',
  33. code:'45454545454521212'
  34. },
  35. {
  36. type: 0,
  37. flag: 0,
  38. B2B: 'ABC',
  39. name: '农业银行借记卡(0023)',
  40. code:'45454545454521212'
  41. }
  42. ]
  43. }
  44. },
  45. computed: {
  46. showWeChatPayMode() {
  47. return this.weChatFlag
  48. },
  49. showB2BpayMode() {
  50. return this.B2BpayFlag
  51. }
  52. },
  53. methods: {
  54. handleChoiceaCards(data){
  55. //选择的银行
  56. console.log('选择的银行',data)
  57. this.cards = data
  58. this.tabClick(3)
  59. },
  60. hanldeShowPopup(index) {
  61. switch (index) {
  62. case 0:
  63. this.popupShow = true
  64. break
  65. case 1:
  66. this.popupShow1 = true
  67. break
  68. default:
  69. break
  70. }
  71. },
  72. tabClick(index) {//tab切换
  73. this.tabCurrentIndex = index
  74. switch(index){
  75. case 0:
  76. this.btnColor='#0ABC64'
  77. this.buttonText='微信支付'
  78. break
  79. case 1:
  80. this.btnColor='#007ACC'
  81. this.buttonText='企业网银支付'
  82. break
  83. case 2:
  84. this.btnColor='#16AFE8'
  85. this.buttonText='个人网银支付'
  86. break
  87. case 3:
  88. this.btnColor='linear-gradient(90deg, #FF9300 0%, #FF5B00 100%)'
  89. this.buttonText='使用银行卡快捷支付'
  90. break
  91. }
  92. },
  93. handleAddCard(index){
  94. //跳转添加卡号
  95. this.$api.navigateTo(`/pages/user/pay/card-add?type=${index}`)
  96. },
  97. checkPayMode(range) {
  98. // 校验支付模式
  99. // test range = '4'
  100. // 1微信 2支付宝 3个人网银 4企业网银
  101. this.weChatFlag = range.indexOf('1') > -1
  102. this.B2BpayFlag = range.indexOf('4') > -1
  103. // 设置默认支付方式
  104. this.tabCurrentIndex = this.weChatFlag ? 0 : this.B2BpayFlag ? 1 : 2
  105. },
  106. handleLogo(type) {
  107. const LogoMap = {
  108. 'CCB':'https://img2.baidu.com/it/u=4262210206,1883697020&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501',
  109. 'ICBC':'https://www.weixinyunduan.com/ups/2016/01/309212/edf5a48e69afa569eb31a52fc36de450.jpg',
  110. 'ABC':'https://userfile.yksup.com/userdata/18039/img/brand-20170315232223_e0p18k.jpg'
  111. }
  112. return LogoMap[type]
  113. },
  114. }
  115. }
  116. export default cardMixins