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