Commit 7d2d862fba5b142b01b82750d330be0876ac0313
Merge branch 'qa' into 'master'
Qa See merge request !267
Showing
1 changed file
with
44 additions
and
21 deletions
pages/user/coupons/coupons.js
| @@ -159,12 +159,13 @@ Page({ | @@ -159,12 +159,13 @@ Page({ | ||
| 159 | wx.navigateTo({ url: '/pages/getphone/getphone', }) | 159 | wx.navigateTo({ url: '/pages/getphone/getphone', }) | 
| 160 | return false; | 160 | return false; | 
| 161 | } | 161 | } | 
| 162 | - this.init(th.myyhj); | 162 | + this.init(th.myyhj,th.s_guoqi); | 
| 163 | + | ||
| 163 | 164 | ||
| 164 | }, | 165 | }, | 
| 165 | 166 | ||
| 166 | //----------券的界面初始化----------- | 167 | //----------券的界面初始化----------- | 
| 167 | - init:function(func){ | 168 | + init:function(func,s_guoqi){ | 
| 168 | var user_id = getApp().globalData.user_id; | 169 | var user_id = getApp().globalData.user_id; | 
| 169 | var store_id = os.stoid; | 170 | var store_id = os.stoid; | 
| 170 | var th=this; | 171 | var th=this; | 
| @@ -200,11 +201,11 @@ Page({ | @@ -200,11 +201,11 @@ Page({ | ||
| 200 | th.data.b_out_arr=b_out_arr; //过期 | 201 | th.data.b_out_arr=b_out_arr; //过期 | 
| 201 | th.data.b_isuse_arr=b_isuse_arr; //已使用 | 202 | th.data.b_isuse_arr=b_isuse_arr; //已使用 | 
| 202 | th.setData({ udata: data}); | 203 | th.setData({ udata: data}); | 
| 203 | - func(); | 204 | + func();s_guoqi(); | 
| 204 | 205 | ||
| 205 | }else{ | 206 | }else{ | 
| 206 | th.setData({ udata: data}); | 207 | th.setData({ udata: data}); | 
| 207 | - func(); | 208 | + func();s_guoqi(); | 
| 208 | } | 209 | } | 
| 209 | }) | 210 | }) | 
| 210 | 211 | ||
| @@ -212,11 +213,38 @@ Page({ | @@ -212,11 +213,38 @@ Page({ | ||
| 212 | }) | 213 | }) | 
| 213 | }, | 214 | }, | 
| 214 | 215 | ||
| 215 | - | 216 | + s_guoqi:function(){ | 
| 217 | + | ||
| 218 | + var th = this, number=0; | ||
| 219 | + var user_id = getApp().globalData.user_id; | ||
| 220 | + var store_id = os.stoid; | ||
| 221 | + var get_data = { | ||
| 222 | + user_id: user_id, | ||
| 223 | + store_id: store_id, | ||
| 224 | + IsUse: 2, | ||
| 225 | + pageSize: 1, | ||
| 226 | + page: 1 | ||
| 227 | + }; | ||
| 228 | + | ||
| 229 | + getApp().request.promiseGet("/api/weshop/users/listQuan", { | ||
| 230 | + data:get_data | ||
| 231 | + }).then(res=>{ | ||
| 232 | + var a = res.data,val = a.data.total; | ||
| 233 | + var details = a.data.pageData; | ||
| 234 | + if (details.length == 0){ | ||
| 235 | + if(th.data.b_out_arr) th.setData({ number: th.data.b_out_arr.length}); | ||
| 236 | + return false; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + var all_length=val+th.data.b_out_arr.length; | ||
| 240 | + th.setData({ number: all_length}); | ||
| 241 | + | ||
| 242 | + }) | ||
| 243 | + }, | ||
| 244 | + | ||
| 216 | //获取劵的数量 | 245 | //获取劵的数量 | 
| 217 | myyhj:function() { | 246 | myyhj:function() { | 
| 218 | - if(this.data.isloading) return; | ||
| 219 | - | 247 | + if(this.data.isloading) return; | 
| 220 | var len = this.data.details.length; | 248 | var len = this.data.details.length; | 
| 221 | this.data.current_page++; | 249 | this.data.current_page++; | 
| 222 | var e = this, sum, val, number; | 250 | var e = this, sum, val, number; | 
| @@ -242,14 +270,12 @@ Page({ | @@ -242,14 +270,12 @@ Page({ | ||
| 242 | getApp().request.promiseGet("/api/weshop/users/listQuan", { | 270 | getApp().request.promiseGet("/api/weshop/users/listQuan", { | 
| 243 | data: get_data, | 271 | data: get_data, | 
| 244 | }).then(res => { | 272 | }).then(res => { | 
| 245 | - th.data.isloading=0; | ||
| 246 | - | ||
| 247 | - var a = res.data; | ||
| 248 | - val = a.data.total; | ||
| 249 | - var details = a.data.pageData; | ||
| 250 | - | ||
| 251 | - th.setData({isset:1}); | ||
| 252 | - | 273 | + th.data.isloading=0; | 
| 274 | + var a = res.data; | ||
| 275 | + val = a.data.total; | ||
| 276 | + var details = a.data.pageData; | ||
| 277 | + th.setData({isset:1}); | ||
| 278 | + | ||
| 253 | //没有找到优惠券的时候 | 279 | //没有找到优惠券的时候 | 
| 254 | if (details.length == 0 && th.data.current_page==1) { | 280 | if (details.length == 0 && th.data.current_page==1) { | 
| 255 | this.setData({sheng:0}); | 281 | this.setData({sheng:0}); | 
| @@ -268,13 +294,11 @@ Page({ | @@ -268,13 +294,11 @@ Page({ | ||
| 268 | return false; | 294 | return false; | 
| 269 | } | 295 | } | 
| 270 | 296 | ||
| 271 | - th.setData({ val: val+init_num }); | ||
| 272 | - | 297 | + th.setData({ val: val+init_num }); | 
| 273 | //数组合并 | 298 | //数组合并 | 
| 274 | big_arr=big_arr.concat(details); | 299 | big_arr=big_arr.concat(details); | 
| 275 | //设置数组 | 300 | //设置数组 | 
| 276 | - th.setData({ details: big_arr, }); | ||
| 277 | - | 301 | + th.setData({ details: big_arr, }); | 
| 278 | //延迟显示二维码的内容 | 302 | //延迟显示二维码的内容 | 
| 279 | setTimeout(function () { | 303 | setTimeout(function () { | 
| 280 | if(th.data.current_page==1) details=big_arr; | 304 | if(th.data.current_page==1) details=big_arr; | 
| @@ -283,8 +307,7 @@ Page({ | @@ -283,8 +307,7 @@ Page({ | ||
| 283 | qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460); | 307 | qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460); | 
| 284 | } | 308 | } | 
| 285 | wx.hideLoading(); | 309 | wx.hideLoading(); | 
| 286 | - }, 1200) | ||
| 287 | - | 310 | + }, 1200) | 
| 288 | }) | 311 | }) | 
| 289 | 312 | ||
| 290 | 313 | 
