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