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