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