1 |
- import{_ as e}from"./s-empty.4d7f5239.js";import{z as s,c as t,Z as l,m as o,n as a,f as c,g as n,w as r,k as i,x as d,s as u,u as f,v as p,l as m,F as g,r as _,E as k,a6 as b,y,j as x,I as v,J as h,D as I,B as w,e as S,N as C,o as A,a9 as P,S as j,i as L,H as T}from"./index-a116b7fa.js";import{_ as $}from"./su-swiper.ce1743f1.js";import{_ as E}from"./su-number-box.7b9bb097.js";import{_ as V}from"./phone-international-input.b9f6c8e6.js";import{c as U,f as O,u as D,d as M}from"./useGoods.6b315a78.js";import{_ as N}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as R}from"./s-layout.4ae51839.js";import{d as z,a as B,_ as F,b as H,c as J,e as q}from"./detail-content-card.fb9524e8.js";import{g as G,T as Z}from"./const.24444c58.js";/* empty css */import"./comment-item.a0333778.js";import"./uni-rate.540043c1.js";import"./su-image.cf5517c4.js";import"./mp-html.02bc03c7.js";const K=N({__name:"s-select-seckill-sku",props:{modelValue:{type:Object,default(){}},show:{type:Boolean,default:!1},singleLimitCount:{type:Number,default:1}},emits:["change","addCart","buy","close"],setup(e,{emit:w}){const S=w,C=e,A=s({goodsInfo:t((()=>C.modelValue)),selectedSku:{},currentPropertyArray:[]}),P=U(A.goodsInfo.skus),j=t((()=>{let e=A.goodsInfo.skus;for(let s of e)s.value_id_array=s.properties.map((e=>e.valueId));return e}));A.goodsInfo.is_sku||(A.selectedSku=A.goodsInfo.skus[0]),l((()=>A.selectedSku),(e=>{S("change",e)}),{immediate:!0,deep:!0});const L=()=>{A.selectedSku.id?A.selectedSku.stock<=0?u.$helper.toast("库存不足"):S("buy",A.selectedSku):u.$helper.toast("请选择规格")};const T=(e=!1,s=0,t=0)=>{let l=[];if(e)for(let c of j.value)c.stock<=0||c.value_id_array.indexOf(t)>=0&&l.push(c);else l=$();let o=[];for(let c of l)o=o.concat(c.value_id_array);if(o=Array.from(new Set(o)),e){let e=o.indexOf(t);o.splice(e,1)}else A.currentPropertyArray.forEach((e=>{if(""!==e.toString())return;let s=o.indexOf(e);s>=0&&o.splice(s,1)}));let a=[];e?a=[s]:A.currentPropertyArray.forEach(((e,s)=>{""!==e&&a.push(s)}));for(let c in P)if(!(a.indexOf(P[c].id)>=0))for(let e in P[c].values)P[c].values[e].disabled=o.indexOf(P[c].values[e].id)<0},$=()=>{let e=[];for(let s of j.value){if(s.stock<=0)continue;let t=!0;A.currentPropertyArray.forEach((e=>{""!==e.toString()&&s.value_id_array.indexOf(e)<0&&(t=!1)})),t&&e.push(s)}return e};return T(!1),(s,t)=>{const l=y,w=x,C=v,j=h,U=o(a("su-number-box"),E),D=I,M=o(a("su-popup"),V);return c(),n(M,{show:e.show,round:"10",onClose:t[2]||(t[2]=e=>S("close"))},{default:r((()=>[i(w,{class:"ss-modal-box bg-white ss-flex-col"},{default:r((()=>[i(w,{class:"modal-header ss-flex ss-col-center"},{default:r((()=>[i(w,{class:"header-left ss-m-r-30"},{default:r((()=>[i(l,{class:"sku-image",src:d(u).$url.cdn(A.selectedSku.picUrl||A.goodsInfo.picUrl),mode:"aspectFill"},null,8,["src"])])),_:1}),i(w,{class:"header-right ss-flex-col ss-row-between ss-flex-1"},{default:r((()=>[i(w,{class:"goods-title ss-line-2"},{default:r((()=>[f(p(A.goodsInfo.name),1)])),_:1}),i(w,{class:"header-right-bottom ss-flex ss-col-center ss-row-between"},{default:r((()=>[i(w,{class:"price-text"},{default:r((()=>[f(p(d(O)(A.selectedSku.price||A.goodsInfo.price)),1)])),_:1}),i(w,{class:"tig ss-flex ss-col-center"},{default:r((()=>[i(w,{class:"tig-icon ss-flex ss-col-center ss-row-center"},{default:r((()=>[i(C,{class:"cicon-alarm"})])),_:1}),i(w,{class:"tig-title"},{default:r((()=>[f("秒杀价")])),_:1})])),_:1}),i(w,{class:"stock-text ss-m-l-20"},{default:r((()=>[f(" 库存"+p(A.selectedSku.stock||A.goodsInfo.stock)+"件 ",1)])),_:1})])),_:1})])),_:1})])),_:1}),i(w,{class:"modal-content ss-flex-1"},{default:r((()=>[i(D,{"scroll-y":"true",class:"modal-content-scroll"},{default:r((()=>[(c(!0),m(g,null,_(d(P),(e=>(c(),n(w,{class:"sku-item ss-m-b-20",key:e.id},{default:r((()=>[i(w,{class:"label-text ss-m-b-20"},{default:r((()=>[f(p(e.name),1)])),_:2},1024),i(w,{class:"ss-flex ss-col-center ss-flex-wrap"},{default:r((()=>[(c(!0),m(g,null,_(e.values,(s=>(c(),n(j,{class:k(["ss-reset-button spec-btn",[{"checked-btn":A.currentPropertyArray[e.id]===s.id},{"disabled-btn":!0===s.disabled}]]),key:s.id,disabled:!0===s.disabled,onClick:t=>((e,s)=>{let t=!0;void 0!==A.currentPropertyArray[e]&&A.currentPropertyArray[e]===s?(t=!1,A.currentPropertyArray.splice(e,1,"")):A.currentPropertyArray[e]=s;let l=[];A.currentPropertyArray.forEach((e=>{""!==e&&l.push(e)}));let o=$();l.length===P.length&&o.length?(o[0].count=A.selectedSku.count||1,A.selectedSku=o[0]):A.selectedSku={},T(t,e,s)})(e.id,s.id)},{default:r((()=>[f(p(s.name),1)])),_:2},1032,["class","disabled","onClick"])))),128))])),_:2},1024)])),_:2},1024)))),128)),i(w,{class:"buy-num-box ss-flex ss-col-center ss-row-between"},{default:r((()=>[i(w,{class:"label-text"},{default:r((()=>[f("购买数量")])),_:1}),i(U,{min:1,max:d(b.min)([e.singleLimitCount,A.selectedSku.stock]),step:1,modelValue:A.selectedSku.count,"onUpdate:modelValue":t[0]||(t[0]=e=>A.selectedSku.count=e),onChange:t[1]||(t[1]=e=>{var s;(s=e)>0&&A.selectedSku.count!==s&&(A.selectedSku.count=s)}),activity:"seckill"},null,8,["max","modelValue"])])),_:1})])),_:1})])),_:1}),i(w,{class:"modal-footer"},{default:r((()=>[i(w,{class:"buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center"},{default:r((()=>[i(j,{class:"ss-reset-button buy-btn",onClick:L},{default:r((()=>[f("确认")])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-bd8b32ba"]]),Q=N({__name:"detail-progress",props:{percent:{type:Number,default:0}},setup:e=>(s,t)=>{const l=x;return c(),n(l,{class:"ss-flex ss-col-center"},{default:r((()=>[i(l,{class:"progress-title ss-m-r-10"},{default:r((()=>[f(" 已抢"+p(e.percent)+"% ",1)])),_:1}),i(l,{class:"progress-box ss-flex ss-col-center"},{default:r((()=>[i(l,{class:"progerss-active",style:w({width:e.percent<10?"10%":e.percent+"%"})},null,8,["style"])])),_:1})])),_:1})}},[["__scopeId","data-v-58b2423c"]]),W=N({__name:"seckill",setup(l){T((e=>({"284c9add":d(_),"1b768876":d(y),"78b5065a":d(I),"93a7b3ee":d(w),d4b50090:d(E)})));const _=u.$url.css("/static/img/shop/goods/seckill-bg.png"),y=u.$url.css("/static/img/shop/goods/seckill-btn.png"),I=u.$url.css("/static/img/shop/goods/activity-btn-disabled.png"),w=u.$url.css("/static/img/shop/goods/seckill-tip-bg.png"),E=u.$url.css("/static/img/shop/goods/groupon-tip-bg.png");S((()=>{}));const V=s({skeletonLoading:!0,goodsInfo:{},showSelectSku:!1,goodsSwiper:[],selectedSku:{},showModel:!1,total:0,percent:0,price:""}),U=t((()=>D(Y.value.endTime)));function N(e){V.selectedSku=e}function W(e){u.$router.go("/pages/order/confirm",{data:JSON.stringify({order_type:"goods",buy_type:"seckill",seckillActivityId:Y.value.id,items:[{skuId:e.id,count:e.count}]})})}const X=t((()=>b.isEmpty(Y)?{}:u.$platform.share.getShareInfo({title:Y.value.name,image:u.$url.cdn(V.goodsInfo.picUrl),params:{page:"4",query:Y.value.id}},{type:"goods",title:Y.value.name,image:u.$url.cdn(V.goodsInfo.picUrl),price:V.goodsInfo.price,marketPrice:V.goodsInfo.marketPrice}))),Y=C(),ee=C(""),se=async e=>{const{data:s}=await j.getSpuDetail(e);s.activity_type="seckill",V.goodsInfo=s,V.goodsSwiper=M(V.goodsInfo.sliderPicUrls),V.goodsInfo.price=b.min([V.goodsInfo.price,...Y.value.products.map((e=>e.seckillPrice))]),s.skus.forEach((e=>{const s=Y.value.products.find((s=>s.skuId===e.id));s?(e.price=s.seckillPrice,e.stock=Math.min(e.stock,s.stock)):e.stock=0,Y.value.totalLimitCount>0&&Y.value.singleLimitCount>0?e.limitCount=Math.min(Y.value.totalLimitCount,Y.value.singleLimitCount):Y.value.totalLimitCount>0?e.limitCount=Y.value.totalLimitCount:Y.value.singleLimitCount>0&&(e.limitCount=Y.value.singleLimitCount)})),V.skeletonLoading=!1};return A((e=>{e.id?(async e=>{const{data:s}=await P.getSeckillActivity(e);Y.value=s,ee.value=G(Y.startTime,Y.endTime),await se(s.spuId)})(e.id):V.goodsInfo=null})),(s,t)=>{const l=o(a("s-empty"),e),_=o(a("su-swiper"),$),b=x,y=v,I=o(a("s-select-seckill-sku"),K),w=h,S=o(a("s-layout"),R);return c(),n(S,{onShareAppMessage:X.value,navbar:"goods"},{default:r((()=>[i(z),V.skeletonLoading?(c(),n(B,{key:0})):null===V.goodsInfo||"seckill"!==V.goodsInfo.activity_type?(c(),n(l,{key:1,text:"活动不存在或已结束",icon:"/static/soldout-empty.png",showAction:"",actionText:"再逛逛",actionUrl:"/pages/goods/list"})):(c(),m(g,{key:2},[i(b,{class:"detail-swiper-selector"},{default:r((()=>[i(_,{class:"ss-m-b-14",isPreview:"",list:V.goodsSwiper,dotStyle:"tag",imageMode:"widthFix",dotCur:"bg-mask-40",seizeHeight:750},null,8,["list"]),i(b,{class:"title-card ss-m-y-14 ss-m-x-20 ss-p-x-20 ss-p-y-34"},{default:r((()=>[i(b,{class:"price-box ss-flex ss-row-between ss-m-b-18"},{default:r((()=>[i(b,{class:"ss-flex"},{default:r((()=>[i(b,{class:"price-text ss-m-r-16"},{default:r((()=>[f(p(d(O)(V.selectedSku.price||V.goodsInfo.price)),1)])),_:1}),i(b,{class:"tig ss-flex ss-col-center"},{default:r((()=>[i(b,{class:"tig-icon ss-flex ss-col-center ss-row-center"},{default:r((()=>[i(y,{class:"cicon-alarm"})])),_:1}),i(b,{class:"tig-title"},{default:r((()=>[f("秒杀价")])),_:1})])),_:1})])),_:1}),U.value.ms>0?(c(),n(b,{key:0,class:"countdown-box"},{default:r((()=>[i(b,{class:"countdown-title ss-m-b-20"},{default:r((()=>[f("距结束仅剩")])),_:1}),i(b,{class:"ss-flex countdown-time"},{default:r((()=>[i(b,{class:"ss-flex countdown-h"},{default:r((()=>[f(p(U.value.h),1)])),_:1}),i(b,{class:"ss-m-x-4"},{default:r((()=>[f(":")])),_:1}),i(b,{class:"countdown-num ss-flex ss-row-center"},{default:r((()=>[f(p(U.value.m),1)])),_:1}),i(b,{class:"ss-m-x-4"},{default:r((()=>[f(":")])),_:1}),i(b,{class:"countdown-num ss-flex ss-row-center"},{default:r((()=>[f(p(U.value.s),1)])),_:1})])),_:1})])),_:1})):(c(),n(b,{key:1,class:"countdown-title"},{default:r((()=>[f(" 活动已结束 ")])),_:1}))])),_:1}),i(b,{class:"ss-flex ss-row-between ss-m-b-60"},{default:r((()=>[V.goodsInfo.marketPrice?(c(),n(b,{key:0,class:"origin-price ss-flex ss-col-center"},{default:r((()=>[f(" 原价 "),i(b,{class:"origin-price-text"},{default:r((()=>[f(p(d(O)(V.selectedSku.marketPrice||V.goodsInfo.marketPrice)),1)])),_:1})])),_:1})):L("",!0),i(Q,{percent:V.percent},null,8,["percent"])])),_:1}),i(b,{class:"title-text ss-line-2 ss-m-b-6"},{default:r((()=>{var e;return[f(p(null==(e=V.goodsInfo)?void 0:e.name),1)]})),_:1}),i(b,{class:"subtitle-text ss-line-1"},{default:r((()=>[f(p(V.goodsInfo.introduction),1)])),_:1})])),_:1}),i(b,{class:"detail-cell-card detail-card ss-flex-col"},{default:r((()=>[i(F,{sku:V.selectedSku,onClick:t[0]||(t[0]=e=>V.showSelectSku=!0)},null,8,["sku"])])),_:1}),i(I,{modelValue:V.goodsInfo,"onUpdate:modelValue":t[1]||(t[1]=e=>V.goodsInfo=e),show:V.showSelectSku,"single-limit-count":Y.value.singleLimitCount,onBuy:W,onChange:N,onClose:t[2]||(t[2]=e=>V.showSelectSku=!1)},null,8,["modelValue","show","single-limit-count"])])),_:1}),i(H,{class:"detail-comment-selector",goodsId:V.goodsInfo.id},null,8,["goodsId"]),i(J,{class:"detail-content-selector",content:V.goodsInfo.description},null,8,["content"]),i(q,{modelValue:V.goodsInfo,"onUpdate:modelValue":t[5]||(t[5]=e=>V.goodsInfo=e)},{default:r((()=>[i(b,{class:"buy-box ss-flex ss-col-center ss-p-r-20"},{default:r((()=>[V.goodsInfo.marketPrice?(c(),n(w,{key:0,class:"ss-reset-button origin-price-btn ss-flex-col",onClick:t[3]||(t[3]=e=>d(u).$router.go("/pages/goods/index",{id:V.goodsInfo.id}))},{default:r((()=>[i(b,null,{default:r((()=>[i(b,{class:"btn-price"},{default:r((()=>[f(p(d(O)(V.goodsInfo.marketPrice)),1)])),_:1}),i(b,null,{default:r((()=>[f("原价购买")])),_:1})])),_:1})])),_:1})):(c(),n(w,{key:1,class:"ss-reset-button origin-price-btn ss-flex-col"},{default:r((()=>[i(b,{class:k(["no-original",(0===V.goodsInfo.stock||(ee.value,d(Z).STARTED),"")])},{default:r((()=>[f(" 秒杀价 ")])),_:1},8,["class"])])),_:1})),i(w,{class:k(["ss-reset-button btn-box ss-flex-col",ee.value===d(Z).STARTED&&0!=V.goodsInfo.stock?"check-btn-box":"disabled-btn-box"]),onClick:t[4]||(t[4]=e=>V.showSelectSku=!0),disabled:0===V.goodsInfo.stock||ee.value!==d(Z).STARTED},{default:r((()=>[i(b,{class:"btn-price"},{default:r((()=>[f(p(d(O)(V.goodsInfo.price)),1)])),_:1}),ee.value===d(Z).STARTED?(c(),n(b,{key:0},{default:r((()=>[0===V.goodsInfo.stock?(c(),n(b,{key:0},{default:r((()=>[f("已售罄")])),_:1})):(c(),n(b,{key:1},{default:r((()=>[f("立即秒杀")])),_:1}))])),_:1})):(c(),n(b,{key:1},{default:r((()=>[f(p(ee.value),1)])),_:1}))])),_:1},8,["class","disabled"])])),_:1})])),_:1},8,["modelValue"])],64))])),_:1},8,["onShareAppMessage"])}}},[["__scopeId","data-v-31d78969"]]);export{W as default};
|