From 7bf27aee6b1663397c76c8bdfc474300ff3eb6fd Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Wed, 31 Aug 2022 14:15:34 +0800 Subject: [PATCH] 优惠券,跳转到相应的券的状态 --- packageD/pages/user/coupons/coupons.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/packageD/pages/user/coupons/coupons.js b/packageD/pages/user/coupons/coupons.js index 24bd321..8d07154 100644 --- a/packageD/pages/user/coupons/coupons.js +++ b/packageD/pages/user/coupons/coupons.js @@ -42,16 +42,23 @@ Page({ by_list:[], isloading:0, pageNum: 1, + currentIndex:0 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - _this = this; - this.setData({ - details: [] - }); - this.wjquery(); + // _this = this; + // this.setData({ + // details: [] + // }); + // this.wjquery(); + if(options.index){ + this.setData({currentIndex:options.index}); + } + + + }, /** * 生命周期函数--监听页面显示 @@ -68,18 +75,26 @@ Page({ * by sty */ getApp().getConfig2(function (ee) { - var json_d = JSON.parse(ee.switch_list); + var json_d = JSON.parse(ee.switch_list); let is_show_dhwz = json_d.dhwz_switch; let grades = th.data.grades; // console.log('is_show_dhwz----------------------------',is_show_dhwz); - if(is_show_dhwz) { - if(grades.indexOf('微券兑换') == -1) { + if (is_show_dhwz) { + if (grades.indexOf('微券兑换') == -1) { grades.push('微券兑换'); - th.setData({ grades }); - }; - }; - th.setData({ is_show_dhwz }); + th.setData({grades}); + } + + } + + th.setData({is_show_dhwz}); + th.init_data(th.data.currentIndex); + },1); + + + + }, @@ -155,6 +170,30 @@ Page({ this.wjquery(); }; }, + + init_data(idx){ + + var name=this.data.grades[idx]; + this.setData({ + is_get: 0, + pageNum: 1, + grade_name: name, + currentIndex: idx, + is_no_more: 0, + current_page: 1, + noMore: false, + details: [], + by_list: [], + showQr: false, + }); + + if(idx == 3) {//微券兑换 + this.exchange(); + } else {//其他 + this.wjquery(); + }; + }, + /** * 点击"立即使用" -- libgit2 0.21.4