Ver Fonte

支付优化

shish há 2 anos atrás
pai
commit
b42085c584
1 ficheiros alterados com 9 adições e 12 exclusões
  1. 9 12
      mallApp/src/pages/callback/index.vue

+ 9 - 12
mallApp/src/pages/callback/index.vue

@@ -18,7 +18,7 @@
             <span>¥</span>
             <span class="app-size-36 app-bold">{{ totalPrice }}</span>
           </div>
-          <div class="order-num app-color-3">订单号: {{ option.orderSn }}</div>
+          <div class="order-num app-color-3">订单号: {{ orderSn }}</div>
         </block>
         <block v-else-if="pageStatus == 3 && payDiscountPrice >0">
           <div>
@@ -94,7 +94,8 @@ export default {
       },
       payCallData: {},
       setPassModal: false,
-      totalPrice:0
+      totalPrice:0,
+      orderSn:''
     };
   },
   computed: {
@@ -109,6 +110,7 @@ export default {
       this.$util.pageTo({url: "/pages/home/recent",type:3})
     },
     init() {
+      this.orderSn = this.option.orderSn ? this.option.orderSn : ''
       if(this.option.totalPrice){
         this.totalPrice = parseFloat(Number(this.option.totalPrice))
       }
@@ -125,27 +127,22 @@ export default {
       }
       balancePay({
         payPassword: this.form.payPassword,
-        orderSn: this.option.orderSn,
+        orderSn: this.orderSn,
         couponId: this.option.couponId
-      })
-        .then(res => {
+      }).then(res => {
           this.modalCancel();
           this.$msg("支付成功!");
-
           this.payCallData = res.data;
           this.paySuccess();
-        })
-        .catch(e => {
-          this.$msg(e.msg);
-          return false;
-        });
+      })
     },
     // 微信支付
     wxPayFn() {
       let miniOpenId = uni.getStorageSync('miniOpenId')
-      wxPay({ orderSn: this.option.orderSn, couponId: this.option.couponId,miniOpenId:miniOpenId }).then(res => {
+      wxPay({ orderSn: this.orderSn, couponId: this.option.couponId,miniOpenId:miniOpenId }).then(res => {
         this.payCallData = res.data
         wexinPay(res.data, this.paySuccess, this.payFail)
+        this.orderSn = res.data.orderSn ? res.data.orderSn : ''
       })
     },
     paySuccess() {