Commit 62646746f8837944e992040c9f4cc23709a85723
1 parent
2b43715b
首页秒杀列表
Showing
1 changed file
with
35 additions
and
2 deletions
pages/index/index/index.js
@@ -379,13 +379,44 @@ Page({ | @@ -379,13 +379,44 @@ Page({ | ||
379 | //当前时间戳 | 379 | //当前时间戳 |
380 | var nt = ut.gettimestamp(); | 380 | var nt = ut.gettimestamp(); |
381 | 381 | ||
382 | - flash_data.forEach(function (val, ind) { | 382 | + flash_data.forEach(async function (val, ind) { |
383 | 383 | ||
384 | if(val.user_price) val.price=val.user_price; | 384 | if(val.user_price) val.price=val.user_price; |
385 | if (val.start_time > nt) flash_data[ind].status = 0; | 385 | if (val.start_time > nt) flash_data[ind].status = 0; |
386 | else if (val.end_time > nt) flash_data[ind].status = 1; | 386 | else if (val.end_time > nt) flash_data[ind].status = 1; |
387 | - if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; | 387 | + |
388 | + if (val.buy_num >= val.goods_num){ | ||
389 | + flash_data[ind].status = 2; | ||
390 | + } else { | ||
391 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
392 | + os.stoid + "/1/" + val.id, {} | ||
393 | + ).then(res => { | ||
394 | + if (res.data.code == 0) { | ||
395 | + if (res.data.data <= 0) flash_data[ind].status = 2; | ||
396 | + }; | ||
397 | + }) | ||
398 | + }; | ||
399 | + | ||
388 | }); | 400 | }); |
401 | + | ||
402 | + // var plist = flash_data; | ||
403 | + // //--循环读取接口--- | ||
404 | + // for (var i = 0; i < plist.length; i++) { | ||
405 | + | ||
406 | + // // if (plist[i].user_price) plist[i].price = plist[i].user_price; | ||
407 | + // // var prom_id = plist[i].id; | ||
408 | + // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
409 | + // os.stoid + "/1/" + prom_id, {} | ||
410 | + // ).then(res => { | ||
411 | + // if (res.data.code == 0) { | ||
412 | + // plist[i].status = 1; | ||
413 | + // if (res.data.data <= 0) plist[i].status = 3; | ||
414 | + // } | ||
415 | + // }) | ||
416 | + // alllist.push(plist[i]); | ||
417 | + // } | ||
418 | + | ||
419 | + | ||
389 | 420 | ||
390 | var arr = new Array(); | 421 | var arr = new Array(); |
391 | //--三个三个一组--- | 422 | //--三个三个一组--- |
@@ -1179,6 +1210,8 @@ Page({ | @@ -1179,6 +1210,8 @@ Page({ | ||
1179 | var url=e.currentTarget.dataset.url; | 1210 | var url=e.currentTarget.dataset.url; |
1180 | getApp().goto(url); | 1211 | getApp().goto(url); |
1181 | }, | 1212 | }, |
1213 | + | ||
1214 | + | ||
1182 | 1215 | ||
1183 | 1216 | ||
1184 | 1217 |