import{_ as q,u as J,r as l,b as f,h as E,c as s,k as o,e,t as a,f as _,w as y,g as b,i as W,j as $,F as P,l as T,p as u,m as x,E as U,z as j,d as F,D as X,o as G,a as Y,q as Z,s as ee,n as K,I as L,J as te}from"./index-QWlmoZOY.js";import{d as se,i as oe,w as ie,h as ae}from"./store-ChtKbj0U.js";/* empty css */import{p as le}from"./padding-CEkSWg1M.js";const ne={class:"my-order"},ce={class:"header-nav"},de={class:"nav-item"},_e={class:"nav-item-clear"},re={class:"header-input"},ve={class:"order-lists","infinite-scroll-distance":300,"infinite-scroll-delay":500,"infinite-scroll-immediate":!1,style:{overflow:"auto"}},ue=["onClick"],fe={class:"top"},pe={class:"create-time"},he={class:"shop"},ye={key:0,class:"left"},me={key:0,class:"shop-name"},ke={class:"right"},ge={class:"money"},$e={class:"count"},be={class:"bottom"},we={class:"pay"},Ce={key:0},xe={key:1},Re={key:2},Ie={key:3},ze={key:4},De={key:5},Oe={key:1,style:{color:"#ff4a00"}},Ve={key:0,class:"cashier"},Be={key:1,class:"cashier",style:{color:"#ff4a00"}},Se={key:0,class:"load-end"},Ae={key:1,class:"load-end"},Le={__name:"order",props:{type:{type:Number,default:2}},emits:["backOne"],setup(w,{expose:t,emit:h}){J(),l([]),l(null);const n=l({verify_code:"",page_no:1,page_size:15}),r=l(!1),m=l(0),k=l(0),I=l(!1),c=l([]),p=(C=!1)=>{r.value||(r.value=!0,n.value.verify_code?(n.value.verify_code=n.value.verify_code.replace("—","-"),n.value.verify_code=n.value.verify_code.replace(/\uFF0D/,"-"),n.value.verify_code=n.value.verify_code.replace(" ",""),se({verify_code:n.value.verify_code}).then(d=>{c.value=[d.data],k.value=0,x.emit("set-sale-order-detail",c.value[0]),m.value=d.data.count,r.value=!1,c.value[0].is_writeoff&&U.warning("订单已核销过")}).catch(d=>{r.value=!1})):oe(n.value).then(d=>{c.value=[...c.value,...d.data.lists],n.value.page_no==1&&x.emit("set-sale-order-detail",c.value[0]),m.value=d.data.count,n.value.page_no++,r.value=!1}).catch(d=>{r.value=!1}))},z=(C,d)=>{k.value=d,x.emit("set-sale-order-detail",C)},g=C=>{n.value.verify_code=C,k.value=0,n.value.page_no=1,p(!0)},R=h,D=()=>{x.emit("set-sale-order-detail",{}),c.value=[],R("backOne")};return t({setCode:g}),(C,d)=>{const O=f("el-button"),V=f("el-input"),B=f("el-image"),S=f("spna"),A=E("loading"),H=E("infinite-scroll");return s(),o("div",ne,[e("div",ce,[e("div",de,a(w.type==2?"核销订单":"核销记录"),1),e("div",_e,[_(O,{type:"primary",size:"small",onClick:D},{default:y(()=>[b("返回上一页")]),_:1})])]),e("div",re,[_(V,{modelValue:n.value.verify_code,"onUpdate:modelValue":d[1]||(d[1]=i=>n.value.verify_code=i),placeholder:"请输入核销码",onKeydown:d[2]||(d[2]=W(i=>p(!0),["enter"])),clearable:""},{append:y(()=>[_(O,{type:"primary",style:{"background-color":"#1890ff",color:"#fff","border-radius":"0 0.315rem 0.315rem 0"},onClick:d[0]||(d[0]=i=>p(!0))},{default:y(()=>[b("搜索")]),_:1})]),_:1},8,["modelValue"])]),$((s(),o("div",ve,[(s(!0),o(P,null,T(c.value,(i,N)=>(s(),o("div",{class:j(["item",{"item-active":k.value==N}]),key:N,onClick:M=>z(i,N)},[e("div",fe,[e("div",{class:j(["sn","cahier"])},"单号: "+a(i.order_id),1),e("div",pe,a(i.pay_time),1)]),e("div",he,[i.product?(s(),o("div",ye,[(s(!0),o(P,null,T(i.product.slice(0,5),(M,Q)=>(s(),F(B,{key:Q,src:M.cart_info.image,class:"shop-img"},null,8,["src"]))),128)),i.product.length==1?(s(),o("div",me,a(i.product[0].store_name),1)):u("",!0)])):u("",!0),e("div",ke,[e("div",ge,"¥"+a(i.pay_price),1),e("div",$e,"共"+a(i.total_num)+"款商品",1)])]),e("div",be,[e("div",we,[i.paid?(s(),o("div",Ce,[b(a(i.paid_name)+" ",1),i.pay_type_name?(s(),F(S,{key:0},{default:y(()=>[b("("+a(i.pay_type_name)+")",1)]),_:2},1024)):i.pay_type==9?(s(),o("span",xe,"(微信收款)")):i.pay_type==17?(s(),o("span",Re,"(现金支付)")):i.pay_type==13?(s(),o("span",Ie,"(支付宝收款)")):i.pay_type==3?(s(),o("span",ze,"(余额支付)")):i.pay_type==1?(s(),o("span",De,"(微信支付)")):u("",!0)])):(s(),o("div",Oe,a(i.paid_name),1))]),i.is_writeoff==0?(s(),o("div",Ve,"核销码:"+a(i.verify_code),1)):(s(),o("div",Be,"已核销:"+a(i.verify_code),1))])],10,ue))),128)),I.value?(s(),o("div",Se,"没有更多了")):u("",!0),r.value?(s(),o("div",Ae,"加载中...")):u("",!0)])),[[A,r.value],[H,p]])])}}},Ee=q(Le,[["__scopeId","data-v-8d729586"]]),v=w=>(Z("data-v-1950b4ed"),w=w(),ee(),w),Fe={class:"my-order"},Ne={key:0,class:"detail"},Ke={class:"table","infinite-scroll-distance":300,"infinite-scroll-delay":300,style:{overflow:"auto"},"infinite-scroll-immediate":!1},Ue=v(()=>e("div",{class:"table-title"},"订单信息",-1)),Me={class:"table-info"},Pe={class:"info-item"},Te=v(()=>e("div",{class:"info-item-title"},"订单编号:",-1)),je={class:"info-item-info"},qe={class:"info-item"},Je=v(()=>e("div",{class:"info-item-title"},"商品款数:",-1)),We={class:"info-item-info"},Ge={class:"info-item"},He=v(()=>e("div",{class:"info-item-title"},"商品总价:",-1)),Qe={class:"info-item-info"},Xe={class:"info-item"},Ye=v(()=>e("div",{class:"info-item-title"},"创建时间:",-1)),Ze={class:"info-item-info"},et={class:"info-item"},tt=v(()=>e("div",{class:"info-item-title"},"优惠抵扣:",-1)),st={class:"info-item-info"},ot={class:"info-item"},it=v(()=>e("div",{class:"info-item-title"},"实际支付:",-1)),at={class:"info-item-info"},lt={class:"info-item"},nt=v(()=>e("div",{class:"info-item-title"},"支付时间:",-1)),ct={class:"info-item-info"},dt={class:"info-item"},_t=v(()=>e("div",{class:"info-item-title"},"支付方式:",-1)),rt={class:"info-item-info"},vt={key:0},ut={key:1},ft={key:2},pt={key:3},ht={key:4},yt={key:5},mt={key:0,class:"table-title"},kt={key:1,class:"table-info"},gt={class:"info-item"},$t=v(()=>e("div",{class:"info-item-title"},"用户ID:",-1)),bt={class:"info-item-info"},wt={class:"info-item"},Ct=v(()=>e("div",{class:"info-item-title"},"用户昵称:",-1)),xt={class:"info-item-info"},Rt={class:"info-item"},It=v(()=>e("div",{class:"info-item-title"},"用户电话:",-1)),zt={class:"info-item-info"},Dt={style:{"font-size":"0.9rem"}},Ot={style:{color:"#ff4a00"}},Vt={style:{display:"flex","align-items":"center"}},Bt={style:{"margin-left":"0.5rem"}},St=v(()=>e("div",{style:{height:"8rem"}},null,-1)),At={class:"footer"},Lt={key:1},Et={key:1},Ft={__name:"detail",setup(w){J(),X();const t=l({id:""});l([]),l(null);const h=l(!1);l(0),l(0),l(["商品信息","订单详情"]),l(""),l(!1);const n=l({page_no:1,page_size:15,loadend:!1,loading:!1}),r=l([]),m=()=>console.log("触底"),k=()=>{ie({verify_code:t.value.verify_code}).then(c=>{c.show==0&&c.msg=="核销成功"&&U.success(c.msg),t.value.is_writeoff=1})},I=()=>{ae({id:t.value.id}).then(c=>{x.emit("letPrintReceipt",c.data)})};return G(()=>{x.on("set-sale-order-detail",c=>{console.log("===",c),t.value=c,n.value.page_no=1,n.value.loadend=!1,n.value.loading=!1,r.value=[]})}),Y(()=>{x.off("set-sale-order-detail")}),(c,p)=>{var V;const z=f("el-image"),g=f("el-table-column"),R=f("el-table"),D=f("el-button"),C=f("el-empty"),d=E("infinite-scroll"),O=E("loading");return s(),o("div",Fe,[t.value.id?$((s(),o("div",Ne,[$((s(),o("div",Ke,[Ue,e("div",Me,[e("div",Pe,[Te,e("div",je,a(t.value.order_id),1)]),e("div",qe,[Je,e("div",We,a(t.value.total_num||0),1)]),e("div",Ge,[He,e("div",Qe,"¥"+a(t.value.pay_price),1)]),e("div",Xe,[Ye,e("div",Ze,a(t.value.pay_time),1)]),e("div",et,[tt,e("div",st,"¥"+a(t.value.deduction_price),1)]),e("div",ot,[it,e("div",at,"¥"+a(t.value.pay_price),1)]),e("div",lt,[nt,e("div",ct,a(t.value.pay_time),1)]),e("div",dt,[_t,e("div",rt,[t.value.pay_type_name?(s(),o("span",vt,a(t.value.pay_type_name),1)):t.value.pay_type==9?(s(),o("span",ut,"微信收款")):t.value.pay_type==17?(s(),o("span",ft,"现金支付")):t.value.pay_type==13?(s(),o("span",pt,"支付宝收款")):t.value.pay_type==3?(s(),o("span",ht,"余额支付")):t.value.pay_type==1?(s(),o("span",yt,"微信支付")):u("",!0)])])]),t.value.uid?(s(),o("div",mt,"用户信息")):u("",!0),t.value.uid?(s(),o("div",kt,[e("div",gt,[$t,e("div",bt,a(t.value.uid),1)]),e("div",wt,[Ct,e("div",xt,a(t.value.nickname),1)]),e("div",Rt,[It,e("div",zt,a(t.value.mobile),1)])])):u("",!0),e("div",Dt,[b(" 共计 "),e("span",Ot,a(((V=t.value.product)==null?void 0:V.length)||" "),1),b(" 款商品 ")]),_(R,{data:t.value.product},{default:y(()=>[_(g,{label:"商品信息"},{default:y(({row:B})=>{var S,A;return[e("div",Vt,[_(z,{style:{height:"3rem",width:"3rem","flex-shrink":"0"},src:(S=B.cart_info)==null?void 0:S.image},null,8,["src"]),e("span",Bt,a((A=B.cart_info)==null?void 0:A.name),1)])]}),_:1}),_(g,{prop:"cart_info.price",label:"单价",width:"150"}),_(g,{prop:"cart_info.cart_num",label:"数量",width:"150"}),_(g,{prop:"cart_info.pay_price",label:"总价",width:"150"})]),_:1},8,["data"]),St])),[[d,m]]),e("div",At,[t.value.is_writeoff==0?(s(),F(D,{key:0,type:"primary",size:"large",disabled:t.value.is_writeoff,onClick:k},{default:y(()=>[b("立即核销")]),_:1},8,["disabled"])):u("",!0),t.value.is_writeoff==1?(s(),o("div",Lt,"该订单已核销")):u("",!0),t.value.is_writeoff==1?(s(),F(D,{key:2,style:{"margin-left":"1rem"},type:"warning",size:"large",onClick:I},{default:y(()=>[b("打印小票")]),_:1})):u("",!0)])])),[[O,h.value]]):(s(),o("div",Et,[_(C,{description:"没找到核销订单信息"})]))])}}},Nt=q(Ft,[["__scopeId","data-v-1950b4ed"]]),Kt={class:"my-card"},Ut={class:"my-code"},Mt=e("h2",null,"订单核销",-1),Pt={class:"box"},Tt=e("span",null,"查看核销记录",-1),Gt={__name:"index",setup(w){const t=l(1),h=l(""),n=l(null),r=l(null),m=()=>{if(h.value=="")return U.error("请输入订单编号");t.value=2,K(()=>{r.value.setCode(h.value)})},k=()=>{t.value=3,K(()=>{r.value.setCode("")})},I=()=>{m()};return G(()=>{K(()=>{n.value.focus()})}),(c,p)=>{const z=f("ArrowRightBold"),g=f("el-icon");return s(),o("div",Kt,[$(e("div",Ut,[Mt,e("div",Pt,[$(e("input",{ref_key:"inputRef",ref:n,"onUpdate:modelValue":p[0]||(p[0]=R=>h.value=R),placeholder:"",class:"input",onKeyup:W(m,["enter"])},null,544),[[te,h.value]]),e("div",{class:"btn",onClick:m},"查询")]),e("div",{class:"to-list",onClick:k},[Tt,_(g,null,{default:y(()=>[_(z)]),_:1})])],512),[[L,t.value==1]]),$(_(Ee,{type:t.value,style:{"flex-shrink":"0"},ref_key:"orderRef",ref:r,onBackOne:p[1]||(p[1]=R=>{t.value=1,h.value=""})},null,8,["type"]),[[L,t.value!=1]]),$(_(le,null,null,512),[[L,t.value!=1]]),$(_(Nt,{ref:"detailRef",onReInit:I},null,512),[[L,t.value!=1]])])}}};export{Gt as default};