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