2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
var P=Object.defineProperty,$=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var S=(e,t,o)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))j.call(t,o)&&S(e,o,t[o]);if(T)for(var o of T(t))A.call(t,o)&&S(e,o,t[o]);return e},B=(e,t)=>$(e,L(t));var C=(e,t,o)=>new Promise((d,y)=>{var h=r=>{try{f(o.next(r))}catch(a){y(a)}},x=r=>{try{f(o.throw(r))}catch(a){y(a)}},f=r=>r.done?d(r.value):Promise.resolve(r.value).then(h,x);f((o=o.apply(e,t)).next())});import{b as z}from"./index-D3VduTvn.js";import{g as U}from"./index-hVHBryxB.js";import{aA as w}from"./bootstrap-CRjSNGHY.js";import{m as E,b9 as g,w as N,ad as s,b2 as i,I as V,bb as D,aT as c,ac as p,ae as m,j as I,u as b,aR as k,bp as n,cX as R,ab as W}from"../jse/index-index-CMeVxoEG.js";const F={key:0,class:"absolute left-0 top-0 z-[1] items-center justify-center"},X={class:"text-xs"},Y={class:"absolute bottom-2 right-2"},M=E({name:"PromotionPoint",__name:"index",props:{property:{}},setup(e){const t=e,o=g([]),d=g([]),y=g([]);N(()=>t.property.activityIds,()=>C(null,null,function*(){try{const r=t.property.activityIds;Array.isArray(r)&&r.length>0&&(y.value=yield U(r),o.value=[],d.value=y.value.map(a=>a.spuId),d.value.length>0&&(o.value=yield z(d.value)),y.value.forEach(a=>{const l=o.value.find(u=>u.id===a.spuId);l&&(l.pointStock=a.stock,l.pointTotalStock=a.totalStock,l.point=a.point,l.pointPrice=a.price)}))}catch(r){console.error("获取积分商城活动细节或 SPU 细节时出错:",r)}}),{immediate:!0,deep:!0});function h(r){const a=t.property.layoutType==="twoCol"?2:1,l=r%a===0?"0":`${t.property.space}px`,u=r<a?"0":`${t.property.space}px`;return{marginLeft:l,marginTop:u}}const x=g();function f(){let r="100%";return t.property.layoutType==="twoCol"&&(r=`${(x.value.offsetWidth-t.property.space)/2}px`),{width:r}}return(r,a)=>(i(),s("div",{ref_key:"containerRef",ref:x,class:"box-content flex min-h-[30px] w-full flex-row flex-wrap"},[(i(!0),s(V,null,D(o.value,(l,u)=>(i(),s("div",{key:u,style:c(B(v(v({},h(u)),f()),{borderTopLeftRadius:`${e.property.borderRadiusTop}px`,borderTopRightRadius:`${e.property.borderRadiusTop}px`,borderBottomLeftRadius:`${e.property.borderRadiusBottom}px`,borderBottomRightRadius:`${e.property.borderRadiusBottom}px`})),class:"relative box-content flex flex-row flex-wrap overflow-hidden bg-card"},[e.property.badge.show?(i(),s("div",F,[I(b(w),{src:e.property.badge.imgUrl,class:"h-6 w-10 object-cover",preview:!1},null,8,["src"])])):p("",!0),m("div",{class:k(["h-[140px]",[{"w-full":e.property.layoutType!=="oneColSmallImg","w-[140px]":e.property.layoutType==="oneColSmallImg"}]])},[I(b(w),{src:l.picUrl,class:"h-full w-full object-cover",preview:!1},null,8,["src"])],2),m("div",{class:k(["box-border flex flex-col gap-2 p-2",[{"w-full":e.property.layoutType!=="oneColSmallImg","w-[calc(100%-140px-16px)]":e.property.layoutType==="oneColSmallImg"}]])},[e.property.fields.name.show?(i(),s("div",{key:0,class:k(["text-sm",[{truncate:e.property.layoutType!=="oneColSmallImg","line-clamp-2 overflow-ellipsis":e.property.layoutType==="oneColSmallImg"}]]),style:c({color:e.property.fields.name.color})},n(l.name),7)):p("",!0),e.property.fields.introduction.show?(i(),s("div",{key:1,style:c({color:e.property.fields.introduction.color}),class:"truncate text-xs"},n(l.introduction),5)):p("",!0),m("div",null,[e.property.fields.price.show?(i(),s("span",{key:0,style:c({color:e.property.fields.price.color}),class:"text-base"},n(l.point)+"积分 "+n(!l.pointPrice||l.pointPrice===0?"":`+${b(R)(l.pointPrice)}元`),5)):p("",!0),e.property.fields.marketPrice.show&&l.marketPrice?(i(),s("span",{key:1,style:c({color:e.property.fields.marketPrice.color}),class:"ml-1 text-xs line-through"}," ¥"+n(b(R)(l.marketPrice)),5)):p("",!0)]),m("div",X,[e.property.fields.salesCount.show?(i(),s("span",{key:0,style:c({color:e.property.fields.salesCount.color})}," 已兑"+n((l.pointTotalStock||0)-(l.pointStock||0))+"件 ",5)):p("",!0),e.property.fields.stock.show?(i(),s("span",{key:1,style:c({color:e.property.fields.stock.color})}," 库存"+n(l.pointTotalStock||0),5)):p("",!0)])],2),m("div",Y,[e.property.btnBuy.type==="text"?(i(),s("span",{key:0,style:c({background:`linear-gradient(to right, ${e.property.btnBuy.bgBeginColor}, ${e.property.btnBuy.bgEndColor}`}),class:"rounded-full px-3 py-1 text-sm text-white"},n(e.property.btnBuy.text),5)):(i(),W(b(w),{key:1,src:e.property.btnBuy.imgUrl,class:"size-7 rounded-full object-cover",preview:!1},null,8,["src"]))])],4))),128))],512))}});export{M as default};
|