4 lines
13 KiB
JavaScript
4 lines
13 KiB
JavaScript
|
import{m as W,s as fe,r as f,aT as M,b as be,af as Fe,_ as ce,aZ as Ee,a_ as Ce,bE as Ve,ag as ye,ah as we,b2 as ve,p as i,y as b,v as a,x as k,G as T,u as t,t as u,i as O,a2 as n,q as x,V as P,A as V,W as G,L as Be,a3 as ge,aX as De,aW as ke,ae as xe,b3 as Ue,b4 as Ae,b6 as qe,b7 as Re,J as Se,aY as Le,b0 as he,b5 as Te}from"./.pnpm.1b0299fb.js";import{_ as Pe}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.7ac2f365.js";import{_ as ze}from"./picker.0aa9b690.js";import{k as Ne}from"./index.689cfa31.js";import{b as $e,d as Ie,e as Me}from"./store_product.90b19113.js";import"./lodash.c3b66c05.js";import{a as Oe}from"./store_category.e6dcae92.js";import{a as Ge}from"./store_product_unit.a4bcfa14.js";import"./index.vue_vue_type_script_setup_true_lang.b077f234.js";import"./usePaging.00aa976d.js";import"./useDictOptions.e9843f63.js";import"./system_store.e6c50bcf.js";import"./index.6c48d0ba.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.abac7546.js";import"./index.49d8d118.js";import"./index.05c22055.js";import"./@vueuse.72d44d91.js";import"./@vue.9d708d7c.js";const We={class:"mb-4 text-lg font-bold"},je={key:1},Je={class:"mb-2"},Xe=W({name:"storeProductEdit"}),Fu=W({...Xe,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Ye,{emit:Ze}){const z=fe(),U=f("info");Ne();const E=f("add"),j=(o,e)=>{console.log(o,e)},v=f([]),d=f([]),J=f([{label:"\u89C4\u683C\u540D\u79F0",prop:"sku_name",width:"180"},{label:"\u4F9B\u8D27\u4EF7",prop:"purchase",width:"180"},{label:"\u5546\u6237\u4EF7",prop:"cost",width:"180"},{label:"\u96F6\u552E\u4EF7",prop:"price",width:"180"},{label:"\u6761\u7801",prop:"bar_code",width:"180"}]),X=()=>{v.value.push({sku_name:"",purchase:0,cost:0,price:0,bar_code:"",editable:!0})},Y=o=>{v.value.splice(o,1)},s=M({id:"",image:"",store_name:"",store_info:"",product_type:0,cate_arr:[],cate_id:"",swap:"",batch:1,store_batch:1,manufacturer_information:"",rose:"0",is_return:1,is_store_all:1,spec_type:0}),y=f(!1),C=f([]),Z=o=>{C.value=C.value.filter(e=>e.id!==o)},H=o=>{o.forEach(e=>{C.value.find(F=>F.id==e.id)||C.value.push(e)}),y.value=!1};let A,q;const R=f(!1);let S;be(()=>{});const K=o=>(S=o,R.value=!0,N.lazyLoad(q,A),!1),N={value:"id",label:"name",lazy:!0,lazyLoad(o,e){A||(A=e),q||(q=o);const F=o.value||0;let r={};R.value?(r={name:S},S||(r={pid:F,page_size:1e4})):r={pid:F,page_size:1e4},Oe({...r}).then(m=>{e(m.lists.map(p=>(p.leaf=p.is_children==0,R.value=!1,p)))})}},L=f([]);(()=>{Ge({}).then(o=>{L.value=o.lists})})();const Q=M({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",trigger:["blur"]}],store_info:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u89C4\u683C",trigger:["blur"]}],cate_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],cate_arr:[{required:!0,message:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),ee=async o=>{for(const e in s)o[e]!=null&&o[e]!=null&&(s[e]=o[e]);s.cate_arr[0]&&(s.cate_arr=s.cate_arr.map(e=>Number(e)))},ue=async o=>{const e=await $e({id:o.id});ee(e)},le=Fe(),B=ce(),ae=async()=>{var F;await((F=z.value)==null?void 0:F.validate());const o={...s};if(s.is_store_all==0&&E.value=="add"?o.store_arr=C.value.map(r=>r.id):E.value=="edit"&&(o.is_store_all=0),!o.cate_arr.length)return ge.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");o.cate_id=o.cate_arr[o.cate_arr.length-1],delete o.cate_arr;const e=f([]);s.spec_type==0?e.value=d.value:e.value=v.value.map(r=>({sku_name:r.sku_name,unit:r.unit,purchase:r.purchase,cost:r.cost,price:r.price,bar_code:r.bar_code})),o.product_arr=e.value,E.value=="edit"?await Ie(o):await Me(o),le.push({path:"/store/store_product?=",query:{page_no:B.query.page}})};return B.query.id&&B.query.mode=="edit"&&(E.value="edit",ue({id:B.query.id})),(o,e)=>{const F=ze,r=De,m=ke,p=Ee,g=Ce,$=Ve,h=ye,w=xe,te=Ue,oe=Ae,_=qe,I=Re,re=Se,se=we,de=Le,ne=Pe,pe=he,ie=Te,me=ve("perms");return i(),b(ie,null,{def
|
||
|
\u8054\u7CFB\u4EBA\u59D3\u540D
|
||
|
\u8054\u7CFB\u7535\u8BDD`,readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u9000\u8D27",prop:"is_return"},{default:a(()=>[u(g,{modelValue:t(s).is_return,"onUpdate:modelValue":e[5]||(e[5]=l=>t(s).is_return=l)},{default:a(()=>[u(p,{label:1},{default:a(()=>e[23]||(e[23]=[n("\u652F\u6301")])),_:1}),u(p,{label:0},{default:a(()=>e[24]||(e[24]=[n("\u4E0D\u652F\u6301")])),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),u(h,{label:"\u5546\u54C1\u89C4\u683C",name:"spec"},{default:a(()=>[u(r,{label:"\u89C4\u683C\u7C7B\u578B"},{default:a(()=>[u(g,{modelValue:t(s).spec_type,"onUpdate:modelValue":e[6]||(e[6]=l=>t(s).spec_type=l)},{default:a(()=>[u(p,{label:0},{default:a(()=>e[25]||(e[25]=[n("\u5355\u89C4\u683C")])),_:1}),u(p,{label:1},{default:a(()=>e[26]||(e[26]=[n("\u591A\u89C4\u683C")])),_:1})]),_:1},8,["modelValue"])]),_:1}),t(s).spec_type==0?(i(),x(P,{key:0},[u(r,{label:"\u89C4\u683C\u540D\u79F0",prop:"sku_name"},{default:a(()=>[u(m,{modelValue:t(d).sku_name,"onUpdate:modelValue":e[7]||(e[7]=l=>t(d).sku_name=l),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u89C4\u683C\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:a(()=>[u($,{class:"w-[500px]",modelValue:t(d).unit,"onUpdate:modelValue":e[8]||(e[8]=l=>t(d).unit=l),options:t(L),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(r,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:a(()=>[u(m,{modelValue:t(d).purchase,"onUpdate:modelValue":e[9]||(e[9]=l=>t(d).purchase=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:a(()=>[u(m,{modelValue:t(d).cost,"onUpdate:modelValue":e[10]||(e[10]=l=>t(d).cost=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price"},{default:a(()=>[u(m,{modelValue:t(d).vip_price,"onUpdate:modelValue":e[11]||(e[11]=l=>t(d).vip_price=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price"},{default:a(()=>[u(m,{modelValue:t(d).price,"onUpdate:modelValue":e[12]||(e[12]=l=>t(d).price=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u96F6\u552E\u8D77\u6279\u91CF",prop:"batch"},{default:a(()=>[u(m,{modelValue:t(d).batch,"onUpdate:modelValue":e[13]||(e[13]=l=>t(d).batch=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u96F6\u552E\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u95E8\u5E97\u8D77\u6279\u91CF",prop:"store_batch"},{default:a(()=>[u(m,{modelValue:t(d).store_batch,"onUpdate:modelValue":e[14]||(e[14]=l=>t(d).store_batch=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u95E8\u5E97\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1})],64)):V("",!0),t(s).spec_type==1?(i(),b(r,{key:1},{default:a(()=>[u(w,{onClick:X,class:"mb-2"},{default:a(()=>e[27]||(e[27]=[n("\u6DFB\u52A0\u89C4\u683C")])),_:1}),u(I,{data:t(v),style:{width:"100%"}},{default:a(()=>[u(_,{label:"\u5355\u4F4D",width:"180"},{default:a(l=>[l.row.editable?(i(),b(oe,{key:0,modelValue:l.row.unit,"onUpdate:modelValue":c=>l.row.unit=c,placeholder:"\u8BF7\u9009\u62E9\u5355\u4F4D"},{default:a(()=>[(i(!0),x(P,null,G(t(L),c=>(i(),b(te,{key:c.id,label:c.name,value:c.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V("",!0)]),_:1}),(i(!0),x(P,null,G(t(J),(l,c)=>(i(),b(_,{key:c,prop:l.prop,label:l.label,width:l.width},{default:a(D=>[D.row.editable?(i(),b(m,{key:0,modelValue:D.row[l.prop],"onUpdate:modelValue":_e=>D.row[l.prop]=_e},null,8,["modelValue","o
|