2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
"use strict";var e=(e,o,s)=>new Promise(((t,n)=>{var i=e=>{try{a(s.next(e))}catch(o){n(o)}},l=e=>{try{a(s.throw(e))}catch(o){n(o)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,l);a((s=s.apply(e,o)).next())}));const o=require("../../../common/vendor.js"),s=require("../sheep/index.js"),t=require("../sheep/hooks/useGoods.js"),n=require("../sheep/api/promotion/seckill.js"),i=require("../sheep/api/product/spu.js"),l=require("../sheep/util/const.js");if(!Array){(o.resolveComponent("s-empty")+o.resolveComponent("su-swiper")+o.resolveComponent("s-select-seckill-sku")+o.resolveComponent("s-layout")+o.resolveComponent("layout-default-uni"))()}Math||(a+r+(()=>"../sheep/components/s-empty/s-empty.js")+(()=>"../sheep/ui/su-swiper/su-swiper.js")+m+u+(()=>"../sheep/components/s-select-seckill-sku/s-select-seckill-sku.js")+d+p+c+(()=>"../sheep/components/s-layout/s-layout.js"))();const a=()=>"./components/detail/detail-navbar.js",u=()=>"./components/detail/detail-cell-sku.js",c=()=>"./components/detail/detail-tabbar.js",r=()=>"./components/detail/detail-skeleton.js",d=()=>"./components/detail/detail-comment-card.js",p=()=>"./components/detail/detail-content-card.js",m=()=>"./components/detail/detail-progress.js",g={__name:"seckill",setup(a){o.useCssVars((e=>({"2fae7a2a":o.unref(u),"687e976e":o.unref(c),"1be8a1a6":o.unref(r),c9f39f48:o.unref(d),"7a7f8a0b":o.unref(p)})));const u=s.sheep.$url.css("/static/img/shop/goods/seckill-bg.png"),c=s.sheep.$url.css("/static/img/shop/goods/seckill-btn.png"),r=s.sheep.$url.css("/static/img/shop/goods/activity-btn-disabled.png"),d=s.sheep.$url.css("/static/img/shop/goods/seckill-tip-bg.png"),p=s.sheep.$url.css("/static/img/shop/goods/groupon-tip-bg.png");o.onPageScroll((()=>{}));const m=o.reactive({skeletonLoading:!0,goodsInfo:{},showSelectSku:!1,goodsSwiper:[],selectedSku:{},showModel:!1,total:0,percent:0,price:""}),g=o.computed((()=>t.useDurationTime(h.value.endTime)));function f(e){m.selectedSku=e}function k(e){s.sheep.$router.go("/modules/mall/order/confirm",{data:JSON.stringify({order_type:"goods",buy_type:"seckill",seckillActivityId:h.value.id,items:[{skuId:e.id,count:e.count}]})})}const v=o.computed((()=>o.isEmpty(o.unref(h))?{}:s.sheep.$platform.share.getShareInfo({title:h.value.name,image:s.sheep.$url.cdn(m.goodsInfo.picUrl),params:{page:"4",query:h.value.id}},{type:"goods",title:h.value.name,image:s.sheep.$url.cdn(m.goodsInfo.picUrl),price:m.goodsInfo.price,marketPrice:m.goodsInfo.marketPrice}))),h=o.ref(),I=o.ref(""),S=o=>e(this,null,(function*(){const{data:e}=yield n.SeckillApi.getSeckillActivity(o);h.value=e,I.value=l.getTimeStatusEnum(h.value.startTime,h.value.endTime),yield y(e.spuId)})),y=s=>e(this,null,(function*(){const{data:e}=yield i.SpuApi.getSpuDetail(s);e.activity_type="seckill",m.goodsInfo=e,m.goodsSwiper=t.formatGoodsSwiper(m.goodsInfo.sliderPicUrls),m.goodsInfo.price=o.min([m.goodsInfo.price,...h.value.products.map((e=>e.seckillPrice))]),e.skus.forEach((e=>{const o=h.value.products.find((o=>o.skuId===e.id));o?(e.price=o.seckillPrice,e.stock=Math.min(e.stock,o.stock)):e.stock=0,h.value.totalLimitCount>0&&h.value.singleLimitCount>0?e.limitCount=Math.min(h.value.totalLimitCount,h.value.singleLimitCount):h.value.totalLimitCount>0?e.limitCount=h.value.totalLimitCount:h.value.singleLimitCount>0&&(e.limitCount=h.value.singleLimitCount)})),m.skeletonLoading=!1}));return o.onLoad((e=>{e.id?S(e.id):m.goodsInfo=null})),(e,n)=>o.e({a:m.skeletonLoading},m.skeletonLoading?{}:null===m.goodsInfo||"seckill"!==m.goodsInfo.activity_type?{c:o.p({text:"活动不存在或已结束",icon:"/static/soldout-empty.png",showAction:!0,actionText:"再逛逛",actionUrl:"/modules/mall/goods/list"})}:o.e({d:o.p({isPreview:!0,list:m.goodsSwiper,dotStyle:"tag",imageMode:"widthFix",dotCur:"bg-mask-40",seizeHeight:750}),e:o.t(o.unref(t.fen2yuan)(m.selectedSku.price||m.goodsInfo.price)),f:g.value.ms>0},g.value.ms>0?{g:o.t(g.value.h),h:o.t(g.value.m),i:o.t(g.value.s)}:{},{j:m.goodsInfo.marketPrice},m.goodsInfo.marketPrice?{k:o.t(o.unref(t.fen2yuan)(m.selectedSku.marketPrice||m.goodsInfo.marketPrice))}:{},{l:o.p({percent:m.percent}),m:o.t(m.goodsInfo.name||""),n:o.t(m.goodsInfo.introduction),o:o.o((e=>m.showSelectSku=!0)),p:o.p({sku:m.selectedSku}),q:o.o(k),r:o.o(f),s:o.o((e=>m.showSelectSku=!1)),t:o.o((e=>m.goodsInfo=e)),v:o.p({show:m.showSelectSku,"single-limit-count":h.value.singleLimitCount,modelValue:m.goodsInfo}),w:o.p({goodsId:m.goodsInfo.id}),x:o.p({content:m.goodsInfo.description}),y:m.goodsInfo.marketPrice},m.goodsInfo.marketPrice?{z:o.t(o.unref(t.fen2yuan)(m.goodsInfo.marketPrice)),A:o.o((e=>o.unref(s.sheep).$router.go("/modules/mall/goods/index",{id:m.goodsInfo.id})))}:{B:o.n((0===m.goodsInfo.stock||(I.value,o.unref(l.TimeStatusEnum).STARTED),""))},{C:o.t(o.unref(t.fen2yuan)(m.goodsInfo.price)),D:I.value===o.unref(l.TimeStatusEnum).STARTED},I.value===o.unref(l.TimeStatusEnum).STARTED?o.e({E:0===m.goodsInfo.stock},(m.goodsInfo.stock,{})):{F:o.t(I.value)},{G:o.o((e=>m.showSelectSku=!0)),H:o.n(I.value===o.unref(l.TimeStatusEnum).STARTED&&0!=m.goodsInfo.stock?"check-btn-box":"disabled-btn-box"),I:0===m.goodsInfo.stock||I.value!==o.unref(l.TimeStatusEnum).STARTED,J:o.o((e=>m.goodsInfo=e)),K:o.p({modelValue:m.goodsInfo})}),{b:null===m.goodsInfo||"seckill"!==m.goodsInfo.activity_type,L:o.p({onShareAppMessage:v.value,navbar:"goods"}),M:o.s(e.__cssVars())})}},f=o._export_sfc(g,[["__scopeId","data-v-30fe1821"]]);g.__runtimeHooks=3,wx.createPage(f);
|