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