cardMixins.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. break
  65. case 2:
  66. this.btnColor = '#16AFE8'
  67. this.buttonText = '个人网银支付'
  68. break
  69. case 3:
  70. this.btnColor = 'linear-gradient(90deg, #FF9300 0%, #F3B574 100%)'
  71. this.buttonText = '使用银行卡快捷支付'
  72. break
  73. }
  74. },
  75. checkPayMode(range) {
  76. // 校验支付模式
  77. // test range = '4'
  78. // 1微信 2支付宝 3个人网银 4企业网银 5快捷支付
  79. this.weChatFlag = range.indexOf('1') > -1
  80. this.B2BpayFlag = range.indexOf('4') > -1
  81. this.QuickPayFlag = range.indexOf('5') > -1
  82. // 设置默认支付方式
  83. if(this.QuickPayFlag){
  84. this.tabCurrentIndex = 3
  85. }else{
  86. this.tabCurrentIndex = this.weChatFlag ? 0 : this.B2BpayFlag ? 1 : 2
  87. }
  88. this.tabClick(this.tabCurrentIndex)
  89. }
  90. }
  91. }
  92. export default cardMixins