Commit 45fe29144d5d6356b332e4f48121aa9a858bae67

Authored by yvan.ni
1 parent efb8f64a

券显示包邮券的功能制作

pages/user/coupons/coupons.js
... ... @@ -26,7 +26,9 @@ Page({
26 26 * 页面的初始数据
27 27 */
28 28 data: {
29   - sheng:3,
  29 + sheng:1, //是否有更多
  30 + overdue_sheng:1, //是否有更多
  31 +
30 32 details: [], //可使用的数据
31 33 sum: 0, //全部票
32 34 val: 0, //可使用票
... ... @@ -49,14 +51,20 @@ Page({
49 51 udata: null,
50 52 iurl:os.imghost,
51 53 is_show_dhwz:0,
  54 +
  55 + b_can_arr:null, //包邮券的未使用内容
  56 + b_out_arr:null, //包邮券的已过期的内容
  57 + b_isuse_arr:null,//包邮券的已使用的内容
  58 +
  59 + isloading:0, //正在加载中的代码
52 60 },
53 61 // 点击选中二维码
54 62 click: function(e) {
55 63 var val = e.currentTarget.dataset.cashrepno;
56 64 getApp().globalData.val =val;
57   - wx.navigateTo({
58   - url: 'qr_code/qr_code',
59   - })
  65 + wx.navigateTo({
  66 + url: 'qr_code/qr_code',
  67 + })
60 68  
61 69 },
62 70 // 点击返回主页
... ... @@ -136,134 +144,158 @@ Page({
136 144 var json_d = JSON.parse(ee.switch_list);
137 145 th.setData({ is_show_dhwz: json_d.dhwz_switch });
138 146 })
  147 +
139 148 },
140 149  
141 150  
142 151 onShow: function() {
143   - // this.setData({
144   - // details: [],
145   -
146   - // });
147   - this.myyhj();
148   -
  152 + var th=this;
  153 + wx.setNavigationBarTitle({ title: "我的优惠券", })
  154 +
149 155 //--先判断会员状态--
150 156 var user_info = getApp().globalData.userInfo;
151 157 if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
152 158 wx.navigateTo({ url: '/pages/getphone/getphone', })
153 159 return false;
154 160 }
155   - wx.setNavigationBarTitle({
156   - title: "我的优惠券",
157   - })
  161 + this.init(th.myyhj);
  162 +
158 163 },
  164 +
  165 + //----------券的界面初始化-----------
  166 + init:function(func){
  167 + var user_id = getApp().globalData.user_id;
  168 + var store_id = os.stoid;
  169 + var th=this;
  170 + rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + user_id, {
  171 + isShowLoading: 0,
  172 + success: function (su) {
  173 +
  174 + var data = su.data.data;
  175 + data.cashcount = parseInt(data.CashCount);
  176 + getApp().globalData.Integral = data.Integral;
  177 +
  178 + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{data:{user_id: user_id, store_id: os.stoid, pageSize:200}}).then(res=>{
  179 + if(res.data.code==0 && res.data.data && res.data.data.total>0 ){
  180 + var b_arr=res.data.data.pageData;
  181 + var b_can_arr=[]; //未使用
  182 + var b_out_arr=[]; //已过期
  183 + var b_isuse_arr=[]; //已过期
  184 + for(var i in b_arr){
  185 + b_arr[i].isby=1;
  186 + if(b_arr[i].isuse==0){
  187 + if(b_arr[i].use_end_time<ut.gettimestamp()){
  188 + b_can_arr.push(b_arr[i]);
  189 + }else{
  190 + b_can_arr.push(b_arr[i]);
  191 + }
  192 +
  193 + }else{
  194 + b_isuse_arr.push(b_arr[i]);
  195 + }
  196 + }
  197 + data.cashcount= data.cashcount+b_arr.length; //加上包邮券的数量
  198 + th.data.b_can_arr=b_can_arr; //可使用
  199 + th.data.b_out_arr=b_out_arr; //过期
  200 + th.data.b_isuse_arr=b_isuse_arr; //已使用
  201 + th.setData({ udata: data});
  202 + func();
  203 +
  204 + }else{
  205 + th.setData({ udata: data});
  206 + func();
  207 + }
  208 + })
  209 +
  210 + }
  211 + })
  212 + },
  213 +
159 214  
160 215 //获取劵的数量
161   - async myyhj() {
162   - //if (this.data.is_no_more) return;
163   - var len = this.data.details.length;
164   - this.data.current_page++;
165   - var e = this,
166   - sum, val, number;
167   - var user_id = getApp().globalData.user_id;
168   - var store_id = os.stoid;
169   -
170   -
171   - console.log("参数", user_id, store_id);
172   - rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + user_id, {
173   - isShowLoading: 0,
174   - success: function (su) {
  216 + myyhj:function() {
  217 + if(this.data.isloading) return;
  218 +
  219 + var len = this.data.details.length;
  220 + this.data.current_page++;
  221 + var e = this, sum, val, number;
  222 + var user_id = getApp().globalData.user_id;
  223 + var store_id = os.stoid;
  224 + var th=this; var init_num=0;
175 225  
176   - var data = su.data.data;
177   -
178   - data.cashcount = parseInt(data.CashCount);
179   - getApp().globalData.Integral = data.Integral;
180   - e.setData({ udata: data});
181   -
182   - }
183   - })
184   - var currentTab = this.data.currentTab;
185   -
186   - if (currentTab==0){
187   - var get_data = {
188   - user_id: user_id,
189   - store_id: store_id,
190   - IsUse: 0,
191   - pageSize: 10,
192   - page: e.data.current_page
193   - };
194   - var big_arr = this.data.details;
195   - wx.showLoading();
196   - await getApp().request.promiseGet("/api/weshop/users/listQuan", {
197   - data: get_data,
198   - }).then(res => {
199   - var a = res.data;
200   - val = a.data.total;
201   -
202   - var details = a.data.pageData;
203   -
204   - if (details.length == 0) {
205   -
206   - this.setData({sheng:0});
207   - getApp().showWarning("未找更多数据");
208   - return false;
209   - }
210   -
211   - details.forEach(function (val, ind) {
212   -
213   - big_arr.push(val);
214   - })
215   -
216   - this.setData({
217   - details: big_arr,
218   - });
219   - setTimeout(function () {
220   -
221   - for (var i = 0; i < details.length; i++) {
222   - var no = i + len;
223   - qrcode('qrcode' + no, details[i].CashRepNo, 460, 460);
224   - }
225   - wx.hideLoading();
226   - }, 1000)
227   -
228   - })
229   - this.setData({
230   - val: val
231   - });
232   - }
233   - var get_data = {
234   - user_id: user_id,
235   - store_id: store_id,
236   - IsUse:2,
237   - pageSize: 1,
238   - page: e.data.current_page
239   - };
  226 + var get_data = {
  227 + user_id: user_id,
  228 + store_id: store_id,
  229 + IsUse: 0,
  230 + pageSize: 10,
  231 + page: e.data.current_page
  232 + };
  233 + var big_arr = this.data.details;
  234 + //可用券加入包邮券
  235 + if(big_arr.length==0 && this.data.b_can_arr){
  236 + big_arr=this.data.b_can_arr;
  237 + }
  238 + init_num=this.data.b_can_arr.length;
  239 +
  240 + wx.showLoading(); th.data.isloading=1;
  241 + getApp().request.promiseGet("/api/weshop/users/listQuan", {
  242 + data: get_data,
  243 + }).then(res => {
  244 + th.data.isloading=0;
  245 +
  246 + var a = res.data;
  247 + val = a.data.total;
  248 + var details = a.data.pageData;
  249 +
  250 + //没有找到优惠券的时候
  251 + if (details.length == 0 && th.data.current_page==1) {
  252 + this.setData({sheng:0});
  253 + getApp().showWarning("未找更多数据");
  254 + if(big_arr.length>0) {
  255 + th.setData({ details: big_arr, });
  256 + th.setData({ val: init_num});
  257 + setTimeout(function(){
  258 + details=big_arr;
  259 + for (var i = 0; i < details.length; i++) {
  260 + var no = i + len;
  261 + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460);
  262 + }
  263 + },1000)
  264 + }
  265 + return false;
  266 + }
  267 +
  268 + th.setData({ val: val+init_num });
  269 +
  270 + //数组合并
  271 + big_arr=big_arr.concat(details);
  272 + //设置数组
  273 + th.setData({ details: big_arr, });
  274 +
  275 + //延迟显示二维码的内容
  276 + setTimeout(function () {
  277 + if(th.data.current_page==1) details=big_arr;
  278 + for (var i = 0; i < details.length; i++) {
  279 + var no = i + len;
  280 + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460);
  281 + }
  282 + wx.hideLoading();
  283 + }, 1200)
  284 +
  285 + })
  286 +
240 287  
241   - var big_arrs = this.data.details;
242   - await getApp().request.promiseGet("/api/weshop/users/listQuan"
243   - , {
244   - data: get_data,
245   - }).then(res => {
246   - var a = res.data;
247   - number= a.data.total;
248   -
249   - var details = a.data.pageData;
250   -
251   -
252   - })
253   - this.setData({
254   - number: number
255   - });
256   -
257   -
  288 +
258 289 },
259   - async overdue(){
  290 +
  291 + overdue:function(){
  292 + if(this.data.isloading) return;
260 293  
261 294 var len = this.data.details.length;
262 295 this.data.current_page++;
263   - var e = this,
264   - sum, val, number;
  296 + var e = this,sum, val, number;
265 297 var user_id = getApp().globalData.user_id;
266   - var store_id = os.stoid;
  298 + var store_id = os.stoid,init_num=0,th=this;
267 299  
268 300 var get_data = {
269 301 user_id: user_id,
... ... @@ -273,57 +305,74 @@ Page({
273 305 page: e.data.current_page
274 306 };
275 307 var big_arr= this.data.details;
276   - wx.showLoading();
277   - await getApp().request.promiseGet("/api/weshop/users/listQuan"
  308 + //可用券加入包邮券
  309 + if(big_arr.length==0 && this.data.b_out_arr){
  310 + big_arr=this.data.b_can_arr;
  311 + }
  312 + init_num=this.data.b_out_arr.length;
  313 +
  314 +
  315 + wx.showLoading();th.data.isloading=1;
  316 + getApp().request.promiseGet("/api/weshop/users/listQuan"
278 317 , {
279 318 data: get_data,
280 319 }).then(res => {
  320 +
  321 + th.data.isloading=0;
281 322 var a = res.data;
282   - number = a.data.total;
283   -
  323 + number = a.data.total;
284 324 var details = a.data.pageData;
285 325  
286   -
287 326 if (details.length == 0) {
288   - //this.data.is_no_more = 1;
  327 + this.setData({overdue_sheng:0});
289 328 getApp().showWarning("未找更多数据");
  329 + if( big_arr.length>0 && th.data.current_page==1) {
  330 + th.setData({ details: big_arr, });
  331 + th.setData({ number: init_num});
  332 + setTimeout(function(){
  333 + details=big_arr;
  334 + for (var i = 0; i < details.length; i++) {
  335 + var no = i + len;
  336 + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460);
  337 + }
  338 + },1000)
  339 +
  340 + }
290 341 return false;
291 342 }
292 343  
293   - details.forEach(function (val, ind) {
294   -
295   - big_arr.push(val);
296   - })
297   -
298   -
  344 + big_arr=big_arr.concat(details);
  345 +
299 346 this.setData({
300   - details: big_arr,
  347 + details: big_arr, number:number+init_num,
301 348 });
  349 +
  350 +
  351 +
302 352 setTimeout(function () {
  353 + if(th.data.current_page==1) details=big_arr;
303 354 for (var i = 0; i < details.length; i++) {
304 355 var no = i + len;
305   - qrcode('qrcode' + no, details[i].CashRepNo, 460, 460);
  356 + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no, 460, 460);
306 357  
307 358 }
308 359 wx.hideLoading();
309   -
310 360 }, 800)
311 361 })
312 362 },
  363 +
313 364 //---加载更多是靠这个函数----
314 365 onReachBottom: function() {
315   - var sheng=this.data.sheng;
316   -
317   - if (sheng==3){
318   - this.myyhj();
319   - }else{
320   - getApp().showWarning("未找更多数据");
321   - }
322   -
  366 + if(this.data.isloading) return false; //正在加载中,则不处理
323 367 var currentTab=this.data.currentTab;
324 368 if (currentTab==2){
325   - this.overdue();
  369 + if(this.data.overdue_sheng==0) return false;
  370 + this.overdue();
326 371 }
  372 + if (currentTab==0){
  373 + if(this.data.sheng==0) return false;
  374 + this.myyhj();
  375 + }
327 376 },
328 377 /**
329 378 * 生命周期函数--监听页面隐藏
... ... @@ -333,21 +382,6 @@ Page({
333 382 },
334 383  
335 384 /**
336   - * 生命周期函数--监听页面卸载
337   - */
338   - onUnload: function() {
339   -
340   - },
341   -
342   - /**
343   - * 页面相关事件处理函数--监听用户下拉动作
344   - */
345   - onPullDownRefresh: function() {
346   -
347   - },
348   -
349   -
350   - /**
351 385 * 用户点击右上角分享
352 386 */
353 387 onShareAppMessage: function() {
... ...
pages/user/coupons/coupons.wxml
... ... @@ -28,6 +28,27 @@
28 28 </view>
29 29 <view wx:else>
30 30 <block wx:for="{{details}}" wx:for-index="idx" wx:for-item="detail">
  31 + <block wx:if="{{detail.isby}}">
  32 + <view class="data" data-cashrepno='{{detail.no}}' bindtap='click'>
  33 + <canvas class="code" canvas-id="qrcode{{idx}}" /><view class="code_val">{{detail.no}}</view>
  34 + </view>
  35 + <view class="moneys">包邮券</view>
  36 + <view class="car-rim">
  37 + <view class="coupon_from">微券来源: 微信商城</view>
  38 + <view wx:if="{{detail.use_end_time!='' && detail.use_end_time!=null}}">
  39 +
  40 + <view class="text">有效期: {{time.format_time(detail.use_start_time)}}至{{time.format_time(detail.use_end_time)}}</view>
  41 + </view>
  42 + <view wx:else>
  43 + <view class="text" wx:if="{{detail.use_start_time!='' && detail.use_start_time!=null}}">有效期: time.format_time(detail.use_start_time)至不限</view>
  44 + <view class="text" wx:else>有效期:不限</view>
  45 + </view>
  46 + <view class="textss">使用说明: 包邮券,全场通用,满 {{detail.condition}}元使用 {{detail.title==null?"":",不包邮地区:"+detail.title}}</view>
  47 + </view>
  48 + </block>
  49 + <block wx:else>
  50 +
  51 +
31 52 <view class="data" data-cashrepno='{{detail.CashRepNo}}' bindtap='click'>
32 53 <canvas class="code" canvas-id="qrcode{{idx}}" />
33 54 <view class="code_val">{{detail.CashRepNo}}</view>
... ... @@ -42,10 +63,11 @@
42 63 <view wx:else>
43 64 <view class="text">有效期:不限</view>
44 65 </view>
45   - <view class="textss">使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用{{detail.region_list_name==null?"":",不包邮地区:"+region_list_name}}
  66 + <view class="textss">使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null?"":",不包邮地区:"+region_list_name}}
46 67 </view>
47 68  
48 69 </view>
  70 + </block>
49 71  
50 72 </block>
51 73 </view>
52 74 \ No newline at end of file
... ...
pages/user/coupons/query/index.js
... ... @@ -30,7 +30,9 @@ Page({
30 30 ],
31 31 display:false,
32 32 is_no_more: 0,
33   - current_page:0,
  33 + current_page:1,
  34 + by_list:[],
  35 + islading:0,
34 36 },
35 37 /**
36 38 * 生命周期函数--监听页面加载
... ... @@ -65,9 +67,7 @@ Page({
65 67 // },
66 68 //监听输入框显示清空按钮
67 69 watchPassWord: function (event) {
68   - console.log("监听输入框显示清空按钮");
69 70 var val = event.detail.value;
70   - console.log("是什么", val);
71 71 if (val != "" && val != null) {
72 72 var isBind = false;
73 73 this.setData({ isBind: isBind });
... ... @@ -78,7 +78,6 @@ Page({
78 78 * 点击下拉框
79 79 */
80 80 bindShowMsg() {
81   - console.log(!this.data.select);
82 81 this.setData({
83 82 select: !this.data.select
84 83 })
... ... @@ -87,7 +86,6 @@ Page({
87 86 * 已选下拉框
88 87 */
89 88 mySelect(e) {
90   - console.log(e)
91 89 var name = e.currentTarget.dataset.name;
92 90 this.setData({
93 91 grade_name: name,
... ... @@ -103,41 +101,38 @@ Page({
103 101 var stime = th.data.datet;
104 102 var etime = th.data.dates;
105 103 var tpye = th.data.grade_name;
106   - console.log(tpye,"选中类型",stime, "数据绑定", etime)
  104 +
107 105 //开始获取时间结束
108   - console.log(stime, "结束开始", etime);
109 106 //删除字符中的——
110 107 var datatk = stime.replace(/[-]/g, "");
111   - console.log("aaa", datak);
112   - var dataj = etime.replace(/[-]/g, "");
113   - console.log("开始", datatk, "结束", dataj);
  108 + var dataj = etime.replace(/[-]/g, "");
114 109 //转换类型
115 110 var datak = parseInt(datatk);
116 111 var dataj = parseInt(dataj);
117   - console.log("sk", datak, "js", dataj);
  112 +
118 113 //判断初始时间小于结束时间
119 114 if (datak > dataj) {
120   - console.log("开始时间", datak, '结束时间', dataj, "时间判断");
121   - getApp().showWarning("结束时间错误");
122   -
  115 + getApp().showWarning("结束时间错误");
123 116 } else {
124 117 this.setData({ details: [] });
125   - console.log(datak, dataj, "时间判断2");
126   - console.log("有进来吗", stime, etime);
127   - this.setData({ current_page: 0 });
  118 + this.data.current_page=1;
  119 + this.data.is_no_more=0;
  120 + this.data.by_list=[];
  121 + this.data.details=[];
128 122 this.wjquery();
129 123 }
130 124  
131 125 },
132 126 //微卷查询流水明细
133   - async wjquery() {
134   - console.log("进来wjquery", this.data.is_no_more);
135   -
136   - //if (this.data.is_no_more) return;
  127 + async wjquery() {
  128 + if (this.data.islading) return;
  129 + if(this.data.is_no_more) return;
  130 + this.data.islading=1;
  131 + var th=this;
  132 +
137 133 var len = this.data.details.length;
138   - this.data.current_page++;
139   - var e = this,
140   - sum, val, number;
  134 +
  135 + var e = this,sum, val, number;
141 136 var user_id = getApp().globalData.user_id;
142 137 var store_id = os.stoid;
143 138 var stime = this.data.datet;
... ... @@ -152,69 +147,108 @@ Page({
152 147 pageSize: 10,
153 148 page: e.data.current_page
154 149 };
  150 +
  151 + var dd={ user_id: user_id, store_id: store_id,pageSize: 100};
  152 + dd.isuse=0;
155 153 // 判断下拉框,添加类型
156   - if (tpye == "已使用"){
157   - console.log("已使用");
  154 + if (tpye == "已使用"){
158 155 get_data.IsUse = 1;
159   - } else if (tpye == "已过期"){
160   - console.log("已过期");
  156 + dd.isuse=1;
  157 + } else if (tpye == "已过期"){
161 158 get_data.IsUse = 2;
162 159 } else if (tpye == "未使用"){
163   - get_data.IsUse = 0;
  160 + get_data.IsUse = 0;
164 161 }
165 162 if (etime != "" && etime != null) {
166 163 get_data.EndDate = etime;
  164 +
  165 + //时间要转成时间戳
  166 + var new_t=new Date(etime)/1000;
  167 + dd.etime=new_t;
167 168 }
168 169  
169 170 if (stime != "" && stime != null) {
170   - get_data.BeginDate= stime;
  171 + get_data.BeginDate= stime;
  172 + //时间要转成时间戳
  173 + var new_t=new Date(stime)/1000;
  174 + dd.stime=new_t;
171 175 }
  176 +
  177 + var by_list=[];
  178 + if(th.data.current_page==1){
  179 + //先拿包邮券
  180 + await getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", {
  181 + data: dd,
  182 + }).then(res => {
  183 + if(res.data.code==0 && res.data.data && res.data.data.total>0){
  184 + by_list=res.data.data.pageData;
  185 + for(var i in by_list){
  186 + by_list[i].isby=1;
  187 + //过滤是时间的范围
  188 + if(get_data.IsUse == 2 && by_list[i].use_end_time>=ut.gettimestamp()){
  189 + th.data.by_list.push(by_list[i]);
  190 + }else if(get_data.IsUse == 0 && by_list[i].use_end_time<ut.gettimestamp()){
  191 + th.data.by_list.push(by_list[i]);
  192 + }else if(get_data.IsUse==1){
  193 + th.data.by_list.push(by_list[i]);
  194 + }else if(get_data.IsUse==undefined){
  195 + th.data.by_list.push(by_list[i]);
  196 + }
  197 + }
  198 + }
  199 + })
  200 + }
172 201  
173 202 var big_arr = this.data.details; ///api/weshop / users / listQuan
174   - await getApp().request.promiseGet("/api/weshop/users/listQuan", {
175   -
  203 + if(th.data.current_page==1 && th.data.by_list.length>0)
  204 + big_arr=th.data.by_list;
  205 +
  206 + await getApp().request.promiseGet("/api/weshop/users/listQuan", {
176 207 data: get_data,
177 208 isShowLoading: 1
178 209  
179 210 }).then(res => {
180   - console.log("1" + res);
  211 +
  212 + th.data.islading=0;
181 213 var a = res.data;
182 214 var len = e.data.details.length;
183 215 var details = a.data.pageData;
184   - console.log("无限大乱斗" + details);
185   -
186   - if (details.length == 0) {
  216 +
  217 + if (details.length == 0 ) {
187 218 this.data.is_no_more = 1;
188 219 getApp().showWarning("未找更多数据");
189   -
  220 + if(th.data.by_list && th.data.current_page==1){
  221 + th.setData({ val: val,details:th.data.by_list});
  222 + details=th.data.by_list;
  223 + setTimeout(function () {
  224 + for (var i = 0; i < details.length; i++) {
  225 + var no = i + len;
  226 + qrcode('qrcode' + no, details[i].no,460, 460);
  227 + }
  228 + }, 100)
  229 + }
190 230 return false;
191 231 }
192   - console.log("无限大乱斗" + details);
193   -
194   - val = a.data.total;
195   -
196   -
197   - console.log("长度", details.length);
198   - details.forEach(function (val, ind) {
199   - big_arr.push(val);
200   - })
201   -
  232 +
  233 + th.data.current_page++;
  234 + val = a.data.total+th.data.by_list.length;
202 235  
  236 + big_arr=big_arr.concat(details);
203 237 this.setData({
204   - details: big_arr,
  238 + details: big_arr,val: val
205 239 });
206 240  
207 241 setTimeout(function () {
  242 + if(by_list) details=big_arr;
208 243 for (var i = 0; i < details.length; i++) {
209 244 var no = i + len;
210   - qrcode('qrcode' + no, details[i].CashRepNo,460, 460);
211   - console.log("是三生三世" + no);
  245 + qrcode('qrcode' + no, details[i].CashRepNo?details[i].CashRepNo:details[i].no,460, 460);
212 246 }
213 247 }, 100)
214 248 })
215   - this.setData({
216   - val: val
217   - });
  249 +
  250 +
  251 +
218 252 },
219 253 //---加载更多是靠这个函数----
220 254 onReachBottom: function () {
... ...
pages/user/coupons/query/index.wxml
... ... @@ -52,10 +52,39 @@
52 52 </form>
53 53 </view>
54 54 <block wx:for="{{details}}" wx:for-index="idx" wx:for-item="detail">
55   - <view wx:if="{{details!=[]}}">
56   - <!-- 判断有没有数据有显示没有不显示 -->
57   - <view class="data" data-cashrepno='{{detail.CashRepNo}}' bindtap='click'>
58   - <view class="code_rim">
  55 +
  56 + <block wx:if="{{detail.isby}}">
  57 + <!-- 判断有没有数据有显示没有不显示 -->
  58 + <view class="data" data-cashrepno='{{detail.no}}' bindtap='click'>
  59 + <view class="code_rim">
  60 + <canvas class="code" canvas-id="qrcode{{idx}}" />
  61 + <view class="code_val">{{detail.no}}</view>
  62 + </view>
  63 +
  64 + <view class="moneys">包邮券</view>
  65 + <view class="car-rim">
  66 + <view class="text">微券来源: 微信商城</view>
  67 + <view wx:if="{{detail.use_end_time!=null}}">
  68 + <!-- 不指定格式则默认输出:yyyy-MM-dd hh:mm:ss 格式 -->
  69 + <view class="text">有效期:
  70 + {{detail.use_start_time==null?" " : time.format_time(detail.use_start_time)}}
  71 + 至 {{ time.format_time(detail.use_end_time)}}</view>
  72 + </view>
  73 + <view wx:else>
  74 + <view class="text">有效期: 不限</view>
  75 + </view>
  76 + <view class="textss">使用说明: 包邮券,全场通用,满 {{detail.condition}}元使用{{detail.title?",不包邮地区:"+detail.title:""}}
  77 + </view>
  78 + </view>
  79 + </view>
  80 +
  81 +
  82 +
  83 + </block>
  84 + <block wx:else>
  85 + <!-- 判断有没有数据有显示没有不显示 -->
  86 + <view class="data" data-cashrepno='{{detail.CashRepNo}}' bindtap='click'>
  87 + <view class="code_rim">
59 88 <canvas class="code" canvas-id="qrcode{{idx}}" />
60 89 <view class="code_val">{{detail.CashRepNo}}</view>
61 90 </view>
... ... @@ -77,6 +106,6 @@
77 106 </view>
78 107 </view>
79 108 </view>
80   -
81   - </view>
  109 + </block>
82 110 </block>
  111 +
... ...