From f5a18a2b00a70e8ffdc45873e7381a969b254062 Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Fri, 9 Jun 2023 17:28:10 +0800 Subject: [PATCH] 优化秒杀组件 --- components/diy_seckill/diy_seckill.js | 20 ++++++++++++++++++-- components/diy_seckill/diy_seckill.wxml | 501 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- components/diy_seckill/diy_seckill.wxss | 38 +++++++++++++++++++++++++++++--------- 3 files changed, 342 insertions(+), 217 deletions(-) diff --git a/components/diy_seckill/diy_seckill.js b/components/diy_seckill/diy_seckill.js index 950eea8..16e6666 100644 --- a/components/diy_seckill/diy_seckill.js +++ b/components/diy_seckill/diy_seckill.js @@ -198,21 +198,35 @@ Component({ Promise.all(promisies).then(() => { // 判断活动是否结束 + let empty=[] for(let i in all_array){ let item=all_array[i]; if(newTime > item.end_time) { all_array[i].status = 3; }; + let price=all_array[i].price.toFixed(2) + let priceArr = price.split(".") + all_array[i].price_n = priceArr[0] + all_array[i].price_xs = priceArr[1] + all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 + if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { + empty.push(all_array[i]) + } + } + + //控制已售罄是否显示 + if (!th.data.object.hide_sold_out_items) { + all_array=empty } + var arr = new Array(); - if (th.data.object.style==6) { + if (th.data.object.style==7) { //--三个三个一组--- for (var i = 0; i < all_array.length; i += 2) { arr.push(all_array.slice(i, i + 2)); } - }else{ //--三个三个一组--- for (var i = 0; i < all_array.length; i += 3) { @@ -220,6 +234,8 @@ Component({ } } + console.log('渲染数据----------'); + console.error(arr); /*--熏染到前台--*/ th.setData({ goods_array: arr }); if (th.data.object.style==6) { diff --git a/components/diy_seckill/diy_seckill.wxml b/components/diy_seckill/diy_seckill.wxml index 4f5a570..231323e 100644 --- a/components/diy_seckill/diy_seckill.wxml +++ b/components/diy_seckill/diy_seckill.wxml @@ -1,53 +1,60 @@ - + - - + + - {{object.column_name}} + {{object.column_name}} - - + + 更多 - - + + - + - + - + - + - - - - 距结束时间 - {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + 已售罄 - - {{aitem.goods_name}} + + + + 距结束时间 + 距开始时间 + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + {{aitem.goods_name}} + + 已秒 {{aitem.buy_num}} + 还剩余{{aitem.status==2 ? '0' : aitem.residue}} + - {{aitem.price}} + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - - 已秒 {{aitem.buy_num}} - 还剩余{{aitem.residue}} - - + - {{object.button_content}} + {{object.button_content}} @@ -56,43 +63,44 @@ - - + + - + - + - + - + - - - + + + 已售罄 + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} - - + + {{aitem.goods_name}} - - 已秒 {{aitem.buy_num}} - 还剩余{{aitem.residue}} + + 已秒 {{aitem.buy_num}} + 还剩余{{aitem.residue}} - + - - {{aitem.price}} + + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - {{object.button_content}} + {{object.button_content}} @@ -101,43 +109,47 @@ - - + + - + - + - + - + - - - + - + --> + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + {{aitem.goods_name}} - 已秒 {{aitem.buy_num}} - {{aitem.residue}} + 已秒 {{aitem.buy_num}} + {{aitem.residue}} - - {{aitem.price}} + + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - {{object.button_content}} + @@ -146,46 +158,50 @@ - - + + - + - + - + - + - - - + - + --> + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + - + {{aitem.goods_name}} - 已秒 {{aitem.buy_num}} - {{aitem.residue}} + 已秒 {{aitem.buy_num}} + {{aitem.residue}} - - {{aitem.price}} + + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - {{object.button_content}} + {{object.button_content}} @@ -195,180 +211,254 @@ - - + + - - + + - + - + - + + + + 已售罄 + + + + + 距结束时间 + 距开始时间 + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + {{aitem.goods_name}} + + 已秒 {{aitem.buy_num}} + 还剩余{{ aitem.status==2 ? '0' : aitem.residue}} + - {{aitem.price}} + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - - 已秒 {{aitem.buy_num}} - 还剩余{{aitem.residue}} - - {{object.button_content}} + {{object.button_content}} - - + + - + - + - + - - - + - + --> + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + {{aitem.goods_name}} - 已秒 {{aitem.buy_num}} - 还剩余{{aitem.residue}} + 已秒 {{aitem.buy_num}} + 还剩余{{aitem.residue}} - - {{aitem.price}} + + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - {{object.button_content}} + {{object.button_content}} - + - + - + - + - - - + - + --> + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + {{aitem.goods_name}} - 已秒 {{aitem.buy_num}} - 还剩余{{aitem.residue}} + 已秒 {{aitem.buy_num}} + 还剩余{{aitem.residue}} - - {{aitem.price}} + + {{aitem.price_n}}.{{aitem.price_xs}} ¥{{aitem.market_price}} - {{object.button_content}} + {{object.button_content}} - + - - + + - - - - - - - - - - - - - + + + + + + + + + - - - + - {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} - + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒 {{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price}} + ¥{{aitem.market_price}} + - {{aitem.goods_name}} - - 已秒 {{aitem.buy_num}} - 还剩余{{aitem.residue}} + + + {{object.button_content}} - - - - {{aitem.price}} - ¥{{aitem.market_price}} - - - - - {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒 {{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.market_price}} - - - - + + + + + + + + + - + @@ -392,24 +482,24 @@ 即将开始 - - - - 火热进行 - - - - - 已抢光 - - - - - 活动已结束 - - - - + + + + 火热进行 + + + + + 已抢光 + + + + + 活动已结束 + + + + @@ -430,7 +520,7 @@ {{aitem.goods_name}} ¥{{aitem.price}} - ¥{{aitem.market_price}} + ¥{{aitem.market_price}} @@ -461,32 +551,32 @@ ¥{{aitem.price}} - + 正在预热 - - - - 已结束 - - - - - - 我要抢 - - - - - 已抢光 - - - + + + 已结束 + + + + + + 我要抢 + + + + + + 已抢光 + + + @@ -498,5 +588,4 @@ - - + \ No newline at end of file diff --git a/components/diy_seckill/diy_seckill.wxss b/components/diy_seckill/diy_seckill.wxss index 29ae5b2..52fc86d 100644 --- a/components/diy_seckill/diy_seckill.wxss +++ b/components/diy_seckill/diy_seckill.wxss @@ -32,7 +32,7 @@ swiper { } .right_k { - width: 30rpx; + width: 93rpx; } .right_k image{ width: 30rpx; @@ -44,7 +44,9 @@ swiper { background: #c4182e; margin-right: 10rpx; } - +.n_t_ms{ + color:rgba(196, 24, 45, 1); +} .sp { min-height: 300rpx; @@ -292,6 +294,7 @@ swiper { .ellipsis-2 { + height: 97rpx; overflow: hidden; text-overflow: ellipsis; @@ -299,8 +302,18 @@ swiper { -webkit-box-orient: vertical; -webkit-line-clamp: 2; } - - +.ellipsis-2n { + + /* height: 97rpx; */ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} +.pdlf10{ + padding: 0 10rpx; +} .new_item1{ width: 100%; overflow: hidden; @@ -328,7 +341,7 @@ swiper { height: 52rpx; } .new_item1_goods_name{ - padding: 10rpx 0rpx; + padding: 10rpx; font-size: 26rpx; width: 100%; box-sizing: border-box; @@ -339,6 +352,7 @@ swiper { align-items: center; justify-content: space-between; font-size: 26rpx; + padding: 0 10rpx; } .clor{ color: rgba(196, 24, 45, 1); @@ -371,7 +385,7 @@ swiper { .new_item1_box{ - padding-top: 17rpx; + /* padding-top: 17rpx; */ width: 100%; box-sizing: border-box; overflow: hidden; @@ -391,7 +405,7 @@ swiper { border-radius:289rpx; } .but_radius5{ - border-radius:17px 17px 0 0; + border-radius:17px; } .imgBox{ position: relative; @@ -399,7 +413,7 @@ swiper { .imgBox_img{ position: absolute; left: 0; - top: 22rpx; + top: 0; width: 74rpx; height: 70rpx; @@ -471,6 +485,12 @@ swiper { } .boxpad{ - padding:11rpx 9rpx; + /* padding:11rpx 9rpx; */ box-sizing: border-box; + } + .pricefs28{ + font-size: 28rpx !important; + } + .pricefs42{ + font-size: 42rpx !important; } \ No newline at end of file -- libgit2 0.21.4