import{a,x as s,G as o,H as e,o as t,j as l,w as d,h as u,I as i,l as r,i as c,z as n,f as g,Q as f,a0 as p,m as _,B as m,A as k,p as v,u as y}from"./index-90c12cc1.js";import{_ as b}from"./uv-line-progress.f06101e5.js";import{_ as h}from"./uv-button.8e862d87.js";import{G as x}from"./good-attr-select.3f64fa6c.js";import{a3 as E}from"./images.cf3befb9.js";import{L as j}from"./index.d156dd8a.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";const I=C({__name:"goods",props:["data","groupBuy","original","stock","list","buyProgress","total","selectModel","model","purchase","link","price","hasFirst"],setup(C){const I=C,P=a(void 0!==I.list),T=a(I.groupBuy),w=a(I.stock),D=a(I.total),F=a(I.buyProgress),B=a(void 0!==I.selectModel),M=a(void 0!==I.model),S=a(I.purchase);a(I.price);const q=a(I.original),A=a(null),G=a(void 0!==I.link),N=a(I.hasFirst),{push:z}=y(),H=()=>{G.value&&z({url:"/pages/goodsDetail/goodsDetail"},{data:{id:I.data.id,skuId:I.data.skuId}})},L=()=>{A.value.open()},Q=()=>{},W=s((()=>{const a=I.data.campaignTotal||I.data.total;return(a-(I.data.campaignStock||I.data.stock))/a*100})),X=s((()=>{const a=I.data.campaignTotal||I.data.total,s=I.data.campaignStock||I.data.stock;return Math.floor((a-s)/a*100).toFixed(0)+"%"}));return(a,s)=>{const y=m,I=o(e("uv-line-progress"),b),G=k,z=v,$=o(e("uv-button"),h),J=o(e("good-attr-select"),x);return t(),l(y,{class:_(["goods",[P.value&&"goods-list",N.value&&"goods-first"]]),onClick:H},{default:d((()=>[u(y,{class:"goods-header"},{default:d((()=>[u(y,{class:"goods-thumb"},{default:d((()=>[u(j,{unique:C.data.id,src:C.data.image,class:"goods-thumb-img",mode:"aspectFit"},null,8,["unique","src"])])),_:1})])),_:1}),u(y,{class:"goods-content"},{default:d((()=>[u(y,null,{default:d((()=>[u(y,{class:"goods-storeName"},{default:d((()=>[i(r(C.data.storeName),1)])),_:1}),N.value&&F.value?(t(),l(y,{key:0,class:"buy-progress-first"},{default:d((()=>[u(I,{activeColor:"#EE6D46",inactiveColor:"#E6E6E6",height:"14rpx",percentage:c(W),showText:!1},null,8,["percentage"]),u(G,{class:"text"},{default:d((()=>[i("已售"+r(c(X)),1)])),_:1})])),_:1})):n("",!0)])),_:1}),B.value?(t(),l(y,{key:0,class:"goods-list-model"},{default:d((()=>[g("div",{class:"goods-list-model-border",onClick:f(L,["stop"])},[u(y,{class:"goods-list-model-label"},{default:d((()=>[i(r(C.data.attrInfo.sku),1)])),_:1}),u(y,{class:"goods-list-model-action icon"},{default:d((()=>[u(z,{src:c(E)},null,8,["src"])])),_:1})],8,["onClick"])])),_:1})):n("",!0),M.value?(t(),l(y,{key:1,class:"goods-list-model-info"},{default:d((()=>[u(y,{class:"goods-list-model-label"},{default:d((()=>[i(r(C.data.attrInfo.sku),1)])),_:1})])),_:1})):n("",!0),u(y,null,{default:d((()=>[u(y,{class:"goods-info"},{default:d((()=>[u(y,{class:"goods-info-left"},{default:d((()=>[T.value?(t(),l(y,{key:0,class:"goods-desc"},{default:d((()=>[i(r(C.data.person)+"人团 ",1)])),_:1})):n("",!0),u(y,{class:"goods-price-row"},{default:d((()=>[u(y,{class:"goods-price"},{default:d((()=>[i(" ¥"+r(C.data.campaignPrice||C.data.price),1)])),_:1}),q.value?(t(),l(y,{key:0,class:"goods-price goods-price-original"},{default:d((()=>[i(" ¥"+r(C.data.otPrice||C.data.originalPrice),1)])),_:1})):n("",!0)])),_:1})])),_:1}),u(y,{class:"goods-info-action"},{default:d((()=>[u(y,{class:"goods-info-action-btn"},{default:d((()=>[p(a.$slots,"action",{},void 0,!0)])),_:3}),w.value?(t(),l(y,{key:0,class:"goods-info-action-desc"},{default:d((()=>[C.data.stock?(t(),l(G,{key:0},{default:d((()=>[i("仅剩"+r(C.data.stock)+"件",1)])),_:1})):(t(),l(G,{key:1},{default:d((()=>[i("库存不足")])),_:1}))])),_:1})):n("",!0),S.value?(t(),l(y,{key:1,class:"buy-num"},{default:d((()=>[u(y,{class:"buy-num-info-desc"},{default:d((()=>[i(" x"+r(S.value),1)])),_:1})])),_:1})):n("",!0),T.value?(t(),l($,{key:2,round:"",block:"",type:"primary"},{default:d((()=>[i(" 立刻拼团 ")])),_:1})):n("",!0)])),_:3})])),_:3}),!N.value&&F.value?(t(),l(y,{key:0,class:"buy-progress"},{default:d((()=>[u(y,{class:"buy-progress-info"},{default:d((()=>[D.value?(t(),l(y,{key:0,class:"buy-progress-info-desc"},{default:d((()=>[i(" 限量"+r(C.data.campaignTotal||C.data.total)+"件 ",1)])),_:1})):n("",!0),u(I,{activeColor:"#EE6D46",inactiveColor:"#E6E6E6",height:"14rpx",percentage:c(W),showText:!1},null,8,["percentage"])])),_:1}),u(y,{class:"buy-progress-action"},{default:d((()=>[u($,{round:"",block:"",type:"primary"},{default:d((()=>[i(" 立即抢购 ")])),_:1})])),_:1})])),_:1})):n("",!0)])),_:3})])),_:3}),u(J,{ref_key:"selectAttrPanel",ref:A,id:C.data.id,onSelect:Q},null,8,["id"])])),_:3},8,["class"])}}},[["__scopeId","data-v-e490e2ab"]]);export{I as _};
