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