diff --git a/components/qr-code/index.vue b/components/qr-code/index.vue index 3abd20b..a1d7bce 100644 --- a/components/qr-code/index.vue +++ b/components/qr-code/index.vue @@ -5,6 +5,7 @@ mode="center" closeable :round="10" + @close="closeHandler" > {{ title }} @@ -55,6 +56,9 @@ export default { } }, methods: { + closeHandler() { + this.$emit('update:show', false) + }, initQRCode() { if (!this.qrData) return this.$nextTick(() => { @@ -64,11 +68,6 @@ export default { qrCode.make() const canvasContext = uni.createCanvasContext('QRCodeCanvas', this) qrCode.canvasContext = canvasContext - console.log( - '%c [ qrCode ]-58', - 'font-size:13px; background:#777244; color:#bbb688;', - qrCode - ) qrCode.drawCanvas() }) } diff --git a/config/request.js b/config/request.js index f3d61e2..ae39429 100644 --- a/config/request.js +++ b/config/request.js @@ -8,7 +8,7 @@ import { getToken, removeToken } from '@/config/auth.js' module.exports = (vm) => { // 初始化请求配置 uni.$u.http.setConfig((config) => { - config.baseURL = 'http://t-app.beida413.com/prod-api' + config.baseURL = 'http://192.168.0.104:8080' // 192.168.0.100:8080 //#ifdef DEV_SERVER diff --git a/pages/pay/index.vue b/pages/pay/index.vue index 4b612c0..5c8fc73 100644 --- a/pages/pay/index.vue +++ b/pages/pay/index.vue @@ -10,17 +10,17 @@ @@ -642,7 +642,7 @@ @tap="quickPay(ifcz)" color="linear-gradient(to right, #fb3024, #fb3024 )" > - {{ '立即支付' }} + 立即支付 @@ -658,19 +658,12 @@ :asyncClose="true" > - + - - {{ '支付宝支付' }} - - - - + --> - + @@ -732,8 +725,6 @@ export default { showSucce: false, // sucPay: 0, content: '支付成功', - wxPopup: false, - wxPopup1: false, luckydrawData: {}, ifcz: false, czJe: '', @@ -803,6 +794,10 @@ export default { // 获取银行卡 // this.getBankList() }, + onUnload() { + clearInterval(this.clockTime) + clearInterval(this.payStatus) + }, methods: { showQRCode(text) { this.qrCodeVisible = true @@ -849,11 +844,6 @@ export default { } }) }, - closewxPopup() { - this.wxPopup = false - this.wxPopup1 = false - clearInterval(payStatus) - }, // 绑定银行卡 bindBank(val) { uni.navigateTo({ @@ -1174,115 +1164,51 @@ export default { } }, scanPayBfWx(val) { - let params - if (this.ifcz) { - params = { - businessType: 3, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - } - } else { - params = { - businessType: this.businessType, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - } + const params = { + businessType: this.ifcz ? 3 : this.businessType, //订单类型充值 + businessCode: this.orderCode, + payChannel: val, + payType: 2, } api.unifiedorder(params).then(res => { - this.wxPopup = true - this.$nextTick(() => { - const ctx = uni.createCanvasContext('qrcodeCanvasWx', this) - const uqrcode = new UQRCode(ctx, { width: 280, height: 280 }) - uqrcode.make(res.data).then(() => { - uqrcode.drawCanvas() - }) - }) + this.showQRCode(res.data) }) this.checkPayStatus(params) }, // 微信支付 scanPayWx(val) { - let params - if (this.ifcz) { - params = { - businessType: 3, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - } - } - else { - params = { - businessType: this.businessType, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - } - - api.unifiedorder(params).then(res => { - this.wxPopup = true - this.$nextTick(() => { - const ctx = uni.createCanvasContext('qrcodeCanvasWx', this) - const uqrcode = new UQRCode(ctx, { width: 280, height: 280 }) - uqrcode.make(res.data).then(() => { - uqrcode.drawCanvas() - }) - }) - }) - this.checkPayStatus(params) + const params = { + businessType: this.ifcz ? 3 : this.businessType, //订单类型充值 + businessCode: this.orderCode, + payChannel: val, + payType: 2, } + api.unifiedorder(params).then(res => { + this.showQRCode(res.data) + }) + this.checkPayStatus(params) }, // 支付宝支付 scanPayAl(val) { - let params - if (this.ifcz) { - params = { - businessType: 3, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 1, - } - } else { - params = { - businessType: this.businessType, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 1, - } + const params = { + businessType: this.ifcz ? 3 : this.businessType, //订单类型充值 + businessCode: this.orderCode, + payChannel: val, + payType: 1, } api.unifiedorder(params).then(res => { - this.wxPopup1 = true - this.$nextTick(() => { - const ctx = uni.createCanvasContext('qrcodeCanvasAlipay', this) - const uqrcode = new UQRCode(ctx, { width: 280, height: 280 }) - uqrcode.make(res.data).then(() => { - uqrcode.drawCanvas() - }) - }) + this.showQRCode(res.data) }) this.checkPayStatus(params) }, // 宝付微信支付 scanPayBfWxJump(val) { - let params - if (this.ifcz) { - params = { - businessType: 3, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - appletFlag: 0, - } - } else { - params = { - businessType: this.businessType, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - appletFlag: 0, - } + const params = { + businessType: this.ifcz ? 3 : this.businessType, //订单类型充值 + businessCode: this.orderCode, + payChannel: val, + payType: 2, + appletFlag: 0, } api.unifiedorder(params).then(res => { let url = @@ -1297,23 +1223,12 @@ export default { }, // 通联微信支付 scanPayTlWxJump(val) { - let params - if (this.ifcz) { - params = { - businessType: 3, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - appletFlag: 0, - } - } else { - params = { - businessType: this.businessType, //订单类型充值 - businessCode: this.orderCode, - payChannel: val, - payType: 2, - appletFlag: 0, - } + const params = { + businessType: this.ifcz ? 3 : this.businessType, //订单类型充值 + businessCode: this.orderCode, + payChannel: val, + payType: 2, + appletFlag: 0, } api.unifiedorder(params).then(res => { let url = @@ -1418,8 +1333,7 @@ export default { this.$refs.successDialog.showSuccess(res.data) }) } else { - this.wxPopup = false - this.wxPopup1 = false + this.qrCodeVisible = false this.showSucce = true } } else {