pages-activity-seckill-list.e9e3513b.js 8.4 KB

1
  1. import{P as e,e as t,f as s,w as a,j as l,Q as n,g as o,y as i,p as r,t as c,i as d,s as u,U as f,c as p,v as g,x as m,o as _,aw as v,aD as y,l as h,u as x,k,r as w,F as b,B as T,q as $,T as A,S,m as C,z as D,R as j,C as I,D as B}from"./index-9880b451.js";import{_ as N}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as W}from"./s-goods-column.2324341a.js";import{_ as R}from"./uni-load-more.aac4524a.js";import{_ as Y}from"./s-layout.dfc5b0b5.js";import{u as M}from"./useGoods.bdd1c2ea.js";import{S as E,T as P}from"./const.172c6469.js";/* empty css *//* empty css *//* empty css */import"./index.df38848e.js";const z=N({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,u,f,p,g,m){const _=d;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=N({__name:"list",setup(e){T((e=>({"6f450c16":x(U)})));const{safeAreaInsets:n,safeArea:N}=u.$platform.device,F=2*u.$platform.device.statusBarHeight,G=2*(N.height+n.bottom)+F-u.$platform.navbar-350,U=u.$url.css("/static/img/shop/goods/seckill-header.png"),q={name:{show:!0},introduction:{show:!0},price:{show:!0},marketPrice:{show:!0}},H=f([]),L=f(""),Q=e=>{y((()=>L.value=`timeItem${e}`))},Z=f(0),J=p((()=>H.value[Z.value])),K=e=>{Z.value=e,V.pageNo=1,ee.value=[],se()},O=p((()=>{var e;const t=null==(e=J.value)?void 0:e.endTime;if(t)return M(`${v().format("YYYY-MM-DD")} ${t}`)})),V=g({id:0,pageNo:1,pageSize:5}),X=f(0),ee=f([]),te=f("");async function se(){te.value="loading";const{data:e}=await E.getSeckillActivityPage(V);e.list.forEach((e=>{e.percent=parseInt(100*(e.totalStock-e.stock)/e.totalStock)})),ee.value=ee.value.concat(...e.list),X.value=e.total,te.value=ee.value.length<X.value?"more":"noMore"}function ae(){"noMore"!==te.value&&(V.pageNo+=1,se())}return m((()=>ae())),_((async()=>{await(async()=>{const{data:e}=await E.getSeckillConfigList(),t=v(),s=t.format("YYYY-MM-DD");e.forEach(((e,a)=>{const l=v(`${s} ${e.startTime}`),n=v(`${s} ${e.endTime}`);t.isBefore(l)?e.status=P.WAIT_START:t.isAfter(n)?e.status=P.END:(e.status=P.STARTED,Z.value=a)})),H.value=e,K(Z.value),Q(Z.value)})()})),(e,n)=>{const f=d,p=$,g=j,m=A,_=S,v=I,y=h(C("su-progress"),z),T=B,N=h(C("s-goods-column"),W),M=h(C("uni-load-more"),R),E=h(C("s-layout"),Y);return t(),s(E,{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=x(J))?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(b,null,w(x(J).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":L.value,"scroll-x":"","scroll-with-animation":""},{default:a((()=>[(t(!0),k(b,null,w(H.value,((e,n)=>(t(),s(f,{key:n,class:D(["item",{active:Z.value===n}]),id:`timeItem${n}`,onClick:e=>K(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=x(J))?void 0:e.status)===x(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(x(O).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(x(O).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(x(O).s),1)])),_:1})])),_:1})])),_:1})):(t(),s(f,{key:1},{default:a((()=>{var e;return[r(c(null==(e=x(J))?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(b,null,w(ee.value,(e=>(t(),s(f,{class:"goods-box ss-m-b-20",key:e.id},{default:a((()=>[l(N,{size:"lg",data:{...e,price:e.seckillPrice},goodsFields:q,seckillTag:!0,onClick:t=>x(u).$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(y,{percentage:e.percent,strokeWidth:"10",textInside:"",isAnimate:""},null,8,["percentage"])])),cart:a((()=>[l(T,{class:D(["ss-reset-button cart-btn",{disabled:x(J).status===x(P).END}])},{default:a((()=>{var e,s;return[(null==(e=x(J))?void 0:e.status)===x(P).WAIT_START?(t(),k("span",{key:0},"未开始")):(null==(s=x(J))?void 0:s.status)===x(P).STARTED?(t(),k("span",{key:1},"马上抢")):(t(),k("span",{key:2},"已结束"))]})),_:1},8,["class"])])),_:2},1032,["data","onClick"])])),_:2},1024)))),128)),X.value>0?(t(),s(M,{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-62f8ccff"]]);export{F as default};