import{d as oe,ai as S,aT as M,r as B,ba as Q,O as E,o as d,c as f,k as w,w as i,a as m,S as g,F as U,i as t,C as N,j as T,t as u,l as h,L as z,aH as ne,aU as se,K as ce,Y as de,aW as ue,s as me,_ as pe,__tla as he}from"./index-66208f93.js";import{E as we,__tla as fe}from"./el-image-5afdbf9a.js";import{__tla as ge}from"./el-image-viewer-3d1b9860.js";import{__tla as ke}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-e54b32e6.js";import{_ as _e,__tla as ye}from"./UploadImg-866c0e44.js";import{__tla as be}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-d74843b7.js";import{__tla as Pe}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-fc10c60c.js";import{c as Ve,__tla as ve}from"./index-4eee12bb.js";import{u as Ue,__tla as Ce}from"./useMessage-798a77de.js";let R,Fe=Promise.all([(()=>{try{return he}catch{}})(),(()=>{try{return fe}catch{}})(),(()=>{try{return ge}catch{}})(),(()=>{try{return ke}catch{}})(),(()=>{try{return ye}catch{}})(),(()=>{try{return be}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return ve}catch{}})(),(()=>{try{return Ce}catch{}})()]).then(async()=>{let A,O,L,D,I,J,j,W,$;A={style:{"font-weight":"bold",color:"#40aaff"}},O={style:{"font-weight":"bold",color:"#40aaff"}},L={key:0},D={key:1},I={key:0},J={key:1},j={style:{"font-weight":"bold",color:"#40aaff"}},W={key:0},$={key:1},R=pe(oe({name:"SkuList",__name:"SkuList",props:{propFormData:{type:Object,default:()=>{}},propertyList:{type:Array,default:()=>[]},ruleConfig:{type:Array,default:()=>[]},isBatch:S.bool.def(!1),isDetail:S.bool.def(!1),isComponent:S.bool.def(!1),isActivityComponent:S.bool.def(!1)},emits:["selectionChange"],setup(k,{expose:X,emit:Z}){const _=M("highPrecisionChange"),ee=M("spuTypeChange"),P=Ue(),v=k,p=B(),F=B([{highPrecisionPrice:0,price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0,promotionFee:0,mark:""}]);Q(()=>{F.value.forEach(r=>{r.promotionFee=r.price-r.costPrice})}),E(()=>_.value,r=>{r?p.value.skus.forEach(s=>{s.price=0,s.marketPrice=0,s.costPrice=0,s.promotionFee=0}):p.value.skus.forEach(s=>{s.highPrecisionPrice=0})});const H=r=>{Ve({zIndex:9999999,urlList:[r]})},le=()=>{p.value.skus.forEach(r=>{se(r,F.value[0])})},C=B([]),ae=(r,s)=>{const e=s.split(".");let c=r;for(const n of e){if(!c||typeof c!="object"||!(n in c)){c=void 0;break}c=c[n]}return c},te=Z,ie=r=>{te("selectionChange",r)};E(()=>v.propFormData,r=>{r&&(p.value=r,Q(()=>{p.value.skus.forEach(s=>{s.promotionFee=s.price-s.costPrice})}))},{deep:!0,immediate:!0});const K=r=>{const s=r.map(c=>c.values.map(n=>({propertyId:c.id,propertyName:c.name,valueId:n.id,valueName:n.name}))),e=q(s);Y(r)||(p.value.skus=[]);for(const c of e){const n={properties:Array.isArray(c)?c:[c],price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0,promotionFee:0,mark:""};p.value.skus.findIndex(y=>JSON.stringify(y.properties)===JSON.stringify(n.properties))===-1&&p.value.skus.push(n)}},Y=r=>{const s=[];p.value.skus.forEach(c=>{var n,y;return(y=(n=c.properties)==null?void 0:n.map(V=>V.propertyId))==null?void 0:y.forEach(V=>{s.indexOf(V)===-1&&s.push(V)})});const e=r.map(c=>c.id);return s.length===e.length},q=r=>{if(r.length===0)return[];if(r.length===1)return r[0];{const s=[],e=q(r.slice(1));for(let c=0;cv.propertyList,r=>{p.value.specType&&(v.isBatch&&(F.value=[{price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0,promotionFee:0,mark:""}]),JSON.stringify(r)!=="[]"&&(C.value=[],r.forEach((s,e)=>{C.value.push({prop:`name${e}`,label:s.name})}),Y(r)||r.some(s=>s.values.length===0)||K(r)))},{deep:!0,immediate:!0});const G=B();return X({generateTableData:K,validateSku:()=>{let r="\u8BF7\u68C0\u67E5\u5546\u54C1\u5404\u884C\u76F8\u5173\u5C5E\u6027\u914D\u7F6E\uFF0C",s=!0;for(const e of p.value.skus){const c=_.value?[]:v==null?void 0:v.ruleConfig;for(const n of c){const y=ae(e,n.name);if(!n.rule(y)){s=!1,r+=n.message;break}}if(e.picUrl=="")throw P.warning("sku\u5FC5\u987B\u4E0A\u4F20\u56FE\u7247"),new Error("sku\u5FC5\u987B\u4E0A\u4F20\u56FE\u7247");if(ee.value==0){if(parseFloat(e.price)G.value}),(r,s)=>{const e=ce,c=de,n=ue,y=me,V=we;return d(),f(U,null,[k.isDetail||k.isActivityComponent?g("",!0):(d(),w(m(z),{key:0,data:k.isBatch?m(F):m(p).skus,border:"",class:"tabNumWidth","max-height":"500",size:"small"},{default:i(()=>{var l;return[t(e,{align:"center",label:"\u56FE\u7247","min-width":"65"},{default:i(({row:a})=>[t(m(_e),{modelValue:a.picUrl,"onUpdate:modelValue":o=>a.picUrl=o,height:"50px",fileSize:.3,width:"50px"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),m(p).specType&&!k.isBatch?(d(!0),f(U,{key:0},N(m(C),(a,o)=>(d(),w(e,{key:o,label:a.label,align:"center","min-width":"120"},{default:i(({row:b})=>{var x;return[T("span",A,u((x=b.properties[o])==null?void 0:x.valueName),1)]}),_:2},1032,["label"]))),128)):g("",!0),t(e,{align:"center",label:"\u5546\u54C1\u6761\u7801","min-width":"168"},{default:i(({row:a})=>[t(c,{modelValue:a.barCode,"onUpdate:modelValue":o=>a.barCode=o,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(e,{align:"center",label:"\u9500\u552E\u4EF7","min-width":"168"},{default:i(({row:a})=>[m(_).value?(d(),w(n,{key:0,modelValue:a.highPrecisionPrice,"onUpdate:modelValue":o=>a.highPrecisionPrice=o,min:0,precision:6,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])):(d(),w(n,{key:1,modelValue:a.price,"onUpdate:modelValue":o=>a.price=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"]))]),_:1}),t(e,{align:"center",label:"\u5E02\u573A\u4EF7","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.marketPrice,"onUpdate:modelValue":o=>a.marketPrice=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right",disabled:m(_).value},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1}),t(e,{align:"center",label:"\u6210\u672C\u4EF7","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.costPrice,"onUpdate:modelValue":o=>a.costPrice=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right",disabled:m(_).value},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1}),t(e,{align:"center",label:"\u7ED3\u7B97\u4EF7","min-width":"168"},{default:i(({row:a})=>[m(_).value?(d(),w(n,{key:0,modelValue:a.highPrecisionSettlementPrice,"onUpdate:modelValue":o=>a.highPrecisionSettlementPrice=o,min:0,precision:6,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])):(d(),w(n,{key:1,modelValue:a.settlementPrice,"onUpdate:modelValue":o=>a.settlementPrice=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"]))]),_:1}),t(e,{align:"center",label:"\u63A8\u5E7F\u8D39","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.promotionFee,"onUpdate:modelValue":o=>a.promotionFee=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right",disabled:""},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(e,{align:"center",label:"\u5E93\u5B58","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.stock,"onUpdate:modelValue":o=>a.stock=o,min:0,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(e,{align:"center",label:"\u91CD\u91CF(kg)","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.weight,"onUpdate:modelValue":o=>a.weight=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(e,{align:"center",label:"\u4F53\u79EF(m^3)","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.volume,"onUpdate:modelValue":o=>a.volume=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(e,{align:"center",label:"\u5907\u6CE8","min-width":"168"},{default:i(({row:a})=>[t(c,{modelValue:a.mark,"onUpdate:modelValue":o=>a.mark=o,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),m(p).subCommissionType?(d(),f(U,{key:1},[t(e,{align:"center",label:"\u4E00\u7EA7\u8FD4\u4F63(\u5143)","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.firstBrokeragePrice,"onUpdate:modelValue":o=>a.firstBrokeragePrice=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(e,{align:"center",label:"\u4E8C\u7EA7\u8FD4\u4F63(\u5143)","min-width":"168"},{default:i(({row:a})=>[t(n,{modelValue:a.secondBrokeragePrice,"onUpdate:modelValue":o=>a.secondBrokeragePrice=o,min:0,precision:2,step:.1,class:"w-100%","controls-position":"right"},null,8,["modelValue","onUpdate:modelValue"])]),_:1})],64)):g("",!0),(l=m(p))!=null&&l.specType?(d(),w(e,{key:2,align:"center",fixed:"right",label:"\u64CD\u4F5C",width:"80"},{default:i(({row:a})=>[k.isBatch?(d(),w(y,{key:0,link:"",size:"small",type:"primary",onClick:le},{default:i(()=>[h(" \u6279\u91CF\u6DFB\u52A0 ")]),_:1})):(d(),w(y,{key:1,link:"",size:"small",type:"primary",onClick:o=>(b=>{const x=p.value.skus.findIndex(re=>JSON.stringify(re.properties)===JSON.stringify(b.properties));p.value.skus.splice(x,1)})(a)},{default:i(()=>[h("\u5220\u9664")]),_:2},1032,["onClick"]))]),_:1})):g("",!0)]}),_:1},8,["data"])),k.isDetail?(d(),w(m(z),{key:1,ref_key:"activitySkuListRef",ref:G,data:m(p).skus,border:"","max-height":"500",size:"small",style:{width:"99%"},onSelectionChange:ie},{default:i(()=>[k.isComponent?(d(),w(e,{key:0,type:"selection",width:"45"})):g("",!0),t(e,{align:"center",label:"\u56FE\u7247","min-width":"80"},{default:i(({row:l})=>[l.picUrl?(d(),w(V,{key:0,src:l.picUrl,class:"h-50px w-50px",onClick:a=>H(l.picUrl)},null,8,["src","onClick"])):g("",!0)]),_:1}),m(p).specType&&!k.isBatch?(d(!0),f(U,{key:1},N(m(C),(l,a)=>(d(),w(e,{key:a,label:l.label,align:"center","min-width":"80"},{default:i(({row:o})=>{var b;return[T("span",O,u((b=o.properties[a])==null?void 0:b.valueName),1)]}),_:2},1032,["label"]))),128)):g("",!0),t(e,{align:"center",label:"\u5546\u54C1\u6761\u7801","min-width":"100"},{default:i(({row:l})=>[h(u(l.barCode),1)]),_:1}),t(e,{align:"center",label:"\u9500\u552E\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[m(_).value?(d(),f("span",L,u(l.highPrecisionPrice/100),1)):(d(),f("span",D,u(l.price),1))]),_:1}),t(e,{align:"center",label:"\u5E02\u573A\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.marketPrice),1)]),_:1}),t(e,{align:"center",label:"\u6210\u672C\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.costPrice),1)]),_:1}),t(e,{align:"center",label:"\u7ED3\u7B97\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[m(_).value?(d(),f("span",I,u(l.highPrecisionSettlementPrice/100),1)):(d(),f("span",J,u(l.settlementPrice),1))]),_:1}),t(e,{align:"center",label:"\u63A8\u5E7F\u8D39(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.promotionFee),1)]),_:1}),t(e,{align:"center",label:"\u5E93\u5B58","min-width":"80"},{default:i(({row:l})=>[h(u(l.stock),1)]),_:1}),t(e,{align:"center",label:"\u91CD\u91CF(kg)","min-width":"80"},{default:i(({row:l})=>[h(u(l.weight),1)]),_:1}),t(e,{align:"center",label:"\u4F53\u79EF(m^3)","min-width":"80"},{default:i(({row:l})=>[h(u(l.volume),1)]),_:1}),t(e,{align:"center",label:"\u5907\u6CE8","min-width":"100"},{default:i(({row:l})=>[h(u(l.mark),1)]),_:1}),m(p).subCommissionType?(d(),f(U,{key:2},[t(e,{align:"center",label:"\u4E00\u7EA7\u8FD4\u4F63(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.firstBrokeragePrice),1)]),_:1}),t(e,{align:"center",label:"\u4E8C\u7EA7\u8FD4\u4F63(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.secondBrokeragePrice),1)]),_:1})],64)):g("",!0)]),_:1},8,["data"])):g("",!0),k.isActivityComponent?(d(),w(m(z),{key:2,data:m(p).skus,border:"","max-height":"500",size:"small",style:{width:"99%"}},{default:i(()=>[k.isComponent?(d(),w(e,{key:0,type:"selection",width:"45"})):g("",!0),t(e,{align:"center",label:"\u56FE\u7247","min-width":"80"},{default:i(({row:l})=>[t(V,{src:l.picUrl,class:"h-60px w-60px",onClick:a=>H(l.picUrl)},null,8,["src","onClick"])]),_:1}),m(p).specType?(d(!0),f(U,{key:1},N(m(C),(l,a)=>(d(),w(e,{key:a,label:l.label,align:"center","min-width":"80"},{default:i(({row:o})=>{var b;return[T("span",j,u((b=o.properties[a])==null?void 0:b.valueName),1)]}),_:2},1032,["label"]))),128)):g("",!0),t(e,{align:"center",label:"\u5546\u54C1\u6761\u7801","min-width":"100"},{default:i(({row:l})=>[h(u(l.barCode),1)]),_:1}),t(e,{align:"center",label:"\u9500\u552E\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[m(_).value?(d(),f("span",W,u(l.highPrecisionPrice/100),1)):(d(),f("span",$,u(l.price),1))]),_:1}),t(e,{align:"center",label:"\u5E02\u573A\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.marketPrice),1)]),_:1}),t(e,{align:"center",label:"\u6210\u672C\u4EF7(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.costPrice),1)]),_:1}),t(e,{align:"center",label:"\u63A8\u5E7F\u8D39(\u5143)","min-width":"80"},{default:i(({row:l})=>[h(u(l.promotionFee),1)]),_:1}),t(e,{align:"center",label:"\u5E93\u5B58","min-width":"80"},{default:i(({row:l})=>[h(u(l.stock),1)]),_:1}),t(e,{align:"center",label:"\u5907\u6CE8","min-width":"100"},{default:i(({row:l})=>[h(u(l.mark),1)]),_:1}),ne(r.$slots,"extension")]),_:3},8,["data"])):g("",!0)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/mall/product/spu/components/SkuList.vue"]])});export{Fe as __tla,R as default};