2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
import{G as W,H as X,a8 as Y,k as ee,D as ue,C as le,v as ae,w as te,M as oe,b as re,N as se,F as ie,I as de,L as pe}from"./element-plus.7e347b00.js";import{_ as ne}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.4241ccf2.js";import{_ as me}from"./picker.796abf78.js";import{k as _e}from"./index.9f7dd589.js";import{b as ce,d as fe,e as be}from"./store_product.156e9d4e.js";import{d as L,s as Fe,r as b,Z as q,i as Ee,ap as ge,o as F,K as E,L as l,a as B,S,u as t,U as u,R as i,Q as h,M as Ce,j as Be}from"./@vue.18505fe0.js";import"./lodash.4e6d2a38.js";import{a as Ve,u as ve}from"./vue-router.101084e3.js";import{a as ye}from"./store_category.0ba4d678.js";import{a as we}from"./store_product_unit.49122246.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.0112e2c7.js";import"./@babel.80d29b7b.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.af250dfd.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.1aadc464.js";import"./system_store.4cdaab00.js";import"./index.b7edee13.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.a9aa2915.js";import"./index.bf0442a0.js";import"./vuedraggable.c5026861.js";import"./vue.1715f83d.js";import"./sortablejs.c62bcaf8.js";import"./axios.cffda5ac.js";import"./jspdf.6c61b9d3.js";import"./fflate.0418c72f.js";import"./pinia.a969beab.js";import"./css-color-function.bb8c34b2.js";import"./color.fbd63fe8.js";import"./clone.31a3aa2c.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.b502f541.js";import"./vue-clipboard3.e775fc74.js";import"./clipboard.6417898a.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const De={class:"mb-4 text-lg font-bold"},he=B("div",{class:"w-full",style:{color:"#64748b"}},"\u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528",-1),xe={class:"mb-2"},Ae=L({name:"storeProductEdit"}),Uu=L({...Ae,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Ue,{emit:ke}){const x=Fe();_e();const m=b("add"),a=q({id:"",image:"",store_name:"",bar_code:"",store_info:"",product_type:0,cate_arr:[],cate_id:"",price:"",vip_price:"",unit:"",stock:"",swap:"",cost:"",purchase:"",batch:1,store_batch:1,manufacturer_information:"",rose:"0",is_return:1,is_store_all:1,is_show:1}),f=b(!1),c=b([]),R=r=>{c.value=c.value.filter(e=>e.id!==r)},N=r=>{r.forEach(e=>{c.value.find(n=>n.id==e.id)||c.value.push(e)}),f.value=!1};let V,v;const y=b(!1);let w;Ee(()=>{});const I=r=>(w=r,y.value=!0,A.lazyLoad(v,V),!1),A={value:"id",label:"name",lazy:!0,lazyLoad(r,e){V||(V=e),v||(v=r);const n=r.value||0;let s={};y.value?(s={name:w},w||(s={pid:n,page_size:1e4})):s={pid:n,page_size:1e4},ye({...s}).then(p=>{e(p.lists.map(d=>(d.leaf=d.is_children==0,y.value=!1,d)))})}},U=b([]);(()=>{we({}).then(r=>{U.value=r.lists})})();const P=q({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",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"]}],price:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",trigger:["blur"]}],vip_price:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",trigger:["blur"]}],unit:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5355\u4F4D",trigger:["blur","change"]}],stock:[{required:!0,message:"\u8BF7\u8F93\u5165\u552E\u5356\u5E93\u5B58",trigger:["blur"]}],swap:[{required:!0,message:"\u8BF7\u8F93\u5165\u5151\u6362\u5E93\u5B58",trigger:["blur"]}],cost:[{required:!0,message:"\u8BF7\u8F93\u5165\u95E8\u5E97\u96F6\u552E",trigger:["blur"]}],purchase:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",trigger:["blur"]}],batch:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D77\u6279\u91CF",trigger:["blur"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),z=async r=>{for(const e in a)r[e]!=null&&r[e]!=null&&(a[e]=r[e]);a.cate_arr[0]&&(a.cate_arr=a.cate_arr.map(e=>Number(e)))},M=async r=>{const e=await ce({id:r.id});z(e)},T=Ve(),g=ve(),$=async()=>{var e;await((e=x.value)==null?void 0:e.validate());const r={...a};if(a.is_store_all==0&&m.value=="add"?r.store_arr=c.value.map(n=>n.id):m.value=="edit"&&(r.is_store_all=0),!r.cate_arr.length)return ee.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");r.cate_id=r.cate_arr[r.cate_arr.length-1],m.value=="edit"?await fe(r):await be(r),T.push({path:"/store/store_product?=",query:{page_no:g.query.page}})};return g.query.id&&g.query.mode=="edit"&&(m.value="edit",M({id:g.query.id})),(r,e)=>{const n=me,s=ue,p=le,d=W,C=X,k=Y,j=ae,D=te,_=oe,G=re,O=se,H=ie,K=ne,Q=de,Z=pe,J=ge("perms");return F(),E(Z,null,{default:l(()=>[B("div",De,S(t(m)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),B("div",null,[u(H,{ref_key:"formRef",ref:x,model:t(a),"label-width":"120px",rules:t(P)},{default:l(()=>[u(s,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:l(()=>[u(n,{modelValue:t(a).image,"onUpdate:modelValue":e[0]||(e[0]=o=>t(a).image=o),limit:1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:l(()=>[u(p,{modelValue:t(a).store_name,"onUpdate:modelValue":e[1]||(e[1]=o=>t(a).store_name=o),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u6761\u7801",prop:"bar_code"},{default:l(()=>[u(p,{modelValue:t(a).bar_code,"onUpdate:modelValue":e[2]||(e[2]=o=>t(a).bar_code=o),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u89C4\u683C",prop:"store_info"},{default:l(()=>[u(p,{modelValue:t(a).store_info,"onUpdate:modelValue":e[3]||(e[3]=o=>t(a).store_info=o),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u89C4\u683C",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:l(()=>[u(C,{modelValue:t(a).product_type,"onUpdate:modelValue":e[4]||(e[4]=o=>t(a).product_type=o),disabled:t(m)!="add"},{default:l(()=>[u(d,{label:0},{default:l(()=>[i("\u666E\u901A\u4EA7\u54C1")]),_:1}),u(d,{label:4},{default:l(()=>[i("\u6D3B\u52A8\u4EA7\u54C1")]),_:1}),u(d,{label:5},{default:l(()=>[i("\u6279\u53D1\u4EA7\u54C1")]),_:1}),u(d,{label:2},{default:l(()=>[i("\u5151\u6362\u4EA7\u54C1")]),_:1}),u(d,{label:3},{default:l(()=>[i("\u8D60\u54C1")]),_:1})]),_:1},8,["modelValue","disabled"])]),_:1}),u(s,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:l(()=>[u(k,{class:"w-[500px]",modelValue:t(a).cate_arr,"onUpdate:modelValue":e[5]||(e[5]=o=>t(a).cate_arr=o),filterable:"",clearable:"","before-filter":I,props:A,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:l(()=>[u(k,{class:"w-[500px]",modelValue:t(a).unit,"onUpdate:modelValue":e[6]||(e[6]=o=>t(a).unit=o),options:t(U),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(s,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:l(()=>[u(p,{modelValue:t(a).purchase,"onUpdate:modelValue":e[7]||(e[7]=o=>t(a).purchase=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:l(()=>[u(p,{modelValue:t(a).cost,"onUpdate:modelValue":e[8]||(e[8]=o=>t(a).cost=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price"},{default:l(()=>[u(p,{modelValue:t(a).vip_price,"onUpdate:modelValue":e[9]||(e[9]=o=>t(a).vip_price=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price"},{default:l(()=>[u(p,{modelValue:t(a).price,"onUpdate:modelValue":e[10]||(e[10]=o=>t(a).price=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u8D77\u6279\u91CF",prop:"batch"},{default:l(()=>[u(p,{modelValue:t(a).batch,"onUpdate:modelValue":e[11]||(e[11]=o=>t(a).batch=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u96F6\u552E\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u6BDB\u5229\u7387",prop:"rose"},{default:l(()=>[u(j,{modelValue:t(a).rose,"onUpdate:modelValue":e[12]||(e[12]=o=>t(a).rose=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6BDB\u5229\u7387",readonly:!1},{suffix:l(()=>[i("%")]),_:1},8,["modelValue"])]),_:1}),u(s,{label:"\u9000\u8D27",prop:"is_return"},{default:l(()=>[u(C,{modelValue:t(a).is_return,"onUpdate:modelValue":e[13]||(e[13]=o=>t(a).is_return=o)},{default:l(()=>[u(d,{label:1},{default:l(()=>[i("\u652F\u6301")]),_:1}),u(d,{label:0},{default:l(()=>[i("\u4E0D\u652F\u6301")]),_:1})]),_:1},8,["modelValue"])]),_:1}),u(s,{label:"\u72B6\u6001",prop:"is_show"},{default:l(()=>[u(C,{modelValue:t(a).is_show,"onUpdate:modelValue":e[14]||(e[14]=o=>t(a).is_show=o)},{default:l(()=>[u(d,{label:1},{default:l(()=>[i("\u4E0A\u67B6")]),_:1}),u(d,{label:0},{default:l(()=>[i("\u4E0B\u67B6")]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(m)=="add"?(F(),E(s,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:l(()=>[u(C,{modelValue:t(a).is_store_all,"onUpdate:modelValue":e[15]||(e[15]=o=>t(a).is_store_all=o)},{default:l(()=>[u(d,{label:1},{default:l(()=>[i("\u5168\u90E8\u95E8\u5E97")]),_:1}),u(d,{label:0},{default:l(()=>[i("\u90E8\u5206\u95E8\u5E97")]),_:1})]),_:1},8,["modelValue"]),he,B("div",xe,[t(a).is_store_all==0?(F(),E(D,{key:0,type:"primary",onClick:e[16]||(e[16]=o=>f.value=!0)},{default:l(()=>[i("\u6DFB\u52A0\u95E8\u5E97")]),_:1})):h("",!0)]),t(a).is_store_all==0?(F(),E(O,{key:0,data:t(c)},{default:l(()=>[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:l(({row:o})=>[u(G,{src:o.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:l(({row:o})=>[i(S(o.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),u(_,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:l(({row:o})=>[Ce((F(),E(D,{type:"danger",link:"",onClick:Se=>R(o.id)},{default:l(()=>[i(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[J,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):h("",!0)]),_:1})):h("",!0),u(s,{label:""},{default:l(()=>[u(D,{onClick:$,type:"primary",class:"w-40"},{default:l(()=>[i("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model","rules"])]),u(Q,{modelValue:t(f),"onUpdate:modelValue":e[17]||(e[17]=o=>Be(f)?f.value=o:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:l(()=>[u(K,{onOnBindStore:N})]),_:1},8,["modelValue"])]),_:1})}}});export{Uu as default};
|