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

2 lines
24 KiB
JavaScript
Raw Normal View History

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