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,{default:a(()=>[k("div",We,T(t(E)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),k("div",null,[u(de,{ref_key:"formRef",ref:z,model:t(s),"label-width":"120px",rules:t(Q)},{default:a(()=>[u(se,{modelValue:t(U),"onUpdate:modelValue":e[17]||(e[17]=l=>O(U)?U.value=l:null),class:"demo-tabs",onTabClick:j},{default:a(()=>[u(h,{label:"\u57FA\u7840\u4FE1\u606F",name:"info"},{default:a(()=>[u(r,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:a(()=>[u(F,{modelValue:t(s).image,"onUpdate:modelValue":e[0]||(e[0]=l=>t(s).image=l),limit:1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:a(()=>[u(m,{modelValue:t(s).store_name,"onUpdate:modelValue":e[1]||(e[1]=l=>t(s).store_name=l),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:a(()=>[u(g,{modelValue:t(s).product_type,"onUpdate:modelValue":e[2]||(e[2]=l=>t(s).product_type=l),disabled:t(E)!="add"},{default:a(()=>[u(p,{label:0},{default:a(()=>e[19]||(e[19]=[n("\u666E\u901A\u4EA7\u54C1")])),_:1}),u(p,{label:1},{default:a(()=>e[20]||(e[20]=[n("\u4F9B\u9500\u7CFB\u5217\u4EA7\u54C1")])),_:1}),u(p,{label:2},{default:a(()=>e[21]||(e[21]=[n("\u5151\u6362\u4EA7\u54C1")])),_:1}),u(p,{label:3},{default:a(()=>e[22]||(e[22]=[n("\u8D60\u54C1")])),_:1})]),_:1},8,["modelValue","disabled"])]),_:1}),u(r,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:a(()=>[u($,{class:"w-[500px]",modelValue:t(s).cate_arr,"onUpdate:modelValue":e[3]||(e[3]=l=>t(s).cate_arr=l),filterable:"",clearable:"","before-filter":K,props:N,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5382\u5BB6\u5907\u6CE8",prop:"manufacturer_information"},{default:a(()=>[u(m,{modelValue:t(s).manufacturer_information,"onUpdate:modelValue":e[4]||(e[4]=l=>t(s).manufacturer_information=l),type:"textarea",autosize:"",class:"w-[500px]",clearable:"",placeholder:`\u5382\u5BB6\u540D\u79F0
|
|
\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","onUpdate:modelValue"])):(i(),x("span",je,T(D.row[l.prop]),1))]),_:2},1032,["prop","label","width"]))),128)),u(_,{label:"\u64CD\u4F5C",width:"100"},{default:a(l=>[u(w,{type:"text",onClick:c=>Y(l.$index)},{default:a(()=>e[28]||(e[28]=[n("\u5220\u9664")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})):V("",!0)]),_:1}),u(h,{label:"\u9002\u7528\u95E8\u5E97",name:"store"},{default:a(()=>[t(E)=="add"?(i(),b(r,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:a(()=>[u(g,{modelValue:t(s).is_store_all,"onUpdate:modelValue":e[15]||(e[15]=l=>t(s).is_store_all=l)},{default:a(()=>[u(p,{label:1},{default:a(()=>e[29]||(e[29]=[n("\u5168\u90E8\u95E8\u5E97")])),_:1}),u(p,{label:0},{default:a(()=>e[30]||(e[30]=[n("\u90E8\u5206\u95E8\u5E97")])),_:1})]),_:1},8,["modelValue"]),e[33]||(e[33]=k("div",{class:"w-full",style:{color:"#64748b"}}," \u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528 ",-1)),k("div",Je,[t(s).is_store_all==0?(i(),b(w,{key:0,type:"primary",onClick:e[16]||(e[16]=l=>y.value=!0)},{default:a(()=>e[31]||(e[31]=[n("\u6DFB\u52A0\u95E8\u5E97")])),_:1})):V("",!0)]),t(s).is_store_all==0?(i(),b(I,{key:0,data:t(C)},{default:a(()=>[u(_,{label:"ID",prop:"id","show-overflow-tooltip":""}),u(_,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),u(_,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),u(_,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),u(_,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:a(({row:l})=>[u(re,{src:l.image,class:"w-[50px] h-[50px]","preview-teleported":!0},null,8,["src"])]),_:1}),u(_,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:a(({row:l})=>[n(T(l.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),u(_,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:a(({row:l})=>[Be((i(),b(w,{type:"danger",link:"",onClick:c=>Z(l.id)},{default:a(()=>e[32]||(e[32]=[n(" \u5220\u9664 ")])),_:2},1032,["onClick"])),[[me,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):V("",!0)]),_:1})):V("",!0)]),_:1})]),_:1},8,["modelValue"]),u(r,{label:""},{default:a(()=>[u(w,{onClick:ae,type:"primary",class:"w-40"},{default:a(()=>e[34]||(e[34]=[n("\u63D0\u4EA4")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),u(pe,{modelValue:t(y),"onUpdate:modelValue":e[18]||(e[18]=l=>O(y)?y.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:a(()=>[u(ne,{onOnBindStore:H})]),_:1},8,["modelValue"])]),_:1})}}});export{Fu as default};
|