tangning пре 2 година
родитељ
комит
b7adfd44df
1 измењених фајлова са 8 додато и 5 уклоњено
  1. 8 5
      src/views/mobile/index.vue

+ 8 - 5
src/views/mobile/index.vue

@@ -55,6 +55,7 @@ async function handelPay() {
 }
 // 调微信支付
 function onBridgeReady(obj) {
+  var that = this
   WeixinJSBridge.invoke(
     'getBrandWCPayRequest',
     {
@@ -71,23 +72,24 @@ function onBridgeReady(obj) {
     },
     function (res) {
       if (res.err_msg == 'get_brand_wcpay_request:ok') {
+        orderDetal.value.payStatus = 1
         // 使用以上方式判断前端返回,微信团队郑重提示:
         //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
         showConfirm({
           text: '成功了',
           type: 'warn',
           callback: (val) => {
-            console.log('我的测试计划', val)
+            handlePayresult()
           }
         })
         console.log('成功了', res)
       } else {
-        console.log('失败了', res)
+        orderDetal.value.payStatus = 2
         showConfirm({
           text: '失败了',
           type: 'warn',
           callback: (val) => {
-            console.log('我的测试计划', val)
+            handlePayresult()
           }
         })
       }
@@ -105,7 +107,7 @@ function getDetial() {
         text: res.payStatus === 2 ? '支付失败' : '支付成功',
         type: res.payStatus === 2 ? 'err' : 'success',
         callback: () => {
-          handlePayresult(res)
+          handlePayresult()
         }
       })
       return
@@ -115,7 +117,8 @@ function getDetial() {
     }
   })
 }
-function handlePayresult(item){
+function handlePayresult(){
+  let item = orderDetal.value
   if(item.orderType == 'incrementOrder'){
     location.replace(`/mobile.html#/information`)
   }else{