cashier-mer/dist/assets/index--1tYNtpI.js

2 lines
24 KiB
JavaScript
Raw Normal View History

2024-06-26 14:23:07 +08:00
import{r as v,J as ye,b,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 W,t as k,p as M,q as pe,s as fe,D as Le,n as ne,C as De,I as Re}from"./index-BVz4Ohfy.js";import{a as me,b as ze,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-CmzBi8Mn.js";import"./moment-Cl4UOzQZ.js";import{r as se}from"./axiosAPI-Cd-ap3gb.js";import{f as qe}from"./store-C3TkF7fN.js";import{p as Te}from"./padding-DDV9klbG.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:l,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(z,r)=>{const a=z.level;let f;if(a!==0&&!z.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:z.data.code}),f=f.data.map(C=>({code:C.area_code,name:C.area_name}))):a===2?(f=await $e({area_code:z.data.code}),f=f.data.map(C=>({code:C.street_code,name:C.street_name}))):a===3?(f=await Ve({street_code:z.data.code}),f=f.data.map(C=>({code:C.village_code,name:C.village_name}))):a===4&&(f=await we({village_code:z.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},R=v([]);(()=>{me().then(z=>{R.value=z.data.lists})})();const N=m,O=()=>{x.value.validate(async z=>{if(z){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],ze(r).then(a=>{N("close")})}})},G=()=>{x.value.validateField("mobile",z=>{z&&Ie({mobile:p.mobile}).then(r=>{j.success("发送成功")}).catch(r=>{j.error("发送失败")})})};return l({addUser:O}),(z,r)=>{const a=b("el-input"),f=b("el-form-item"),C=b("el-button"),B=b("el-option"),H=b("el-select"),J=b("el-cascader"),K=b("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:G},{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(R.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.selectedV