|
@@ -1,6 +1,8 @@
|
|
|
<template>
|
|
|
<div class="pay-code">
|
|
|
- <div class="paymount">扫码付款:<span class="exp">¥</span><span class="price">{{ data.payAmount | formatPrice }}</span></div>
|
|
|
+ <div class="paymount">
|
|
|
+ 扫码付款:<span class="exp">¥</span><span class="price">{{ data.payAmount | formatPrice }}</span>
|
|
|
+ </div>
|
|
|
<el-image v-loading="isLoading" :src="payUrl" class="qrcode" />
|
|
|
<div class="pay-tip">
|
|
|
<i class="icon-wechat" />
|
|
@@ -29,24 +31,31 @@ export default {
|
|
|
this.drawQrcode()
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- clearInterval(this.timer)
|
|
|
+ this.stopPayCheck()
|
|
|
},
|
|
|
methods: {
|
|
|
// 绘制支付二维码
|
|
|
drawQrcode() {
|
|
|
- const wxPayUri = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=${JSON.stringify(this.data)}#wechat_redirect`
|
|
|
+ // const wxPayUri = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=${process.env.VUE_APP_BASE_SERVER}/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=${JSON.stringify(this.data)}#wechat_redirect`
|
|
|
+ const wxPayUri = `https://www-b.caimei365.com/wxcode.html?orderInfo=${encodeURIComponent(
|
|
|
+ JSON.stringify(this.data)
|
|
|
+ )}`
|
|
|
qrcode
|
|
|
.toDataURL(wxPayUri, { width: 180, margin: 0, errorCorrectionLevel: 'H', type: 'image/jpeg', scale: 1 })
|
|
|
- .then(url => {
|
|
|
+ .then((url) => {
|
|
|
this.payUrl = url
|
|
|
this.checkedPayConfirm()
|
|
|
})
|
|
|
- .catch(err => {
|
|
|
+ .catch((err) => {
|
|
|
console.error(err)
|
|
|
- }).finally(() => {
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
this.isLoading = false
|
|
|
})
|
|
|
},
|
|
|
+ stopPayCheck() {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ },
|
|
|
// 验证确认支付
|
|
|
checkedPayConfirm() {
|
|
|
this.timer = setInterval(() => {
|