Bladeren bron

feat(福利Go)卡券中心

xing.li 3 jaren geleden
bovenliggende
commit
abf63cc28a
3 gewijzigde bestanden met toevoegingen van 40 en 19 verwijderingen
  1. 10 13
      pages/welfareMall/activityInfo/activityInfo.js
  2. 28 4
      pages/welfareMall/activityList/activityList.js
  3. 2 2
      project.config.json

+ 10 - 13
pages/welfareMall/activityInfo/activityInfo.js

@@ -127,23 +127,18 @@ Page({
    * 下单
    */
   async nowBuy() {
-
-   
     let _self = this;
     try {
       let res = await WelfareMall.createOrder(_self.data.userMobile, _self.data.detail.activityId,1);
       _self.setData({
         orderInfo: res.data,
       })
-      // console.log(this.data.activityInfo.isPay)
-      // console.log(_self.data.orderInfo)
       if (this.data.detail.isPay == 1 && _self.data.orderInfo.orderSn) {
-        // console.log(22222)
         _self.goPay();
       } else {
-        // wx.reLaunch({
-        //   url: '/pages/couponSuccess/couponSuccess'
-        // })
+        _self.setData({
+          hideWindowValue:true
+        })
       }
 
     } catch (err) {
@@ -157,9 +152,9 @@ Page({
   async goPay() {
     console.log(wx.getStorageSync('loginInfo').openId)
     var _self = this;
-      let res = await WelfareMall.getOrderParams(_self.data.orderInfo.orderSn,wx.getStorageSync('loginInfo').openId);
-      console.log(res);
-      // res = res.wxPrePayVo
+      let result = await WelfareMall.getOrderParams(_self.data.orderInfo.orderSn,wx.getStorageSync('loginInfo').openId);
+      console.log(result);
+      let res = result.data
       wx.requestPayment({
         timeStamp: res.wxPrePayVo.timeStamp,
         package: res.wxPrePayVo.pack,
@@ -168,13 +163,15 @@ Page({
         paySign: res.wxPrePayVo.paySign,
         success: function (res) {
           //支付成功,跳转领取成功页面
+          _self.setData({
+            hideWindowValue:true
+          })
           // wx.reLaunch({
           //   url: '/pages/couponSuccess/couponSuccess'
           // })
         },
         fail: function (res) {
-          // console.log('payerror')
-          // console.log(res);
+         
         }
       })
   },

+ 28 - 4
pages/welfareMall/activityList/activityList.js

@@ -10,13 +10,16 @@ Page({
       type:1, //1免费 2 收费
       page:1,
       pageSize:10,
-      list:[]
+      list:[],
+      init:true
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.data.page = 1;
+    this.data.type = 1;
     this.getActivityList()
   },
 
@@ -59,7 +62,15 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+      let page = this.data.page +1
+
+      this.setData({
+        page:page
+      })
+      if(this.data.init){
+        this.getActivityList()
+      }
+      
   },
 
   /**
@@ -92,11 +103,24 @@ Page({
   // 1是免费,2是收费
    getActivityList: async function() {
 
-   
     let res = await WelfareMall.getActivityList(this.data.type,this.data.page,this.data.pageSize)
     console.log(res);
+    let init = true;
+    if(res.data.length==0){
+      init = false;
+      this.setData({
+        init:init
+      })
+      return;
+    }
+
+    if(this.data.page!=1){
+      var nowResult = this.data.recruitList.concat(res.data)
+    }else{
+      var nowResult = res.data
+    }
     this.setData({
-      list:res.data
+      list:nowResult
     })
   }
 })

+ 2 - 2
project.config.json

@@ -4,7 +4,7 @@
     "ignore": []
   },
   "setting": {
-    "urlCheck": false,
+    "urlCheck": true,
     "es6": true,
     "enhance": true,
     "postcss": false,
@@ -37,7 +37,7 @@
     "packNpmRelationList": [],
     "minifyWXSS": false,
     "disableUseStrict": false,
-    "minifyWXML": true,
+    "minifyWXML": false,
     "showES6CompileOption": false,
     "useCompilerPlugins": false
   },