import{u as D,Q as Y,d as w,o as I,U as M,j as e,c as t,a9 as S,T as i,a as j,cX as b,b as r,cV as f,ai as p,aC as k,aD as c,aL as B,an as R,cw as $,n as N,aM as y,a6 as E,az as L,aB as O,aE as U,C as F,R as _,W as V,aq as H}from"../index.Crez7j-Y.bundle.js";import{P as q}from"./PreviousOrderAPIs.DG34jGDX.bundle.js";import{E as u}from"./ExpandSection.D-EhWsaW.bundle.js";import{u as A}from"./useClaimHooks.DyLDR42V.bundle.js";const G=(l,n)=>{const{getPreviousOrderDetailAPI:s}=q();return D({queryKey:Y.getPreviousOrderDetail(l),queryFn:()=>s(l),...n})},Q=w.memo(()=>{const l=I(),n=w.useCallback(()=>{l(M.MYPAGE_PREVIOUS_ORDER_LIST)},[]);return e.jsx(t,{mx:"auto",width:300,my:5,children:e.jsx(S,{sx:{py:1.5},fullWidth:!0,color:"black",variant:"contained",onClick:n,children:e.jsx(i,{variant:"button",children:"목록 보기"})})})});function z({receiver:l,isPending:n}){const{isMobile:s}=j();return e.jsxs(b,{isMobile:s,children:[e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"받으시는 분"})}),e.jsx(t,{flex:s?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[l==null?void 0:l.receiverName,n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"주소"})}),e.jsx(t,{flex:s?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:["(".concat(l==null?void 0:l.receiverZipCd,") "),"".concat(l==null?void 0:l.receiverAddress," ").concat(l==null?void 0:l.receiverDetailAddress),n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"휴대폰 번호"})}),e.jsx(t,{flex:s?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[f(l==null?void 0:l.receiverMobileNumber),n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"전화번호"})}),e.jsx(t,{flex:s?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[f(l==null?void 0:l.receiverPhoneNumber),n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"배송 메모"})}),e.jsx(t,{flex:s?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[f(l==null?void 0:l.deliveryMemo),n&&e.jsx(r,{width:"50%"})]})})]})]})}function T(l){const{isDesktop:n,isMobile:s}=j();return e.jsxs(e.Fragment,{children:[n&&e.jsx(K,{...l}),s&&e.jsx(X,{...l})]})}function K(l){const{index:n,length:s,orderProduct:a,mainPayAmt:x,orderYmdt:d,orderNo:o}=l,{formatPriceWithCommas:h}=p(),{getClaimStatusTypeLabel:g}=A();return e.jsxs(k,{children:[n===0&&e.jsxs(c,{rowSpan:s,align:"center",children:[e.jsx(i,{variant:"body",component:"p",fontWeight:500,children:d&&B(d).format("YYYY-MM-DD")}),e.jsx(i,{variant:"small",component:"p",children:o})]}),e.jsx(c,{children:e.jsx(t,{display:"flex",children:e.jsxs(t,{display:"flex",flexDirection:"column",justifyContent:"center",px:1,gap:1,children:[e.jsx(i,{variant:"body",fontWeight:500,children:a.productName}),e.jsx(i,{variant:"small",children:a.optionValue}),a.purchaserInputs.map(m=>e.jsx(i,{variant:"body",children:m.inputValue}))]})})}),e.jsx(c,{align:"center",children:e.jsx(i,{variant:"body",children:a.orderCnt})}),n===0&&e.jsx(c,{align:"center",rowSpan:s,children:e.jsx(i,{variant:"body",children:h(x,"WON")})}),e.jsx(c,{align:"center",children:e.jsx(R,{title:e.jsx(i,{variant:"subtitle1",fontWeight:400,children:"최신 배송상태는 이전 주문 배송상태 확인하기 링크를 통해 확인하실 수 있습니다."}),children:e.jsxs(t,{display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx($,{color:"error"}),e.jsx(i,{variant:"body",children:g(a.orderStatusType)})]})})})]})}function X(l){const{orderProduct:n,mainPayAmt:s}=l,{formatPriceWithCommas:a}=p(),{getClaimStatusTypeLabel:x}=A();return e.jsx(t,{p:3,my:2,bgcolor:N,display:"flex",justifyContent:"space-between",children:e.jsxs(t,{display:"flex",flexDirection:"column",justifyContent:"center",gap:1,children:[e.jsx(i,{variant:"subtitle1",children:n.productName}),e.jsx(i,{variant:"body",children:n.optionValue}),e.jsxs(t,{display:"flex",gap:1,children:[e.jsx(i,{variant:"subtitle1",children:"수량 : ".concat(n.orderCnt," 개")}),e.jsx(y,{}),e.jsx(i,{variant:"subtitle1",children:"최종 결제금액 : ".concat(a(s,"WON"))}),e.jsx(y,{})]}),e.jsx(i,{variant:"subtitle1",children:x(n.orderStatusType)})]})})}function Z(l){const{isDesktop:n,isMobile:s}=j();return e.jsxs(t,{bgcolor:E,p:s?0:3,borderRadius:2,children:[n&&e.jsx(J,{...l}),s&&e.jsx(ee,{...l})]})}function J(l){const{orderNo:n,previousOrderDetail:s,isPending:a}=l;return e.jsxs(L,{size:"small",sx:{"& th":{py:1,px:0,bgcolor:N},"& td":{py:1,px:0}},children:[e.jsx(O,{children:e.jsxs(k,{children:[e.jsx(c,{width:150,align:"center",children:e.jsx(i,{variant:"body",fontWeight:500,children:"주문일자(주문번호)"})}),e.jsx(c,{width:300,align:"center",children:e.jsx(i,{variant:"body",fontWeight:500,children:"상품정보"})}),e.jsx(c,{width:70,align:"center",children:e.jsx(i,{variant:"body",fontWeight:500,children:"수량"})}),e.jsx(c,{width:100,align:"center",children:e.jsx(i,{variant:"body",fontWeight:500,children:"최종 결제금액"})}),e.jsx(c,{width:100,align:"center",children:e.jsx(i,{variant:"body",fontWeight:500,children:"진행상태"})})]})}),e.jsxs(U,{children:[a&&Array.from({length:5}).map((x,d)=>e.jsx(k,{children:Array.from({length:6}).map((o,h)=>e.jsx(c,{children:e.jsx(r,{sx:{height:100,width:"70%",margin:"auto"}})},h*10))},d)),s==null?void 0:s.orderProduct.map((x,d,o)=>e.jsx(T,{orderProduct:x,index:d,length:o.length,mainPayAmt:s.lastPayment.mainPayAmt,orderYmdt:s.paymentMethod.orderYmdt,orderNo:n},d))]})]})}function ee(l){const{orderNo:n,previousOrderDetail:s,isPending:a}=l;return a?e.jsx(e.Fragment,{children:Array.from({length:3}).map((x,d)=>e.jsxs(t,{display:"flex",gap:2,mb:2,children:[e.jsx(r,{variant:"rectangular",sx:{height:100,flex:1}}),e.jsxs(t,{flex:2,children:[e.jsx(r,{variant:"text"}),e.jsx(r,{variant:"text"}),e.jsx(r,{variant:"text"}),e.jsx(r,{variant:"text"})]})]},d))}):e.jsxs(e.Fragment,{children:[e.jsxs(t,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(i,{variant:"subtitle1",children:B(s==null?void 0:s.paymentMethod.orderYmdt).format("YYYY-MM-DD")}),e.jsx(i,{variant:"subtitle1",color:F,children:n})]}),s==null?void 0:s.orderProduct.map((x,d,o)=>e.jsx(T,{index:d,length:o.length,orderProduct:x,mainPayAmt:s.lastPayment.mainPayAmt,orderYmdt:s.paymentMethod.orderYmdt,orderNo:n},d))]})}function se(l){const{orderer:n,isPending:s}=l,{isMobile:a}=j();return e.jsxs(b,{isMobile:a,children:[e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"주문자 명"})}),e.jsx(t,{flex:a?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[n==null?void 0:n.ordererName,s&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"이메일"})}),e.jsx(t,{flex:a?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[n==null?void 0:n.ordererEmail,s&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"휴대폰 번호"})}),e.jsx(t,{flex:a?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[f(n==null?void 0:n.ordererMobileNumber),s&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"전화번호"})}),e.jsx(t,{flex:a?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[f(n==null?void 0:n.ordererPhoneNumber),s&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"주문 메모"})}),e.jsx(t,{flex:a?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[f(n==null?void 0:n.orderMemo),s&&e.jsx(r,{width:"50%"})]})})]})]})}function te(l){var g,m,v,W,P,C;const{isPending:n,lastPayment:s,paymentMethod:a}=l,{formatPriceWithCommas:x,formatPriceWithSign:d}=p(),o=w.useCallback(()=>!a||!a.payDetail.account?!1:a.payType.includes("ACCOUNT"),[a]),{isMobile:h}=j();return e.jsxs(e.Fragment,{children:[e.jsxs(b,{isMobile:h,children:[e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"결제 수단"})}),e.jsx(t,{flex:h?3:4,children:e.jsxs(i,{variant:"subtitle1",sx:{wordBreak:"break-all",fontWeight:400},children:[a==null?void 0:a.payTypeLabel,n&&e.jsx(r,{width:"50%"})]})})]}),o()&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"입금 은행"})}),e.jsx(t,{flex:h?3:4,children:e.jsxs(i,{variant:"subtitle1",fontWeight:400,sx:{wordBreak:"break-all"},children:[(g=a==null?void 0:a.payDetail)==null?void 0:g.bank,n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"계좌 번호"})}),e.jsx(t,{flex:h?3:4,children:e.jsxs(i,{variant:"subtitle1",fontWeight:400,sx:{wordBreak:"break-all"},children:[(m=a==null?void 0:a.payDetail)==null?void 0:m.account,n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"예금주명"})}),e.jsx(t,{flex:h?3:4,children:e.jsxs(i,{variant:"subtitle1",fontWeight:400,sx:{wordBreak:"break-all"},children:[a==null?void 0:a.payDetail.accountHolder,n&&e.jsx(r,{width:"50%"})]})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"입금자명"})}),e.jsx(t,{flex:h?3:4,children:e.jsxs(i,{variant:"subtitle1",fontWeight:400,sx:{wordBreak:"break-all"},children:[a==null?void 0:a.payDetail.depositor,n&&e.jsx(r,{width:"50%"})]})})]})]})]}),e.jsx(y,{}),e.jsxs(b,{isMobile:h,children:[e.jsxs(t,{display:"flex",justifyContent:"space-between",children:[e.jsx(i,{variant:"subtitle1",children:"상품금액"}),e.jsxs(i,{variant:"subtitle1",fontWeight:600,align:h?"right":"left",sx:{wordBreak:"break-all"},children:["".concat(x((v=s==null?void 0:s.standardAmt)!=null?v:0,"WON")),n&&e.jsx(r,{width:"50%"})]})]}),e.jsxs(t,{display:"flex",justifyContent:"space-between",children:[e.jsx(i,{variant:"subtitle1",children:"할인금액"}),e.jsxs(i,{variant:"subtitle1",fontWeight:600,align:h?"right":"left",sx:{wordBreak:"break-all"},children:["".concat(d((W=s==null?void 0:s.discountAmt)!=null?W:0,"WON","minus")),n&&e.jsx(r,{width:"50%"})]})]}),e.jsxs(t,{display:"flex",justifyContent:"space-between",children:[e.jsx(i,{variant:"subtitle1",children:"배송비"}),e.jsxs(i,{variant:"subtitle1",fontWeight:600,align:h?"right":"left",sx:{wordBreak:"break-all"},children:["".concat(x((P=s==null?void 0:s.deliveryAmt)!=null?P:0,"WON")),n&&e.jsx(r,{width:"50%"})]})]}),e.jsx(y,{}),e.jsxs(t,{display:"flex",justifyContent:"space-between",children:[e.jsx(i,{variant:"subtitle1",children:"결제 금액"}),e.jsxs(i,{variant:"subtitle1",fontWeight:600,color:_,align:h?"right":"left",sx:{wordBreak:"break-all"},children:["".concat(x((C=s==null?void 0:s.payAmt)!=null?C:0,"WON")),n&&e.jsx(r,{width:"50%"})]})]})]})]})}function ie({refund:l,isPending:n}){var x;const{formatPriceWithCommas:s}=p(),{isMobile:a}=j();return e.jsxs(b,{isMobile:a,children:[e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"환불 금액"})}),e.jsx(t,{flex:a?3:4,children:e.jsx(i,{variant:"subtitle1",fontWeight:400,align:a?"right":"left",children:s((x=l==null?void 0:l.refundAmt)!=null?x:0,"WON")})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"환불 수단"})}),e.jsx(t,{flex:a?3:4,children:e.jsx(i,{variant:"subtitle1",fontWeight:400,align:a?"right":"left",children:l==null?void 0:l.refundTypeLabel})})]}),e.jsxs(t,{display:"flex",children:[e.jsx(t,{flex:1,children:e.jsx(i,{variant:"subtitle1",children:"환불 처리 일시"})}),e.jsx(t,{flex:a?3:4,children:e.jsx(i,{variant:"subtitle1",fontWeight:400,align:a?"right":"left",children:l==null?void 0:l.refundCompleteYmdt})})]})]})}function de(){const[l]=V(),n=l.get("orderNo")||"",{data:s,isPending:a}=G(n),{isMobile:x}=j();return e.jsxs(t,{px:{desktop:4,mobile:2},gap:5,component:"section",display:"flex",flexDirection:"column",children:[x&&e.jsx(H,{title:"이전주문 상세"}),e.jsx(u,{title:"이전주문/배송 상세",children:e.jsx(Z,{previousOrderDetail:s,orderNo:n,isPending:a})}),e.jsx(u,{title:"주문자 정보",children:e.jsx(se,{isPending:a,orderer:s==null?void 0:s.orderer})}),e.jsx(u,{title:"배송지 정보",children:s==null?void 0:s.receiver.map((d,o)=>e.jsx(z,{isPending:a,receiver:d},o))}),e.jsx(u,{title:"결제 정보",children:e.jsx(te,{isPending:a,lastPayment:s==null?void 0:s.lastPayment,paymentMethod:s==null?void 0:s.paymentMethod})}),(s==null?void 0:s.refund)&&e.jsx(u,{title:"환불 정보",children:e.jsx(ie,{refund:s==null?void 0:s.refund,isPending:a})}),e.jsx(Q,{})]})}export{de as default};