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.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-e2b0bc71"),V=V(),fe(),V),Me={class:"my-order"},We={class:"header-nav"},Ge=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(V){re(),v([]);const l=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)l.value.page_no=1;else if(w.value||m.value)return;m.value=!0,Fe(l.value).then(a=>{r?S.value=a.data.lists:S.value=[...S.value,...a.data.lists],l.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)},R=v(!1),A=v(null),N=()=>{var r;(r=A.value)==null||r.addUser()},O=()=>{R.value=!1,F(!0)},G=v([]);return(()=>{me().then(r=>{G.value=r.data.lists})})(),ce(()=>{P.on("re-load-user-list",()=>{F(!0)})}),ve(()=>{P.off("re-load-user-list")}),(r,a)=>{const f=b("Plus"),C=b("el-icon"),B=b("el-button"),H=b("el-option"),J=b("el-select"),K=b("el-input"),h=b("el-avatar"),E=b("el-tag"),L=b("el-dialog"),c=de("loading"),n=de("infinite-scroll");return s(),$("div",Me,[e("div",We,[Ge,u(B,{type:"primary",onClick:a[0]||(a[0]=o=>R.value=!0)},{default:i(()=>[u(C,null,{default:i(()=>[u(f)]),_:1}),y(" 添加用户")]),_:1})]),e("div",He,[Qe,u(J,{modelValue:l.value.user_ship,"onUpdate:modelValue":a[1]||(a[1]=o=>l.value.user_ship=o),onChange:a[2]||(a[2]=o=>F(!0)),placeholder:"请选择用户类型",style:{flex:"1"}},{default:i(()=>[(s(!0),$(T,null,te(G.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:l.value.mobile,"onUpdate:modelValue":a[4]||(a[4]=o=>l.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:W(["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,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,[y("余额: "),e("span",ot,k(o.now_money),1)]),e("div",null,[y("采购款: "),e("span",it,k(o.purchase_funds),1)]),e("div",null,[y("返还金: "),e("span",nt,k((d=o.return_money)==null?void 0:d.toFixed(2)),1)]),e("div",null,[y("礼品券: "),e("span",dt,k(o.integral),1)]),e("div",null,[o.user_ship!=1?(s(),I(E,{key:0,type:"primary"},{default:i(()=>[y(k(o.user_ship_name),1)]),_:2},1024)):(s(),I(E,{key:1,type:"success"},{default:i(()=>[y(k(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(L,{modelValue:R.value,"onUpdate:modelValue":a[8]||(a[8]=o=>R.value=o),title:"添加用户",width:"600"},{footer:i(()=>[e("div",ct,[u(B,{onClick:a[7]||(a[7]=o=>R.value=!1)},{default:i(()=>[y("取消")]),_:1}),u(B,{type:"primary",onClick:N},{default:i(()=>[y(" 添加 ")]),_:1})])]),default:i(()=>[u(Ke,{ref_key:"addRef",ref:A,onClose:O},null,512)]),_:1},8,["modelValue"])])}}},_t=ue(vt,[["__scopeId","data-v-e2b0bc71"]]),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"},Dt=le(()=>e("div",{class:"tips"},"按回车(Enter)确认支付",-1)),Rt={key:1,class:"balance"},zt=le(()=>e("div",null,"不够找零, 请支付更多金额",-1)),It=le(()=>e("div",{class:"tips"},"按下小键盘输入金额",-1)),Ft=[zt,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:l,emit:m}){const x=v(!1),p=v(1),w=v(""),S=v("");re();const F=()=>{h()},X=()=>{ne(()=>{setTimeout(()=>{var t;E.value=!1,w.value="",a.value=!0,(t=S.value)==null||t.focus(),R(p.value)},300)})},R=t=>{p.value=t,console.log(p.value),p.value==2?window.addEventListener("keydown",Z):(window.removeEventListener("keydown",Z),ne(()=>{var _;w.value="",(_=S.value)==null||_.focus()}))},A=v({price:0,uid:""}),N=v([]),O=v(!1),G=t=>{A.value=t.data,A.value.total=t.data.price,N.value=t.cart_id,O.value=t.isRePay||!1},z=t=>{A.value.total=t.price,H.value=t.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 t;if(C.test(w.value))t="9";else if(B.test(w.value))t="13";else return E.value=!1,w.value="",S.value.focus(),j.error("请输入正确的支付码");he({uid:A.value.uid,price:A.value.price,pay_type:t,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 t=17;if(p.value==1)if(C.test(w.value))t="9";else if(B.test(w.value))t="13";else return E.value=!1,w.value="",S.value.focus(),j.error("请输入正确的支付码");qe({order_id:A.value.order_id,pay_type:t,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=t=>{var _;window.removeEventListener("keydown",Z),a.value=!1,E.value=!1,w.value="",c.value="",L.value=[],(_=S.value)==null||_.blur(),r("paySuccess",t),x.value=!1},E=v(!1);l({drawer:x,setForm:G,setRePay:z,beforeClose:h});const L=v([]),c=v(""),n=Le(()=>+c.value>0?(c.value-A.value.total).toFixed(2):-1),o=v(!1),g=t=>{t===-1?L.value=[]:L.value.pop(),c.value=L.value.length?L.value.join(""):0},d=t=>{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)&&(L.value.join("")<=9999999&&L.value.push(t),c.value=L.value.join("")>99999999?99999999:L.value.join(""))},Y=()=>{if(n.value===""||n.value===null||n.value===void 0||+c.value<+A.value.total)return j.error("收款金额应该大于等于应收金额");O.value?K():he({uid:A.value.uid,price:A.value.price,pay_type:17}).then(t=>{x.value=!1,j({message:t.msg,type:"success"}),R(1),h()}).catch(t=>{E.value=!1})},Z=t=>{let U=(t||window.event).keyCode;if(U==37)return R(2);if(U==120)return P.emit("F9");if(U==27)return h();switch(t.stopPropagation(),t.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 R(1)},ae=()=>{if(!(!x.value||ee.value&&w.value.length>0)&&p.value==1)return R(2)};return ce(()=>{P.on("left",oe),P.on("right",ae)}),ve(()=>{P.off("left",oe),P.off("right",ae)}),(t,_)=>{const U=b("el-input"),Q=b("el-button"),Se=b("Delete"),xe=b("el-icon"),Ue=b("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:W(["left",{active:p.value==1}]),onClick:_[0]||(_[0]=q=>R(1))}," 微信/支付宝 ",2),e("div",{class:W(["right",{active:p.value==2}]),onClick:_[1]||(_[1]=q=>R(2))}," 现金收款 ",2)]),e("div",null,[e("div",yt,[ht,e("div",gt,[y(" ¥"),e("span",bt,k((ie=A.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,k(c.value),1)):(s(),$("span",Ut,"按下键盘输入客户支付金额"))]),n.value>=0?(s(),$("div",At,[e("div",null,[y(" 需找零(元):"),e("span",Lt,"¥"+k(n.value),1)]),Dt])):(s(),$("div",Rt,Ft)),e("div",Pt,[e("div",jt,[(s(!0),$(T,null,te(f.value,q=>(s(),I(Q,{key:q,onClick:Wl=>d(q)},{default:i(()=>[y(k(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:W(["enter",{"enter-disable":+c.value<+A.value.total}]),disabled:+c.value<+A.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"]]),D=V=>(pe("data-v-ff0075ff"),V=V(),fe(),V),qt={class:"my-order"},Tt={key:0,class:"detail"},Jt={class:"table"},Kt=D(()=>e("div",{class:"table-title"},"用户信息",-1)),Mt={class:"table-info"},Wt={class:"info-item"},Gt=D(()=>e("div",{class:"info-item-title"},"用户余额:",-1)),Ht={class:"info-item-info red"},Qt={class:"info-item"},Xt=D(()=>e("div",{class:"info-item-title"},"采购款:",-1)),Yt={class:"info-item-info red"},Zt={class:"info-item"},el=D(()=>e("div",{class:"info-item-title"},"返还金:",-1)),tl={class:"info-item-info red"},ll={class:"info-item"},al=D(()=>e("div",{class:"info-item-title"},"头像:",-1)),sl={class:"info-item-info"},ol={class:"info-item"},il=D(()=>e("div",{class:"info-item-title"},"礼品券:",-1)),nl={class:"info-item-info red"},dl={class:"info-item"},ul=D(()=>e("div",{class:"info-item-title"},"ID:",-1)),rl={class:"info-item-info"},cl={class:"info-item"},vl=D(()=>e("div",{class:"info-item-title"},"用户昵称:",-1)),_l={class:"info-item-info"},pl={class:"info-item"},fl=D(()=>e("div",{class:"info-item-title"},"用户电话:",-1)),ml={class:"info-item-info"},yl={class:"info-item"},hl=D(()=>e("div",{class:"info-item-title"},"用户账号:",-1)),gl={class:"info-item-info"},bl={class:"info-item"},kl=D(()=>e("div",{class:"info-item-title"},"真实姓名:",-1)),$l={class:"info-item-info"},Vl={class:"info-item"},wl=D(()=>e("div",{class:"info-item-title"},"创建时间:",-1)),Cl={class:"info-item-info"},Sl={class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},xl=D(()=>e("div",{class:"info-item-title"},"用户类型:",-1)),Ul={class:"info-item-info"},Al={key:0,class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},Ll=D(()=>e("div",{class:"info-item-title"},"用户标签:",-1)),Dl={class:"info-item-info"},Rl={class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},zl=D(()=>e("div",{class:"info-item-title"},"用户地址:",-1)),Il=D(()=>e("div",{class:"table-title"},[y("供销经营礼包"),e("span",{class:"tips"},"首次购买1000元以上成为行业会员")],-1)),Fl={class:"table-info"},Pl={class:"pay-btn"},jl=D(()=>e("div",null,"¥1000.00",-1)),El=[jl],Nl=D(()=>e("div",null,"¥2000.00",-1)),Ol=[Nl],Bl=D(()=>e("div",null,"¥5000.00",-1)),ql=[Bl],Tl={key:1},Jl={__name:"detail",setup(V){re(),De();const l=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:l.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 R=()=>{je({id:l.value.id,user_ship:l.value.user_ship}).then(c=>{var n;j.success("修改成功"),l.value.user_ship_name=(n=F.value.find(o=>o.id==l.value.user_ship))==null?void 0:n.title,S.value=!1})},A=()=>{S.value=!1},N=v(!1),O=v([]);(()=>{Ee().then(c=>{O.value=c.data.lists})})();const z=()=>{Ne({id:l.value.id,label_id:l.value.label_id}).then(c=>{var n;j.success("修改成功"),l.value.label_name=(n=O.value.find(o=>o.label_id==l.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:l.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=l.value.account),a.value.real_name||(a.value.real_name=l.value.real_name||l.value.nickname),Be({...a.value,uid:l.value.id}).then(c=>{j.success("编辑成功"),L.value=!0})},E=()=>{f.value=JSON.parse(JSON.stringify(C.value)),L.value=!0},L=v(!0);return ce(()=>{P.on("set-user-detail",c=>{l.value=c,Pe({id:c.id}).then(({data:n})=>{l.value=Object.assign(c,n),console.log(l.value)}),B()})}),ve(()=>{P.off("set-user-detail")}),(c,n)=>{var ae;const o=b("el-avatar"),g=b("el-tag"),d=b("el-button"),Y=b("el-option"),Z=b("el-select"),ee=b("el-cascader"),oe=b("el-empty");return s(),$("div",qt,[l.value.id?(s(),$("div",Tt,[e("div",Jt,[Kt,e("div",Mt,[e("div",Wt,[Gt,e("div",Ht,"¥"+k(l.value.now_money),1)]),e("div",Qt,[Xt,e("div",Yt,"¥"+k(l.value.purchase_funds),1)]),e("div",Zt,[el,e("div",tl,"¥"+k((ae=l.value.number)==null?void 0:ae.toFixed(2)),1)]),e("div",ll,[al,e("div",sl,[u(o,{style:{width:"4rem",height:"4rem"},src:l.value.avatar},null,8,["src"])])]),e("div",ol,[il,e("div",nl,"¥"+k(l.value.integral),1)]),e("div",dl,[ul,e("div",rl,k(l.value.id),1)]),e("div",cl,[vl,e("div",_l,k(l.value.nickname),1)]),e("div",pl,[fl,e("div",ml,k(l.value.mobile),1)]),e("div",yl,[hl,e("div",gl,k(l.value.account),1)]),e("div",bl,[kl,e("div",$l,k(l.value.real_name),1)]),e("div",Vl,[wl,e("div",Cl,k(l.value.create_time),1)]),e("div",Sl,[xl,e("div",Ul,[S.value==!1?(s(),$(T,{key:0},[l.value.user_ship!=1?(s(),I(g,{key:0,type:"primary",size:"large"},{default:i(()=>[y(k(l.value.user_ship_name),1)]),_:1})):(s(),I(g,{key:1,type:"success",size:"large"},{default:i(()=>[y(k(l.value.user_ship_name),1)]),_:1})),l.value.user_ship!=1?(s(),I(d,{key:2,type:"primary",style:{"margin-left":"1rem"},onClick:n[0]||(n[0]=t=>S.value=!0)},{default:i(()=>[y("修改")]),_:1})):M("",!0)],64)):(s(),$(T,{key:1},[u(Z,{modelValue:l.value.user_ship,"onUpdate:modelValue":n[1]||(n[1]=t=>l.value.user_ship=t),placeholder:"请选择用户类型",style:{width:"10rem"}},{default:i(()=>[(s(!0),$(T,null,te(F.value,t=>(s(),I(Y,{key:t.id,label:t.title,value:t.id,disabled:t.id==1},null,8,["label","value","disabled"]))),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:A},{default:i(()=>[y("取消")]),_:1})],64))])]),l.value.user_ship==1?(s(),$("div",Al,[Ll,e("div",Dl,[N.value==!1?(s(),$(T,{key:0},[l.value.label_name?(s(),I(g,{key:0,type:"primary",size:"large"},{default:i(()=>[y(k(l.value.label_name),1)]),_:1})):M("",!0),l.value.label_name?(s(),I(d,{key:1,type:"primary",style:{"margin-left":"1rem"},onClick:n[2]||(n[2]=t=>N.value=!0)},{default:i(()=>[y("修改")]),_:1})):(s(),I(d,{key:2,type:"primary",style:{"margin-left":"1rem"},onClick:n[3]||(n[3]=t=>{l.value.label_id="",N.value=!0})},{default:i(()=>[y("添加")]),_:1}))],64)):(s(),$(T,{key:1},[u(Z,{modelValue:l.value.label_id,"onUpdate:modelValue":n[4]||(n[4]=t=>l.value.label_id=t),placeholder:"请选择用户类型",style:{width:"10rem"}},{default:i(()=>[(s(!0),$(T,null,te(O.value,t=>(s(),I(Y,{key:t.label_id,label:t.label_name,value:t.label_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(d,{type:"primary",style:{"margin-left":"1rem"},onClick:z},{default:i(()=>[y("确认")]),_:1}),u(d,{style:{"margin-left":"1rem"},onClick:r},{default:i(()=>[y("取消")]),_:1})],64))])])):M("",!0),e("div",Rl,[zl,(s(),I(ee,{key:l.value.id,style:{flex:"1"},modelValue:f.value,"onUpdate:modelValue":n[5]||(n[5]=t=>f.value=t),options:H.value,props:K,load:J,class:"w-full",disabled:L.value},null,8,["modelValue","options","disabled"])),L.value?(s(),I(d,{key:0,type:"primary",style:{"margin-left":"1rem"},onClick:n[6]||(n[6]=t=>L.value=!1)},{default:i(()=>[y("修改")]),_:1})):M("",!0),L.value?M("",!0):(s(),I(d,{key:1,type:"primary",style:{"margin-left":"1rem"},onClick:h},{default:i(()=>[y("确认")]),_:1})),L.value?M("",!0):(s(),I(d,{key:2,style:{"margin-left":"1rem"},onClick:E},{default:i(()=>[y("取消")]),_:1}))])]),Il,e("div",Fl,[e("div",Pl,[e("div",{class:W(["pay-item",{"pay-item-active":m.value.type==1}]),onClick:n[7]||(n[7]=t=>m.value.type=1)},El,2),e("div",{class:W(["pay-item",{"pay-item-active":m.value.type==2}]),onClick:n[8]||(n[8]=t=>m.value.type=2)},Ol,2),e("div",{class:W(["pay-item",{"pay-item-active":m.value.type==3}]),onClick:n[9]||(n[9]=t=>m.value.type=3)},ql,2),e("div",{class:W(["pay-item",{"pay-item-active":m.value.type==0}]),onClick:n[11]||(n[11]=t=>m.value.type=0)},[_e(e("input",{type:"number",class:"input","onUpdate:modelValue":n[10]||(n[10]=t=>m.value.price=t),placeholder:"自定义金额"},null,512),[[Re,m.value.price]])],2)]),u(d,{type:"primary",size:"large",class:"pay",onClick:p},{default:i(()=>[y("立即支付")]),_:1})])])])):(s(),$("div",Tl,[u(oe)])),u(Bt,{ref_key:"payRef",ref:x,onPaySuccess:w},null,512)])}}},Kl=ue(Jl,[["__scopeId","data-v-ff0075ff"]]),Ml={class:"my-card"},ea={__name:"index",setup(V){return(l,m)=>(s(),$("div",Ml,[u(_t,{style:{"flex-shrink":"0"},ref:"orderRef"},null,512),u(Te),u(Kl,{ref:"detailRef"},null,512)]))}};export{ea as default};