acdr-ui/dist/build/mp-weixin/modules/mall/goods/groupon.js
2024-10-01 09:15:35 +08:00

2 lines
5.3 KiB
JavaScript

"use strict";const o=require("../../../common/vendor.js"),e=require("../sheep/index.js"),t=require("../sheep/hooks/useGoods.js"),s=require("../sheep/api/promotion/combination.js"),n=require("../sheep/api/product/spu.js");if(!Array){(o.resolveComponent("s-empty")+o.resolveComponent("su-swiper")+o.resolveComponent("s-select-groupon-sku")+o.resolveComponent("s-layout")+o.resolveComponent("layout-default-uni"))()}Math||(i+r+(()=>"../sheep/components/s-empty/s-empty.js")+(()=>"../sheep/ui/su-swiper/su-swiper.js")+c+p+(()=>"../sheep/components/s-select-groupon-sku/s-select-groupon-sku.js")+d+u+a+(()=>"../sheep/components/s-layout/s-layout.js"))();const i=()=>"./components/detail/detail-navbar.js",c=()=>"./components/detail/detail-cell-sku.js",a=()=>"./components/detail/detail-tabbar.js",r=()=>"./components/detail/detail-skeleton.js",d=()=>"./components/detail/detail-comment-card.js",u=()=>"./components/detail/detail-content-card.js",p=()=>"./components/groupon/groupon-card-list.js",g={__name:"groupon",setup(i){o.useCssVars((e=>({"4e4386c4":o.unref(c),"2e930422":o.unref(a),"298872d3":o.unref(r),"2e8c10b1":o.unref(d)})));const c=e.sheep.$url.css("/static/img/shop/goods/groupon-bg.png"),a=e.sheep.$url.css("/static/img/shop/goods/groupon-btn.png"),r=e.sheep.$url.css("/static/img/shop/goods/activity-btn-disabled.png"),d=e.sheep.$url.css("/static/img/shop/goods/groupon-tip-bg.png");o.onPageScroll((()=>{}));const u=o.reactive({skeletonLoading:!0,goodsId:0,goodsInfo:{},goodsSwiper:[],showSelectSku:!1,selectedSku:{},activity:{},grouponId:0,grouponNum:0,grouponAction:"create",combinationHeadId:null}),p=o.computed((()=>t.useDurationTime(u.activity.endTime)));function g(o){u.selectedSku=o}function l(){u.showSelectSku=!1}function m(){u.grouponAction="create",u.grouponId=0,u.showSelectSku=!0}function f(o){u.grouponAction="join",u.grouponId=o.activityId,u.combinationHeadId=o.id,u.grouponNum=o.userSize,u.showSelectSku=!0}function y(o){e.sheep.$router.go("/modules/mall/order/confirm",{data:JSON.stringify({order_type:"goods",combinationActivityId:u.activity.id,combinationHeadId:u.combinationHeadId,items:[{skuId:o.id,count:o.count}]})})}const I=o.computed((()=>o.isEmpty(u.activity)?{}:e.sheep.$platform.share.getShareInfo({title:u.activity.name,image:e.sheep.$url.cdn(u.goodsInfo.picUrl),params:{page:"3",query:u.activity.id}},{type:"goods",title:u.activity.name,image:e.sheep.$url.cdn(u.goodsInfo.picUrl),price:t.fen2yuan(u.goodsInfo.price),marketPrice:t.fen2yuan(u.goodsInfo.marketPrice)})));return o.onLoad((o=>{return e=this,i=null,c=function*(){if(!o.id)return void(u.goodsInfo=null);u.grouponId=o.id;const{code:e,data:i}=yield s.CombinationApi.getCombinationActivity(u.grouponId);u.activity=i;const{data:c}=yield n.SpuApi.getSpuDetail(i.spuId);u.goodsId=c.id,i.products.forEach((o=>{c.price=Math.min(c.price,o.combinationPrice)})),c.skus.forEach((o=>{const e=i.products.find((e=>e.skuId===o.id));e?o.price=e.combinationPrice:o.stock=0})),u.skeletonLoading=!1,0===e?(u.goodsInfo=c,u.grouponNum=i.userSize,u.goodsSwiper=t.formatGoodsSwiper(u.goodsInfo.sliderPicUrls)):u.goodsInfo=null},new Promise(((o,t)=>{var s=o=>{try{a(c.next(o))}catch(e){t(e)}},n=o=>{try{a(c.throw(o))}catch(e){t(e)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(s,n);a((c=c.apply(e,i)).next())}));var e,i,c})),(s,n)=>o.e({a:u.skeletonLoading},u.skeletonLoading?{}:null===u.goodsInfo||0!==u.activity.status||u.activity.endTime<(new Date).getTime()?{c:o.o((t=>o.unref(e.sheep).$router.back())),d:o.p({text:"活动不存在或已结束",icon:"/static/soldout-empty.png",showAction:!0,actionText:"返回上一页"})}:o.e({e:o.p({isPreview:!0,list:u.goodsSwiper,dotStyle:"tag",imageMode:"widthFix",dotCur:"bg-mask-40",seizeHeight:750}),f:o.t(o.unref(t.fen2yuan)(u.activity.price||u.goodsInfo.price)),g:o.unref(e.sheep).$url.static("/static/img/shop/goods/groupon-tag.png"),h:u.goodsInfo.price},u.goodsInfo.price?{i:o.t(o.unref(t.fen2yuan)(u.goodsInfo.price))}:{},{j:p.value.ms>0},p.value.ms>0?{k:o.t(p.value.h),l:o.t(p.value.m),m:o.t(p.value.s)}:{},{n:o.t(u.goodsInfo.name),o:o.t(u.goodsInfo.introduction),p:o.o((o=>u.showSelectSku=!0)),q:o.p({sku:u.selectedSku}),r:o.o(f),s:o.o((o=>u.activity=o)),t:o.p({modelValue:u.activity}),v:o.o(y),w:o.o(g),x:o.o(l),y:o.p({show:u.showSelectSku,goodsInfo:u.goodsInfo,selectedSku:u.selectedSku,grouponAction:u.grouponAction,grouponNum:u.grouponNum}),z:o.p({goodsId:u.goodsId}),A:o.p({content:u.goodsInfo.description}),B:o.t(o.unref(t.fen2yuan)(u.goodsInfo.marketPrice)),C:o.o((t=>o.unref(e.sheep).$router.go("/modules/mall/goods/index",{id:u.goodsInfo.id}))),D:o.t(o.unref(t.fen2yuan)(u.selectedSku.price*u.selectedSku.count||u.activity.price*u.selectedSku.count||u.goodsInfo.price*u.selectedSku.count||u.goodsInfo.price)),E:u.activity.startTime>(new Date).getTime()},u.activity.startTime>(new Date).getTime()||u.activity.endTime<=(new Date).getTime()?{}:o.e({G:0===u.goodsInfo.stock},(u.goodsInfo.stock,{})),{F:u.activity.endTime<=(new Date).getTime(),H:o.o(m),I:o.n(0===u.activity.status&&0!==u.goodsInfo.stock?"check-btn-box":"disabled-btn-box"),J:0===u.goodsInfo.stock||0!==u.activity.status,K:o.o((o=>u.goodsInfo=o)),L:o.p({modelValue:u.goodsInfo})}),{b:null===u.goodsInfo||0!==u.activity.status||u.activity.endTime<(new Date).getTime(),M:o.p({onShareAppMessage:I.value,navbar:"goods"}),N:o.s(s.__cssVars())})}},l=o._export_sfc(g,[["__scopeId","data-v-1271c5c2"]]);g.__runtimeHooks=3,wx.createPage(l);