index-6ddc9bf7.js 2.4 KB

1
  1. import{d as k,r as t,w as b,b as B,o as p,A as I,B as C,C as y,aE as s,a as o,c as l,F as _,P as E,f as h,E as f,aa as j,D as g,a$ as z}from"./index-bf9ff227.js";import{E as L}from"./el-image-0ccbae3c.js";import"./el-image-viewer-a3b9f5bd.js";import{g as P}from"./spu-3efee143.js";import{g as U}from"./combinationActivity-613a6094.js";const A={key:0,class:"absolute left-0 top-0 z-1 items-center justify-center"},D=k({name:"PromotionCombination",__name:"index",props:{property:{}},setup(R){const a=R,i=t([]);b(()=>a.property.activityId,async()=>{if(!a.property.activityId)return;const e=await U(a.property.activityId);e!=null&&e.spuId&&(i.value=[await P(e.spuId)])},{immediate:!0,deep:!0});const d=t(375),m=t(),r=t(2),v=t("100%"),c=t("0"),x=t("");return b(()=>[a.property,d,i.value.length],()=>{r.value=a.property.layoutType==="oneCol"?1:3;const e=(d.value-a.property.space*(r.value-1))/r.value;c.value=r.value===2?"64px":`${e}px`,x.value=`repeat(${r.value}, auto)`,v.value="100%"},{immediate:!0,deep:!0}),B(()=>{var e,u;d.value=((u=(e=m.value)==null?void 0:e.wrapRef)==null?void 0:u.offsetWidth)||375}),(e,u)=>{const w=L,$=z;return p(),I($,{class:"z-1 min-h-30px","wrap-class":"w-full",ref_key:"containerRef",ref:m},{default:C(()=>[y("div",{class:"grid overflow-x-auto",style:s({gridGap:`${e.property.space}px`,gridTemplateColumns:o(x),width:o(v)})},[(p(!0),l(_,null,E(o(i),(n,T)=>(p(),l("div",{class:"relative box-content flex flex-row flex-wrap overflow-hidden bg-white",style:s({borderTopLeftRadius:`${e.property.borderRadiusTop}px`,borderTopRightRadius:`${e.property.borderRadiusTop}px`,borderBottomLeftRadius:`${e.property.borderRadiusBottom}px`,borderBottomRightRadius:`${e.property.borderRadiusBottom}px`}),key:T},[e.property.badge.show?(p(),l("div",A,[h(w,{fit:"cover",src:e.property.badge.imgUrl,class:"h-26px w-38px"},null,8,["src"])])):f("",!0),h(w,{fit:"cover",src:n.picUrl,style:s({width:o(c),height:o(c)})},null,8,["src","style"]),y("div",{class:j(["flex flex-col gap-8px p-8px box-border",{"w-[calc(100%-64px)]":o(r)===2,"w-full":o(r)===3}])},[e.property.fields.name.show?(p(),l("div",{key:0,class:"truncate text-12px",style:s({color:e.property.fields.name.color})},g(n.name),5)):f("",!0),y("div",null,[e.property.fields.price.show?(p(),l("span",{key:0,class:"text-12px",style:s({color:e.property.fields.price.color})}," \uFFE5"+g(n.price),5)):f("",!0)])],2)],4))),128))],4)]),_:1},512)}}});export{D as default};