cashier-mer/build/assets/index-O9aMn1kT.js

2 lines
29 KiB
JavaScript
Raw Normal View History

2024-07-02 13:49:36 +08:00
import{r as d,B as De,b as h,c as i,k as b,f as l,w as s,g as p,F as G,l as le,d as R,E as P,_ as ye,u as he,o as ge,m as E,a as be,h as fe,e,i as Re,j as ke,z as X,t as k,p as Z,q as $e,s as Ve,G as Oe,n as ce,D as je,J as Ie}from"./index-DNPYm-1T.js";import{a as we,b as Pe,c as Ee,u as Ne,d as Fe,e as Be,f as qe,g as Te,h as Je,i as Ke,j as Me}from"./user-DH5E0et8.js";import"./moment-Cl4UOzQZ.js";import{r as ue}from"./axiosAPI-CWnjWYA_.js";import{f as We}from"./store-BZ5tmM3p.js";import{p as Ge}from"./padding-DdWIh3sw.js";function Ce(V){return ue.get("/city",{params:V})}function xe(V){return ue.get("/area",{params:V})}function Se(V){return ue.get("/street",{params:V})}function Ue(V){return ue.get("/village",{params:V})}function Le(V){return ue.get("/brigade",{params:V})}const He={class:"add-user"},Qe={__name:"add",emits:["close"],setup(V,{expose:o,emit:r}){const w=d(null),m=De({mobile:"",code:"",real_name:"",user_ship:"",selectedValues:[]}),U=De({mobile:[{required:!0,message:"请输入手机号",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"请输入正确的手机号",trigger:"blur"}],code:[{required:!0,message:"请输入验证码",trigger:"blur"}],real_name:[{required:!0,message:"请输入用户姓名",trigger:"blur"}],user_ship:[{required:!0,message:"请选择用户类型",trigger:"change"}],selectedValues:[{required:!0,message:"请选择用户地址",trigger:"change"}]}),A=d([]),N=async(D,g)=>{const $=D.level;let c;if($!==0&&!D.data.code)return g([]);$===0?(c=await Ce({province_code:51e4}),c=c.data.map(L=>({code:L.city_code,name:L.city_name}))):$===1?(c=await xe({city_code:D.data.code}),c=c.data.map(L=>({code:L.area_code,name:L.area_name}))):$===2?(c=await Se({area_code:D.data.code}),c=c.data.map(L=>({code:L.street_code,name:L.street_name}))):$===3?(c=await Ue({street_code:D.data.code}),c=c.data.map(L=>({code:L.village_code,name:L.village_name}))):$===4&&(c=await Le({village_code:D.data.code}),c=c.data.map(L=>({code:L.id,name:L.brigade_name,leaf:!0}))),g(c)},B={value:"code",label:"name",children:"children",multiple:!1,lazy:!0,lazyLoad:N},q=d([]);(()=>{we().then(D=>{q.value=D.data.lists})})();const J=r,M=()=>{w.value.validate(async D=>{if(D){let g={};g.mobile=m.mobile,g.code=m.code,g.user_ship=m.user_ship,g.real_name=m.real_name,g.province="510000",g.city=m.selectedValues[0],g.area=m.selectedValues[1],g.street=m.selectedValues[2],g.village=m.selectedValues[3],g.brigade=m.selectedValues[4],Pe(g).then($=>{J("close")})}})},se=()=>{w.value.validateField("mobile",D=>{D&&Ee({mobile:m.mobile}).then(g=>{P.success("发送成功")}).catch(g=>{P.error("发送失败")})})};return o({addUser:M}),(D,g)=>{const $=h("el-input"),c=h("el-form-item"),L=h("el-button"),Y=h("el-option"),ae=h("el-select"),ee=h("el-cascader"),C=h("el-form");return i(),b("div",He,[l(C,{model:m,rules:U,ref_key:"formDataRef",ref:w,"label-width":"80px"},{default:s(()=>[l(c,{label:"用户电话",prop:"mobile"},{default:s(()=>[l($,{modelValue:m.mobile,"onUpdate:modelValue":g[0]||(g[0]=a=>m.mobile=a),placeholder:"请输入用户电话"},null,8,["modelValue"])]),_:1}),l(c,{label:"验证码",prop:"code"},{default:s(()=>[l($,{modelValue:m.code,"onUpdate:modelValue":g[1]||(g[1]=a=>m.code=a),placeholder:"请输入验证码",style:{flex:"1"}},null,8,["modelValue"]),l(L,{type:"primary",style:{"margin-left":"1rem"},onClick:se},{default:s(()=>[p("获取验证码")]),_:1})]),_:1}),l(c,{label:"用户姓名",prop:"real_name"},{default:s(()=>[l($,{modelValue:m.real_name,"onUpdate:modelValue":g[2]||(g[2]=a=>m.real_name=a),placeholder:"请输入用户姓名"},null,8,["modelValue"])]),_:1}),l(c,{label:"用户类型",prop:"user_ship"},{default:s(()=>[l(ae,{modelValue:m.user_ship,"onUpdate:modelValue":g[3]||(g[3]=a=>m.user_ship=a),placeholder:"请选择用户类型",style:{width:"100%"}},{default:s(()=>[(i(!0),b(G,null,le(q.value,a=>(i(),R(Y,{key:a.id,label:a.title,value:a.id,disabled:a.id==1},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(c,{label:"用户地址",prop:"selectedValues"},{default:s(()=>[l(ee,{style:{width:"100%"},modelValue: