4 lines
11 KiB
JavaScript
4 lines
11 KiB
JavaScript
import{a4 as X,G as Y,H as ee,k as ue,D as le,C as ae,w as te,M as oe,b as re,N as se,F as ie,I as pe,L as de}from"./element-plus.e226cbd2.js";import{a as ne,b as me,c as _e,_ as ce}from"./store_product.b5655c31.js";import{_ as fe}from"./picker.a0f07b9c.js";import{w as Fe}from"./index.bcc0f007.js";import{d as L,s as be,r as F,Z as q,i as Ee,ap as ge,o as b,K as E,L as o,a as B,S,u as a,U as u,R as d,Q as h,M as Be,j as Ve}from"./@vue.18505fe0.js";import"./lodash.60201f64.js";import{a as Ce,u as ve}from"./vue-router.101084e3.js";import{a as we}from"./store_category.896a2553.js";import{a as ye}from"./store_product_unit.26535b58.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.8ae0c638.js";import"./axios.2b8d80bd.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.11f62324.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.327e6c47.js";import"./system_store.b3607d4d.js";import"./index.c6f2e1d0.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.63767521.js";import"./index.e9d89a03.js";import"./vuedraggable.d1fd737a.js";import"./vue.feef8fd6.js";import"./sortablejs.c8f4cbb7.js";import"./pinia.a969beab.js";import"./css-color-function.b82a2ce7.js";import"./color.b905eb26.js";import"./clone.e1fb2883.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.495afef3.js";import"./vue-clipboard3.cb649e18.js";import"./clipboard.4592e390.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"},Ue=L({name:"storeProductEdit"}),Du=L({...Ue,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(ke,{emit:Ae}){const x=be(),{removeTab:R}=Fe(),m=F("add"),l=q({id:"",image:"",store_name:"",bar_code:"",cate_arr:[],cate_id:"",price:"",vip_price:"",unit:"",stock:"",swap:"",cost:"",purchase:"1",batch:"",manufacturer_information:"",rose:"0",is_return:1,is_store_all:1}),z=()=>{const e=l.bar_code.replace(/[^a-zA-Z0-9]/g,"");l.bar_code=e},f=F(!1),_=F([]),I=r=>{_.value=_.value.filter(e=>e.id!==r)},N=r=>{r.forEach(e=>{_.value.find(p=>p.id==e.id)||_.value.push(e)}),f.value=!1};let V,C,v=F(!1),w;Ee(()=>{});const P=r=>(w=r,v.value=!0,U.lazyLoad(C,V),!1),U={value:"id",label:"name",lazy:!0,lazyLoad(r,e){V||(V=e),C||(C=r);let p=r.value||0,s={};v.value?(s={name:w},w||(s={pid:p,page_size:1e4})):s={pid:p,page_size:1e4},we({...s}).then(i=>{e(i.lists.map(c=>(c.leaf=c.is_children==0,v.value=!1,c)))})}},k=F([]);(()=>{ye({}).then(r=>{k.value=r.lists})})();const M=q({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",trigger:["blur"]}],bar_code:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",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"]}]}),T=async r=>{for(const e in l)r[e]!=null&&r[e]!=null&&(l[e]=r[e]);l.cate_arr[0]&&(l.cate_arr=l.cate_arr.map(e=>Number(e)))},$=async r=>{const e=await ne({id:r.id});T(e)},j=Ce(),y=ve(),G=async()=>{var e;await((e=x.value)==null?void 0:e.validate());let r={...l};if(l.is_store_all==0&&m.value=="add"?r.store_arr=_.value.map(p=>p.id):m.value=="edit"&&(r.is_store_all=0),!r.cate_arr.length)return ue.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");r.cate_id=r.cate_arr[r.cate_arr.length-1],delete r.cate_arr,m.value=="edit"?await me(r):await _e(r),R(),j.push({path:"/store/store_product"})};return y.query.id&&y.query.mode=="edit"&&(m.value="edit",$({id:y.query.id})),(r,e)=>{const p=fe,s=le,i=ae,c=X,g=Y,A=ee,D=te,n=oe,O=re,Z=se,H=ie,K=ce,Q=pe,J=de,W=ge("perms");return b(),E(J,null,{default:o(()=>[B("div",De,S(a(m)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),B("div",null,[u(H,{ref_key:"formRef",ref:x,model:a(l),"label-width":"120px",rules:a(M)},{default:o(()=>[u(s,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:o(()=>[u(p,{modelValue:a(l).image,"onUpdate:modelValue":e[0]||(e[0]=t=>a(l).image=t),limit:1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:o(()=>[u(i,{modelValue:a(l).store_name,"onUpdate:modelValue":e[1]||(e[1]=t=>a(l).store_name=t),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:o(()=>[u(i,{modelValue:a(l).bar_code,"onUpdate:modelValue":e[2]||(e[2]=t=>a(l).bar_code=t),class:"w-[500px]",onInput:z,clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:o(()=>[u(c,{class:"w-[500px]",modelValue:a(l).cate_arr,"onUpdate:modelValue":e[3]||(e[3]=t=>a(l).cate_arr=t),filterable:"",clearable:"","before-filter":P,props:U,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:o(()=>[u(c,{class:"w-[500px]",modelValue:a(l).unit,"onUpdate:modelValue":e[4]||(e[4]=t=>a(l).unit=t),options:a(k),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(s,{label:"\u552E\u5356\u5E93\u5B58",prop:"stock"},{default:o(()=>[u(i,{modelValue:a(l).stock,"onUpdate:modelValue":e[5]||(e[5]=t=>a(l).stock=t),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5E93\u5B58",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5151\u6362\u5E93\u5B58",prop:"swap"},{default:o(()=>[u(i,{modelValue:a(l).swap,"onUpdate:modelValue":e[6]||(e[6]=t=>a(l).swap=t),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5E93\u5B58",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:o(()=>[u(i,{modelValue:a(l).purchase,"onUpdate:modelValue":e[7]||(e[7]=t=>a(l).purchase=t),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:o(()=>[u(i,{modelValue:a(l).cost,"onUpdate:modelValue":e[8]||(e[8]=t=>a(l).cost=t),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:o(()=>[u(i,{modelValue:a(l).vip_price,"onUpdate:modelValue":e[9]||(e[9]=t=>a(l).vip_price=t),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:o(()=>[u(i,{modelValue:a(l).price,"onUpdate:modelValue":e[10]||(e[10]=t=>a(l).price=t),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:o(()=>[u(i,{modelValue:a(l).batch,"onUpdate:modelValue":e[11]||(e[11]=t=>a(l).batch=t),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5382\u5BB6\u5907\u6CE8",prop:"manufacturer_information"},{default:o(()=>[u(i,{modelValue:a(l).manufacturer_information,"onUpdate:modelValue":e[12]||(e[12]=t=>a(l).manufacturer_information=t),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(s,{label:"\u9000\u8D27",prop:"is_return"},{default:o(()=>[u(A,{modelValue:a(l).is_return,"onUpdate:modelValue":e[13]||(e[13]=t=>a(l).is_return=t)},{default:o(()=>[u(g,{label:1},{default:o(()=>[d("\u652F\u6301")]),_:1}),u(g,{label:0},{default:o(()=>[d("\u4E0D\u652F\u6301")]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(m)=="add"?(b(),E(s,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:o(()=>[u(A,{modelValue:a(l).is_store_all,"onUpdate:modelValue":e[14]||(e[14]=t=>a(l).is_store_all=t)},{default:o(()=>[u(g,{label:1},{default:o(()=>[d("\u5168\u90E8\u95E8\u5E97")]),_:1}),u(g,{label:0},{default:o(()=>[d("\u90E8\u5206\u95E8\u5E97")]),_:1})]),_:1},8,["modelValue"]),he,B("div",xe,[a(l).is_store_all==0?(b(),E(D,{key:0,type:"primary",onClick:e[15]||(e[15]=t=>f.value=!0)},{default:o(()=>[d("\u6DFB\u52A0\u95E8\u5E97")]),_:1})):h("",!0)]),a(l).is_store_all==0?(b(),E(Z,{key:0,data:a(_)},{default:o(()=>[u(n,{label:"ID",prop:"id","show-overflow-tooltip":""}),u(n,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),u(n,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),u(n,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),u(n,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:o(({row:t})=>[u(O,{src:t.image,class:"w-[50px] h-[50px]","preview-teleported":!0},null,8,["src"])]),_:1}),u(n,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:o(({row:t})=>[d(S(t.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),u(n,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:o(({row:t})=>[Be((b(),E(D,{type:"danger",link:"",onClick:Se=>I(t.id)},{default:o(()=>[d(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[W,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):h("",!0)]),_:1})):h("",!0),u(s,{label:""},{default:o(()=>[u(D,{onClick:G,type:"primary",class:"w-40"},{default:o(()=>[d("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model","rules"])]),u(Q,{modelValue:a(f),"onUpdate:modelValue":e[16]||(e[16]=t=>Ve(f)?f.value=t:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:o(()=>[u(K,{onOnBindStore:N})]),_:1},8,["modelValue"])]),_:1})}}});export{Du as default};
|