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

2 lines
32 KiB
JavaScript
Raw Normal View History

2024-07-06 18:08:19 +08:00
import{u as ge,r as c,G as Ie,b as g,c as n,k as $,f as a,w as t,F as te,l as ie,d as R,E as D,_ as ke,o as $e,m as J,a as Ve,h as me,e,g as h,p as ee,i as Ee,j as he,z as de,t as k,q as we,s as Ce,J as He,n as pe,I as Qe}from"./index-BnGigPfR.js";import{a as Se,b as Xe,c as Ye,u as Ze,d as Pe,e as Ne,f as el,g as ll,h as al,i as tl}from"./user-Cxe1-N3Y.js";import"./moment-Cl4UOzQZ.js";import{r as fe}from"./axiosAPI-DJRwxDIy.js";import{_ as je}from"./authCode-D1GYIlL-.js";import{g as sl,u as ol,k as il}from"./store-DOZFgKpz.js";import{p as nl}from"./padding-CO-3gQOa.js";function Ue(x){return fe.get("/city",{params:x})}function xe(x){return fe.get("/area",{params:x})}function ze(x){return fe.get("/street",{params:x})}function Ae(x){return fe.get("/village",{params:x})}function Re(x){return fe.get("/brigade",{params:x})}const ul={class:"add-user"},dl={__name:"add",emits:["close"],setup(x,{expose:u,emit:w}){const L=ge(),F=c(null),r=Ie({mobile:"",code:"",real_name:"",user_ship:"",selectedValues:[]}),j=Ie({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"}]}),X=c([]),q=async(I,_)=>{const P=I.level;let V;if(P!==0&&!I.data.code)return _([]);P===0?(V=await Ue({province_code:51e4}),V=V.data.map(S=>({code:S.city_code,name:S.city_name}))):P===1?(V=await xe({city_code:I.data.code}),V=V.data.map(S=>({code:S.area_code,name:S.area_name}))):P===2?(V=await ze({area_code:I.data.code}),V=V.data.map(S=>({code:S.street_code,name:S.street_name}))):P===3?(V=await Ae({street_code:I.data.code}),V=V.data.map(S=>({code:S.village_code,name:S.village_name}))):P===4&&(V=await Re({village_code:I.data.code}),V=V.data.map(S=>({code:S.id,name:S.brigade_name,leaf:!0}))),_(V)},W={value:"code",label:"name",children:"children",multiple:!1,lazy:!0,lazyLoad:q},C=c([]);(()=>{Se({type_id:4}).then(I=>{var _;C.value=(_=I.data.lists)==null?void 0:_.filter(P=>P.id==0||P.id==4)})})();const O=w,E=()=>{F.value.validate(async I=>{if(I){let _={};_.mobile=r.mobile,_.code=r.code,_.user_ship=r.user_ship,_.real_name=r.real_name,_.province="510000",_.city=r.selectedValues[0],_.area=r.selectedValues[1],_.street=r.selectedValues[2],_.village=r.selectedValues[3],_.brigade=r.selectedValues[4],_.store_id=L.userInfo.store_id,Xe(_).then(P=>{r.mobile="",r.code="",r.user_ship="",r.real_name="",r.selectedValues=[],F.value.resetFields(),O("close")})}})},se=c(null),re=()=>{F.value.validateField("mobile",I=>{I&&Ye({mobile:r.mobile}).then(_=>{D.success("发送成功"),se.value.startCountDown()}).catch(_=>{D.error("发送失败")})})};return u({addUser:E}),(I,_)=>{const P=g("el-input"),V=g("el-form-item"),S=g("el-option"),G=g("el-select"),U=g("el-cascader"),d=g("el-form");return n(),$("div",ul,[a(d,{model:r,rules:j,ref_key:"formDataRef",ref:F,"label-width":"80px"},{default:t(()=>[a(V,{label:"用户电话",prop:"mobile"},{default:t(()=>[a(P,{modelValue:r.mobile,"onUpdate:modelValue":_[0]||(_[0]=f=>r.mobile=f),placeholder:"请输入用户电话"},null,8,["modelValue"])]),_:1}),a(V,{label:"验证码",prop:"code"},{default:t(()=>[a(P,{modelValue:r.code,"onUpdate:modelValue":_[1]||(_[1]=f=>r.code=f),placeholder:"请输入验证码",style:{flex:"1"}},null,8,["modelValue"]),a(je,{ref_key:"authCodeRef",ref:se,style:{"margin-left":"1rem"},onSendCode:re,start:!1},null,512)]),_:1}),a(V,{label:"用户姓名",prop:"real_name"},{default:t(()=>[a(P,{modelValue:r.real_name,"onUpdate:modelValue":_[2]||(_[2]=f=>r.real_name=f),placeholder:"请输入用户姓名"},null,8,["modelValue"])]),_:1}),a(V,{label:"用户类型",prop:"user_ship"},{default:t(()=>[a(G,{modelValue:r.user_ship,"onUpdate:modelValue":_[3]||(_[3]=f=>r.user_ship=f),placeholder:"请选择用户类型",style:{width:"100%"}},{default:t(()=>[(n(!0),$(te,null,ie(C