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