import{C as e,E as t,M as n,O as r,T as i,_ as a,a as o,b as s,f as c,g as l,h as u,j as d,k as f,l as p,m,n as h,o as g,s as _,t as v,w as y,x as b,y as x}from"./index-vhvNh9F8.js";var S={style:{display:`flex`,background:`#fff`,padding:`8px 4px`,"border-bottom":`1px solid #eee`,"overflow-x":`auto`}},C=[`onClick`],w={__name:`OrderStatusBar`,props:{tabs:{type:Object,required:!0},current:{type:String,default:`all`}},emits:[`change`],setup(t){return(r,i)=>(e(),a(`div`,S,[(e(!0),a(c,null,y(t.tabs,(i,o)=>(e(),a(`span`,{key:o,style:d([{"flex-shrink":`0`,padding:`4px 14px`,margin:`0 4px`,"border-radius":`14px`,"font-size":`13px`,cursor:`pointer`,transition:`all .2s`},{background:t.current===o?`var(--primary)`:`#f5f6fa`,color:t.current===o?`#fff`:`#666`}]),onClick:e=>r.$emit(`change`,o)},n(i),13,C))),128))]))}},T={class:`page`},E={class:`card-body`},D={style:{display:`flex`,"justify-content":`space-between`,"font-size":`12px`,color:`#999`}},O={style:{flex:`1`,"min-width":`0`}},k={style:{"font-size":`13px`,overflow:`hidden`,"text-overflow":`ellipsis`,"white-space":`nowrap`}},A={style:{color:`#999`,"font-size":`12px`,"margin-top":`4px`}},j={style:{"text-align":`right`,"font-size":`13px`,"margin-top":`6px`}},M={style:{color:`var(--danger)`}},N={style:{display:`flex`,gap:`8px`,"justify-content":`flex-end`,"margin-top":`8px`}},P=_({__name:`Orders`,setup(_){let S=p(),C=r(localStorage.getItem(`token`)||``),P=r([]),F=r(!1),I=r(!1),L=r(1),R=r(`all`),z={all:`全部`,pending_pay:`待付款`,pending_ship:`待发货`,shipped:`已发货`,received:`已收货`,completed:`已完成`};function B(e){R.value=e,L.value=1,I.value=!1,P.value=[],V()}async function V(){if(!C.value){I.value=!0;return}if(!F.value){F.value=!0;try{let e={page:L.value,pageSize:10};R.value!==`all`&&(e.status=R.value);let t=await o.get(`/order/list`,{params:e,headers:{Authorization:`Bearer `+C.value}});if(t.code===0){let e=t.data.list||[];L.value===1?P.value=e:P.value=[...P.value,...e],I.value=e.length<10,I.value||L.value++}else I.value=!0}catch{I.value=!0}F.value=!1}}function H(e){e.pay_url?window.location.href=e.pay_url:alert(`支付通道暂未开放`)}function U(e){S.push(`/review-list?order_no=`+e.order_no)}function W(e){S.push(`/follow-up?order_no=`+e.order_no)}return b(()=>{C.value&&V()}),(r,o)=>{let p=i(`van-image`),_=i(`van-button`),b=i(`van-list`),C=i(`van-empty`);return e(),a(`div`,T,[s(g,{title:`我的订单`,onBack:o[0]||=e=>f(S).push(`/user`)}),s(w,{tabs:z,current:R.value,onChange:B},null,8,[`current`]),s(b,{loading:F.value,"onUpdate:loading":o[1]||=e=>F.value=e,finished:I.value,"finished-text":`没有更多了`,onLoad:V,"immediate-check":!1},{default:t(()=>[(e(!0),a(c,null,y(P.value,r=>(e(),a(`div`,{key:r.order_no,class:`card`},[m(`div`,E,[m(`div`,D,[m(`span`,null,n(r.created_at),1),m(`span`,{style:d({color:r.status===`pending_pay`?`var(--danger)`:`var(--success)`})},n(f(h)(r.status)),5)]),(e(!0),a(c,null,y(r.items,r=>(e(),a(`div`,{key:r.id,style:{display:`flex`,gap:`10px`,"margin-top":`8px`}},[s(p,{src:r.image,style:{width:`60px`,height:`60px`,"border-radius":`4px`,"object-fit":`cover`,"flex-shrink":`0`},"lazy-load":``},{error:t(()=>[...o[2]||=[m(`div`,{class:`img-placeholder`,style:{width:`60px`,height:`60px`,"border-radius":`4px`,"font-size":`14px`}},`📷`,-1)]]),_:1},8,[`src`]),m(`div`,O,[m(`div`,k,n(r.product_name),1),m(`div`,A,`¥`+n(f(v)(r.price))+` x `+n(r.quantity),1)])]))),128)),m(`div`,j,[o[3]||=x(`实付: `,-1),m(`b`,M,`¥`+n(f(v)(r.pay_amount)),1)]),m(`div`,N,[r.status===`pending_pay`?(e(),u(_,{key:0,plain:``,size:`mini`,round:``,class:`primary-btn--plain`,onClick:e=>H(r)},{default:t(()=>[...o[4]||=[x(`去支付`,-1)]]),_:1},8,[`onClick`])):l(``,!0),r.status===`received`?(e(),u(_,{key:1,plain:``,size:`mini`,round:``,class:`primary-btn--plain`,onClick:e=>U(r)},{default:t(()=>[...o[5]||=[x(`去评价`,-1)]]),_:1},8,[`onClick`])):l(``,!0),r.status===`received`||r.status===`completed`?(e(),u(_,{key:2,plain:``,size:`mini`,round:``,class:`primary-btn--plain`,onClick:e=>W(r)},{default:t(()=>[...o[6]||=[x(`追评`,-1)]]),_:1},8,[`onClick`])):l(``,!0)])])]))),128))]),_:1},8,[`loading`,`finished`]),!P.value.length&&!F.value?(e(),u(C,{key:0,description:`暂无订单`})):l(``,!0)])}}},[[`__scopeId`,`data-v-820dfee0`]]);export{P as default};