pages-goods-groupon.78c96fa7.js 9.0 KB

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