From 62646746f8837944e992040c9f4cc23709a85723 Mon Sep 17 00:00:00 2001 From: taiwan Date: Fri, 11 Mar 2022 17:18:22 +0800 Subject: [PATCH] 首页秒杀列表 --- pages/index/index/index.js | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 7c4b123..d42dfff 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -379,13 +379,44 @@ Page({ //当前时间戳 var nt = ut.gettimestamp(); - flash_data.forEach(function (val, ind) { + flash_data.forEach(async function (val, ind) { if(val.user_price) val.price=val.user_price; if (val.start_time > nt) flash_data[ind].status = 0; else if (val.end_time > nt) flash_data[ind].status = 1; - if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; + + if (val.buy_num >= val.goods_num){ + flash_data[ind].status = 2; + } else { + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/1/" + val.id, {} + ).then(res => { + if (res.data.code == 0) { + if (res.data.data <= 0) flash_data[ind].status = 2; + }; + }) + }; + }); + + // var plist = flash_data; + // //--循环读取接口--- + // for (var i = 0; i < plist.length; i++) { + + // // if (plist[i].user_price) plist[i].price = plist[i].user_price; + // // var prom_id = plist[i].id; + // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + // os.stoid + "/1/" + prom_id, {} + // ).then(res => { + // if (res.data.code == 0) { + // plist[i].status = 1; + // if (res.data.data <= 0) plist[i].status = 3; + // } + // }) + // alllist.push(plist[i]); + // } + + var arr = new Array(); //--三个三个一组--- @@ -1179,6 +1210,8 @@ Page({ var url=e.currentTarget.dataset.url; getApp().goto(url); }, + + -- libgit2 0.21.4