From 96b8ed637eddad187a24932a73044beb0e493dcb Mon Sep 17 00:00:00 2001 From: TianYu <332368756@qq.com> Date: Thu, 18 May 2023 18:30:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/paymentMember/index.vue | 40 ++++++++++++++----- yudao-ui-app/index.html | 1 + 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/yudao-ui-app/components/paymentMember/index.vue b/yudao-ui-app/components/paymentMember/index.vue index b3607addd..dd4798b74 100644 --- a/yudao-ui-app/components/paymentMember/index.vue +++ b/yudao-ui-app/components/paymentMember/index.vue @@ -75,6 +75,35 @@ action: 'payClose' }); }, + // 微信支付JSAPI调起 + wxPayJSAPI(payData) { + function onBridgeReady() { + WeixinJSBridge.invoke('getBrandWCPayRequest', { + "appId": payData.appId, //公众号ID,由商户传入 + "timeStamp": payData.timeStamp, //时间戳,自1970年以来的秒数 + "nonceStr": payData.nonceStr, //随机串 + "package": payData.packageValue, + "signType": payData.signType, //微信签名方式: + "paySign": payData.paySign //微信签名 + }, + function(res) { + if (res.err_msg == "get_brand_wcpay_request:ok") { + // 使用以上方式判断前端返回,微信团队郑重提示: + //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 + } + }) + } + if (typeof WeixinJSBridge == "undefined") { + if (document.addEventListener) { + document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false) + } else if (document.attachEvent) { + document.attachEvent('WeixinJSBridgeReady', onBridgeReady) + document.attachEvent('onWeixinJSBridgeReady', onBridgeReady) + } + } else { + onBridgeReady() + } + }, goPay: function(paytype) { let that = this; if (that.payInfo.orderInfos.length === 0) return that.$util.Tips({ @@ -99,16 +128,7 @@ switch (paytype) { case 'WXPAY': uni.hideLoading(); - location.replace(jsConfig.h5Url + '&redirect_url=' + window.location.protocol + - '//' + window.location.host + goPages + '&status=1'); - return that.$util.Tips({ - title: "支付中", - icon: 'success' - }, () => { - that.$emit('onChangeFun', { - action: 'pay_complete' - }); - }); + that.wxPayJSAPI(jsConfig.jsapiResult) break; case 'ALIPAY': uni.hideLoading(); diff --git a/yudao-ui-app/index.html b/yudao-ui-app/index.html index 03e5fc6e1..20de081f3 100644 --- a/yudao-ui-app/index.html +++ b/yudao-ui-app/index.html @@ -9,6 +9,7 @@ '') + From 40398dab272af2567c9bcf25398bc42aa90cb443 Mon Sep 17 00:00:00 2001 From: TianYu <332368756@qq.com> Date: Thu, 18 May 2023 19:11:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20openid=E5=8A=A8=E6=80=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-app/components/paymentMember/index.vue | 15 +++++++-------- yudao-ui-app/manifest.json | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/yudao-ui-app/components/paymentMember/index.vue b/yudao-ui-app/components/paymentMember/index.vue index dd4798b74..692d924e5 100644 --- a/yudao-ui-app/components/paymentMember/index.vue +++ b/yudao-ui-app/components/paymentMember/index.vue @@ -112,14 +112,13 @@ uni.showLoading({ title: '支付中' }); - that.payInfo.openid = 'omq7W6DxNcTjsvzahB5D3gwkGPzI' - // if(paytype === 'WXPAY' && !that.openId) { - // return that.$util.Tips({ - // title: '请在微信客户端进行支付操作' - // }); - // } else { - // that.payInfo.openid = that.openId - // } + if(paytype === 'WXPAY' && !that.openId) { + return that.$util.Tips({ + title: '请在微信客户端进行支付操作' + }); + } else { + that.payInfo.openid = that.openId + } memberTopUp({ ...that.payInfo, payType: paytype diff --git a/yudao-ui-app/manifest.json b/yudao-ui-app/manifest.json index 2b885fa76..28c074a07 100644 --- a/yudao-ui-app/manifest.json +++ b/yudao-ui-app/manifest.json @@ -1,6 +1,6 @@ { "name" : "crmeb", - "appid" : "__UNI__E8BDBA5", + "appid" : "__UNI__B5A2217", "description" : "crmeb商城", "versionName" : "1.0.0", "versionCode" : 1001,