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

2 lines
24 KiB
JavaScript
Raw Normal View History

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