seckill.js 6.4 KB

1
  1. "use strict";const e=require("../../common/vendor.js"),s=require("../../sheep/index.js"),o=require("../../sheep/hooks/useGoods.js"),t=require("../../sheep/api/promotion/seckill.js"),i=require("../../sheep/api/product/spu.js"),r=require("../../sheep/util/const.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/request/index.js"),require("../../sheep/config/index.js"),require("../../sheep/platform/index.js"),require("../../sheep/platform/provider/wechat/index.js"),require("../../sheep/platform/provider/wechat/miniProgram.js"),require("../../sheep/api/member/auth.js"),require("../../sheep/api/member/social.js"),require("../../sheep/api/member/user.js"),require("../../sheep/platform/provider/apple/index.js"),require("../../sheep/platform/share.js"),require("../../sheep/router/index.js"),require("../../sheep/hooks/useModal.js"),require("../../sheep/helper/index.js"),require("../../sheep/helper/test.js"),require("../../sheep/helper/digit.js"),require("../../sheep/api/member/signin.js"),require("../../sheep/helper/throttle.js"),require("../../sheep/platform/pay.js"),require("../../sheep/api/pay/order.js"),require("../../sheep/store/user.js"),require("../../sheep/store/cart.js"),require("../../sheep/api/trade/cart.js"),require("../../sheep/api/pay/wallet.js"),require("../../sheep/api/trade/order.js"),require("../../sheep/api/promotion/coupon.js"),require("../../sheep/store/sys.js"),require("../../sheep/store/modal.js"),require("../../sheep/config/zIndex.js"),require("../../sheep/util/index.js"),!Array){(e.resolveComponent("s-empty")+e.resolveComponent("su-swiper")+e.resolveComponent("s-select-seckill-sku")+e.resolveComponent("s-layout"))()}Math||(n+p+(()=>"../../sheep/components/s-empty/s-empty.js")+(()=>"../../sheep/ui/su-swiper/su-swiper.js")+c+a+(()=>"../../sheep/components/s-select-seckill-sku/s-select-seckill-sku.js")+l+d+u+(()=>"../../sheep/components/s-layout/s-layout.js"))();const n=()=>"./components/detail/detail-navbar.js",a=()=>"./components/detail/detail-cell-sku.js",u=()=>"./components/detail/detail-tabbar.js",p=()=>"./components/detail/detail-skeleton.js",l=()=>"./components/detail/detail-comment-card.js",d=()=>"./components/detail/detail-content-card.js",c=()=>"./components/detail/detail-progress.js",m={__name:"seckill",setup(n){e.useCssVars((s=>({"284c9add":e.unref(a),"1b768876":e.unref(u),"78b5065a":e.unref(p),"93a7b3ee":e.unref(l),d4b50090:e.unref(d)})));const a=s.sheep.$url.css("/static/img/shop/goods/seckill-bg.png"),u=s.sheep.$url.css("/static/img/shop/goods/seckill-btn.png"),p=s.sheep.$url.css("/static/img/shop/goods/activity-btn-disabled.png"),l=s.sheep.$url.css("/static/img/shop/goods/seckill-tip-bg.png"),d=s.sheep.$url.css("/static/img/shop/goods/groupon-tip-bg.png");e.onPageScroll((()=>{}));const c=e.reactive({skeletonLoading:!0,goodsInfo:{},showSelectSku:!1,goodsSwiper:[],selectedSku:{},showModel:!1,total:0,percent:0,price:""}),m=e.computed((()=>o.useDurationTime(k.value.endTime)));function g(e){c.selectedSku=e}function h(e){s.sheep.$router.go("/pages/order/confirm",{data:JSON.stringify({order_type:"goods",buy_type:"seckill",seckillActivityId:k.value.id,items:[{skuId:e.id,count:e.count}]})})}const f=e.computed((()=>e.lodashExports.isEmpty(k)?{}:s.sheep.$platform.share.getShareInfo({title:k.value.name,image:s.sheep.$url.cdn(c.goodsInfo.picUrl),params:{page:"4",query:k.value.id}},{type:"goods",title:k.value.name,image:s.sheep.$url.cdn(c.goodsInfo.picUrl),price:c.goodsInfo.price,marketPrice:c.goodsInfo.marketPrice}))),k=e.ref(),v=e.ref(""),j=async s=>{const{data:t}=await i.SpuApi.getSpuDetail(s);t.activity_type="seckill",c.goodsInfo=t,c.goodsSwiper=o.formatGoodsSwiper(c.goodsInfo.sliderPicUrls),c.goodsInfo.price=e.lodashExports.min([c.goodsInfo.price,...k.value.products.map((e=>e.seckillPrice))]),t.skus.forEach((e=>{const s=k.value.products.find((s=>s.skuId===e.id));s?(e.price=s.seckillPrice,e.stock=Math.min(e.stock,s.stock)):e.stock=0,k.value.totalLimitCount>0&&k.value.singleLimitCount>0?e.limitCount=Math.min(k.value.totalLimitCount,k.value.singleLimitCount):k.value.totalLimitCount>0?e.limitCount=k.value.totalLimitCount:k.value.singleLimitCount>0&&(e.limitCount=k.value.singleLimitCount)})),c.skeletonLoading=!1};return e.onLoad((e=>{e.id?(async e=>{const{data:s}=await t.SeckillApi.getSeckillActivity(e);k.value=s,v.value=r.getTimeStatusEnum(k.startTime,k.endTime),await j(s.spuId)})(e.id):c.goodsInfo=null})),(t,i)=>{var n;return e.e({a:c.skeletonLoading},c.skeletonLoading?{}:null===c.goodsInfo||"seckill"!==c.goodsInfo.activity_type?{c:e.p({text:"活动不存在或已结束",icon:"/static/soldout-empty.png",showAction:!0,actionText:"再逛逛",actionUrl:"/pages/goods/list"})}:e.e({d:e.p({isPreview:!0,list:c.goodsSwiper,dotStyle:"tag",imageMode:"widthFix",dotCur:"bg-mask-40",seizeHeight:750}),e:e.t(e.unref(o.fen2yuan)(c.selectedSku.price||c.goodsInfo.price)),f:m.value.ms>0},m.value.ms>0?{g:e.t(m.value.h),h:e.t(m.value.m),i:e.t(m.value.s)}:{},{j:c.goodsInfo.marketPrice},c.goodsInfo.marketPrice?{k:e.t(e.unref(o.fen2yuan)(c.selectedSku.marketPrice||c.goodsInfo.marketPrice))}:{},{l:e.p({percent:c.percent}),m:e.t(null==(n=c.goodsInfo)?void 0:n.name),n:e.t(c.goodsInfo.introduction),o:e.o((e=>c.showSelectSku=!0)),p:e.p({sku:c.selectedSku}),q:e.o(h),r:e.o(g),s:e.o((e=>c.showSelectSku=!1)),t:e.o((e=>c.goodsInfo=e)),v:e.p({show:c.showSelectSku,"single-limit-count":k.value.singleLimitCount,modelValue:c.goodsInfo}),w:e.p({goodsId:c.goodsInfo.id}),x:e.p({content:c.goodsInfo.description}),y:c.goodsInfo.marketPrice},c.goodsInfo.marketPrice?{z:e.t(e.unref(o.fen2yuan)(c.goodsInfo.marketPrice)),A:e.o((o=>e.unref(s.sheep).$router.go("/pages/goods/index",{id:c.goodsInfo.id})))}:{B:e.n((0===c.goodsInfo.stock||(v.value,e.unref(r.TimeStatusEnum).STARTED),""))},{C:e.t(e.unref(o.fen2yuan)(c.goodsInfo.price)),D:v.value===e.unref(r.TimeStatusEnum).STARTED},v.value===e.unref(r.TimeStatusEnum).STARTED?e.e({E:0===c.goodsInfo.stock},(c.goodsInfo.stock,{})):{F:e.t(v.value)},{G:e.o((e=>c.showSelectSku=!0)),H:e.n(v.value===e.unref(r.TimeStatusEnum).STARTED&&0!=c.goodsInfo.stock?"check-btn-box":"disabled-btn-box"),I:0===c.goodsInfo.stock||v.value!==e.unref(r.TimeStatusEnum).STARTED,J:e.o((e=>c.goodsInfo=e)),K:e.p({modelValue:c.goodsInfo})}),{b:null===c.goodsInfo||"seckill"!==c.goodsInfo.activity_type,L:e.s(t.__cssVars()),M:e.p({onShareAppMessage:f.value,navbar:"goods"})})}}},g=e._export_sfc(m,[["__scopeId","data-v-31d78969"]]);m.__runtimeHooks=3,wx.createPage(g);