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

2 lines
28 KiB
JavaScript
Raw Normal View History

2024-06-28 18:15:50 +08:00
import{u as pe,r,B as xe,b,c as o,k as g,f as i,w as u,g as y,F as M,l as se,d as z,E as F,_ as ye,o as he,m as I,a as ge,h as de,e,i as ze,j as ue,z as X,t as k,p as Q,q as be,s as ke,G as Ee,n as _e,D as Ne,J as Be}from"./index-DslPK7Nc.js";import{a as $e,b as qe,c as Te,u as Je,d as Ue,e as Ke,f as Me,g as We,h as Ge,i as He,j as Qe}from"./user-jp6MVT4O.js";import"./moment-Cl4UOzQZ.js";import{r as re}from"./axiosAPI-DYpcg3Yc.js";import{f as Xe,u as Ye,j as Ze}from"./store-BUqDvNxu.js";import{p as el}from"./padding-CQ0n6974.js";function Ae(V){return re.get("/city",{params:V})}function Le(V){return re.get("/area",{params:V})}function De(V){return re.get("/street",{params:V})}function Pe(V){return re.get("/village",{params:V})}function Fe(V){return re.get("/brigade",{params:V})}const ll={class:"add-user"},tl={__name:"add",emits:["close"],setup(V,{expose:s,emit:v}){const w=pe(),D=r(null),c=xe({mobile:"",code:"",real_name:"",user_ship:"",selectedValues:[]}),U=xe({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"}]}),O=r([]),j=async(P,d)=>{const h=P.level;let t;if(h!==0&&!P.data.code)return d([]);h===0?(t=await Ae({province_code:51e4}),t=t.data.map(x=>({code:x.city_code,name:x.city_name}))):h===1?(t=await Le({city_code:P.data.code}),t=t.data.map(x=>({code:x.area_code,name:x.area_name}))):h===2?(t=await De({area_code:P.data.code}),t=t.data.map(x=>({code:x.street_code,name:x.street_name}))):h===3?(t=await Pe({street_code:P.data.code}),t=t.data.map(x=>({code:x.village_code,name:x.village_name}))):h===4&&(t=await Fe({village_code:P.data.code}),t=t.data.map(x=>({code:x.id,name:x.brigade_name,leaf:!0}))),d(t)},E={value:"code",label:"name",children:"children",multiple:!1,lazy:!0,lazyLoad:j},C=r([]);(()=>{$e().then(P=>{C.value=P.data.lists})})();const J=v,oe=()=>{D.value.validate(async P=>{if(P){let d={};d.mobile=c.mobile,d.code=c.code,d.user_ship=c.user_ship,d.real_name=c.real_name,d.province="510000",d.city=c.selectedValues[0],d.area=c.selectedValues[1],d.street=c.selectedValues[2],d.village=c.selectedValues[3],d.brigade=c.selectedValues[4],d.store_id=w.userInfo.store_id,qe(d).then(h=>{J("close")})}})},ee=()=>{D.value.validateField("mobile",P=>{P&&Te({mobile:c.mobile}).then(d=>{F.success("发送成功")}).catch(d=>{F.error("发送失败")})})};return s({addUser:oe}),(P,d)=>{const h=b("el-input"),t=b("el-form-item"),x=b("el-button"),ae=b("el-option"),N=b("el-select"),le=b("el-cascader"),R=b("el-form");return o(),g("div",ll,[i(R,{model:c,rules:U,ref_key:"formDataRef",ref:D,"label-width":"80px"},{default:u(()=>[i(t,{label:"用户电话",prop:"mobile"},{default:u(()=>[i(h,{modelValue:c.mobile,"onUpdate:modelValue":d[0]||(d[0]=$=>c.mobile=$),placeholder:"请输入用户电话"},null,8,["modelValue"])]),_:1}),i(t,{label:"验证码",prop:"code"},{default:u(()=>[i(h,{modelValue:c.code,"onUpdate:modelValue":d[1]||(d[1]=$=>c.code=$),placeholder:"请输入验证码",style:{flex:"1"}},null,8,["modelValue"]),i(x,{type:"primary",style:{"margin-left":"1rem"},onClick:ee},{default:u(()=>[y("获取验证码")]),_:1})]),_:1}),i(t,{label:"用户姓名",prop:"real_name"},{default:u(()=>[i(h,{modelValue:c.real_name,"onUpdate:modelValue":d[2]||(d[2]=$=>c.real_name=$),placeholder:"请输入用户姓名"},null,8,["modelValue"])]),_:1}),i(t,{label:"用户类型",prop:"user_ship"},{default:u(()=>[i(N,{modelValue:c.user_ship,"onUpdate:modelValue":d[3]||(d[3]=$=>c.user_ship=$),placeholder:"请选择用户类型",style:{width:"100%"}},{default:u(()=>[(o(!0),g(M,null,se(C.value,$=>(o(),z(ae,{key:$.id,label:$.title,value:$.id,disabled:$.id==1},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])]),_:1}),i(t,{label:"用户地址",prop:"selectedValues"},{default