2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
import{J as Ae,K as De,E as A,u as de,L as Ie,r as c,M as ye,b as $,c as o,k,f as v,w as r,F as J,l as te,d as z,_ as re,o as ce,m as E,a as ve,h as ue,e,g as y,i as ge,j as _e,z as W,t as b,p as M,q as pe,s as fe,D as Re,n as ne,C as ze,I as Pe}from"./index-C4rRmnc5.js";import{a as me,b as je,u as Ee,c as he,d as Fe,e as Ne,f as Oe,g as Te,h as Be,i as qe}from"./user-UEbWTjyf.js";import"./moment-Cl4UOzQZ.js";import{g as Je}from"./store-BxeA20BY.js";import{p as Ke}from"./padding-BA_o-z8h.js";const Q=Ae.create({baseURL:De.api,timeout:6e4});Q.interceptors.request.use(s=>{const t=localStorage.getItem("Token");return t&&(s.headers.token=t),s},s=>(console.error(s),Promise.reject(s)));Q.interceptors.response.use(s=>{var t;if(s.data.code===-1&&(s.data.msg=="登录过期"||s.data.msg=="登录超时,请重新登录"))throw A({message:s.data.msg,type:"error"}),setTimeout(()=>{const _=de();_.setUserInfo({}),_.setToken(""),Ie.push("/login")},500),new Error(s.data.msg);if(s.data.code===400)throw A({message:s.data.msg,type:"error"}),new Error(s.data.msg);if(s.data.show&&A({message:s.data.msg,type:"error"}),s.data.code===500)throw s.data.msg=JSON.parse(s.data.msg),A({message:((t=s.data.msg)==null?void 0:t.msg)||s.data.msg,type:"error"}),new Error(s.data.msg);return s.data.code===0?Promise.reject(s.data):s.data},s=>{var t,_;return console.error(s),A({message:((_=(t=s.response)==null?void 0:t.data)==null?void 0:_.msg)||s,type:"error"}),Promise.reject(s)});function be(s){return Q.get("/city",{params:s})}function ke(s){return Q.get("/area",{params:s})}function $e(s){return Q.get("/street",{params:s})}function we(s){return Q.get("/village",{params:s})}function Ve(s){return Q.get("/brigade",{params:s})}const Me={class:"add-user"},We={__name:"add",emits:["close"],setup(s,{expose:t,emit:_}){const S=c(null),f=ye({mobile:"",real_name:"",user_ship:"",selectedValues:[]}),w=ye({mobile:[{required:!0,message:"请输入手机号",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"请输入正确的手机号",trigger:"blur"}],real_name:[{required:!0,message:"请输入用户姓名",trigger:"blur"}],user_ship:[{required:!0,message:"请选择用户类型",trigger:"change"}],selectedValues:[{required:!0,message:"请选择用户地址",trigger:"change"}]}),C=c([]),j=async(P,g)=>{const V=P.level;let a;if(V!==0&&!P.data.code)return g([]);V===0?(a=await be({province_code:51e4}),a=a.data.map(m=>({code:m.city_code,name:m.city_name}))):V===1?(a=await ke({city_code:P.data.code}),a=a.data.map(m=>({code:m.area_code,name:m.area_name}))):V===2?(a=await $e({area_code:P.data.code}),a=a.data.map(m=>({code:m.street_code,name:m.street_name}))):V===3?(a=await we({street_code:P.data.code}),a=a.data.map(m=>({code:m.village_code,name:m.village_name}))):V===4&&(a=await Ve({village_code:P.data.code}),a=a.data.map(m=>({code:m.id,name:m.brigade_name,leaf:!0}))),g(a)},X={value:"code",label:"name",children:"children",multiple:!1,lazy:!0,lazyLoad:j},I=c([]);(()=>{me().then(P=>{I.value=P.data.lists})})();const O=_;return t({addUser:()=>{S.value.validate(async P=>{if(P){let g={};g.mobile=f.mobile,g.user_ship=f.user_ship,g.real_name=f.real_name,g.province="510000",g.city=f.selectedValues[0],g.area=f.selectedValues[1],g.street=f.selectedValues[2],g.village=f.selectedValues[3],g.brigade=f.selectedValues[4],je(g).then(V=>{O("close")})}})}}),(P,g)=>{const V=$("el-input"),a=$("el-form-item"),m=$("el-option"),K=$("el-select"),T=$("el-cascader"),G=$("el-form");return o(),k("div",Me,[v(G,{model:f,rules:w,ref_key:"formDataRef",ref:S,"label-width":"80px"},{default:r(()=>[v(a,{label:"用户电话",prop:"mobile"},{default:r(()=>[v(V,{modelValue:f.mobile,"onUpdate:modelValue":g[0]||(g[0]=U=>f.mobile=U),placeholder:"请输入用户电话"},null,8,["modelValue"])]),_:1}),v(a,{label:"用户姓名",prop:"real_name"},{default:r(()=>[v(V,{modelValue:f.real_name,"onUpdate:modelValue":g[1]||(g[1]=U=>f.real_name=U),placeholder:"请输入用户姓名"},null,8,["modelValue"])]),_:1}),v(a,{label:"用户类型",prop:"user_ship"},{default:r(()=>[v(K,{modelValue:f.user_ship,"onUpdate:modelValue":g[2]||(g[2]=U=>f.user_ship=U),placeholder:"请选择用户类型",style:{width:"100%"}},{default:r(()=>[(o(!0),k(J,null,te(I.value,U=>(o(),z(m,{key:U.id,label:U.title,value:U.id,disabled:U.id==1},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])]),_:1}),v(a,{label:"用户地址",prop:"selectedValues"},{default:r(()=>[v(T,{style:{width:"100%"},modelValue:f.selectedValues,"onUpdate:modelValue":g[3]||(g[3]=U=>f.selectedValues=U),options:C.value,props:X,load:j,class:"w-full"},null,8,["modelValue","options"])]),_:1})]),_:1},8,["model","rules"])])}}},Ce=s=>(pe("data-v-e2b0bc71"),s=s(),fe(),s),Ge={class:"my-order"},He={class:"header-nav"},Qe=Ce(()=>e("div",{class:"nav-item"},b("用户列表"),-1)),Xe={class:"header-row"},Ye=Ce(()=>e("div",{class:"label"},"用户类型",-1)),Ze={class:"header-input"},et={class:"order-lists","infinite-scroll-distance":300,"infinite-scroll-delay":500,style:{overflow:"auto"}},tt=["onClick"],at={style:{display:"flex","flex-direction":"column","justify-content":"space-around",flex:"1"}},lt={class:"top flex"},st={class:"r-1"},ot={class:"bold"},it={class:"bottom flex",style:{"justify-content":"space-between"}},nt={class:"red"},dt={class:"red"},ut={class:"red"},rt={class:"red"},ct={key:0,class:"load-end"},vt={key:1,class:"load-end"},_t={class:"dialog-footer"},pt={__name:"order",props:{isSystem:{type:Boolean,default:!1},source:{type:Number,default:1}},setup(s){de(),c([]);const t=c({page_no:1,page_size:20,mobile:"",user_ship:""}),_=c(!1),S=c(0),f=c(0),w=c(!1),C=c([]),j=(V=!1)=>{if(V)t.value.page_no=1;else if(w.value||_.value)return;_.value=!0,Ee(t.value).then(a=>{V?C.value=a.data.lists:C.value=[...C.value,...a.data.lists],t.value.page_no==1&&C.value.length>0&&E.emit("set-user-detail",C.value[0]),a.data.lists.length<t.value.page_size?w.value=!0:t.value.page_no++,f.value=0,S.value=a.data.count,_.value=!1}).catch(a=>{w.value=!0,_.value=!1})},X=(V,a)=>{f.value=a,E.emit("set-user-detail",V)},I=c(!1),R=c(null),O=()=>{var V;(V=R.value)==null||V.addUser()},B=()=>{I.value=!1,j(!0)},P=c([]);return(()=>{me().then(V=>{P.value=V.data.lists})})(),ce(()=>{E.on("re-load-user-list",()=>{j(!0)})}),ve(()=>{E.off("re-load-user-list")}),(V,a)=>{const m=$("Plus"),K=$("el-icon"),T=$("el-button"),G=$("el-option"),U=$("el-select"),Y=$("el-input"),N=$("el-avatar"),F=$("el-tag"),L=$("el-dialog"),u=ue("loading"),n=ue("infinite-scroll");return o(),k("div",Ge,[e("div",He,[Qe,v(T,{type:"primary",onClick:a[0]||(a[0]=i=>I.value=!0)},{default:r(()=>[v(K,null,{default:r(()=>[v(m)]),_:1}),y(" 添加用户")]),_:1})]),e("div",Xe,[Ye,v(U,{modelValue:t.value.user_ship,"onUpdate:modelValue":a[1]||(a[1]=i=>t.value.user_ship=i),onChange:a[2]||(a[2]=i=>j(!0)),placeholder:"请选择用户类型",style:{flex:"1"}},{default:r(()=>[(o(!0),k(J,null,te(P.value,i=>(o(),z(G,{key:i.id,label:i.title,value:i.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),e("div",Ze,[v(Y,{modelValue:t.value.mobile,"onUpdate:modelValue":a[4]||(a[4]=i=>t.value.mobile=i),placeholder:"搜索手机号/ID",onKeydown:a[5]||(a[5]=ge(i=>j(!0),["enter"])),onClear:a[6]||(a[6]=i=>j(!0)),clearable:""},{append:r(()=>[v(T,{type:"primary",style:{"background-color":"#1890ff",color:"#fff","border-radius":"0 0.315rem 0.315rem 0"},onClick:a[3]||(a[3]=i=>j(!0))},{default:r(()=>[y("搜索")]),_:1})]),_:1},8,["modelValue"])]),_e((o(),k("div",et,[(o(!0),k(J,null,te(C.value,(i,h)=>{var d;return o(),k("div",{class:W(["item",{"item-active":f.value==h}]),key:h,onClick:Z=>X(i,h)},[v(N,{class:"avatar",src:i.avatar},null,8,["src"]),e("div",at,[e("div",lt,[e("div",st,[e("span",ot,b(i.nickname),1),e("span",null,b(" (ID:"+i.id+")"),1)]),e("div",null,"手机号: "+b(i.mobile),1)]),e("div",it,[e("div",null,[y("余额: "),e("span",nt,b(i.now_money),1)]),e("div",null,[y("采购款: "),e("span",dt,b(i.purchase_funds),1)]),e("div",null,[y("返还金: "),e("span",ut,b((d=i.return_money)==null?void 0:d.toFixed(2)),1)]),e("div",null,[y("礼品券: "),e("span",rt,b(i.integral),1)]),e("div",null,[i.user_ship!=1?(o(),z(F,{key:0,type:"primary"},{default:r(()=>[y(b(i.user_ship_name),1)]),_:2},1024)):(o(),z(F,{key:1,type:"success"},{default:r(()=>[y(b(i.user_ship_name),1)]),_:2},1024))])])])],10,tt)}),128)),w.value?(o(),k("div",ct,"没有更多了")):M("",!0),_.value?(o(),k("div",vt,"加载中...")):M("",!0)])),[[u,_.value],[n,j]]),v(L,{modelValue:I.value,"onUpdate:modelValue":a[8]||(a[8]=i=>I.value=i),title:"添加用户",width:"600"},{footer:r(()=>[e("div",_t,[v(T,{onClick:a[7]||(a[7]=i=>I.value=!1)},{default:r(()=>[y("取消")]),_:1}),v(T,{type:"primary",onClick:O},{default:r(()=>[y(" 添加 ")]),_:1})])]),default:r(()=>[v(We,{ref_key:"addRef",ref:R,onClose:B},null,512)]),_:1},8,["modelValue"])])}}},ft=re(pt,[["__scopeId","data-v-e2b0bc71"]]),ae=s=>(pe("data-v-88b7f8af"),s=s(),fe(),s),mt=ae(()=>e("h4",null,"选择支付方式",-1)),yt={class:"dra-body"},ht={class:"header"},gt={style:{display:"inline-block"}},bt=ae(()=>e("div",{style:{color:"#999",padding:"2rem 0 0.3rem 0"}},"应收金额(元):",-1)),kt={style:{color:"#f5222d","padding-bottom":"2rem"}},$t={style:{"font-size":"1.6rem"}},wt={key:0,"element-loading-text":"支付中",class:"card1"},Vt=ae(()=>e("div",{class:"tips"},null,-1)),Ct={key:1,class:"card2"},St={class:"drawer-body"},xt={class:"counter"},Ut={class:"received"},Lt={key:0},At={key:1,style:{"font-size":"1rem",color:"#999"}},Dt={key:0,class:"balance"},It={class:"money"},Rt=ae(()=>e("div",{class:"tips"},"按回车(Enter)确认支付",-1)),zt={key:1,class:"balance"},Pt=ae(()=>e("div",null,"不够找零, 请支付更多金额",-1)),jt=ae(()=>e("div",{class:"tips"},"按下小键盘输入金额",-1)),Et=[Pt,jt],Ft={class:"keypad"},Nt={class:"left"},Ot={class:"right"},Tt={style:{width:"100%",display:"flex","justify-content":"center"}},Bt={__name:"payUser",emits:["paySuccess"],setup(s,{expose:t,emit:_}){const S=c(!1),f=c(1),w=c(""),C=c("");de();const j=()=>{N()},X=()=>{ne(()=>{setTimeout(()=>{var l;F.value=!1,w.value="",a.value=!0,(l=C.value)==null||l.focus(),I(f.value)},300)})},I=l=>{if(f.value=l,f.value==2)return f.value=1,A.error("暂不支持现金收款");window.removeEventListener("keydown",le),ne(()=>{var p;w.value="",(p=C.value)==null||p.focus()})},R=c({price:0,uid:""}),O=c([]),B=c(!1),P=l=>{R.value=l.data,O.value=l.cart_id,B.value=l.isRePay||!1},g=l=>{R.value.total=l.price,G.value=l.order_id},V=_,a=c(!1),m=c(["1","2","3","4","5","6","7","8","9","0","00","."]),K=/^(10|11|12|13|14|15)\d{16}$/,T=/^(25|26|27|28|29|30)\d{14,22}$/,G=c(""),U=()=>{if(F.value=!0,C.value.blur(),B.value)Y();else{let l;if(K.test(w.value))l="9";else if(T.test(w.value))l="13";else return F.value=!1,w.value="",C.value.focus(),A.error("请输入正确的支付码");he({uid:R.value.uid,price:R.value.price,pay_type:l,auth_code:w.value}).then(p=>{p.data.out_trade_no&&p.msg=="支付成功"?(S.value=!1,A({message:"支付成功",type:"success"}),N(p.data)):p.msg=="用户支付中"&&p.code==1&&(A.warning(p.msg),E.on("pay_success",x=>{A({message:"支付成功",type:"success"}),setTimeout(()=>{E.off("pay_success")},200),S.value=!1,N(x)}))}).catch(p=>{F.value=!1,ne(()=>{var x;(x=C.value)==null||x.focus()})})}},Y=()=>{let l=17;if(f.value==1)if(K.test(w.value))l="9";else if(T.test(w.value))l="13";else return F.value=!1,w.value="",C.value.focus(),A.error("请输入正确的支付码");Je({order_id:R.value.order_id,pay_type:l,auth_code:w.value}).then(p=>{var x;(x=p.msg)!=null&&x.includes("成功")?(S.value=!1,A({message:"支付成功",type:"success"}),N()):p.msg=="用户支付中"&&p.code==1&&(A.warning(p.msg),E.on("pay_success",H=>{A({message:"支付成功",type:"success"}),setTimeout(()=>{E.off("pay_success")},200),S.value=!1,N(H)}))}).catch(p=>{w.value="",F.value=!1,ne(()=>{var x;(x=C.value)==null||x.focus()})})};c(0);const N=l=>{var p;window.removeEventListener("keydown",le),a.value=!1,F.value=!1,w.value="",u.value="",L.value=[],(p=C.value)==null||p.blur(),V("paySuccess",l),S.value=!1},F=c(!1);t({drawer:S,setForm:P,setRePay:g,beforeClose:N});const L=c([]),u=c(""),n=Re(()=>+u.value>0?(u.value-R.value.total).toFixed(2):-1),i=c(!1),h=l=>{l===-1?L.value=[]:L.value.pop(),u.value=L.value.length?L.value.join(""):0},d=l=>{i.value===!1&&(u.value="",i.value=!0);let p=String(u.value).indexOf(".")+1,x=String(u.value).length-p;console.log(p,x),(p===0||x<2)&&(L.value.join("")<=9999999&&L.value.push(l),u.value=L.value.join("")>99999999?99999999:L.value.join(""))},Z=()=>{if(n.value===""||n.value===null||n.value===void 0||+u.value<+R.value.total)return A.error("收款金额应该大于等于应收金额");B.value?Y():he({uid:R.value.uid,price:R.value.price,pay_type,pay_type:"17"}).then(l=>{S.value=!1,A({message:l.msg,type:"success"}),I(1),N()}).catch(l=>{F.value=!1})},le=l=>{let x=(l||window.event).keyCode;if(x==37)return I(2);if(x==120)return E.emit("F9");if(x==27)return N();switch(l.stopPropagation(),l.preventDefault(),x){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:h();break;case 13:Z();break}},ee=c(!1),oe=()=>{if(!(!S.value||ee.value&&w.value.length>0)&&f.value==2)return I(1)},se=()=>{if(!(!S.value||ee.value&&w.value.length>0)&&f.value==1)return I(2)};return ce(()=>{E.on("left",oe),E.on("right",se)}),ve(()=>{E.off("left",oe),E.off("right",se)}),(l,p)=>{const x=$("el-input"),H=$("el-button"),Se=$("Delete"),xe=$("el-icon"),Ue=$("el-drawer"),Le=ue("loading");return o(),z(Ue,{size:"60rem",modelValue:S.value,"onUpdate:modelValue":p[6]||(p[6]=ie=>S.value=ie),direction:"rtl",onOpen:X,"before-close":N},{header:r(()=>[mt]),default:r(()=>{var ie;return[e("div",yt,[e("div",ht,[e("div",{class:W(["left",{active:f.value==1}]),onClick:p[0]||(p[0]=q=>I(1))}," 微信/支付宝 ",2),e("div",{class:W(["right",{active:f.value==2}]),onClick:p[1]||(p[1]=q=>I(2))}," 现金收款 ",2)]),e("div",null,[e("div",gt,[bt,e("div",kt,[y(" ¥"),e("span",$t,b((ie=R.value)==null?void 0:ie.price),1)])])]),f.value==1?_e((o(),k("div",wt,[v(x,{ref_key:"codeRef",ref:C,modelValue:w.value,"onUpdate:modelValue":p[2]||(p[2]=q=>w.value=q),autofocus:"",class:"code-input",placeholder:"请点击输入框聚焦扫码或输入编码号",onKeyup:ge(U,["enter"]),onFocus:p[3]||(p[3]=q=>ee.value=!0),onBlur:p[4]||(p[4]=q=>ee.value=!1)},null,8,["modelValue"]),Vt])),[[Le,F.value]]):(o(),k("div",Ct,[e("div",St,[e("div",xt,[e("div",Ut,[u.value?(o(),k("span",Lt,b(u.value),1)):(o(),k("span",At,"按下键盘输入客户支付金额"))]),n.value>=0?(o(),k("div",Dt,[e("div",null,[y(" 需找零(元):"),e("span",It,"¥"+b(n.value),1)]),Rt])):(o(),k("div",zt,Et)),e("div",Ft,[e("div",Nt,[(o(!0),k(J,null,te(m.value,q=>(o(),z(H,{key:q,onClick:Ha=>d(q)},{default:r(()=>[y(b(q),1)]),_:2},1032,["onClick"]))),128))]),e("div",Ot,[v(H,{onClick:h},{default:r(()=>[v(xe,null,{default:r(()=>[v(Se)]),_:1})]),_:1}),v(H,{onClick:p[5]||(p[5]=q=>h(-1))},{default:r(()=>[y("C")]),_:1}),v(H,{class:W(["enter",{"enter-disable":+u.value<+R.value.total}]),disabled:+u.value<+R.value.total,onClick:Z},{default:r(()=>[y(" 确认 ")]),_:1},8,["class","disabled"])])])])])]))])]}),footer:r(()=>[e("div",Tt,[v(H,{class:"cancel-btn",onClick:j},{default:r(()=>[y("取消收款")]),_:1})])]),_:1},8,["modelValue"])}}},qt=re(Bt,[["__scopeId","data-v-88b7f8af"]]),D=s=>(pe("data-v-ff0075ff"),s=s(),fe(),s),Jt={class:"my-order"},Kt={key:0,class:"detail"},Mt={class:"table"},Wt=D(()=>e("div",{class:"table-title"},"用户信息",-1)),Gt={class:"table-info"},Ht={class:"info-item"},Qt=D(()=>e("div",{class:"info-item-title"},"用户余额:",-1)),Xt={class:"info-item-info red"},Yt={class:"info-item"},Zt=D(()=>e("div",{class:"info-item-title"},"采购款:",-1)),ea={class:"info-item-info red"},ta={class:"info-item"},aa=D(()=>e("div",{class:"info-item-title"},"返还金:",-1)),la={class:"info-item-info red"},sa={class:"info-item"},oa=D(()=>e("div",{class:"info-item-title"},"头像:",-1)),ia={class:"info-item-info"},na={class:"info-item"},da=D(()=>e("div",{class:"info-item-title"},"礼品券:",-1)),ua={class:"info-item-info red"},ra={class:"info-item"},ca=D(()=>e("div",{class:"info-item-title"},"ID:",-1)),va={class:"info-item-info"},_a={class:"info-item"},pa=D(()=>e("div",{class:"info-item-title"},"用户昵称:",-1)),fa={class:"info-item-info"},ma={class:"info-item"},ya=D(()=>e("div",{class:"info-item-title"},"用户电话:",-1)),ha={class:"info-item-info"},ga={class:"info-item"},ba=D(()=>e("div",{class:"info-item-title"},"用户账号:",-1)),ka={class:"info-item-info"},$a={class:"info-item"},wa=D(()=>e("div",{class:"info-item-title"},"真实姓名:",-1)),Va={class:"info-item-info"},Ca={class:"info-item"},Sa=D(()=>e("div",{class:"info-item-title"},"创建时间:",-1)),xa={class:"info-item-info"},Ua={class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},La=D(()=>e("div",{class:"info-item-title"},"用户类型:",-1)),Aa={class:"info-item-info"},Da={key:0,class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},Ia=D(()=>e("div",{class:"info-item-title"},"用户标签:",-1)),Ra={class:"info-item-info"},za={class:"info-item",style:{width:"100%","flex-shrink":"0","align-items":"center"}},Pa=D(()=>e("div",{class:"info-item-title"},"用户地址:",-1)),ja=D(()=>e("div",{class:"table-title"},[y("供销经营礼包"),e("span",{class:"tips"},"首次购买1000元以上成为行业会员")],-1)),Ea={class:"table-info"},Fa={class:"pay-btn"},Na=D(()=>e("div",null,"¥1000.00",-1)),Oa=[Na],Ta=D(()=>e("div",null,"¥2000.00",-1)),Ba=[Ta],qa=D(()=>e("div",null,"¥5000.00",-1)),Ja=[qa],Ka={key:1},Ma={__name:"detail",setup(s){de(),ze();const t=c({id:""}),_=c({price:"",type:1}),S=c(null),f=()=>{_.value.type==1?_.value.price="1000":_.value.type==2?_.value.price="2000":_.value.type==3&&(_.value.price="5000"),_.value.type==0&&(_.value.price=Number(_.value.price).toFixed(2)),console.log("支付",_.value),S.value.setForm({data:{uid:t.value.id,price:_.value.price}}),S.value.drawer=!0},w=()=>{console.log("支付成功"),E.emit("re-load-user-list")},C=c(!1),j=c([]);(()=>{me().then(u=>{j.value=u.data.lists})})();const I=()=>{Ne({id:t.value.id,user_ship:t.value.user_ship}).then(u=>{var n;A.success("修改成功"),t.value.user_ship_name=(n=j.value.find(i=>i.id==t.value.user_ship))==null?void 0:n.title,C.value=!1})},R=()=>{C.value=!1},O=c(!1),B=c([]);(()=>{Oe().then(u=>{B.value=u.data.lists})})();const g=()=>{Te({id:t.value.id,label_id:t.value.label_id}).then(u=>{var n;A.success("修改成功"),t.value.label_name=(n=B.value.find(i=>i.label_id==t.value.label_id))==null?void 0:n.label_name,O.value=!1})},V=()=>{O.value=!1},a=c({id:"",province:"",city:"",area:"",street:"",brigade:""}),m=c([]),K=c([]),T=()=>{Be({uid:t.value.id}).then(u=>{u.data.village&&(m.value=[u.data.city,u.data.area,u.data.street,u.data.village,+u.data.brigade],K.value=JSON.parse(JSON.stringify(m.value)),a.value=Object.assign(a.value,u.data))})},G=c([]),U=async(u,n)=>{const i=u.level;let h;if(i!==0&&!u.data.code)return n([]);i===0?(h=await be({province_code:51e4}),h=h.data.map(d=>({code:d.city_code,name:d.city_name}))):i===1?(h=await ke({city_code:u.data.code}),h=h.data.map(d=>({code:d.area_code,name:d.area_name}))):i===2?(h=await $e({area_code:u.data.code}),h=h.data.map(d=>({code:d.street_code,name:d.street_name}))):i===3?(h=await we({street_code:u.data.code}),h=h.data.map(d=>({code:d.village_code,name:d.village_name}))):i===4&&(h=await Ve({village_code:u.data.code}),h=h.data.map(d=>({code:d.id,name:d.brigade_name,leaf:!0}))),n(h)},Y={value:"code",label:"name",children:"children",multiple:!1,lazy:!0,lazyLoad:U},N=async()=>{a.value.city=m.value[0],a.value.area=m.value[1],a.value.street=m.value[2],a.value.village=m.value[3],a.value.brigade=m.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),qe({...a.value,uid:t.value.id}).then(u=>{A.success("编辑成功"),L.value=!0})},F=()=>{m.value=JSON.parse(JSON.stringify(K.value)),L.value=!0},L=c(!0);return ce(()=>{E.on("set-user-detail",u=>{t.value=u,Fe({id:u.id}).then(({data:n})=>{t.value=Object.assign(u,n),console.log(t.value)}),T()})}),ve(()=>{E.off("set-user-detail")}),(u,n)=>{var se;const i=$("el-avatar"),h=$("el-tag"),d=$("el-button"),Z=$("el-option"),le=$("el-select"),ee=$("el-cascader"),oe=$("el-empty");return o(),k("div",Jt,[t.value.id?(o(),k("div",Kt,[e("div",Mt,[Wt,e("div",Gt,[e("div",Ht,[Qt,e("div",Xt,"¥"+b(t.value.now_money),1)]),e("div",Yt,[Zt,e("div",ea,"¥"+b(t.value.purchase_funds),1)]),e("div",ta,[aa,e("div",la,"¥"+b((se=t.value.number)==null?void 0:se.toFixed(2)),1)]),e("div",sa,[oa,e("div",ia,[v(i,{style:{width:"4rem",height:"4rem"},src:t.value.avatar},null,8,["src"])])]),e("div",na,[da,e("div",ua,"¥"+b(t.value.integral),1)]),e("div",ra,[ca,e("div",va,b(t.value.id),1)]),e("div",_a,[pa,e("div",fa,b(t.value.nickname),1)]),e("div",ma,[ya,e("div",ha,b(t.value.mobile),1)]),e("div",ga,[ba,e("div",ka,b(t.value.account),1)]),e("div",$a,[wa,e("div",Va,b(t.value.real_name),1)]),e("div",Ca,[Sa,e("div",xa,b(t.value.create_time),1)]),e("div",Ua,[La,e("div",Aa,[C.value==!1?(o(),k(J,{key:0},[t.value.user_ship!=1?(o(),z(h,{key:0,type:"primary",size:"large"},{default:r(()=>[y(b(t.value.user_ship_name),1)]),_:1})):(o(),z(h,{key:1,type:"success",size:"large"},{default:r(()=>[y(b(t.value.user_ship_name),1)]),_:1})),t.value.user_ship!=1?(o(),z(d,{key:2,type:"primary",style:{"margin-left":"1rem"},onClick:n[0]||(n[0]=l=>C.value=!0)},{default:r(()=>[y("修改")]),_:1})):M("",!0)],64)):(o(),k(J,{key:1},[v(le,{modelValue:t.value.user_ship,"onUpdate:modelValue":n[1]||(n[1]=l=>t.value.user_ship=l),placeholder:"请选择用户类型",style:{width:"10rem"}},{default:r(()=>[(o(!0),k(J,null,te(j.value,l=>(o(),z(Z,{key:l.id,label:l.title,value:l.id,disabled:l.id==1},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"]),v(d,{type:"primary",style:{"margin-left":"1rem"},onClick:I},{default:r(()=>[y("确认")]),_:1}),v(d,{style:{"margin-left":"1rem"},onClick:R},{default:r(()=>[y("取消")]),_:1})],64))])]),t.value.user_ship==1?(o(),k("div",Da,[Ia,e("div",Ra,[O.value==!1?(o(),k(J,{key:0},[t.value.label_name?(o(),z(h,{key:0,type:"primary",size:"large"},{default:r(()=>[y(b(t.value.label_name),1)]),_:1})):M("",!0),t.value.label_name?(o(),z(d,{key:1,type:"primary",style:{"margin-left":"1rem"},onClick:n[2]||(n[2]=l=>O.value=!0)},{default:r(()=>[y("修改")]),_:1})):(o(),z(d,{key:2,type:"primary",style:{"margin-left":"1rem"},onClick:n[3]||(n[3]=l=>{t.value.label_id="",O.value=!0})},{default:r(()=>[y("添加")]),_:1}))],64)):(o(),k(J,{key:1},[v(le,{modelValue:t.value.label_id,"onUpdate:modelValue":n[4]||(n[4]=l=>t.value.label_id=l),placeholder:"请选择用户类型",style:{width:"10rem"}},{default:r(()=>[(o(!0),k(J,null,te(B.value,l=>(o(),z(Z,{key:l.label_id,label:l.label_name,value:l.label_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),v(d,{type:"primary",style:{"margin-left":"1rem"},onClick:g},{default:r(()=>[y("确认")]),_:1}),v(d,{style:{"margin-left":"1rem"},onClick:V},{default:r(()=>[y("取消")]),_:1})],64))])])):M("",!0),e("div",za,[Pa,(o(),z(ee,{key:t.value.id,style:{flex:"1"},modelValue:m.value,"onUpdate:modelValue":n[5]||(n[5]=l=>m.value=l),options:G.value,props:Y,load:U,class:"w-full",disabled:L.value},null,8,["modelValue","options","disabled"])),L.value?(o(),z(d,{key:0,type:"primary",style:{"margin-left":"1rem"},onClick:n[6]||(n[6]=l=>L.value=!1)},{default:r(()=>[y("修改")]),_:1})):M("",!0),L.value?M("",!0):(o(),z(d,{key:1,type:"primary",style:{"margin-left":"1rem"},onClick:N},{default:r(()=>[y("确认")]),_:1})),L.value?M("",!0):(o(),z(d,{key:2,style:{"margin-left":"1rem"},onClick:F},{default:r(()=>[y("取消")]),_:1}))])]),ja,e("div",Ea,[e("div",Fa,[e("div",{class:W(["pay-item",{"pay-item-active":_.value.type==1}]),onClick:n[7]||(n[7]=l=>_.value.type=1)},Oa,2),e("div",{class:W(["pay-item",{"pay-item-active":_.value.type==2}]),onClick:n[8]||(n[8]=l=>_.value.type=2)},Ba,2),e("div",{class:W(["pay-item",{"pay-item-active":_.value.type==3}]),onClick:n[9]||(n[9]=l=>_.value.type=3)},Ja,2),e("div",{class:W(["pay-item",{"pay-item-active":_.value.type==0}]),onClick:n[11]||(n[11]=l=>_.value.type=0)},[_e(e("input",{type:"number",class:"input","onUpdate:modelValue":n[10]||(n[10]=l=>_.value.price=l),placeholder:"自定义金额"},null,512),[[Pe,_.value.price]])],2)]),v(d,{type:"primary",size:"large",class:"pay",onClick:f},{default:r(()=>[y("立即支付")]),_:1})])])])):(o(),k("div",Ka,[v(oe)])),v(qt,{ref_key:"payRef",ref:S,onPaySuccess:w},null,512)])}}},Wa=re(Ma,[["__scopeId","data-v-ff0075ff"]]),Ga={class:"my-card"},tl={__name:"index",setup(s){return(t,_)=>(o(),k("div",Ga,[v(ft,{style:{"flex-shrink":"0"},ref:"orderRef"},null,512),v(Ke),v(Wa,{ref:"detailRef"},null,512)]))}};export{tl as default};
|