pages-activity-seckill-list.c7033b86.js 8.5 KB

1
  1. import{af as e,f as t,g as s,w as a,k as l,ah as n,i as o,B as i,u as r,v as c,j as u,s as d,N as f,c as p,z as g,A as m,o as _,a9 as v,bg as h,a2 as y,m as x,l as k,r as b,F as w,x as T,H as $,y as A,at as j,D as S,n as C,E as D,au as I,I as B,J as N}from"./index-0faec82b.js";import{_ as W}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as E}from"./s-goods-column.c6fe8b05.js";import{_ as M}from"./uni-load-more.860cfa8a.js";import{_ as R}from"./s-layout.88d8cb8b.js";import{u as Y}from"./useGoods.b071619b.js";import{T as P}from"./const.d2a73310.js";import"./points.c381a8e1.js";/* empty css *//* empty css */import"./phone-international-input.38423d06.js";/* empty css */const z=W({name:"AiProgress",components:{},props:{percentage:{type:[Number,String],required:!0},textInside:{type:Boolean,default:!1},strokeWidth:{type:[Number,String],default:6},duration:{type:[Number,String],default:2e3},isAnimate:{type:Boolean,default:!1},bgColor:{type:String,default:"linear-gradient(90deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%)"},noData:{type:Boolean,default:!1},lineData:{type:Boolean,default:!1},inBgColor:{type:String,default:"#ebeef5"}},data:()=>({width:0,timer:null,containerWidth:0,contentWidth:0}),methods:{start(){if(this.isAnimate){this.$nextTick((()=>{let e=this.$refs.progressContainer.$el,t=this.$refs.progressContent.$el,s=window.getComputedStyle(e,null).width.replace("px","")*(1*this.percentage/100);t.style.width=s.toFixed(2)+"px",t.style.transition=`width ${this.duration/1e3}s ease`}));const t=e().in(this).selectAll("#container");e().in(this).selectAll("#content"),t.boundingClientRect().exec((e=>{this.contentWidth=1*e[0][0].width*(1*this.percentage/100).toFixed(2)+"px"}))}}},mounted(){this.$nextTick((()=>{this.start()}))},created(){},filters:{},computed:{},watch:{},directives:{}},[["render",function(e,d,f,p,g,m){const _=u;return t(),s(_,null,{default:a((()=>[f.lineData?(t(),s(_,{key:0,class:"flex a-center content"},{default:a((()=>[l(_,null,{default:a((()=>[n(e.$slots,"content",{},void 0,!0)])),_:3})])),_:3})):o("",!0),l(_,{class:"flex a-center",style:{"padding-right":"10rpx"}},{default:a((()=>[l(_,{class:"progress-container",id:"container",ref:"progressContainer",style:i({background:f.inBgColor})},{default:a((()=>[f.isAnimate?(t(),s(_,{key:0,class:"progress-content flex j-end",id:"content",ref:"progressContent",style:i({height:f.strokeWidth+"px",background:f.bgColor,width:g.contentWidth,transition:`width ${f.duration/1e3}s ease`})},{default:a((()=>[f.textInside&&!f.noData?(t(),s(_,{key:0,class:"textInside flex a-center j-center"},{default:a((()=>[l(_,{class:"text"},{default:a((()=>[r(c(f.percentage)+"%",1)])),_:1})])),_:1})):o("",!0)])),_:1},8,["style"])):o("",!0),f.isAnimate?o("",!0):(t(),s(_,{key:1,class:"progress-content flex j-end",style:i({width:f.percentage+"%",height:f.strokeWidth+"px",background:f.bgColor})},{default:a((()=>[f.textInside&&!f.noData?(t(),s(_,{key:0,class:"textInside flex a-center j-center"},{default:a((()=>[l(_,{class:"text"},{default:a((()=>[r(c(f.percentage)+"%",1)])),_:1})])),_:1})):o("",!0)])),_:1},8,["style"]))])),_:1},8,["style"]),l(_,null,{default:a((()=>[f.textInside||f.lineData||f.noData||f.isAnimate?o("",!0):(t(),s(_,{key:0,class:"percentage"},{default:a((()=>[r(c(f.percentage)+"% ",1)])),_:1}))])),_:1})])),_:1})])),_:3})}],["__scopeId","data-v-0ecdc384"]]),F=W({__name:"list",setup(e){$((e=>({c6cd02b4:T(H)})));const{safeAreaInsets:n,safeArea:W}=d.$platform.device,F=2*d.$platform.device.statusBarHeight,G=2*(W.height+n.bottom)+F-d.$platform.navbar-350,H=d.$url.css("/static/img/shop/goods/seckill-header.png"),U={name:{show:!0},introduction:{show:!0},price:{show:!0},marketPrice:{show:!0}},q=f([]),J=f(""),L=e=>{y((()=>J.value=`timeItem${e}`))},K=f(0),O=p((()=>q.value[K.value])),Q=e=>{K.value=e,X.pageNo=1,ee.value=[],se()},V=p((()=>{var e;const t=null==(e=O.value)?void 0:e.endTime;if(t)return Y(`${h().format("YYYY-MM-DD")} ${t}`)})),X=g({id:0,pageNo:1,pageSize:5}),Z=f(0),ee=f([]),te=f("");async function se(){te.value="loading";const{data:e}=await v.getSeckillActivityPage(X);e.list.forEach((e=>{e.percent=parseInt(100*(e.totalStock-e.stock)/e.totalStock)})),ee.value=ee.value.concat(...e.list),Z.value=e.total,te.value=ee.value.length<Z.value?"more":"noMore"}function ae(){"noMore"!==te.value&&(X.pageNo+=1,se())}return m((()=>ae())),_((async()=>{await(async()=>{const{data:e}=await v.getSeckillConfigList(),t=h(),s=t.format("YYYY-MM-DD");e.forEach(((e,a)=>{const l=h(`${s} ${e.startTime}`),n=h(`${s} ${e.endTime}`);t.isBefore(l)?e.status=P.WAIT_START:t.isAfter(n)?e.status=P.END:(e.status=P.STARTED,K.value=a)})),q.value=e,Q(K.value),L(K.value)})()})),(e,n)=>{const f=u,p=A,g=I,m=j,_=S,v=B,h=x(C("su-progress"),z),y=N,$=x(C("s-goods-column"),E),W=x(C("uni-load-more"),M),Y=x(C("s-layout"),R);return t(),s(Y,{navbar:"inner",bgStyle:{color:"rgb(245,28,19)"}},{default:a((()=>{var e,n;return[l(f,{class:"page-bg",style:i([{marginTop:"-"+Number(F+88)+"rpx"}])},null,8,["style"]),(null==(n=null==(e=O.value)?void 0:e.sliderPicUrls)?void 0:n.length)>0?(t(),s(f,{key:0,class:"header"},{default:a((()=>[l(m,{"indicator-dots":"true",autoplay:"true",circular:!0,interval:"3000",duration:"1500","indicator-color":"rgba(255,255,255,0.6)","indicator-active-color":"#fff"},{default:a((()=>[(t(!0),k(w,null,b(O.value.sliderPicUrls,((e,n)=>(t(),s(g,{key:n,class:"borRadius14"},{default:a((()=>[l(p,{src:e,class:"slide-image borRadius14","lazy-load":""},null,8,["src"])])),_:2},1024)))),128))])),_:1})])),_:1})):o("",!0),l(f,{class:"flex align-center justify-between ss-p-25"},{default:a((()=>[l(f,{class:"time-icon"},{default:a((()=>[l(p,{class:"ss-w-100 ss-h-100",src:"http://mall.yudao.iocoder.cn/static/images/priceTag.png"})])),_:1}),l(_,{class:"time-list","scroll-into-view":J.value,"scroll-x":"","scroll-with-animation":""},{default:a((()=>[(t(!0),k(w,null,b(q.value,((e,n)=>(t(),s(f,{key:n,class:D(["item",{active:K.value===n}]),id:`timeItem${n}`,onClick:e=>Q(n)},{default:a((()=>[l(f,{class:"time"},{default:a((()=>[r(c(e.startTime),1)])),_:2},1024),l(f,{class:"status"},{default:a((()=>[r(c(e.status),1)])),_:2},1024)])),_:2},1032,["class","id","onClick"])))),128))])),_:1},8,["scroll-into-view"])])),_:1}),l(f,{class:"list-content"},{default:a((()=>[l(f,{class:"content-header ss-flex-col ss-col-center ss-row-center"},{default:a((()=>[l(f,{class:"content-header-box ss-flex ss-row-center"},{default:a((()=>{var e;return[(null==(e=O.value)?void 0:e.status)===T(P).STARTED?(t(),s(f,{key:0,class:"countdown-box ss-flex"},{default:a((()=>[l(f,{class:"countdown-title ss-m-r-12"},{default:a((()=>[r("距结束")])),_:1}),l(f,{class:"ss-flex countdown-time"},{default:a((()=>[l(f,{class:"ss-flex countdown-h"},{default:a((()=>[r(c(V.value.h),1)])),_:1}),l(f,{class:"ss-m-x-4"},{default:a((()=>[r(":")])),_:1}),l(f,{class:"countdown-num ss-flex ss-row-center"},{default:a((()=>[r(c(V.value.m),1)])),_:1}),l(f,{class:"ss-m-x-4"},{default:a((()=>[r(":")])),_:1}),l(f,{class:"countdown-num ss-flex ss-row-center"},{default:a((()=>[r(c(V.value.s),1)])),_:1})])),_:1})])),_:1})):(t(),s(f,{key:1},{default:a((()=>{var e;return[r(c(null==(e=O.value)?void 0:e.status),1)]})),_:1}))]})),_:1})])),_:1}),l(_,{class:"scroll-box",style:i({height:G+"rpx"}),"scroll-y":"true","scroll-with-animation":!1,"enable-back-to-top":!0},{default:a((()=>[(t(!0),k(w,null,b(ee.value,(e=>(t(),s(f,{class:"goods-box ss-m-b-20",key:e.id},{default:a((()=>[l($,{size:"lg",data:{...e,price:e.seckillPrice},goodsFields:U,seckillTag:!0,onClick:t=>T(d).$router.go("/pages/goods/seckill",{id:e.id})},{activity:a((()=>[l(f,{class:"limit"},{default:a((()=>[r("限量 "),l(v,{class:"ss-m-l-5"},{default:a((()=>[r(c(e.stock)+" "+c(e.unitName),1)])),_:2},1024)])),_:2},1024),l(h,{percentage:e.percent,strokeWidth:"10",textInside:"",isAnimate:""},null,8,["percentage"])])),cart:a((()=>[l(y,{class:D(["ss-reset-button cart-btn",{disabled:O.value.status===T(P).END}])},{default:a((()=>{var e,s;return[(null==(e=O.value)?void 0:e.status)===T(P).WAIT_START?(t(),k("span",{key:0},"未开始")):(null==(s=O.value)?void 0:s.status)===T(P).STARTED?(t(),k("span",{key:1},"马上抢")):(t(),k("span",{key:2},"已结束"))]})),_:1},8,["class"])])),_:2},1032,["data","onClick"])])),_:2},1024)))),128)),Z.value>0?(t(),s(W,{key:0,status:te.value,"content-text":{contentdown:"上拉加载更多"},onClick:ae},null,8,["status"])):o("",!0)])),_:1},8,["style"])])),_:1})]})),_:1},8,["bgStyle"])}}},[["__scopeId","data-v-2deb3a78"]]);export{F as default};