浏览代码

feat(福利go)修改无库存状态

xing.li 3 年之前
父节点
当前提交
58559cf730
共有 2 个文件被更改,包括 26 次插入11 次删除
  1. 24 9
      pages/welfareMall/activityInfo/activityInfo.js
  2. 2 2
      project.config.json

+ 24 - 9
pages/welfareMall/activityInfo/activityInfo.js

@@ -15,7 +15,8 @@ Page({
      buttonText:'',
      userMobile: '', //用户手机号
      orderInfo: [], //下单信息
-     hideWindowValue:false
+     hideWindowValue:false,
+     preventDup:true
   },
 
   /**
@@ -87,13 +88,13 @@ Page({
      let res  = await WelfareMall.getActivityDetail(activityId)
 
      let statusShowText = '';
-     if(res.data.stock <=0){
-      statusShowText == '已售罄'
+     if(res.data.stock <= 0){
+      statusShowText = '已售罄'
      }
      if(res.data.status ==3){
-      statusShowText == '已结束'
+      statusShowText = '已结束'
      }
-
+     console.log(res.data.stock)
      let buttonText = res.data.isPay == 1 ? '立即抢购' : '立即领取';
      this.setData({
        detail:res.data,
@@ -134,6 +135,12 @@ Page({
    */
   async nowBuy() {
     let _self = this;
+    if(!this.data.preventDup){
+        return;
+    }
+    this.setData({
+      preventDup:false
+    })
     try {
       let res = await WelfareMall.createOrder(_self.data.userMobile, _self.data.detail.activityId,1);
       _self.setData({
@@ -143,11 +150,15 @@ Page({
         _self.goPay();
       } else {
         _self.setData({
-          hideWindowValue:true
+          hideWindowValue:true,
+          preventDup:true
         })
       }
 
     } catch (err) {
+      this.setData({
+        preventDup:true
+      })
       app.showToast(err.msg);
     }
 
@@ -156,10 +167,10 @@ Page({
    * 获取订单参数
    */
   async goPay() {
-    console.log(wx.getStorageSync('loginInfo').openId)
+    // console.log(wx.getStorageSync('loginInfo').openId)
     var _self = this;
       let result = await WelfareMall.getOrderParams(_self.data.orderInfo.orderSn,wx.getStorageSync('loginInfo').openId);
-      console.log(result);
+      // console.log(result);
       let res = result.data
       wx.requestPayment({
         timeStamp: res.wxPrePayVo.timeStamp,
@@ -170,11 +181,15 @@ Page({
         success: function (res) {
           //支付成功,跳转领取成功页面
           _self.setData({
-            hideWindowValue:true
+            hideWindowValue:true,
+            preventDup:true
           })
          
         },
         fail: function (res) {
+          _self.setData({
+            preventDup:true
+          })
           _self.goToOrderList()
         }
       })

+ 2 - 2
project.config.json

@@ -31,7 +31,7 @@
       "outputPath": ""
     },
     "enableEngineNative": false,
-    "useIsolateContext": true,
+    "useIsolateContext": false,
     "userConfirmedBundleSwitch": false,
     "packNpmManually": false,
     "packNpmRelationList": [],
@@ -42,7 +42,7 @@
     "useCompilerPlugins": false
   },
   "compileType": "miniprogram",
-  "libVersion": "2.21.0",
+  "libVersion": "2.21.2",
   "appid": "wxcc1cdb8babd3f62c",
   "projectname": "%E9%A3%9E%E7%A0%81",
   "debugOptions": {