1import{d as It,f as Ct,h as St,ae as Ot,i as f,c as I,u as At,k as wt,l as p,o as h,m as t,e as o,t as a,y as v,C as z,w as et,v as nt,p as Q,q as Tt,E as Lt,F as G,x as J,G as b,cx as Mt,cy as Ut,B as Kt,s as at,_ as $t}from"./D1FcBL9p.js";import{_ as Rt}from"./Hi3xaYxS.js";/* empty css *//* empty css *//* empty css */import{_ as qt}from"./BlRCviZe.js";import{g as xt}from"./dHs4w_Xp.js";import{m as Ft,p as D,s as Yt,e as Bt,l as Dt}from"./nDqXXtmZ.js";import{m as Ht,i as Vt,s as Et,c as zt,f as Qt,l as Gt}from"./DFMl0yuL.js";import{r as Jt,a as lt}from"./COIhoESH.js";import{p as jt,b as Wt,d as Xt,e as ct,f as Zt,c as to}from"./GB6TE49s.js";import{b as oo,c as T,d as j,e as W,f as X}from"./Dk2WgwZp.js";const so={class:"shop-checkout-mobile-container"},eo={class:"checkout-header"},no={class:"checkout-title"},ao={class:"checkout-content"},lo={class:"checkout-module payment-module"},co={class:"module-title-large"},io={class:"payment-sub"},uo={class:"sub-title"},ro=["src"],po={class:"amount-row"},ho={class:"amount-label"},mo={class:"amount-value"},_o={key:0,class:"amount-row"},vo={class:"amount-label"},fo={class:"amount-value amount-value-discount"},ko={key:1,class:"voucher-note"},yo={class:"amount-total"},Po={class:"total-label"},No={class:"total-value"},bo={class:"payment-sub"},go={class:"sub-title"},Io=["src"],Co={class:"amount-row"},So={class:"amount-label"},Oo={class:"amount-value amount-value-points"},Ao=["src"],wo={key:0,class:"amount-row"},To={class:"amount-label"},Lo={class:"amount-value amount-value-points"},Mo=["src"],Uo=["src"],Ko={class:"amount-total"},$o={class:"total-label"},Ro={class:"total-value total-value-points"},qo=["src"],xo=["disabled"],Fo={class:"checkout-module pickup-module"},Yo=["src"],Bo={class:"module-title"},Do={key:0,class:"module-content"},Ho={class:"content-section"},Vo={class:"section-title"},Eo={class:"form-row"},zo={class:"form-item"},Qo={class:"form-label"},Go={class:"form-item"},Jo={class:"form-label"},jo={class:"phone-input-wrapper"},Wo={class:"content-section"},Xo={class:"section-title"},Zo={class:"address-list"},ts=["onClick"],os={class:"address-name"},ss={class:"address-text"},es={key:0,class:"address-hours"},ns={class:"checkout-module delivery-module"},as={class:"module-header module-header-disabled"},ls=["src"],cs={class:"module-title"},is={class:"checkout-module product-module"},us={class:"module-header product-header"},rs={class:"module-title"},ds={class:"product-list"},ps={class:"product-image"},hs={class:"product-info"},ms={class:"merchant-name"},_s={class:"product-name"},vs={class:"product-qty"},fs={class:"product-price"},ks={key:0,class:"price-amount"},ys={key:1,class:"price-connector"},Ps={key:2,class:"price-points"},Ns={class:"price-points-num"},bs={class:"price-points-label"},gs={key:0,class:"product-no-stock-msg"},Is={class:"product-subtotal"},Cs={class:"subtotal-label"},Ss={class:"subtotal-amount"},Os={key:0,class:"subtotal-amount-num"},As={key:1,class:"subtotal-connector"},ws={key:2,class:"subtotal-points"},Ts={class:"subtotal-points-num"},Ls={class:"subtotal-points-label"},Ms=It({__name:"mobile",setup(Us){const{t:l}=Ct(),H=St(),it=Ot(),y=f("PICKUP"),O=f(0),$=f(null),P=f([]),g=f(null),R=f(!1),q=oo(),_=f({name:"",phone:"",areaCode:"+852"}),ut=[{label:"+852",value:"+852"},{label:"+86",value:"+86"}],rt=n=>String(n)==="0",N=f([]),dt=f(0),x=f(0),pt=f(""),ht=I(()=>{var n,e;return(e=(n=N.value[O.value])==null?void 0:n.id)!=null?e:""});function F(n){var e;return Vt(n,{deliveryType:y.value,selectedShopId:ht.value,productStockList:(e=g.value)==null?void 0:e.productStockList})}const mt=I(()=>{const n=P.value;return n.length?n.every(e=>!F(e)):!1}),C=n=>{var k;const e=n.payMethod||"ONLY_AMOUNT",i=q.value;let d=0,m=0;e==="ONLY_AMOUNT"?d=T(i,n):e==="ONLY_POINT"?m=j(i,n):e==="AMOUNT_POINT"?(d=W(i,n),m=X(i,n)):d=T(i,n);const c=(k=n.quantity)!=null?k:1,s=d*c,r=m*c;return e==="ONLY_AMOUNT"?{amount:`HK$ ${s}`,pointsNum:null,pointsLabel:null}:e==="ONLY_POINT"?{amount:null,pointsNum:String(r),pointsLabel:l("shop.points")}:e==="AMOUNT_POINT"?{amount:`HK$ ${s}`,pointsNum:String(r),pointsLabel:l("shop.points")}:{amount:`HK$ ${s}`,pointsNum:null,pointsLabel:null}};At({title:l("shop.checkoutTitle")});const Y=I(()=>{var d,m;if(g.value)return{amount:(d=g.value.totalAmount)!=null?d:0,points:(m
1=g.value.totalPoints)!=null?m:0};let n=0,e=0;const i=q.value;return P.value.forEach(c=>{var U;const s=(U=c.quantity)!=null?U:1,r=c.payMethod||"ONLY_AMOUNT";let k=0,A=0;r==="ONLY_AMOUNT"?k=T(i,c):r==="ONLY_POINT"?A=j(i,c):r==="AMOUNT_POINT"?(k=W(i,c),A=X(i,c)):k=T(i,c);const L=k*s,M=A*s;r==="ONLY_AMOUNT"?n+=L:r==="ONLY_POINT"?e+=M:r==="AMOUNT_POINT"&&(n+=L,e+=M)}),{amount:n,points:e}}),V=I(()=>Y.value.points),S=I(()=>{const{amount:n,points:e}=Y.value;return n>0&&e>0?{amount:`HK$ ${n}`,pointsNum:String(e),pointsLabel:l("shop.points")}:e>0?{amount:null,pointsNum:String(e),pointsLabel:l("shop.points")}:{amount:`HK$ ${n}`,pointsNum:null,pointsLabel:null}}),Z=I(()=>Y.value.amount),_t=I(()=>Math.max(0,Z.value-(x.value||0))),vt=I(()=>{var e;return(((e=$.value)!=null?e:0)-V.value+dt.value).toLocaleString()}),ft=async()=>{var A,L,M,U,tt,ot;const n=P.value;if(!(n!=null&&n.length)){b.warning(l("common.noData")||"è´ç©è½¦ä¸ºç©º");return}if(n.some(u=>F(u))){b.warning(l("shop.checkoutCannotPayDueToStock"));return}const e=((A=n[0])==null?void 0:A.deptId)||((L=n[0])==null?void 0:L.deptName)||"";if(!e){b.warning(l("shop.checkoutDeptRequired")||"缺å°å·¥ä¼ä¿¡æ¯");return}if(y.value==="PICKUP"){if(!((M=_.value.name)!=null&&M.trim())){b.warning(l("shop.checkoutNameRequired")||"请è¾å
¥å§å");return}if(!((U=_.value.phone)!=null&&U.trim())){b.warning(l("shop.checkoutPhoneRequired")||"请è¾å
¥çµè¯");return}if(!((tt=N.value)!=null&&tt.length)){b.warning(l("shop.checkoutSelectPickupAddress")||"è¯·éæ©åè´§å°å");return}}const i=y.value==="PICKUP"&&N.value[O.value]?N.value[O.value].id:"",d=((ot=_.value.name)==null?void 0:ot.trim())||"",m=`${_.value.areaCode||""}${_.value.phone||""}`.trim(),c=q.value,s=n.map(u=>{var st;const w=Math.max(1,(st=u.quantity)!=null?st:1),E=u.payMethod||"ONLY_AMOUNT";let K=0,B=0;E==="ONLY_AMOUNT"?K=T(c,u):E==="ONLY_POINT"?B=j(c,u):E==="AMOUNT_POINT"?(K=W(c,u),B=X(c,u)):K=T(c,u);const bt=K*w,gt=Math.round(B*w);return{productId:String(u.productId||u.id||""),quantity:w,payMethod:u.payMethod||"ONLY_AMOUNT",...u.id?{cartItemId:u.id}:{},frontUnitAmount:K,frontUnitPoints:Math.round(B),frontTotalAmount:bt,frontTotalPoints:gt}}),{amount:r,points:k}=Y.value;R.value=!0;try{const u=await Yt({deptId:e,itemList:s,isSubmitOrder:!0,shopId:y.value==="PICKUP"?i:void 0,receiverName:y.value==="PICKUP"?d:void 0,receiverPhone:y.value==="PICKUP"?m:void 0,frontTotalAmount:r,frontTotalPoints:k});if(!u){b.error(l("shop.checkoutSubmitFailed")||"æäº¤å¤±è´¥ï¼è¯·éè¯");return}const w=r>0;if(!w&&"onlyPointsOrder"in u&&u.onlyPointsOrder===!0&&u.orderKey){H.push({path:"/shop/paySuccess",query:{orderNumber:u.orderKey}});return}if(w&&"onlyPointsOrder"in u&&u.onlyPointsOrder===!0){b.error(l("shop.checkoutSubmitFailed")||"æäº¤å¤±è´¥ï¼è¯·éè¯");return}typeof window<"u"&&window.sessionStorage&&sessionStorage.setItem("mallPaymentRequest",JSON.stringify(u)),H.push({path:"/externalPaymentTwo",query:{type:"mall"}})}catch(u){b.error((u==null?void 0:u.message)||l("shop.checkoutSubmitFailed")||"æäº¤å¤±è´¥ï¼è¯·éè¯")}finally{R.value=!1}},kt=async()=>{var n;try{const e=await xt();$.value=(n=e==null?void 0:e.availablePoint)!=null?n:0}catch{$.value=null}},yt=async()=>{var n,e;try{const[i,d]=await Promise.all([Mt(),Ut()]),m=(e=(n=d==null?void 0:d.mobile)!=null?n:i==null?void 0:i.mobile)!=null?e:"",{areaCode:c,localNumber:s}=Et(m),r=zt(i==null?void 0:i.nickname);r&&(_.value.name=r),s&&(_.value.phone=s),c&&(_.value.areaCode=c)}catch{}},Pt=async()=>{const n=jt();let e=!1,i=!1;try{let d;if(n)e=!0,d=[Wt(n)];else{const s=Xt(),r=await Bt();if(!r||r.length===0){s&&s.length&&ct(),P.value=[],g.value=null;return}if(s&&s.length>0?(i=!0,d=Zt(r,s)):d=Qt(r,it),!d.length){P.value=[],g.value=null;return}}const{productList:m,settlement:c}=await Gt(d,{loggedIn:q.value});P.value=m,g.value=c}catch{P.value=[],g.value=null}finally{e&&to(),i&&ct()}},Nt=async()=>{var d,m;const n=P.value,e=n.map(c=>c.productId||c.id).filter(Boolean),i=((d=n[0])==null?void 0:d.deptId)||((m=n[0])==null?void 0:m.deptName)||"";if(!e.length){N.value=[];return}try{const c=await Dt({deptId:i,productIds:e,onlyHasStock:!1});N.value=(c||[]).map(s=>({id:s.id,storeName:s.shopName,address:s.shopAddress,hours:s.shopBusinessTime||""})),N.value.length>0&&(O.value=0)}catch{N.value=[]}};return wt(async()=>{kt(),await Promise.all([Pt(),yt()]),await Nt()}),(n,e)=>{var c;const i=Kt,d=Lt,m=Rt;return h(),p("div",so,[t("div",eo,[t("img",{src:qt,class:"back-icon",alt:"è¿å",onClick:e[0]||(e[0]=s=>o(H).back())}),t("h1",no,a(o(l)("shop.checkoutTitle")),1)]),t("div",ao,[t("div",lo,[t("div",co,a(o(l)("shop.checkoutPaymentDetails")),1),t("div",io,[t("div",uo,[t("img",{src:o(Ft),class:"sub-icon",alt:""},null,8,ro),t("span",null,a(o(l)("shop.checkoutPayment")),1)]),t("div",po,[t("span",ho,a(o(l)("shop.cartSubtotal")),1),t("span",mo,"HK$ "+a(o(Z)),1)]),o(x)?(h(),p("div",_o,[t("span",vo,a(o(l)("shop.checkoutVoucher")),1),t("span",fo,"-HK$ "+a(o(x)),1)])):v("",!0),o(x)?(h(),p("div",ko,a(o(pt)),1)):v("",!0),t("div",yo,[t("span",Po,a(o(l)("shop.checkoutTotalPayment")),1),t("span",No,"HK$ "+a(o(_t)),1)])]),t("div",bo,[t("div",go,[t("img",{src:o(D),class:"sub-icon",alt:""},null,8,Io),t("span",null,a(o(l)("shop.points")),1)]),t("div",Co,[t("span",So,a(o(l)("shop.checkoutAvailablePoints")),1),t("span",Oo,[t("img",{src:o(D),class:"amount-point-icon",alt:""}
1,null,8,Ao),z(" "+a(((c=o($))!=null?c:0).toLocaleString()),1)])]),o(V)>0?(h(),p("div",wo,[t("span",To,a(o(l)("shop.checkoutUsedPoints")),1),t("span",Lo,[t("img",{src:o(Ht),class:"amount-sign-icon amount-minus-icon",alt:""},null,8,Mo),t("img",{src:o(D),class:"amount-point-icon",alt:""},null,8,Uo),z(" "+a(o(V)),1)])])):v("",!0),t("div",Ko,[t("span",$o,a(o(l)("shop.checkoutRemainingPoints")),1),t("span",Ro,[t("img",{src:o(D),class:"amount-point-icon",alt:""},null,8,qo),z(" "+a(o(vt)),1)])])]),t("button",{class:"confirm-btn",disabled:o(R)||!o(mt),onClick:ft},a(o(R)?o(l)("shop.checkoutSubmitting"):o(l)("shop.checkoutConfirmPayment")),9,xo)]),t("div",Fo,[t("div",{class:"module-header",onClick:e[1]||(e[1]=s=>y.value="PICKUP")},[t("img",{src:o(y)==="PICKUP"?o(Jt):o(lt),class:"radio-icon",alt:""},null,8,Yo),t("span",Bo,a(o(l)("shop.checkoutSelfPickup")),1)]),o(y)==="PICKUP"?(h(),p("div",Do,[t("div",Ho,[t("div",Vo,a(o(l)("shop.checkoutEnterInfo")),1),t("div",Eo,[t("div",zo,[t("label",Qo,a(o(l)("shop.checkoutName")),1),et(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>o(_).name=s),type:"text",class:"form-input"},null,512),[[nt,o(_).name]])]),t("div",Go,[t("label",Jo,a(o(l)("shop.checkoutPhone")),1),t("div",jo,[Q(d,{modelValue:o(_).areaCode,"onUpdate:modelValue":e[3]||(e[3]=s=>o(_).areaCode=s),class:"phone-area-select","popper-class":"checkout-phone-area-dropdown-mobile"},{default:Tt(()=>[(h(),p(G,null,J(ut,s=>Q(i,{key:s.value,label:s.label,value:s.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),e[5]||(e[5]=t("div",{class:"phone-input-divider"},null,-1)),et(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>o(_).phone=s),type:"text",class:"phone-number-input"},null,512),[[nt,o(_).phone]])])])])]),t("div",Wo,[t("div",Xo,a(o(l)("shop.checkoutSelectPickupAddress")),1),t("div",Zo,[(h(!0),p(G,null,J(o(N),(s,r)=>(h(),p("div",{key:s.id||r,class:at(["address-item",{selected:o(O)===r}]),onClick:k=>O.value=r},[t("div",os,a(s.storeName),1),t("div",ss,a(s.address),1),rt(s.id)?v("",!0):(h(),p("div",es,a(o(l)("shop.checkoutBusinessHours"))+": "+a(s.hours),1))],10,ts))),128))])])])):v("",!0)]),t("div",ns,[t("div",as,[t("img",{src:o(lt),class:"radio-icon",alt:""},null,8,ls),t("span",cs,a(o(l)("shop.checkoutDelivery")),1)])]),t("div",is,[t("div",us,[t("span",rs,a(o(l)("shop.checkoutProductDetails")),1)]),t("div",ds,[(h(!0),p(G,null,J(o(P),(s,r)=>(h(),p("div",{key:s.productId||s.id||r,class:at(["product-item",{"is-no-stock-at-shop":F(s)}])},[t("div",ps,[Q(m,{src:s.publicizeImage||s.image||s.productImage,class:"img",alt:""},null,8,["src"])]),t("div",hs,[t("div",ms,a(s.deptName||s.unionName||""),1),t("div",_s,a(s.productName||s.name||""),1),t("div",vs,a(o(l)("shop.checkoutQuantity"))+" x"+a(s.quantity||1),1),t("div",fs,[C(s).amount?(h(),p("span",ks,a(C(s).amount),1)):v("",!0),C(s).amount&&C(s).pointsNum?(h(),p("span",ys," + ")):v("",!0),C(s).pointsNum?(h(),p("span",Ps,[t("span",Ns,a(C(s).pointsNum),1),t("span",bs,a(C(s).pointsLabel),1)])):v("",!0)]),F(s)?(h(),p("div",gs,a(o(l)("shop.checkoutNoStockAtShop")),1)):v("",!0)])],2))),128))]),t("div",Is,[t("span",Cs,a(o(l)("shop.cartSubtotal")),1),t("span",Ss,[o(S).amount?(h(),p("span",Os,a(o(S).amount),1)):v("",!0),o(S).amount&&o(S).pointsNum?(h(),p("span",As," + ")):v("",!0),o(S).pointsNum?(h(),p("span",ws,[t("span",Ts,a(o(S).pointsNum),1),t("span",Ls,a(o(S).pointsLabel),1)])):v("",!0)])])])])])}}}),zs=$t(Ms,[["__scopeId","data-v-db31be19"]]);export{zs as default};
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.