groupon.js 6.2 KB

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