2024-10-01 09:15:35 +08:00
|
|
|
"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.introduct
|