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