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