pages-goods-groupon.fddcceb3.js 8.9 KB

1
  1. import{_ as s}from"./s-empty.4d7f5239.js";import{z as e,a0 as t,a8 as o,f as a,g as l,w as i,k as n,u as c,v as d,l as u,F as r,r as f,x as g,s as p,G as m,i as _,j as y,I as b,y as k,J as I,e as x,c as w,o as v,S,a6 as h,m as j,E as $,H as C,n as A}from"./index-a116b7fa.js";import{_ as P}from"./su-swiper.ce1743f1.js";import{_ as T}from"./s-select-groupon-sku.fa8904fa.js";import{_ as V}from"./s-layout.4ae51839.js";import{d as H,a as N,_ as z,b as D,c as U,e as E}from"./detail-content-card.fb9524e8.js";import{u as L,d as M,f as F}from"./useGoods.6b315a78.js";import{_ as J}from"./_plugin-vue_export-helper.1b428a4d.js";/* empty css */import"./su-number-box.7b9bb097.js";import"./phone-international-input.b9f6c8e6.js";import"./comment-item.a0333778.js";import"./uni-rate.540043c1.js";import"./su-image.cf5517c4.js";import"./mp-html.02bc03c7.js";const G=J({__name:"groupon-card-list",props:{modelValue:{type:Object,default(){}}},emits:["join"],setup(s,{emit:x}){const w=s,v=e({list:[]}),S=x;function h(s){const e=L(s);if(e.ms<=0)return"该团已解散";let t="剩余 ";return t+=`${e.h}时`,t+=`${e.m}分`,t+=`${e.s}秒`,t}return t((async()=>{const{data:s}=await o.getHeadCombinationRecordList(w.modelValue.id,0,10);v.list=s})),(s,e)=>{const t=y,o=b,x=k,w=I;return v.list.length>0?(a(),l(t,{key:0,class:"groupon-list detail-card ss-p-x-20"},{default:i((()=>[n(t,{class:"join-activity ss-flex ss-row-between ss-m-t-30"},{default:i((()=>[n(t,{class:""},{default:i((()=>[c("已有"+d(v.list.length)+"人参与活动",1)])),_:1}),n(o,{class:"cicon-forward"})])),_:1}),(a(!0),u(r,null,f(v.list,((s,e)=>(a(),l(t,{onClick:e=>g(p).$router.go("/pages/activity/groupon/detail",{id:s.id}),key:e,class:"ss-m-t-40 ss-flex ss-row-between border-bottom ss-p-b-30"},{default:i((()=>[n(t,{class:"ss-flex ss-col-center"},{default:i((()=>[n(x,{src:g(p).$url.cdn(s.avatar),class:"user-avatar"},null,8,["src"]),n(t,{class:"user-nickname ss-m-l-20 ss-line-1"},{default:i((()=>[c(d(s.nickname),1)])),_:2},1024)])),_:2},1024),n(t,{class:"ss-flex ss-col-center"},{default:i((()=>[n(t,{class:"ss-flex-col ss-col-bottom ss-m-r-20"},{default:i((()=>[n(t,{class:"title ss-flex ss-m-b-14"},{default:i((()=>[c(" 还差 "),n(t,{class:"num"},{default:i((()=>[c(d(s.userSize-s.userCount)+"人",1)])),_:2},1024),c(" 成团 ")])),_:2},1024),n(t,{class:"end-time"},{default:i((()=>[c(d(h(s.expireTime)),1)])),_:2},1024)])),_:2},1024),n(t,{class:""},{default:i((()=>[n(w,{class:"ss-reset-button go-btn",onClick:m((e=>function(s){S("join",s)}(s)),["stop"])},{default:i((()=>[c(" 去参团 ")])),_:2},1032,["onClick"])])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:1})):_("",!0)}}},[["__scopeId","data-v-2ff60b94"]]),O=J({__name:"groupon",setup(t){C((s=>({"040f3d14":g(f),"3f561f06":g(m),"5a8a7761":g(b),"75728c3f":g(J)})));const f=p.$url.css("/static/images/groupon-bg.png"),m=p.$url.css("/static/images/groupon-btn.png"),b=p.$url.css("/static/images/activity-btn-disabled.png"),J=p.$url.css("/static/images/groupon-tip-bg.png");x((()=>{}));const O=e({skeletonLoading:!0,goodsId:0,goodsInfo:{},goodsSwiper:[],showSelectSku:!1,selectedSkuPrice:{},activity:{},grouponId:0,grouponNum:0,grouponAction:"create",combinationHeadId:null}),q=w((()=>L(O.activity.endTime)));function B(s){O.selectedSkuPrice=s}function R(){O.showSelectSku=!1}function K(){O.grouponAction="create",O.grouponId=0,O.showSelectSku=!0}function Q(s){O.grouponAction="join",O.grouponId=s.activityId,O.combinationHeadId=s.id,O.grouponNum=s.userSize,O.showSelectSku=!0}function W(s){p.$router.go("/pages/order/confirm",{data:JSON.stringify({order_type:"goods",combinationActivityId:O.activity.id,combinationHeadId:O.combinationHeadId,items:[{skuId:s.id,count:s.count}]})})}const X=w((()=>h.isEmpty(O.activity)?{}:p.$platform.share.getShareInfo({title:O.activity.name,image:p.$url.cdn(O.goodsInfo.picUrl),params:{page:"3",query:O.activity.id}},{type:"goods",title:O.activity.name,image:p.$url.cdn(O.goodsInfo.picUrl),price:F(O.goodsInfo.price),marketPrice:F(O.goodsInfo.marketPrice)})));return v((async s=>{if(!s.id)return void(O.goodsInfo=null);O.grouponId=s.id;const{code:e,data:t}=await o.getCombinationActivity(O.grouponId);O.activity=t;const{data:a}=await S.getSpuDetail(t.spuId);O.goodsId=a.id,t.products.forEach((s=>{a.price=Math.min(a.price,s.combinationPrice)})),O.skeletonLoading=!1,0===e?(O.goodsInfo=a,O.grouponNum=t.userSize,O.goodsSwiper=M(O.goodsInfo.sliderPicUrls)):O.goodsInfo=null})),(e,t)=>{const o=j(A("s-empty"),s),f=j(A("su-swiper"),P),m=y,b=k,x=j(A("s-select-groupon-sku"),T),w=I,v=j(A("s-layout"),V);return a(),l(v,{onShareAppMessage:X.value,navbar:"goods"},{default:i((()=>[n(H),O.skeletonLoading?(a(),l(N,{key:0})):null===O.goodsInfo||0!==O.activity.status||O.activity.endTime<(new Date).getTime()?(a(),l(o,{key:1,text:"活动不存在或已结束",icon:"/static/soldout-empty.png",showAction:"",actionText:"返回上一页",onClickAction:t[0]||(t[0]=s=>g(p).$router.back())})):(a(),u(r,{key:2},[n(m,{class:"detail-swiper-selector"},{default:i((()=>[n(f,{class:"ss-m-b-14",isPreview:"",list:O.goodsSwiper,dotStyle:"tag",imageMode:"widthFix",dotCur:"bg-mask-40",seizeHeight:750},null,8,["list"]),n(m,{class:"title-card detail-card ss-m-y-14 ss-m-x-20 ss-p-x-20 ss-p-y-34"},{default:i((()=>[n(m,{class:"ss-flex ss-row-between ss-m-b-60"},{default:i((()=>[n(m,null,{default:i((()=>[n(m,{class:"price-box ss-flex ss-col-bottom ss-m-b-18"},{default:i((()=>[n(m,{class:"price-text ss-m-r-16"},{default:i((()=>[c(d(g(F)(O.activity.price||O.goodsInfo.price)),1)])),_:1}),n(m,{class:"tig ss-flex ss-col-center"},{default:i((()=>[n(m,{class:"tig-icon ss-flex ss-col-center ss-row-center"},{default:i((()=>[n(m,{class:"groupon-tag"},{default:i((()=>[n(b,{src:g(p).$url.static("/static/images/groupon-tag.png")},null,8,["src"])])),_:1})])),_:1}),n(m,{class:"tig-title"},{default:i((()=>[c("拼团价")])),_:1})])),_:1})])),_:1}),n(m,{class:"ss-flex ss-row-between"},{default:i((()=>[O.goodsInfo.price?(a(),l(m,{key:0,class:"origin-price ss-flex ss-col-center"},{default:i((()=>[c(" 单买价: "),n(m,{class:"origin-price-text"},{default:i((()=>[c(d(g(F)(O.goodsInfo.price)),1)])),_:1})])),_:1})):_("",!0)])),_:1})])),_:1}),q.value.ms>0?(a(),l(m,{key:0,class:"countdown-box"},{default:i((()=>[n(m,{class:"countdown-title ss-m-b-20"},{default:i((()=>[c("距结束仅剩")])),_:1}),n(m,{class:"ss-flex countdown-time"},{default:i((()=>[n(m,{class:"ss-flex countdown-h"},{default:i((()=>[c(d(q.value.h),1)])),_:1}),n(m,{class:"ss-m-x-4"},{default:i((()=>[c(":")])),_:1}),n(m,{class:"countdown-num ss-flex ss-row-center"},{default:i((()=>[c(d(q.value.m),1)])),_:1}),n(m,{class:"ss-m-x-4"},{default:i((()=>[c(":")])),_:1}),n(m,{class:"countdown-num ss-flex ss-row-center"},{default:i((()=>[c(d(q.value.s),1)])),_:1})])),_:1})])),_:1})):(a(),l(m,{key:1,class:"countdown-title"},{default:i((()=>[c(" 活动已结束 ")])),_:1}))])),_:1}),n(m,{class:"title-text ss-line-2 ss-m-b-6"},{default:i((()=>[c(d(O.goodsInfo.name),1)])),_:1}),n(m,{class:"subtitle-text ss-line-1"},{default:i((()=>[c(d(O.goodsInfo.introduction),1)])),_:1})])),_:1}),n(m,{class:"detail-cell-card detail-card ss-flex-col"},{default:i((()=>[n(z,{sku:O.selectedSkuPrice,onClick:t[1]||(t[1]=s=>O.showSelectSku=!0)},null,8,["sku"])])),_:1}),n(G,{modelValue:O.activity,"onUpdate:modelValue":t[2]||(t[2]=s=>O.activity=s),onJoin:Q},null,8,["modelValue"]),n(x,{show:O.showSelectSku,goodsInfo:O.goodsInfo,grouponAction:O.grouponAction,grouponNum:O.grouponNum,onBuy:W,onChange:B,onClose:R},null,8,["show","goodsInfo","grouponAction","grouponNum"])])),_:1}),n(D,{class:"detail-comment-selector",goodsId:O.goodsId},null,8,["goodsId"]),n(U,{class:"detail-content-selector",content:O.goodsInfo.description},null,8,["content"]),n(E,{modelValue:O.goodsInfo,"onUpdate:modelValue":t[4]||(t[4]=s=>O.goodsInfo=s)},{default:i((()=>[n(m,{class:"buy-box ss-flex ss-col-center ss-p-r-20"},{default:i((()=>[n(w,{class:"ss-reset-button origin-price-btn ss-flex-col",onClick:t[3]||(t[3]=s=>g(p).$router.go("/pages/goods/index",{id:O.goodsInfo.id}))},{default:i((()=>[n(m,{class:"btn-price"},{default:i((()=>[c(d(g(F)(O.goodsInfo.marketPrice)),1)])),_:1}),n(m,null,{default:i((()=>[c("原价购买")])),_:1})])),_:1}),n(w,{class:$(["ss-reset-button btn-tox ss-flex-col",0===O.activity.status&&0!==O.goodsInfo.stock?"check-btn-box":"disabled-btn-box"]),onClick:K,disabled:0===O.goodsInfo.stock||0!==O.activity.status},{default:i((()=>[n(m,{class:"btn-price"},{default:i((()=>[c(d(g(F)(O.activity.price||O.goodsInfo.price)),1)])),_:1}),O.activity.startTime>(new Date).getTime()?(a(),l(m,{key:0},{default:i((()=>[c("未开始")])),_:1})):O.activity.endTime<=(new Date).getTime()?(a(),l(m,{key:1},{default:i((()=>[c("已结束")])),_:1})):(a(),l(m,{key:2},{default:i((()=>[0===O.goodsInfo.stock?(a(),l(m,{key:0},{default:i((()=>[c("已售罄")])),_:1})):(a(),l(m,{key:1},{default:i((()=>[c("立即开团")])),_:1}))])),_:1}))])),_:1},8,["class","disabled"])])),_:1})])),_:1},8,["modelValue"])],64))])),_:1},8,["onShareAppMessage"])}}},[["__scopeId","data-v-8e22adfd"]]);export{O as default};