// 收银台 import Vue from 'vue' const cardMixins = { data() { return { popupShow: false,// 控制支付记录弹窗 popupShow1: false,// 控制快捷支付银行弹窗 tabCurrentIndex: 0, weChatFlag:false, // 微信支付开关 B2BpayFlag: false,//企业网银支付开关 buttonText:'微信支付', btnColor:'#0ABC64', cards:{ type: 1, flag: 0, B2B: 'CCB', name: '建设银行借记卡(0023)', code:'45454545454521212' }, list: [ { type: 1, flag: 0, B2B: 'CCB', name: '建设银行借记卡(0023)', code:'45454545454521212' }, { type: 1, flag: 0, B2B: 'ICBC', name: '工商银行借记卡(0023)', code:'45454545454521212' }, { type: 0, flag: 0, B2B: 'ABC', name: '农业银行借记卡(0023)', code:'45454545454521212' } ] } }, computed: { showWeChatPayMode() { return this.weChatFlag }, showB2BpayMode() { return this.B2BpayFlag } }, methods: { handleChoiceaCards(data){ //选择的银行 console.log('选择的银行',data) this.cards = data this.tabClick(3) }, hanldeShowPopup(index) { switch (index) { case 0: this.popupShow = true break case 1: this.popupShow1 = true break default: break } }, tabClick(index) {//tab切换 this.tabCurrentIndex = index switch(index){ case 0: this.btnColor='#0ABC64' this.buttonText='微信支付' break case 1: this.btnColor='#007ACC' this.buttonText='企业网银支付' break case 2: this.btnColor='#16AFE8' this.buttonText='个人网银支付' break case 3: this.btnColor='linear-gradient(90deg, #FF9300 0%, #FF5B00 100%)' this.buttonText='使用银行卡快捷支付' break } }, handleAddCard(index){ //跳转添加卡号 this.$api.navigateTo(`/pages/user/pay/card-add?type=${index}`) }, checkPayMode(range) { // 校验支付模式 // test range = '4' // 1微信 2支付宝 3个人网银 4企业网银 this.weChatFlag = range.indexOf('1') > -1 this.B2BpayFlag = range.indexOf('4') > -1 // 设置默认支付方式 this.tabCurrentIndex = this.weChatFlag ? 0 : this.B2BpayFlag ? 1 : 2 }, handleLogo(type) { const LogoMap = { 'CCB':'https://img2.baidu.com/it/u=4262210206,1883697020&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501', 'ICBC':'https://www.weixinyunduan.com/ups/2016/01/309212/edf5a48e69afa569eb31a52fc36de450.jpg', 'ABC':'https://userfile.yksup.com/userdata/18039/img/brand-20170315232223_e0p18k.jpg' } return LogoMap[type] }, } } export default cardMixins