import{_ as F,u as q,L as te,r as i,o as T,m as z,a as W,b as p,s as x,c as a,h as d,e,f as s,w as u,g as w,v as se,z as N,F as O,i as E,y as oe,t as c,d as le,A as y,R as ae,S as ie,T as de,E as ne,B as K,C as P,P as re,Q as _e,U as ce}from"./index-D1f-ww4d.js";import{h as ue}from"./moment-Cl4UOzQZ.js";/* empty css */import{p as ve}from"./padding-KS62mXF5.js";const Q=V=>(K("data-v-27ca906a"),V=V(),P(),V),me={class:"my-order"},fe={class:"header-nav"},pe=Q(()=>e("div",{class:"nav-item"},c("待提交采购订单"),-1)),he={class:"nav-item-btn"},ge={class:"header-input"},ye={class:"order-lists","infinite-scroll-distance":300,"infinite-scroll-delay":500,style:{overflow:"auto"}},be=["onClick"],$e={class:"top"},ke={class:"sn"},we={class:"create-time"},Ve={class:"shop"},Ce={key:0,class:"left"},Ae={key:0,class:"shop-name"},ze={class:"right"},De={class:"money"},Le={class:"count"},Ue={class:"bottom"},Se={class:"pay"},Re={key:0},Ye={key:0},xe={key:1},Me={key:2},Be={key:1,style:{color:"#ff4a00"}},Ie={key:0,class:"cashier"},Ne={key:0,class:"load-end"},Oe={key:1,class:"load-end"},Ee=Q(()=>e("div",{style:{width:"100%",height:"7rem"}},null,-1)),Fe={key:0,class:"bottom-btn-fiexd"},qe={class:"dialog-footer"},Te={__name:"order",props:{isSystem:{type:Boolean,default:!1},source:{type:Number,default:0}},emits:["addAddress"],setup(V,{expose:U,emit:t}){q();const D=te();i([]);const o=i(1);i(null);const A=f=>{v(!0)},L=f=>f.getTime()>Date.now(),m=i({page_no:1,page_size:20,number:"",date:ue(new Date).format("YYYY-MM-DD"),is_mer:1}),_=i(!1),r=i(0),$=i(0),h=i(!1),k=i([]),v=(f=!1)=>{if(f)m.value.page_no=1;else if(h.value||_.value)return;_.value=!0,o.value==1&&(m.value.paid=null),o.value==2&&(m.value.paid=0),C.value=!1,ie(m.value).then(n=>{f?k.value=n.data.lists:k.value=[...k.value,...n.data.lists],n.data.lists.length{h.value=!0,_.value=!1})},S=()=>{de().then(f=>{ne.success("提交成功"),v(!0),z.emit("set-order-count-zero",f.data)})},g=(f,n)=>{$.value=n,z.emit("set-c-order-detail",f)};U({getOrderList:v});const M=t,Y=f=>{M("addAddress",f)},C=i(!1);return T(()=>{z.on("update-c-order-detail",f=>{k.value[$.value].paid=1}),C.value=!0,z.on("new_order",()=>{D.name=="order"&&(C.value=!0)})}),W(()=>{z.off("update-c-order-detail")}),(f,n)=>{const j=p("el-date-picker"),R=p("el-button"),G=p("el-input"),H=p("el-image"),J=p("el-dialog"),X=x("loading"),Z=x("infinite-scroll");return a(),d("div",me,[e("div",fe,[pe,e("div",he,[s(j,{modelValue:m.value.date,"onUpdate:modelValue":n[0]||(n[0]=l=>m.value.date=l),type:"date",placeholder:"请选择时间",size:"small",clearable:!1,"value-format":"YYYY-MM-DD","disabled-date":L,onChange:A},null,8,["modelValue"])])]),e("div",ge,[s(G,{modelValue:m.value.number,"onUpdate:modelValue":n[2]||(n[2]=l=>m.value.number=l),placeholder:"请输入订单编号",onKeydown:n[3]||(n[3]=se(l=>v(!0),["enter"])),onClear:n[4]||(n[4]=l=>v(!0)),clearable:""},{append:u(()=>[s(R,{type:"primary",style:{"background-color":"#1890ff",color:"#fff","border-radius":"0 0.315rem 0.315rem 0"},onClick:n[1]||(n[1]=l=>v(!0))},{default:u(()=>[w("搜索")]),_:1})]),_:1},8,["modelValue"])]),N((a(),d("div",ye,[(a(!0),d(O,null,E(k.value,(l,B)=>(a(),d("div",{class:oe(["item",{"item-active":$.value==B}]),key:B,onClick:I=>g(l,B)},[e("div",$e,[e("div",ke,"单号: "+c(l.number),1),e("div",we,c(l.create_time),1)]),e("div",Ve,[l.goods_list?(a(),d("div",Ce,[(a(!0),d(O,null,E(l.goods_list.slice(0,5),(I,ee)=>(a(),le(H,{key:ee,src:I.imgs,class:"shop-img"},null,8,["src"]))),128)),l.goods_list.length==1?(a(),d("div",Ae,c(l.goods_list[0].class_name),1)):y("",!0)])):y("",!0),e("div",ze,[e("div",De,"¥"+c(l.total),1),e("div",Le,"共"+c(l.goods_count)+"款商品",1)])]),e("div",Ue,[e("div",Se,[l.paid?(a(),d("div",Re,[w(" 已支付 "),l.pay_type==9?(a(),d("span",Ye,"(微信收款)")):y("",!0),l.pay_type==3?(a(),d("span",xe,"(余额支付)")):y("",!0),l.pay_type==1?(a(),d("span",Me,"(微信支付)")):y("",!0)])):(a(),d("div",Be,"未支付"))]),l.address_id?y("",!0):(a(),d("div",Ie,[s(R,{size:"small",type:"primary",onClick:ae(I=>Y(l),["stop"])},{default:u(()=>[w("添加收货地址")]),_:2},1032,["onClick"])]))])],10,be))),128)),h.value?(a(),d("div",Ne,"没有更多了")):y("",!0),_.value?(a(),d("div",Oe,"加载中...")):y("",!0),Ee])),[[X,_.value],[Z,v]]),_.value?y("",!0):(a(),d("div",Fe,[s(R,{class:"btn",type:"primary",onClick:S,disabled:!k.value.length},{default:u(()=>[w(" 提交采购")]),_:1},8,["disabled"])])),s(J,{modelValue:C.value,"onUpdate:modelValue":n[7]||(n[7]=l=>C.value=l),title:"您有新的订单,是否立即刷新",width:"500","before-close":f.handleClose},{footer:u(()=>[e("div",qe,[s(R,{onClick:n[5]||(n[5]=l=>C.value=!1)},{default:u(()=>[w("稍后刷新")]),_:1}),s(R,{type:"primary",onClick:n[6]||(n[6]=l=>v(!0))},{default:u(()=>[w(" 立即刷新 ")]),_:1})])]),_:1},8,["modelValue","before-close"])])}}},We=F(Te,[["__scopeId","data-v-27ca906a"]]),b=V=>(K("data-v-0317eb70"),V=V(),P(),V),Ke={class:"my-order"},Pe={class:"detail"},Qe={key:0,class:"table","infinite-scroll-distance":300,"infinite-scroll-delay":300,style:{overflow:"auto"},"infinite-scroll-immediate":!1},je=b(()=>e("div",{class:"table-title"},"订单信息",-1)),Ge={class:"table-info"},He={class:"info-item"},Je=b(()=>e("div",{class:"info-item-title"},"订单编号:",-1)),Xe={class:"info-item-info"},Ze={class:"info-item"},et=b(()=>e("div",{class:"info-item-title"},"商品款数:",-1)),tt={class:"info-item-info"},st={class:"info-item"},ot=b(()=>e("div",{class:"info-item-title"},"商品总价:",-1)),lt={class:"info-item-info"},at={class:"info-item"},it=b(()=>e("div",{class:"info-item-title"},"创建时间:",-1)),dt={class:"info-item-info"},nt={class:"info-item"},rt=b(()=>e("div",{class:"info-item-title"},"优惠抵扣:",-1)),_t={class:"info-item-info"},ct={class:"info-item"},ut=b(()=>e("div",{class:"info-item-title"},"实际支付:",-1)),vt={class:"info-item-info"},mt={class:"info-item"},ft=b(()=>e("div",{class:"info-item-title"},"支付时间:",-1)),pt={class:"info-item-info"},ht={class:"info-item"},gt=b(()=>e("div",{class:"info-item-title"},"支付方式:",-1)),yt={class:"info-item-info"},bt={key:0},$t={key:1},kt={key:2},wt=b(()=>e("div",{class:"table-title"},"收货人信息",-1)),Vt={key:0,class:"table-info",style:{"flex-direction":"column"}},Ct={class:"info-item"},At=b(()=>e("div",{class:"info-item-title"},"收货人:",-1)),zt={class:"info-item-info"},Dt={class:"info-item"},Lt=b(()=>e("div",{class:"info-item-title"},"联系方式:",-1)),Ut={class:"info-item-info"},St={class:"info-item"},Rt=b(()=>e("div",{class:"info-item-title"},"收货地址:",-1)),Yt={class:"info-item-info"},xt={key:1,class:"addAddress"},Mt={style:{"font-size":"0.9rem"}},Bt={style:{color:"#ff4a00"}},It={style:{display:"flex","align-items":"center"}},Nt={style:{"margin-left":"0.5rem"}},Ot={__name:"detail",emits:["addAddress"],setup(V,{emit:U}){q(),re();const t=i({id:""});i([]),i(null);const D=i(!1);i(0),i(0),i(["商品信息","订单详情"]),i(""),i(!1);const o=i({page_no:1,page_size:15,loadend:!1,loading:!1}),A=i([]),L=()=>{console.log("触底"),t.value.id&&!o.value.loadend&&(console.log("加载"),o.value.loading=!0,_e({pid:t.value.id,page_no:o.value.page_no,page_size:o.value.page_size}).then(r=>{A.value=[...A.value,...r.data.lists],r.data.lists.length{m("addAddress",r)};return T(()=>{z.on("set-c-order-detail",r=>{t.value=r,o.value.page_no=1,o.value.loadend=!1,o.value.loading=!1,A.value=[],L()})}),W(()=>{z.off("set-c-order-detail")}),(r,$)=>{var Y;const h=p("el-button"),k=p("el-image"),v=p("el-table-column"),S=p("el-table"),g=x("loading"),M=x("infinite-scroll");return a(),d("div",Ke,[N((a(),d("div",Pe,[(Y=t.value)!=null&&Y.id?N((a(),d("div",Qe,[je,e("div",Ge,[e("div",He,[Je,e("div",Xe,c(t.value.number),1)]),e("div",Ze,[et,e("div",tt,c(t.value.goods_count),1)]),e("div",st,[ot,e("div",lt,"¥"+c(t.value.total),1)]),e("div",at,[it,e("div",dt,c(t.value.create_time),1)]),e("div",nt,[rt,e("div",_t,"¥"+c(t.value.deduction_price),1)]),e("div",ct,[ut,e("div",vt,"¥"+c(t.value.actual),1)]),e("div",mt,[ft,e("div",pt,c(t.value.update_time),1)]),e("div",ht,[gt,e("div",yt,[t.value.pay_type==9?(a(),d("span",bt,"微信收款")):y("",!0),t.value.pay_type==3?(a(),d("span",$t,"余额支付")):y("",!0),t.value.pay_type==1?(a(),d("span",kt,"微信支付")):y("",!0)])])]),wt,t.value.user_phone?(a(),d("div",Vt,[e("div",Ct,[At,e("div",zt,c(t.value.real_name),1)]),e("div",Dt,[Lt,e("div",Ut,c(t.value.user_phone),1)]),e("div",St,[Rt,e("div",Yt,c(t.value.user_address),1)])])):(a(),d("div",xt,[s(h,{type:"primary",onClick:$[0]||($[0]=C=>_(t.value)),size:"large"},{default:u(()=>[w("点击添加收货地址")]),_:1})])),e("div",Mt,[w(" 共计 "),e("span",Bt,c(t.value.goods_count),1),w(" 款商品 ")]),s(S,{data:A.value},{default:u(()=>[s(v,{label:"商品信息"},{default:u(({row:C})=>[e("div",It,[s(k,{style:{height:"3rem",width:"3rem"},src:C.imgs},null,8,["src"]),e("span",Nt,c(C.goods_name),1)])]),_:1}),s(v,{prop:"price",label:"单价",width:"150"}),s(v,{prop:"nums",label:"数量",width:"150"}),s(v,{prop:"total",label:"总价",width:"150"})]),_:1},8,["data"])])),[[g,D.value],[M,L]]):y("",!0)])),[[g,D.value]])])}}},Et=F(Ot,[["__scopeId","data-v-0317eb70"]]),Ft={class:"my-card"},qt={class:"dialog-footer"},Qt={__name:"index",setup(V){const U=i(null),t=i(!1),D=_=>{_.id!=o.value.order_id?o.value={real_name:"",phone:"",detail:"",order_id:_.id}:o.value.order_id=_.id,t.value=!0},o=i({real_name:"",phone:"",detail:"",order_id:""}),A=i({real_name:[{required:!0,message:"请输入姓名",trigger:"blur"}],phone:[{required:!0,message:"请输入手机号",trigger:"blur"}],detail:[{required:!0,message:"请输入地址",trigger:"blur"}]}),L=i(null),m=()=>{var _;(_=L.value)==null||_.validate(r=>{r&&ce(o.value).then($=>{var h;t.value=!1,(h=U.value)==null||h.getOrderList(!0)})})};return(_,r)=>{const $=p("el-input"),h=p("el-form-item"),k=p("el-form"),v=p("el-button"),S=p("el-dialog");return a(),d("div",Ft,[s(We,{style:{"flex-shrink":"0"},ref_key:"orderRef",ref:U,onAddAddress:D},null,512),s(ve),s(Et,{ref:"detailRef",onAddAddress:D},null,512),s(S,{modelValue:t.value,"onUpdate:modelValue":r[4]||(r[4]=g=>t.value=g),title:"添加地址",width:"500"},{footer:u(()=>[e("div",qt,[s(v,{onClick:r[3]||(r[3]=g=>t.value=!1)},{default:u(()=>[w("取消")]),_:1}),s(v,{type:"primary",onClick:m},{default:u(()=>[w(" 确认 ")]),_:1})])]),default:u(()=>[s(k,{ref_key:"formRef",ref:L,model:o.value,"label-width":"100",rules:A.value},{default:u(()=>[s(h,{label:"收货人","label-width":_.formLabelWidth,prop:"real_name"},{default:u(()=>[s($,{modelValue:o.value.real_name,"onUpdate:modelValue":r[0]||(r[0]=g=>o.value.real_name=g),autocomplete:"off",placeholder:"请输入收货人"},null,8,["modelValue"])]),_:1},8,["label-width"]),s(h,{label:"电话","label-width":_.formLabelWidth,prop:"phone"},{default:u(()=>[s($,{modelValue:o.value.phone,"onUpdate:modelValue":r[1]||(r[1]=g=>o.value.phone=g),type:"number",placeholder:"请输入电话"},null,8,["modelValue"])]),_:1},8,["label-width"]),s(h,{label:"地址","label-width":_.formLabelWidth,prop:"detail"},{default:u(()=>[s($,{modelValue:o.value.detail,"onUpdate:modelValue":r[2]||(r[2]=g=>o.value.detail=g),placeholder:"请输入地址"},null,8,["modelValue"])]),_:1},8,["label-width"])]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])])}}};export{Qt as default};