1import{j as e,C as s,b as t,al as n,ae as l,a4 as i,ao as a,a0 as o}from"./index-D1TPP0ID.js";import{e as r,r as d,u as c}from"./react-CH-bOe9I.js";import{u as m}from"./hooks-C1xjp8Fj.js";import{I as u}from"./index-oYUJYnj2.js";import{O as x}from"./index-IrV6i_6g.js";import{P as f}from"./index-DKj1rkZQ.js";import{C as h}from"./index-BgIdRhki.js";import{u as p}from"./i18next-DHCxiuaf.js";import{I as b}from"./index-DztKp6xY.js";const v=({text:t,disabled:n,handleSubmit:l})=>{const{t:i}=p();return e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-[2] flex items-center justify-end bg-b-2 px-3 py-2 shadow-bottom",children:e.jsx(s,{className:"fond-semibold h-10 w-full text-size-base leading-5",type:"primary",size:"normal",onClick:()=>l(),disabled:n,children:null!=t?t:i("button.Submit")})})},j=({visible:j,orderNo:k,propsItems:y,onClose:_})=>{var g,N,C;const{state:w}=r();let q="",S=[];const{isMobile:R}=t(),[z,A]=d.useState("Refund Only"),[H,M]=d.useState([]),O=c(),{t:V}=p();n(location.search).order_no?q=n(location.search).order_no:(q=null==w?void 0:w.no,S=null==w?void 0:w.items);const I=q||k||"",{detail:L,isLoading:T}=m(I),B=n(location.search).sku_no;n(location.search).order_no&&B&&(S=null==(N=null==(g=null==L?void 0:L.order_items)?void 0:g.filter((e=>0===e.is_gift)))?void 0:N.map((e=>({...e,actual_quantity:e.sku_no===B?e.quantity-(e.refund_quantity||0):0}))));const P=!H.length||!z,Z=y||S,E=(null==Z?void 0:Z.length)?Z:(null==(C=null==L?void 0:L.order_items)?void 0:C.filter((e=>0===e.is_gift)))||[],K=E.filter((e=>0!==e.actual_quantity&&e.quantity-(e.refund_quantity||0)!=0)),U=(K.length||0)>1,Y=[{label:V("refund.RefundOnlyNoReturnNeeded"),key:"Refund Only",describe:V("refund.ItemNotReceivedRejected"),icon:"data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3%207C3%205.89543%203.89543%205%205%205H19C20.1046%205%2021%205.89543%2021%207V17C21%2018.1046%2020.1046%2019%2019%2019H5C3.89543%2019%203%2018.1046%203%2017V7Z'%20stroke='%23111111'%20stroke-width='1.5'/%3e%3cpath%20d='M16%2014.5H8L10.5%2012'%20stroke='black'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='3'%20y1='9.25'%20x2='21'%20y2='9.25'%20stroke='%23111111'%20stroke-width='1.5'/%3e%3c/svg%3e"},{label:V("refund.ReturnAndRefund"),key:"Return and Refund",describe:V("refund.ItemReceived"),icon:"data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M4%209H20V19C20%2019.5523%2019.5523%2020%2019%2020H5C4.44772%2020%204%2019.5523%204%2019V9Z'%20stroke='%23111111'%20stroke-width='1.5'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2%205.5C2%205.22386%202.22386%205%202.5%205H21.5C21.7761%205%2022%205.22386%2022%205.5V8.5C22%208.77614%2021.7761%209%2021.5%209H2.5C2.22386%209%202%208.77614%202%208.5V5.5Z'%20stroke='%23111111'%20stroke-width='1.5'/%3e%3cpath%20d='M13.1262%2016.25H14.4459C15.1736%2016.25%2015.7624%2015.658%2015.7584%2014.9303V14.9303C15.7544%2014.2082%2015.168%2013.625%2014.4459%2013.625H9.37621'%20stroke='%23111111'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20d='M10.125%2011.75L8.25%2013.625L10.125%2015.5'%20stroke='%23111111'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e"}],D=e=>{e!==z&&A(e)},F=e=>-1!==H.findIndex((s=>s.sku_no===e)),G=e=>{U&&(F(e)?M(H.filter((s=>s.sku_no!==e))):M([...H,K.find((s=>s.sku_no===e))]))},J=()=>{document.body.style.overflowY="unset",O("/refunds",{state:{type:z,no:I,only:"Refund Only"===z,items:E.map((e=>{const s=H.find((s=>s.sku_no===e.sku_no));return{...e,actual_quantity:((null==s?void 0:s.quantity)||0)-((null==s?void 0:s.refund_quantity)||0)}}))}})};return d.useLayoutEffect((()=>{M(K||[])}),[L.order_no,j]),R?e.jsxs(f,{title:V("refund.AfterSalesApplication"),isLoading:T,children:[e.jsxs("div",{className:"bg-b-2 px-3",children:[e.jsx("div",{className:"pt-4 text-size-base font-semibold leading-normal text-t-1",children:V("refund.AfterSalesType")}),Y.map(((s,t)=>d.createElement(l,{iconClassName:"w-6 h-6",labelClassName:"text-size-sm",onClick:()=>D(s.key),...s,key:s.label,topBorder:0!==t,hideArrow:!0,rightText:e.jsx(i,{checked:z===s.key})})))]}),e.jsxs("div",{className:"mb-16 mt-2 bg-b-2 px-3 pt-2",children:[e.jsx("div",{className:"pt-2 text-size-base font-semibold leading-normal text-t-1",children:V("refund.AfterSalesProducts")}),K.map(((s,t)=>e.jsxs("div",{className:"flex items-center ".concat(0!==t?"border-t-[0.5px] border-line-1":""),onClick:()=>G(s.sku_no),children:[e.jsx(u,{className:"flex-1 py-4",...s,quantity:s.quantity-(s.refund_quantity||0)}),U&&e.jsx(h,{className:"ml-3",checked:F(s.sku_no)})]},s.sku_no)))]}),e.jsx(x,{}),e.jsx(v,{disabled:P,handleSubmit:J})]}):e.jsxs(a,{contentClassName:"w-[50rem] py-6",containerClassName:"!z-[99]",visible:j||!1,onClose:_,title:V("refund.RequestAfterSalesService"),footer:e.jsxs("div",{className:"flex items-center justify-end",children:[e.jsx(s,{onClick:_,children:V("button.Cancel")}),e.jsx(s,{className:"ml-3",disabled:P,type:"primary",onClick:J,children:V("button.Confirm")})]}),children:[e.jsx("div",{className:"max-h-[388px] overflow-y-auto rounded bg-b-1 px-4 py-2",children:K.map((s=>{const{sku_name:t,spec_attr:n,sale_price:l,origin_price:i,quantity:a,refund_quantity:r,sku_primary_image:d}=s;return e.jsxs("div",{className:"flex cursor-pointer items-center bg-b-1 py-2",onClick:()=>G(s.sku_no),children:[e.jsx(b,{image:d,name:t}),e.jsxs("div",{className:"my-1 ml-3 flex min-h-[5.125rem] w-0 flex-1 flex-col text-phone-base text-t-1",children:[e.jsx("div",{className:"truncate",children:t}),e.jsx("div",{className:"mt-2 text-phone-small text-t-3",children:n}),e.jsxs("div",{className:"mt-auto flex items-center text-phone-base",children:[e.jsx("span",{className:"font-semibold",children:o(l)}),!!i&&e.jsx("span",{className:"ml-1 text-phone-small text-t-3 line-through",children:o(i)}),e.jsxs("div",{className:"text-t-1 ".concat(U?"ml-6":"ml-auto"),children:["x",a-r]})]})]}),U&&e.jsx(h,{className:"ml-3",checked:F(s.sku_no)})]},s.sku_no)}))}),e.jsx("div",{className:"my-4 text-size-base font-medium",children:V("refund.SelectAfterSalesServiceType")}),e.jsx("div",{className:"flex",children:Y.map(((s,t)=>e.jsxs("div",{className:"flex flex-1 cursor-pointer items-center justify-center rounded-lg border border-line-1 p-4 ".concat(0!==t?"ml-4":""," ").concat(z===s.key?"border-t-1":""),onClick:()=>D(s.key),children:[e.jsx("img",{className:"h-6 w-6",src:s.icon,alt:""}),e.jsxs("div",{className:"ml-4 flex flex-1 flex-col",children:[e.jsx("span",{children:s.label}),e.jsx("span",{className:"text-t-3",children:s.describe})]})]})))})]})},k=Object.freeze(Object.defineProperty({__proto__:null,default:j},Symbol.toStringTag,{value:"Module"}));
1export{j as A,v as O,k as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.