Commit 7bf27aee6b1663397c76c8bdfc474300ff3eb6fd

Authored by yvan.ni
1 parent 4621df77

优惠券,跳转到相应的券的状态

packageD/pages/user/coupons/coupons.js
... ... @@ -42,16 +42,23 @@ Page({
42 42 by_list:[],
43 43 isloading:0,
44 44 pageNum: 1,
  45 + currentIndex:0
45 46 },
46 47 /**
47 48 * 生命周期函数--监听页面加载
48 49 */
49 50 onLoad: function (options) {
50   - _this = this;
51   - this.setData({
52   - details: []
53   - });
54   - this.wjquery();
  51 + // _this = this;
  52 + // this.setData({
  53 + // details: []
  54 + // });
  55 + // this.wjquery();
  56 + if(options.index){
  57 + this.setData({currentIndex:options.index});
  58 + }
  59 +
  60 +
  61 +
55 62 },
56 63 /**
57 64 * 生命周期函数--监听页面显示
... ... @@ -68,18 +75,26 @@ Page({
68 75 * by sty
69 76 */
70 77 getApp().getConfig2(function (ee) {
71   - var json_d = JSON.parse(ee.switch_list);
  78 + var json_d = JSON.parse(ee.switch_list);
72 79 let is_show_dhwz = json_d.dhwz_switch;
73 80 let grades = th.data.grades;
74 81 // console.log('is_show_dhwz----------------------------',is_show_dhwz);
75   - if(is_show_dhwz) {
76   - if(grades.indexOf('微券兑换') == -1) {
  82 + if (is_show_dhwz) {
  83 + if (grades.indexOf('微券兑换') == -1) {
77 84 grades.push('微券兑换');
78   - th.setData({ grades });
79   - };
80   - };
81   - th.setData({ is_show_dhwz });
  85 + th.setData({grades});
  86 + }
  87 +
  88 + }
  89 +
  90 + th.setData({is_show_dhwz});
  91 + th.init_data(th.data.currentIndex);
  92 +
82 93 },1);
  94 +
  95 +
  96 +
  97 +
83 98 },
84 99  
85 100  
... ... @@ -155,6 +170,30 @@ Page({
155 170 this.wjquery();
156 171 };
157 172 },
  173 +
  174 + init_data(idx){
  175 +
  176 + var name=this.data.grades[idx];
  177 + this.setData({
  178 + is_get: 0,
  179 + pageNum: 1,
  180 + grade_name: name,
  181 + currentIndex: idx,
  182 + is_no_more: 0,
  183 + current_page: 1,
  184 + noMore: false,
  185 + details: [],
  186 + by_list: [],
  187 + showQr: false,
  188 + });
  189 +
  190 + if(idx == 3) {//微券兑换
  191 + this.exchange();
  192 + } else {//其他
  193 + this.wjquery();
  194 + };
  195 + },
  196 +
158 197  
159 198 /**
160 199 * 点击"立即使用"
... ...