1 |
- import{d as X,ag as x,r as B,b7 as R,L as j,o as u,c as V,v as f,w as i,a as h,P as w,F as v,f as t,q as F,g as N,t as d,n as p,H as S,az as Y,aR as Z,G as ee,V as le,aT as ae,C as te,_ as ie,__tla as oe}from"./index-6d7b82ba.js";import{E as re,__tla as ne}from"./el-image-afb9e567.js";import{__tla as se}from"./el-image-viewer-4a19ded4.js";import{__tla as ce}from"./SPuUploadImg.vue_vue_type_style_index_0_scoped_ba706063_lang-b2231227.js";import{_ as de,__tla as me}from"./UploadImg-f5f3b1db.js";import{__tla as ue}from"./UploadImgs.vue_vue_type_style_index_0_scoped_9d666400_lang-aa91c91b.js";import{__tla as pe}from"./UploadFile.vue_vue_type_style_index_0_scoped_436eca1b_lang-5325525b.js";import{c as he,__tla as fe}from"./index-8e19be94.js";import{u as we,__tla as ge}from"./useMessage-be161634.js";let $,_e=Promise.all([(()=>{try{return oe}catch{}})(),(()=>{try{return ne}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return ue}catch{}})(),(()=>{try{return pe}catch{}})(),(()=>{try{return fe}catch{}})(),(()=>{try{return ge}catch{}})()]).then(async()=>{let z,A,E;z={style:{"font-weight":"bold",color:"#40aaff"}},A={style:{"font-weight":"bold",color:"#40aaff"}},E={style:{"font-weight":"bold",color:"#40aaff"}},$=ie(X({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:q,emit:G}){const L=we(),y=g,m=B(),U=B([{price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0,promotionFee:0,mark:""}]);R(()=>{U.value.forEach(o=>{o.promotionFee=o.price-o.costPrice})});const T=o=>{he({zIndex:9999999,urlList:[o]})},H=()=>{m.value.skus.forEach(o=>{Z(o,U.value[0])})},P=B([]),W=(o,c)=>{const e=c.split(".");let n=o;for(const s of e){if(!n||typeof n!="object"||!(s in n)){n=void 0;break}n=n[s]}return n},K=G,M=o=>{K("selectionChange",o)};j(()=>y.propFormData,o=>{o&&(m.value=o,R(()=>{m.value.skus.forEach(c=>{c.promotionFee=c.price-c.costPrice})}))},{deep:!0,immediate:!0});const D=o=>{const c=o.map(n=>n.values.map(s=>({propertyId:n.id,propertyName:n.name,valueId:s.id,valueName:s.name}))),e=I(c);O(o)||(m.value.skus=[]);for(const n of e){const s={properties:Array.isArray(n)?n:[n],price:0,marketPrice:0,costPrice:0,barCode:"",picUrl:"",stock:0,weight:0,volume:0,firstBrokeragePrice:0,secondBrokeragePrice:0,promotionFee:0,mark:""};m.value.skus.findIndex(k=>JSON.stringify(k.properties)===JSON.stringify(s.properties))===-1&&m.value.skus.push(s)}},O=o=>{const c=[];m.value.skus.forEach(n=>{var s,k;return(k=(s=n.properties)==null?void 0:s.map(b=>b.propertyId))==null?void 0:k.forEach(b=>{c.indexOf(b)===-1&&c.push(b)})});const e=o.map(n=>n.id);return c.length===e.length},I=o=>{if(o.length===0)return[];if(o.length===1)return o[0];{const c=[],e=I(o.slice(1));for(let n=0;n<o[0].length;n++)for(let s=0;s<e.length;s++)Array.isArray(e[s])?c.push([o[0][n],...e[s]]):c.push([o[0][n],e[s]]);return c}};j(()=>y.propertyList,o=>{m.value.specType&&(y.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)!=="[]"&&(P.value=[],o.forEach((c,e)=>{P.value.push({prop:`name${e}`,label:c.name})}),O(o)||o.some(c=>c.values.length===0)||D(o)))},{deep:!0,immediate:!0});const J=B();return q({generateTableData:D,validateSku:()=>{let o="\u8BF7\u68C0\u67E5\u5546\u54C1\u5404\u884C\u76F8\u5173\u5C5E\u6027\u914D\u7F6E\uFF0C",c=!0;for(const e of m.value.skus){for(const n of y==null?void 0:y.ruleConfig){const s=W(e,n.name);if(!n.rule(s)){c=!1,o+=n.message;break}}if(e.price<e.costPrice)throw L.warning("\u5546\u54C1\u9500\u552E\u4EF7\u5FC5\u987B\u5927\u4E8E\u6210\u672C\u4EF7"),new Error("\u5546\u54C1\u9500\u552E\u4EF7\u5FC5\u987B\u5927\u4E8E\u6210\u672C\u4EF7");if(!c)throw L.warning(o),new Error(o)}},getSkuTableRef:()=>J.value}),(o,c)=>{const e=ee,n=le,s=ae,k=te,b=re;return u(),V(v,null,[g.isDetail||g.isActivityComponent?w("",!0):(u(),f(h(S),{key:0,data:g.isBatch?h(U):h(m).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(de),{modelValue:l.picUrl,"onUpdate:modelValue":r=>l.picUrl=r,height:"50px",width:"50px"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),h(m).specType&&!g.isBatch?(u(!0),V(v,{key:0},F(h(P),(l,r)=>(u(),f(e,{key:r,label:l.label,align:"center","min-width":"120"},{default:i(({row:_})=>{var C;return[N("span",z,d((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(n,{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?(u(),f(s,{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"])):(u(),f(s,{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(s,{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(s,{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:"\u63A8\u5E7F\u8D39","min-width":"168"},{default:i(({row:l})=>[t(s,{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(s,{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(s,{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(s,{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(n,{modelValue:l.mark,"onUpdate:modelValue":r=>l.mark=r,class:"w-100%"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),h(m).subCommissionType?(u(),V(v,{key:1},[t(e,{align:"center",label:"\u4E00\u7EA7\u8FD4\u4F63(\u5143)","min-width":"168"},{default:i(({row:l})=>[t(s,{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(s,{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(m))!=null&&a.specType?(u(),f(e,{key:2,align:"center",fixed:"right",label:"\u64CD\u4F5C",width:"80"},{default:i(({row:l})=>[g.isBatch?(u(),f(k,{key:0,link:"",size:"small",type:"primary",onClick:H},{default:i(()=>[p(" \u6279\u91CF\u6DFB\u52A0 ")]),_:1})):(u(),f(k,{key:1,link:"",size:"small",type:"primary",onClick:r=>(_=>{const C=m.value.skus.findIndex(Q=>JSON.stringify(Q.properties)===JSON.stringify(_.properties));m.value.skus.splice(C,1)})(l)},{default:i(()=>[p("\u5220\u9664")]),_:2},1032,["onClick"]))]),_:1})):w("",!0)]}),_:1},8,["data"])),g.isDetail?(u(),f(h(S),{key:1,ref_key:"activitySkuListRef",ref:J,data:h(m).skus,border:"","max-height":"500",size:"small",style:{width:"99%"},onSelectionChange:M},{default:i(()=>[g.isComponent?(u(),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?(u(),f(b,{key:0,src:a.picUrl,class:"h-50px w-50px",onClick:l=>T(a.picUrl)},null,8,["src","onClick"])):w("",!0)]),_:1}),h(m).specType&&!g.isBatch?(u(!0),V(v,{key:1},F(h(P),(a,l)=>(u(),f(e,{key:l,label:a.label,align:"center","min-width":"80"},{default:i(({row:r})=>{var _;return[N("span",A,d((_=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(d(a.barCode),1)]),_:1}),t(e,{align:"center",label:"\u9500\u552E\u4EF7(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.price),1)]),_:1}),t(e,{align:"center",label:"\u5E02\u573A\u4EF7(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.marketPrice),1)]),_:1}),t(e,{align:"center",label:"\u6210\u672C\u4EF7(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.costPrice),1)]),_:1}),t(e,{align:"center",label:"\u63A8\u5E7F\u8D39(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.promotionFee),1)]),_:1}),t(e,{align:"center",label:"\u5E93\u5B58","min-width":"80"},{default:i(({row:a})=>[p(d(a.stock),1)]),_:1}),t(e,{align:"center",label:"\u91CD\u91CF(kg)","min-width":"80"},{default:i(({row:a})=>[p(d(a.weight),1)]),_:1}),t(e,{align:"center",label:"\u4F53\u79EF(m^3)","min-width":"80"},{default:i(({row:a})=>[p(d(a.volume),1)]),_:1}),t(e,{align:"center",label:"\u5907\u6CE8","min-width":"100"},{default:i(({row:a})=>[p(d(a.mark),1)]),_:1}),h(m).subCommissionType?(u(),V(v,{key:2},[t(e,{align:"center",label:"\u4E00\u7EA7\u8FD4\u4F63(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.firstBrokeragePrice),1)]),_:1}),t(e,{align:"center",label:"\u4E8C\u7EA7\u8FD4\u4F63(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.secondBrokeragePrice),1)]),_:1})],64)):w("",!0)]),_:1},8,["data"])):w("",!0),g.isActivityComponent?(u(),f(h(S),{key:2,data:h(m).skus,border:"","max-height":"500",size:"small",style:{width:"99%"}},{default:i(()=>[g.isComponent?(u(),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=>T(a.picUrl)},null,8,["src","onClick"])]),_:1}),h(m).specType?(u(!0),V(v,{key:1},F(h(P),(a,l)=>(u(),f(e,{key:l,label:a.label,align:"center","min-width":"80"},{default:i(({row:r})=>{var _;return[N("span",E,d((_=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(d(a.barCode),1)]),_:1}),t(e,{align:"center",label:"\u9500\u552E\u4EF7(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.price),1)]),_:1}),t(e,{align:"center",label:"\u5E02\u573A\u4EF7(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.marketPrice),1)]),_:1}),t(e,{align:"center",label:"\u6210\u672C\u4EF7(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.costPrice),1)]),_:1}),t(e,{align:"center",label:"\u63A8\u5E7F\u8D39(\u5143)","min-width":"80"},{default:i(({row:a})=>[p(d(a.promotionFee),1)]),_:1}),t(e,{align:"center",label:"\u5E93\u5B58","min-width":"80"},{default:i(({row:a})=>[p(d(a.stock),1)]),_:1}),t(e,{align:"center",label:"\u5907\u6CE8","min-width":"100"},{default:i(({row:a})=>[p(d(a.mark),1)]),_:1}),Y(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{_e as __tla,$ as default};
|