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-BMBzhgd2.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-dRm6MYdG.js";import"./moment-Cl4UOzQZ.js";import{r as se}from"./axiosAPI-DiwKH9qZ.js";import{f as qe}from"./store-CRSplG2K.js";import{p as Te}from"./padding-C5KE8DBb.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.selectedValues,"onUpdate:modelValue":r[4]||(r[4]=g=>p.selectedValues=g),options:S.value,props:Z,load:I,class:"w-full"},null,8,["modelValue","options"])]),_:1})]),_:1},8,["model","rules"])])}}},Ce=w=>(pe("data-v-3d8750ac"),w=w(),fe(),w),Me={class:"my-order"},Ge={class:"header-nav"},We=Ce(()=>e("div",{class:"nav-item"},k("用户列表"),-1)),He={class:"header-row"},Qe=Ce(()=>e("div",{class:"label"},"用户类型",-1)),Xe={class:"header-input"},Ye={class:"order-lists","infinite-scroll-distance":300,"infinite-scroll-delay":500,style:{overflow:"auto"}},Ze=["onClick"],et={style:{display:"flex","flex-direction":"column","justify-content":"space-around",flex:"1"}},tt={class:"top flex"},lt={class:"r-1"},at={class:"bold"},st={class:"bottom flex",style:{"justify-content":"space-between"}},ot={class:"red"},it={class:"red"},nt={class:"red"},dt={class:"red"},ut={key:0,class:"load-end"},rt={key:1,class:"load-end"},ct={class:"dialog-footer"},vt={__name:"order",props:{isSystem:{type:Boolean,default:!1},source:{type:Number,default:1}},setup(w){re(),_([]);const t=_({page_no:1,page_size:20,mobile:"",user_ship:""}),y=_(!1),U=_(0),p=_(0),C=_(!1),S=_([]),I=(r=!1)=>{if(r)t.value.page_no=1;else if(C.value||y.value)return;y.value=!0,Ie(t.value).then(l=>{r?S.value=l.data.lists:S.value=[...S.value,...l.data.lists],t.value.page_no==1&&S.value.length>0&&P.emit("set-user-detail",S.value[0]),l.data.lists.length{C.value=!0,y.value=!1})},Z=(r,l)=>{p.value=l,P.emit("set-user-detail",r)},D=_(!1),L=_(null),N=()=>{var r;(r=L.value)==null||r.addUser()},O=()=>{D.value=!1,I(!0)},H=_([]);return(()=>{me().then(r=>{H.value=r.data.lists})})(),ce(()=>{P.on("re-load-user-list",()=>{I(!0)})}),ve(()=>{P.off("re-load-user-list")}),(r,l)=>{const f=$("Plus"),x=$("el-icon"),B=$("el-button"),Q=$("el-option"),J=$("el-select"),K=$("el-input"),g=$("el-avatar"),E=$("el-tag"),z=$("el-dialog"),c=de("loading"),n=de("infinite-scroll");return s(),V("div",Me,[e("div",Ge,[We,u(B,{type:"primary",onClick:l[0]||(l[0]=o=>D.value=!0)},{default:i(()=>[u(x,null,{default:i(()=>[u(f)]),_:1}),h(" 添加用户")]),_:1})]),e("div",He,[Qe,u(J,{modelValue:t.value.user_ship,"onUpdate:modelValue":l[1]||(l[1]=o=>t.value.user_ship=o),onChange:l[2]||(l[2]=o=>I(!0)),placeholder:"请选择用户类型",style:{flex:"1"}},{default:i(()=>[(s(!0),V(T,null,te(H.value,o=>(s(),R(Q,{key:o.id,label:o.title,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),e("div",Xe,[u(K,{modelValue:t.value.mobile,"onUpdate:modelValue":l[4]||(l[4]=o=>t.value.mobile=o),placeholder:"搜索手机号/ID",onKeydown:l[5]||(l[5]=ge(o=>I(!0),["enter"])),onClear:l[6]||(l[6]=o=>I(!0)),clearable:""},{append:i(()=>[u(B,{type:"primary",style:{"background-color":"#1890ff",color:"#fff","border-radius":"0 0.315rem 0.315rem 0"},onClick:l[3]||(l[3]=o=>I(!0))},{default:i(()=>[h("搜索")]),_:1})]),_:1},8,["modelValue"])]),_e((s(),V("div",Ye,[(s(!0),V(T,null,te(S.value,(o,b)=>{var d,M;return s(),V("div",{class:W(["item",{"item-active":p.value==b}]),key:b,onClick:X=>Z(o,b)},[u(g,{class:"avatar",src:o.avatar},null,8,["src"]),e("div",et,[e("div",tt,[e("div",lt,[e("span",at,k(o.nickname),1),e("span",null,k(" (ID:"+o.id+")"),1)]),e("div",null,"手机号: "+k(o.mobile),1)]),e("div",st,[e("div",null,[h("余额: "),e("span",ot,k(o.now_money),1)]),e("div",null,[h("采购款: "),e("span",it,k(o.purchase_funds),1)]),e("div",null,[h("返还金: "),e("span",nt,k((d=o.return_money)==null?void 0:d.toFixed(2)),1)]),e("div",null,[h("礼品券: "),e("span",dt,k((M=o.get_frozen)==null?void 0:M.toFixed(2)),1)]),e("div",null,[o.user_ship!=1?(s(),R(E,{key:0,type:"primary"},{default:i(()=>[h(k(o.user_ship_name),1)]),_:2},1024)):(s(),R(E,{key:1,type:"success"},{default:i(()=>[h(k(o.user_ship_name),1)]),_:2},1024))])])])],10,Ze)}),128)),C.value?(s(),V("div",ut,"没有更多了")):G("",!0),y.value?(s(),V("div",rt,"加载中...")):G("",!0)])),[[c,y.value],[n,I]]),u(z,{modelValue:D.value,"onUpdate:modelValue":l[8]||(l[8]=o=>D.value=o),title:"添加用户",width:"600"},{footer:i(()=>[e("div",ct,[u(B,{onClick:l[7]||(l[7]=o=>D.value=!1)},{default:i(()=>[h("取消")]),_:1}),u(B,{type:"primary",onClick:N},{default:i(()=>[h(" 添加 ")]),_:1})])]),default:i(()=>[u(Ke,{ref_key:"addRef",ref:L,onClose:O},null,512)]),_:1},8,["modelValue"])])}}},_t=ue(vt,[["__scopeId","data-v-3d8750ac"]]),le=w=>(pe("data-v-7b0b3630"),w=w(),fe(),w),pt=le(()=>e("h4",null,"选择支付方式",-1)),ft={class:"dra-body"},mt={class:"header"},yt={style:{display:"inline-block"}},ht=le(()=>e("div",{style:{color:"#999",padding:"2rem 0 0.3rem 0"}},"应收金额(元):",-1)),gt={style:{color:"#f5222d","padding-bottom":"2rem"}},bt={style:{"font-size":"1.6rem"}},kt={key:0,"element-loading-text":"支付中",class:"card1"},$t=le(()=>e("div",{class:"tips"},null,-1)),Vt={key:1,class:"card2"},wt={class:"drawer-body"},Ct={class:"counter"},xt={class:"received"},St={key:0},Ut={key:1,style:{"font-size":"1rem",color:"#999"}},At={key:0,class:"balance"},Lt={class:"money"},zt=le(()=>e("div",{class:"tips"},"按回车(Enter)确认支付",-1)),Dt={key:1,class:"balance"},Ft=le(()=>e("div",null,"不够找零, 请支付更多金额",-1)),Rt=le(()=>e("div",{class:"tips"},"按下小键盘输入金额",-1)),It=[Ft,Rt],Pt={class:"keypad"},jt={class:"left"},Et={class:"right"},Nt={style:{width:"100%",display:"flex","justify-content":"center"}},Ot={__name:"payUser",emits:["paySuccess"],setup(w,{expose:t,emit:y}){const U=_(!1),p=_(1),C=_(""),S=_("");re();const I=()=>{g()},Z=()=>{ne(()=>{setTimeout(()=>{var m;E.value=!1,C.value="",l.value=!0,(m=S.value)==null||m.focus(),D(p.value)},300)})},D=m=>{p.value=m,console.log(p.value),p.value==2?window.addEventListener("keydown",X):(window.removeEventListener("keydown",X),ne(()=>{var v;C.value="",(v=S.value)==null||v.focus()}))},L=_({price:0,uid:""}),N=_([]),O=_(!1),H=m=>{L.value=m.data,L.value.total=m.data.price,N.value=m.cart_id,O.value=m.isRePay||!1},F=m=>{L.value.total=m.price,Q.value=m.order_id},r=y,l=_(!1),f=_(["1","2","3","4","5","6","7","8","9","0","00","."]),x=/^(10|11|12|13|14|15)\d{16}$/,B=/^(25|26|27|28|29|30)\d{14,22}$/,Q=_(""),J=()=>{if(E.value=!0,S.value.blur(),O.value)K();else{let m;if(x.test(C.value))m="9";else if(B.test(C.value))m="13";else return E.value=!1,C.value="",S.value.focus(),j.error("请输入正确的支付码");he({uid:L.value.uid,price:L.value.price,pay_type:m,auth_code:C.value}).then(v=>{v.data.out_trade_no&&v.msg=="支付成功"?(U.value=!1,j({message:"支付成功",type:"success"}),g(v.data)):v.msg=="用户支付中"&&v.code==1&&(j.warning(v.msg),P.on("pay_success",a=>{j({message:"支付成功",type:"success"}),setTimeout(()=>{P.off("pay_success")},200),U.value=!1,g(a)}))}).catch(v=>{E.value=!1,ne(()=>{var a;(a=S.value)==null||a.focus()})})}},K=()=>{let m=17;if(p.value==1)if(x.test(C.value))m="9";else if(B.test(C.value))m="13";else return E.value=!1,C.value="",S.value.focus(),j.error("请输入正确的支付码");qe({order_id:L.value.order_id,pay_type:m,auth_code:C.value}).then(v=>{var a;(a=v.msg)!=null&&a.includes("成功")?(U.value=!1,j({message:"支付成功",type:"success"}),g()):v.msg=="用户支付中"&&v.code==1&&(j.warning(v.msg),P.on("pay_success",Y=>{j({message:"支付成功",type:"success"}),setTimeout(()=>{P.off("pay_success")},200),U.value=!1,g(Y)}))}).catch(v=>{C.value="",E.value=!1,ne(()=>{var a;(a=S.value)==null||a.focus()})})};_(0);const g=m=>{var v;window.removeEventListener("keydown",X),l.value=!1,E.value=!1,C.value="",c.value="",z.value=[],(v=S.value)==null||v.blur(),r("paySuccess",m),U.value=!1},E=_(!1);t({drawer:U,setForm:H,setRePay:F,beforeClose:g});const z=_([]),c=_(""),n=Le(()=>+c.value>0?(c.value-L.value.total).toFixed(2):-1),o=_(!1),b=m=>{m===-1?z.value=[]:z.value.pop(),c.value=z.value.length?z.value.join(""):0},d=m=>{o.value===!1&&(c.value="",o.value=!0);let v=String(c.value).indexOf(".")+1,a=String(c.value).length-v;console.log(v,a),(v===0||a<2)&&(z.value.join("")<=9999999&&z.value.push(m),c.value=z.value.join("")>99999999?99999999:z.value.join(""))},M=()=>{if(n.value===""||n.value===null||n.value===void 0||+c.value<+L.value.total)return j.error("收款金额应该大于等于应收金额");O.value?K():he({uid:L.value.uid,price:L.value.price,pay_type:17}).then(m=>{U.value=!1,j({message:m.msg,type:"success"}),D(1),g()}).catch(m=>{E.value=!1})},X=m=>{let a=(m||window.event).keyCode;if(a==37)return D(2);if(a==120)return P.emit("F9");if(a==27)return g();switch(m.stopPropagation(),m.preventDefault(),a){case 96:case 48:d(0);break;case 97:case 49:d(1);break;case 98:case 50:d(2);break;case 99:case 51:d(3);break;case 100:case 52:d(4);break;case 101:case 53:d(5);break;case 102:case 54:d(6);break;case 103:case 55:d(7);break;case 104:case 56:d(8);break;case 105:case 57:d(9);break;case 110:d(".");break;case 190:d(".");break;case 8:b();break;case 13:M();break}},ee=_(!1),oe=()=>{if(!(!U.value||ee.value&&C.value.length>0)&&p.value==2)return D(1)},ae=()=>{if(!(!U.value||ee.value&&C.value.length>0)&&p.value==1)return D(2)};return ce(()=>{P.on("left",oe),P.on("right",ae)}),ve(()=>{P.off("left",oe),P.off("right",ae)}),(m,v)=>{const a=$("el-input"),Y=$("el-button"),xe=$("Delete"),Se=$("el-icon"),Ue=$("el-drawer"),Ae=de("loading");return s(),R(Ue,{size:"60rem",modelValue:U.value,"onUpdate:modelValue":v[6]||(v[6]=ie=>U.value=ie),direction:"rtl",onOpen:Z,"before-close":g},{header:i(()=>[pt]),default:i(()=>{var ie;return[e("div",ft,[e("div",mt,[e("div",{class:W(["left",{active:p.value==1}]),onClick:v[0]||(v[0]=q=>D(1))}," 微信/支付宝 ",2),e("div",{class:W(["right",{active:p.value==2}]),onClick:v[1]||(v[1]=q=>D(2))}," 现金收款 ",2)]),e("div",null,[e("div",yt,[ht,e("div",gt,[h(" ¥"),e("span",bt,k((ie=L.value)==null?void 0:ie.price),1)])])]),p.value==1?_e((s(),V("div",kt,[u(a,{ref_key:"codeRef",ref:S,modelValue:C.value,"onUpdate:modelValue":v[2]||(v[2]=q=>C.value=q),autofocus:"",class:"code-input",placeholder:"请点击输入框聚焦扫码或输入编码号",onKeyup:ge(J,["enter"]),onFocus:v[3]||(v[3]=q=>ee.value=!0),onBlur:v[4]||(v[4]=q=>ee.value=!1)},null,8,["modelValue"]),$t])),[[Ae,E.value]]):(s(),V("div",Vt,[e("div",wt,[e("div",Ct,[e("div",xt,[c.value?(s(),V("span",St,k(c.value),1)):(s(),V("span",Ut,"按下键盘输入客户支付金额"))]),n.value>=0?(s(),V("div",At,[e("div",null,[h(" 需找零(元):"),e("span",Lt,"¥"+k(n.value),1)]),zt])):(s(),V("div",Dt,It)),e("div",Pt,[e("div",jt,[(s(!0),V(T,null,te(f.value,q=>(s(),R(Y,{key:q,onClick:Ql=>d(q)},{default:i(()=>[h(k(q),1)]),_:2},1032,["onClick"]))),128))]),e("div",Et,[u(Y,{onClick:b},{default:i(()=>[u(Se,null,{default:i(()=>[u(xe)]),_:1})]),_:1}),u(Y,{onClick:v[5]||(v[5]=q=>b(-1))},{default:i(()=>[h("C")]),_:1}),u(Y,{class:W(["enter",{"enter-disable":+c.value<+L.value.total}]),disabled:+c.value<+L.value.total,onClick:M},{default:i(()=>[h(" 确认 ")]),_:1},8,["class","disabled"])])])])])]))])]}),footer:i(()=>[e("div",Nt,[u(Y,{class:"cancel-btn",onClick:I},{default:i(()=>[h("取消收款")]),_:1})])]),_:1},8,["modelValue"])}}},Bt=ue(Ot,[["__scopeId","data-v-7b0b3630"]]),A=w=>(pe("data-v-3f469190"),w=w(),fe(),w),qt={class:"my-order"},Tt={key:0,class:"detail"},Jt={class:"table"},Kt=A(()=>e("div",{class:"table-title"},"用户信息",-1)),Mt={class:"table-info"},Gt={class:"info-item"},Wt=A(()=>e("div",{class:"info-item-title"},"用户余额:",-1)),Ht={class:"info-item-info red"},Qt={class:"info-item"},Xt=A(()=>e("div",{class:"info-item-title"},"采购款:",-1)),Yt={class:"info-item-info red"},Zt={class:"info-item"},el=A(()=>e("div",{class:"info-item-title"},"返还金:",-1)),tl={class:"info-item-info red"},ll={class:"info-item"},al=A(()=>e("div",{class:"info-item-title"},"头像:",-1)),sl={class:"info-item-info"},ol={class:"info-item"},il=A(()=>e("div",{class:"info-item-title"},"礼品券:",-1)),nl={class:"info-item-info red"},dl={class:"info-item"},ul=A(()=>e("div",{class:"info-item-title"},"冻结礼品券:",-1)),rl={class:"info-item-info red"},cl={class:"info-item"},vl=A(()=>e("div",{class:"info-item-title"},"ID:",-1)),_l={class:"info-item-info"},pl={class:"info-item"},fl=A(()=>e("div",{class:"info-item-title"},"用户昵称:",-1)),ml={class:"info-item-info"},yl={class:"info-item"},hl=A(()=>e("div",{class:"info-item-title"},"用户电话:",-1)),gl={class:"info-item-info"},bl={class:"info-item"},kl=A(()=>e("div",{class:"info-item-title"},"用户账号:",-1)),$l={class:"info-item-info"},Vl={class:"info-item"},wl=A(()=>e("div",{class:"info-item-title"},"真实姓名:",-1)),Cl={class:"info-item-info"},xl={class:"info-item"},Sl=A(()=>e("div",{class:"info-item-title"},"创建时间:",-1)),Ul={class:"info-item-info"},Al={class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},Ll=A(()=>e("div",{class:"info-item-title"},"用户类型:",-1)),zl={class:"info-item-info"},Dl={key:0,class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},Fl=A(()=>e("div",{class:"info-item-title"},"用户标签:",-1)),Rl={class:"info-item-info"},Il={class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},Pl=A(()=>e("div",{class:"info-item-title"},"用户地址:",-1)),jl=A(()=>e("div",{class:"table-title"},[h("供销经营礼包"),e("span",{class:"tips"},"首次购买1000元以上成为行业会员")],-1)),El={class:"table-info"},Nl={class:"pay-btn"},Ol=A(()=>e("div",null,"¥1000.00",-1)),Bl=[Ol],ql=A(()=>e("div",null,"¥2000.00",-1)),Tl=[ql],Jl=A(()=>e("div",null,"¥5000.00",-1)),Kl=[Jl],Ml={key:1},Gl={__name:"detail",setup(w){re(),ze();const t=_({id:""}),y=_({price:"",type:1}),U=_(null),p=()=>{y.value.type==1?y.value.price="1000":y.value.type==2?y.value.price="2000":y.value.type==3&&(y.value.price="5000"),y.value.type==0&&(y.value.price=Number(y.value.price).toFixed(2)),console.log("支付",y.value),U.value.setForm({data:{uid:t.value.id,price:y.value.price}}),U.value.drawer=!0},C=()=>{console.log("支付成功"),P.emit("re-load-user-list")},S=_(!1),I=_([]);(()=>{me().then(c=>{I.value=c.data.lists})})();const D=()=>{je({id:t.value.id,user_ship:t.value.user_ship}).then(c=>{var n;j.success("修改成功"),t.value.user_ship_name=(n=I.value.find(o=>o.id==t.value.user_ship))==null?void 0:n.title,S.value=!1})},L=()=>{S.value=!1},N=_(!1),O=_([]);(()=>{Ee().then(c=>{O.value=c.data.lists})})();const F=()=>{Ne({id:t.value.id,label_id:t.value.label_id}).then(c=>{var n;j.success("修改成功"),t.value.label_name=(n=O.value.find(o=>o.label_id==t.value.label_id))==null?void 0:n.label_name,N.value=!1})},r=()=>{N.value=!1},l=_({id:"",province:"",city:"",area:"",street:"",brigade:""}),f=_([]),x=_([]),B=()=>{Oe({uid:t.value.id}).then(c=>{c.data.village&&(f.value=[c.data.city,c.data.area,c.data.street,c.data.village,+c.data.brigade],x.value=JSON.parse(JSON.stringify(f.value)),l.value=Object.assign(l.value,c.data))})},Q=_([]),J=async(c,n)=>{const o=c.level;let b;if(o!==0&&!c.data.code)return n([]);o===0?(b=await be({province_code:51e4}),b=b.data.map(d=>({code:d.city_code,name:d.city_name}))):o===1?(b=await ke({city_code:c.data.code}),b=b.data.map(d=>({code:d.area_code,name:d.area_name}))):o===2?(b=await $e({area_code:c.data.code}),b=b.data.map(d=>({code:d.street_code,name:d.street_name}))):o===3?(b=await Ve({street_code:c.data.code}),b=b.data.map(d=>({code:d.village_code,name:d.village_name}))):o===4&&(b=await we({village_code:c.data.code}),b=b.data.map(d=>({code:d.id,name:d.brigade_name,leaf:!0}))),n(b)},K={value:"code",label:"name",children:"children",multiple:!1,lazy:!0,lazyLoad:J},g=async()=>{l.value.city=f.value[0],l.value.area=f.value[1],l.value.street=f.value[2],l.value.village=f.value[3],l.value.brigade=f.value[4],l.value.phone||(l.value.phone=t.value.account),l.value.real_name||(l.value.real_name=t.value.real_name||t.value.nickname),Be({...l.value,uid:t.value.id}).then(c=>{j.success("编辑成功"),z.value=!0})},E=()=>{f.value=JSON.parse(JSON.stringify(x.value)),z.value=!0},z=_(!0);return ce(()=>{P.on("set-user-detail",c=>{t.value=c,Pe({id:c.id}).then(({data:n})=>{t.value=Object.assign(c,n),console.log(t.value)}),B()})}),ve(()=>{P.off("set-user-detail")}),(c,n)=>{var ae,m,v;const o=$("el-avatar"),b=$("el-tag"),d=$("el-button"),M=$("el-option"),X=$("el-select"),ee=$("el-cascader"),oe=$("el-empty");return s(),V("div",qt,[t.value.id?(s(),V("div",Tt,[e("div",Jt,[Kt,e("div",Mt,[e("div",Gt,[Wt,e("div",Ht,"¥"+k(t.value.now_money),1)]),e("div",Qt,[Xt,e("div",Yt,"¥"+k(t.value.purchase_funds),1)]),e("div",Zt,[el,e("div",tl,"¥"+k((ae=t.value.return_money)==null?void 0:ae.toFixed(2)),1)]),e("div",ll,[al,e("div",sl,[u(o,{style:{width:"4rem",height:"4rem"},src:t.value.avatar},null,8,["src"])])]),e("div",ol,[il,e("div",nl,"¥"+k((m=t.value.get_frozen)==null?void 0:m.toFixed(2)),1)]),e("div",dl,[ul,e("div",rl,"¥"+k((v=t.value.amount_frozen)==null?void 0:v.toFixed(2)),1)]),e("div",cl,[vl,e("div",_l,k(t.value.id),1)]),e("div",pl,[fl,e("div",ml,k(t.value.nickname),1)]),e("div",yl,[hl,e("div",gl,k(t.value.mobile),1)]),e("div",bl,[kl,e("div",$l,k(t.value.account),1)]),e("div",Vl,[wl,e("div",Cl,k(t.value.real_name),1)]),e("div",xl,[Sl,e("div",Ul,k(t.value.create_time),1)]),e("div",Al,[Ll,e("div",zl,[S.value==!1?(s(),V(T,{key:0},[t.value.user_ship!=1?(s(),R(b,{key:0,type:"primary",size:"large"},{default:i(()=>[h(k(t.value.user_ship_name),1)]),_:1})):(s(),R(b,{key:1,type:"success",size:"large"},{default:i(()=>[h(k(t.value.user_ship_name),1)]),_:1})),t.value.user_ship!=1?(s(),R(d,{key:2,type:"primary",style:{"margin-left":"1rem"},onClick:n[0]||(n[0]=a=>S.value=!0)},{default:i(()=>[h("修改")]),_:1})):G("",!0)],64)):(s(),V(T,{key:1},[u(X,{modelValue:t.value.user_ship,"onUpdate:modelValue":n[1]||(n[1]=a=>t.value.user_ship=a),placeholder:"请选择用户类型",style:{width:"10rem"}},{default:i(()=>[(s(!0),V(T,null,te(I.value,a=>(s(),R(M,{key:a.id,label:a.title,value:a.id,disabled:a.id==1},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"]),u(d,{type:"primary",style:{"margin-left":"1rem"},onClick:D},{default:i(()=>[h("确认")]),_:1}),u(d,{style:{"margin-left":"1rem"},onClick:L},{default:i(()=>[h("取消")]),_:1})],64))])]),t.value.user_ship==1?(s(),V("div",Dl,[Fl,e("div",Rl,[N.value==!1?(s(),V(T,{key:0},[t.value.label_name?(s(),R(b,{key:0,type:"primary",size:"large"},{default:i(()=>[h(k(t.value.label_name),1)]),_:1})):G("",!0),t.value.label_name?(s(),R(d,{key:1,type:"primary",style:{"margin-left":"1rem"},onClick:n[2]||(n[2]=a=>N.value=!0)},{default:i(()=>[h("修改")]),_:1})):(s(),R(d,{key:2,type:"primary",style:{"margin-left":"1rem"},onClick:n[3]||(n[3]=a=>{t.value.label_id="",N.value=!0})},{default:i(()=>[h("添加")]),_:1}))],64)):(s(),V(T,{key:1},[u(X,{modelValue:t.value.label_id,"onUpdate:modelValue":n[4]||(n[4]=a=>t.value.label_id=a),placeholder:"请选择用户类型",style:{width:"10rem"}},{default:i(()=>[(s(!0),V(T,null,te(O.value,a=>(s(),R(M,{key:a.label_id,label:a.label_name,value:a.label_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(d,{type:"primary",style:{"margin-left":"1rem"},onClick:F},{default:i(()=>[h("确认")]),_:1}),u(d,{style:{"margin-left":"1rem"},onClick:r},{default:i(()=>[h("取消")]),_:1})],64))])])):G("",!0),e("div",Il,[Pl,(s(),R(ee,{key:t.value.id,style:{flex:"1"},modelValue:f.value,"onUpdate:modelValue":n[5]||(n[5]=a=>f.value=a),options:Q.value,props:K,load:J,class:"w-full",disabled:z.value},null,8,["modelValue","options","disabled"])),z.value?(s(),R(d,{key:0,type:"primary",style:{"margin-left":"1rem"},onClick:n[6]||(n[6]=a=>z.value=!1)},{default:i(()=>[h("修改")]),_:1})):G("",!0),z.value?G("",!0):(s(),R(d,{key:1,type:"primary",style:{"margin-left":"1rem"},onClick:g},{default:i(()=>[h("确认")]),_:1})),z.value?G("",!0):(s(),R(d,{key:2,style:{"margin-left":"1rem"},onClick:E},{default:i(()=>[h("取消")]),_:1}))])]),jl,e("div",El,[e("div",Nl,[e("div",{class:W(["pay-item",{"pay-item-active":y.value.type==1}]),onClick:n[7]||(n[7]=a=>y.value.type=1)},Bl,2),e("div",{class:W(["pay-item",{"pay-item-active":y.value.type==2}]),onClick:n[8]||(n[8]=a=>y.value.type=2)},Tl,2),e("div",{class:W(["pay-item",{"pay-item-active":y.value.type==3}]),onClick:n[9]||(n[9]=a=>y.value.type=3)},Kl,2),e("div",{class:W(["pay-item",{"pay-item-active":y.value.type==0}]),onClick:n[11]||(n[11]=a=>y.value.type=0)},[_e(e("input",{type:"number",class:"input","onUpdate:modelValue":n[10]||(n[10]=a=>y.value.price=a),placeholder:"自定义金额"},null,512),[[De,y.value.price]])],2)]),u(d,{type:"primary",size:"large",class:"pay",onClick:p},{default:i(()=>[h("立即支付")]),_:1})])])])):(s(),V("div",Ml,[u(oe)])),u(Bt,{ref_key:"payRef",ref:U,onPaySuccess:C},null,512)])}}},Wl=ue(Gl,[["__scopeId","data-v-3f469190"]]),Hl={class:"my-card"},aa={__name:"index",setup(w){return(t,y)=>(s(),V("div",Hl,[u(_t,{style:{"flex-shrink":"0"},ref:"orderRef"},null,512),u(Te),u(Wl,{ref:"detailRef"},null,512)]))}};export{aa as default};