Explorar el Código

余额不足引导去充值

shish hace 3 meses
padre
commit
37916fc8a4
Se han modificado 1 ficheros con 23 adiciones y 9 borrados
  1. 23 9
      mallApp/src/pages/callback/pay.vue

+ 23 - 9
mallApp/src/pages/callback/pay.vue

@@ -30,10 +30,10 @@
         </block>
         <block v-if="pageStatus == 1 || pageStatus == 2">
           <view class="call-one-btn">
-            <view v-if="Number(hdInfo.balance)>0" style="color:green;font-weight:bold;font-size:36upx;margin-top:28upx;">可用余额 ¥{{ parseFloat(hdInfo.balance) }}</view>
+            <view v-if="Number(orderInfo.balance)>0" style="color:green;font-weight:bold;font-size:36upx;margin-top:28upx;">可用余额 ¥{{ parseFloat(orderInfo.balance) }}</view>
             <button v-if="orderInfo.showYePay == 1" class="button-com green pay-wx" @click="balancePayFn" style="height:100upx;line-height:50upx;">余额支付</button>
             <block v-if="Number(orderInfo.rechargeWeal) == 3 && Number(orderInfo.hbId) != 0">
-              <view style="color:green;font-size:36upx;margin-top:28upx;text-align:center;">使用了红包,只支持余额支付</view>
+              <view style="color:green;font-size:36upx;margin-top:28upx;text-align:center;">使用红包,只能余额支付</view>
             </block>
             <block v-else>
               <button v-if="getPayType == 1" class="button-com green pay-wx" @click="wxPayFn" style="height:100upx;line-height:50upx;">微信支付</button>
@@ -99,6 +99,10 @@ export default {
   computed: {
     ...mapGetters({ shopUser: "getShopUser",loginInfo:"getLoginInfo" })
   },
+  onShow() {
+      let id = this.option.id ? this.option.id : 0
+      this.getOrderInfo(id)
+  },
   methods: {
     register(){
       let account = uni.getStorageSync('account')
@@ -114,10 +118,12 @@ export default {
       this.initClass(this.pageStatus);
       getShopUser(true)
       let id = this.option.id?this.option.id:0
+      this.getOrderInfo(id)
+    },
+    getOrderInfo(id){
       getDetail({id:id}).then(res=>{
         if(res.code == 1){
           this.orderInfo = res.data ? res.data : {}
-          console.log('this.orderInfo',this.orderInfo)
         }
       })
     },
@@ -171,13 +177,21 @@ export default {
       let id = this.option.id?this.option.id:0
       let account = this.option.account?this.option.account:0
       let hdId = this.option.hdId?this.option.hdId:0
-			that.$util.confirmModal({content:'确认余额支付?'},() => {
-        balancePay({orderSn:this.orderSn}).then(res=>{
-          if(res.code == 1){
-            this.$util.pageTo({ url:"/pages/callback/paySuccess?id="+id+'&account='+account+'&hdId='+hdId,type: 2})
-          }
+
+      if(Number(this.orderInfo.balance) < Number(this.orderInfo.actPrice)){
+        that.$util.confirmModal({content:'余额不足,请充值'},() => {
+          that.$util.pageTo({ url: "/pages/member/recharge?hdId=" + hdId + "&account=" + account, })
         })
-      })
+        return false
+      }else{
+        that.$util.confirmModal({content:'确认余额支付?'},() => {
+          balancePay({orderSn:this.orderSn}).then(res=>{
+            if(res.code == 1){
+              this.$util.pageTo({ url:"/pages/callback/paySuccess?id="+id+'&account='+account+'&hdId='+hdId,type: 2})
+            }
+          })
+        })
+      }
     },
     // 初始样式
     initClass(val) {