1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[54795],{76332:function(t,e,o){(window.__NEXT_P=window.__NEXT_P||[]).push(["/group-order/dish",function(){return o(64439)}])},93258:function(t,e){"use strict";e.Z={getCart:"/sale/api/shopping/cart/group-order/web/query",joinCart:"/sale/api/shopping/cart/group-order/web/join",startEdit:"/sale/api/shopping/cart/group-order/web/start-edit",editCart:"/sale/api/shopping/cart/group-order/web/item/edit/v2",getShopDetail:"/sale/api/store/dish/list/v3",getOrderSetting:"/api/shop",getDishDetail:"/sale/api/store/dish/detail",getComboGoodsDetail:"/sale/api/store/dish/combo/detail",validateUpsell:"/sale/api/upsell/check",stopEdit:"/sale/api/shopping/cart/group-order/web/end-edit",getUpSellDishDetail:"/sale/api/upsell/dish/detail",clearCart:"/sale/api/shopping/cart/group-order/web/clear"}},96821:function(t,e,o){"use strict";o.d(e,{Dl:function(){return l},PQ:function(){return n},WF:function(){return i}});let i={GROUP_ORDER_CANCEL:"CANCEL",GROUP_ORDER_ORDERED:"ORDERED",GROUP_ORDER_OPEN:"OPEN",GROUP_ORDER_COMPLETE:"COMPLETE",GROUP_ORDER_ORDERING:"ORDERING"},l={GROUP_ORDER_CANCEL:98500,GROUP_ORDER_LOCKED:98501},n={USER_READY_READY:"READY",USER_READY_ORDERING:"ORDERING"}},64439:function(t,e,o){"use strict";o.r(e),o.d(e,{__N_SSP:function(){return W},default:function(){return z}});var i=o(85893),l=o(67294),n=o(24344),d=o(25142),s=o(95053),a=o.n(s),u=t=>{let{children:e}=t;return(0,i.jsx)("div",{className:a().group_order_container,children:(0,i.jsx)("div",{className:a().wrap,children:e})})},r=o(10367),c=o.n(r),p=o(11163),v=o(68949),h=new class{constructor(){this.orderId=null,this.routerPullStatus=!1,this.updateState=t=>{for(let[e,o]of Object.entries(t))this[e]=o},(0,v.ky)(this)}},m=o(84851),g=o(55164),I=o.n(g),_=(0,m.Pi)(()=>{let{appConfig:t}=(0,n.s6)(),{updateState:e,routerPullStatus:o}=h,l=(0,p.useRouter)(),{itemGroupId:d,shoppingCartId:s}=l.query,a=async()=>{o||(e({routerPullStatus:!0}),await l.push("/group-order/order?shoppingCartId=".concat(s,"&itemGroupId=").concat(d)),e({routerPullStatus:!1}))};return(0,i.jsxs)("div",{className:I().group_order_header,children:[(0,i.jsx)("div",{className:"group_order_header_logo",children:(0,i.jsx)("img",{src:null==t?void 0:t.logoUrl,alt:""})}),d&&(0,i.jsx)(c(),{type:"primary",className:"group_order_header_link",onClick:a,children:"View Group Order"})]})}),f=o(93258),L=o(85416),O=o(45042);let b=function(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],o=new Map;for(let i of t){let t=o.get(i.token);t&&e?(t.count+=null==i?void 0:i.count,t.subTotalPrice+=null==i?void 0:i.subTotalPrice):o.set(i.token,{...i})}return Array.from(o.values())},E=t=>{let e=null==t?void 0:t.map(t=>{var e,o,i,l;let n=[],d=new Map;null===(e=t.addOnList)||void 0===e||e.forEach(t=>{if(t.groupId){var e;d.has(t.groupId)||d.set(t.groupId,{groupId:t.groupId,addOnList:[]}),d.get(t.groupId).addOnList||d.get(t.groupId),null===(e=d.get(t.groupId).addOnList)||void 0===e||e.push({...t})}}),n.push(...Array.from(d.values()));let s=[],a=new Map;null===(o=t.tasteList)||void 0===o||o.forEach(t=>{if(t.groupId){var e;a.has(t.groupId)||a.set(t.groupId,{groupId:t.groupId,tasteList:[]}),null===(e=a.get(t.groupId))||void 0===e||e.tasteList.push({tasteId:t.tasteId,id:t.tasteId,tasteName:t.tasteName})}}),s.push(...Array.from(null==a?void 0:a.values())),t.token=(0,O.pb)({...t,id:t.dishId,specialInstructions:t.notes||"",addOnGroupList:n||[],specificationId:null!==(i=t.specificationId)&&void 0!==i?i:void 0,note:t.describe,tasteItemList:s,tagList:null==t?void 0:t.tagList}).token;let u={...t,categoryId:t.categoryId,categoryName:t.categoryName,id:t.dishId,name:t.dishName,price:t.price,minimalOrderQuantity:t.minimalOrderQuantity,description:t.describe,imageUrl:t.imageUrl,note:t.describe,upSellId:t.upSellId,subTotalPrice:t.subTotalAmount,count:t.dishCount,specialInstructions:t.notes||"",addOnGroupList:n,tasteItemList:s,specificationId:null!==(l=t.specificationId)&&void 0!==l?l:void 0};return{...u}});return b(e)},C=(t,e)=>{var o,i;let l=[],n=[];return null==t||null===(o=t.addOnGroupList)||void 0===o||o.forEach(t=>{var e;let o=null==t?void 0:null===(e=t.addOnList)||void 0===e?void 0:e.map(e=>({addOnCount:(null==e?void 0:e.count)||e.addOnCount,addOnId:null==e?void 0:e.addOnId,groupId:null==t?void 0:t.groupId}));null==l||l.push(...o)}
1),null==t||null===(i=t.tasteItemList)||void 0===i||i.forEach(t=>{var e;let o=null==t?void 0:null===(e=t.tasteList)||void 0===e?void 0:e.map(e=>({groupId:null==t?void 0:t.groupId,tasteId:null==e?void 0:e.tasteId}));n.push(...o)}),{dishId:t.dishId,dishCount:t.count,categoryId:t.categoryId,specificationId:t.specificationId,addOnList:(null==l?void 0:l.length)?l:null==t?void 0:t.addOnList,imageUrl:t.imageUrl,menuId:t.menuId,notes:t.specialInstructions,specificationName:t.specificationName,tasteList:(null==n?void 0:n.length)?n:[],upSellId:t.upSellId,dishName:t.dishName,token:t.token,itemId:null==e?void 0:e.itemId,newToken:t.token||(0,O.pb)(t).token}},N=(t,e)=>{let o=new Map(null==e?void 0:e.map(t=>[t.token,t])),i=[];return t.forEach(t=>{let e=o.get(t.token);if(e){if(t.newToken&&t.token!==t.newToken||t.count!==e.count){let o=i.findIndex(e=>e.token===t.token&&"UPDATE"===e.actionType);-1!==o?i[o]={...C(t,{itemId:t.itemId||(null==e?void 0:e.itemId)}),actionType:"UPDATE"}:i.push({...C(t,{itemId:t.itemId||(null==e?void 0:e.itemId)}),actionType:"UPDATE"})}}else i.push({...C(t),actionType:"ADD"})}),o.forEach(e=>{t.some(t=>t.token===e.token)||i.push({...e,actionType:"DELETE"})}),i},y=t=>{let e=[...t];return null==e||e.forEach(t=>{var e,o;let i=[];null==t||null===(e=t.addOnGroupList)||void 0===e||e.forEach(t=>{t.addOnList&&t.addOnList.length>0&&i.push(...t.addOnList.map(t=>({...t,addOnCount:(null==t?void 0:t.count)||(null==t?void 0:t.addOnCount)})))});let l=[];null==t||null===(o=t.tasteItemList)||void 0===o||o.forEach(t=>{t.tasteList&&t.tasteList.length>0&&l.push(...t.tasteList)}),t.addOnList=i,t.tasteList=l,t.dishCount=t.count}),e};var T=o(96821),k=o(32459),S=o(49531),D=o(50361),P=o.n(D);let R=t=>null==t?void 0:t.map(t=>{var e;return{...t,dishList:null==t?void 0:null===(e=t.dishList)||void 0===e?void 0:e.map(t=>({originDish:t,count:null==t?void 0:t.dishCount,dishId:null==t?void 0:t.dishId,dishName:null==t?void 0:t.dishName,specificationId:null==t?void 0:t.specificationId,tasteItemList:function(t){let e=[];return t.forEach(t=>{let o=e.find(e=>e.groupId===t.groupId);o||(o={groupId:t.groupId,tasteList:[]},e.push(o)),o.tasteList.push({tasteId:t.tasteId,groupId:t.groupId,tasteName:t.tasteName})}),e}(null==t?void 0:t.tasteList),addOnGroupList:function(t){let e=[];return t.forEach(t=>{let o=e.find(e=>e.groupId===t.groupId);o||(o={groupId:t.groupId,addOnList:[]},e.push(o)),o.addOnList.push({addOnId:t.addOnId,addOnPrice:t.addOnPrice,addOnName:t.addOnName,imageUrl:null==t?void 0:t.imageUrl,groupId:t.groupId,available:null==t?void 0:t.available,maxLimit:null==t?void 0:t.maxLimit,soldOut:null==t?void 0:t.soldOut,count:t.addOnCount})}),e}(null==t?void 0:t.addOnList),specialInstructions:null==t?void 0:t.notes,notes:null==t?void 0:t.describe}))}});var w=t=>null==t?void 0:t.map(t=>({...t,count:t.comboCount,comboPrice:t.price,itemId:null==t?void 0:t.itemId,comboSubTotalPrice:t.subTotalAmount,selectCombo:R(null==t?void 0:t.comboGroupList)})),x=t=>{let e=(0,p.useRouter)(),{shoppingCartId:o,itemGroupId:i}=e.query,d=(0,n.QT)({url:f.Z.getCart,method:"post"}),[s,a]=(0,l.useState)([]),[u,r]=(0,l.useState)([]),[c,v]=(0,l.useState)(null),[h,m]=(0,l.useState)([]),[g,I]=(0,l.useState)([]),[_,L]=(0,l.useState)([]),[C,y]=(0,l.useState)([]),D=(0,l.useMemo)(()=>null!=_&&!!_.length||JSON.stringify(h)!==JSON.stringify(g),[h,_,g]),R=async()=>{try{var t;let{data:l}=await d.send({shoppingCartId:o,groupId:i});l&&l.state!==T.WF.GROUP_ORDER_CANCEL||await e.push("/group-order/cancel");let n=(null==l?void 0:null===(t=l.shoppingCartGroupList)||void 0===t?void 0:t.find(t=>t.groupId===i))||{},s=null==n?void 0:n.dishList,u=null==n?void 0:n.comboList,c=w(u);I(c),m(c),a(s||[]),v(l),r(E(s||[]))}catch(t){console.error(t)}};return(0,l.useEffect)(()=>{R()},[]),(0,l.useEffect)(()=>{var t,e;let o=null==c?void 0:null===(e=c.shoppingCartGroupList)||void 0===e?void 0:null===(t=e.find(t=>t.groupId===i))||void 0===t?void 0:t.dishList,l=E(o||[]),n=N(u,l||[]);y(n)},[u,c]),{cartData:s,groupInfo:c,updateCartQuantity:e=>{var o,i;let l={...e};if((null==l?void 0:null===(o=l.tasteItemList)||void 0===o?void 0:o.length)&&l.tasteList){let t=[];
1null==l||null===(i=l.tasteItemList)||void 0===i||i.forEach(e=>{var o;null==e||null===(o=e.tasteList)||void 0===o||o.forEach(e=>{e&&t.push(e)})}),l.tasteList=t}(null==l?void 0:l.specialInstructions)||(l.specialInstructions=""),r(o=>{var i,n,d;let a=null==o?void 0:o.find(t=>t.token===(null==l?void 0:l.token));if(a||t){if(!t&&a){(0,k.eE)("add",l,null==l?void 0:l.count,(null==c?void 0:null===(n=c.shop)||void 0===n?void 0:n.name)||"");let t=o.map(t=>(t.token===a.token&&(t.count+=l.count,t.describe),{...l,...t,subTotalPrice:Number(t.subTotalPrice)+Number(null==l?void 0:l.subTotalPrice),notes:l.specialInstructions,describe:null==e?void 0:e.note}));return b(t.filter(t=>t.count>0))}}else{(0,k.eE)("add",l,null==l?void 0:l.count,(null==c?void 0:null===(i=c.shop)||void 0===i?void 0:i.name)||"");let t=s.find(t=>t.dishId===(null==l?void 0:l.id));return o.push({...t,...l,describe:null==l?void 0:l.note,notes:l.specialInstructions}),[...o].filter(t=>t.count>0)}if(t){let e=(null==a?void 0:a.count)-((null==l?void 0:l.count)||0);(0,k.eE)(e<0?"add":"minus",l,Math.abs(e),(null==c?void 0:null===(d=c.shop)||void 0===d?void 0:d.name)||"");let i=o.map(e=>(e.token===t.token&&(e.imageUrl=null==l?void 0:l.imageUrl,e.name=l.name,e.price=l.price,e.notes=l.note,e.note=null==l?void 0:l.note,e.specialInstructions=l.specialInstructions,e.describe=null==l?void 0:l.note,e.newToken=(0,O.pb)(e).token,e.addOnGroupList=null==l?void 0:l.addOnGroupList,e.tasteList=null==l?void 0:l.tasteList,e.tasteItemList=null==l?void 0:l.tasteItemList,e.specificationId=null==l?void 0:l.specificationId,e.token=(0,O.pb)(e).token,e.subTotalPrice=Number(null==l?void 0:l.subTotalPrice),e.dishPrice=null==l?void 0:l.dishPrice,e.count=null==l?void 0:l.count,e.dishCount=null==l?void 0:l.count,e.upSellId=null==l?void 0:l.upSellId),{...l,...e}));return b(i.filter(t=>t.count>0))}return[]})},getCartInfo:R,cartList:u,editList:C,updateCart:t=>{var e;let{dataSource:o,value:i,operate:l}=t;(0,k.eE)(l,o,1,(null==c?void 0:null===(e=c.shop)||void 0===e?void 0:e.name)||""),r(t=>{let e=t.find(t=>t.token===(null==o?void 0:o.token));return e?(e.count=i,e.count<=0)?t.filter(t=>t.token!==e.token):t.map(t=>t.token===e.token?{...e,subTotalPrice:(e.price||0)*e.count,dishId:e.id||(null==t?void 0:t.dishId)}:t).filter(t=>t.count>0):t})},updateUpsell:t=>{let{dataSource:e,value:o,type:i}=t;if("add"===i){r(t=>{let i=t.find(t=>t.dishId===(null==e?void 0:e.dishId));if(!i){let i=[...t],[l]=E([e]);return i.push({...l,count:o,subTotalPrice:((null==l?void 0:l.price)||0)*o}),i}return i.count<=0?t.filter(t=>t.dishId!==i.dishId):t.map(t=>t.dishId===i.dishId?{...i,subTotalPrice:(i.price||0)*i.count,dishId:i.dishId}:t).filter(t=>t.count>0)});return}r(t=>{let i=t.map(t=>t.dishId===(null==e?void 0:e.dishId)?{...t,count:o,subTotalPrice:t.price*o}:t);return i.filter(t=>t.count>0)})},isLoading:d.loading,comboList:h,isEditCombo:D,deleteComboList:_,changeCombo:(t,e)=>{let o=P()(h),i=o[t];i&&(o[t]=e),m(o)},addCombo:t=>{t&&m([...h||[],t])},changeComboCount:(t,e)=>{let o=[...h],i=o[t];if(e<1){let e=null==i?void 0:i.itemId;if(e){let t=null==_?void 0:_.findIndex(t=>t===e);-1===t&&L([..._,e])}o.splice(t,1)}else i&&(o[t]={...i,count:e,comboSubTotalPrice:(0,S.m)({unitPrice:null==i?void 0:i.comboPrice,count:e})});m(o)}}},G=o(88737);let U=t=>{let e=[];return t.forEach(t=>{var o;null===(o=t.tasteList)||void 0===o||o.forEach(t=>{e.push(t)})}),e},A=t=>{let e=[];return t.forEach(t=>{var o;null===(o=t.addOnList)||void 0===o||o.forEach(t=>{t.addOnCount=t.count,e.push(t)})}),e},j=t=>null==t?void 0:t.map(t=>{var e,o,i,l,n;return{menuId:null==t?void 0:null===(e=t.originDish)||void 0===e?void 0:e.menuId,categoryId:null==t?void 0:null===(o=t.originDish)||void 0===o?void 0:o.categoryId,dishId:null==t?void 0:t.dishId,specificationName:null==t?void 0:null===(i=t.originDish)||void 0===i?void 0:i.specificationName,specificationId:null==t?void 0:t.specificationId,imageUrl:null==t?void 0:null===(l=t.originDish)||void 0===l?void 0:l.imageUrl,dishPrice:null==t?void 0:t.subTotalPrice,tasteList:t.tasteList||U(t.tasteItemList),addOnList:(null==t?void 0:t.addOnList)||A(null==t?void 0:t.addOnGroupList),dishCount:null==t?void 0:t.count,dis
1hName:null==t?void 0:null===(n=t.originDish)||void 0===n?void 0:n.dishName,notes:null==t?void 0:t.specialInstructions}}),Q=(t,e)=>t?null==t?void 0:t.map(t=>({comboGroupId:t.comboGroupId,dishList:j(null==t?void 0:t.dishList)})):null;var Z=t=>null==t?void 0:t.map(t=>({comboId:null==t?void 0:t.comboId,itemId:null==t?void 0:t.itemId,menuId:null==t?void 0:t.menuId,comboCount:null==t?void 0:t.count,categoryId:null==t?void 0:t.categoryId,categoryName:null==t?void 0:t.categoryName,comboName:null==t?void 0:t.comboName,price:null==t?void 0:t.comboPrice,comboGroupList:Q(t.selectCombo,t)})),M=t=>{let{dishList:e,deleteComboList:o}=t,i=Z(t.comboList),l=[];["UPDATE","ADD","DELETE"].forEach(t=>{let o=e.filter(e=>e.actionType===t);if(o.length>0){let e=l.findIndex(e=>e.type===t);if("DELETE"===t){let i=o.map(t=>t.itemId);e>-1?l[e]={...l[e],itemIdList:i}:l.push({type:t,itemIdList:i})}else e>-1?l[e]={...l[e],dishList:o}:l.push({type:t,dishList:o})}});let n=i.filter(t=>!t.itemId),d=i.filter(t=>t.itemId);if(n.length>0){let t=l.findIndex(t=>"ADD"===t.type);t>-1?l[t]={...l[t],comboList:n}:l.push({type:"ADD",comboList:n})}if(d.length>0){let t=l.findIndex(t=>"UPDATE"===t.type);t>-1?l[t]={...l[t],comboList:d}:l.push({type:"UPDATE",comboList:d})}if(o&&o.length>0){let t=l.findIndex(t=>"DELETE"===t.type);t>-1?l[t].itemIdList?l[t].itemIdList=[...l[t].itemIdList,...o]:l[t].itemIdList=o:l.push({type:"DELETE",itemIdList:o})}return l},Y=o(25392),V=o(57811),q=o.n(V),F=o(803),W=!0,z=(t=>{let e=e=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_,{}),(0,i.jsx)(u,{children:(0,i.jsx)(t,{...e})})]}),o=t.displayName||t.name||"Component";return e.displayName="WithLayout(".concat(o,")"),e})((0,m.Pi)(()=>{let t=(0,F.Z)(),{shoppingCartId:e,itemGroupId:o}=t.query,s=(0,n.hU)(),a=G.t.getItem("__group_order_id"),u=(0,n.QT)({url:f.Z.getShopDetail,method:"post"}),r=(0,n.QT)({url:f.Z.getDishDetail,method:"get"});(0,n.QT)({url:f.Z.getComboGoodsDetail,method:"get"});let c=(0,n.QT)({url:"".concat(f.Z.getOrderSetting,"/").concat(a,"/order-setting"),method:"get"}),p=(0,n.QT)({url:f.Z.validateUpsell+"?subChannelName=App",method:"post"}),v=(0,n.QT)({url:f.Z.startEdit,method:"post"}),m=(0,n.QT)({url:f.Z.stopEdit,method:"post"}),g=(0,n.QT)({url:f.Z.editCart,method:"post"}),I=(0,n.QT)({url:f.Z.getUpSellDishDetail+"?subChannelName=App",method:"get"}),_=(0,n.QT)(f.Z.getComboGoodsDetail),[O,b]=(0,l.useState)(!1),[E,C]=(0,l.useState)(!1),[N,S]=(0,l.useState)(!0),[D,P]=(0,l.useState)(null),[R,w]=(0,l.useState)(void 0),[U,A]=(0,l.useState)(null),[j,Q]=(0,l.useState)(null),[Z,V]=(0,l.useState)(null),[W,z]=(0,l.useState)(null),[J,X]=(0,l.useState)(null),[H,K]=(0,l.useState)(!1),[B,$]=(0,l.useState)(null),[tt,te]=(0,l.useState)(!1),[to,ti]=(0,l.useState)(!1),{updateState:tl,routerPullStatus:tn}=h,{updateCartQuantity:td,groupInfo:ts,cartList:ta,editList:tu,isLoading:tr,updateCart:tc,updateUpsell:tp,comboList:tv,deleteComboList:th,isEditCombo:tm,changeCombo:tg,addCombo:tI,changeComboCount:t_}=x(U);(0,l.useEffect)(()=>{H||(X(null),z(null))},[H]);let tf=async()=>{try{var l,n,s;if(!a){t.push("/group-order/index?shoppingCartId=".concat(e));return}if(!ts)return;let[{data:r},{data:p}]=await Promise.all([u.send({shopId:null==ts?void 0:null===(l=ts.shop)||void 0===l?void 0:l.id,subChannelName:"App"}),c.send({id:null==ts?void 0:null===(n=ts.shop)||void 0===n?void 0:n.id})]),h=await v.send({shoppingCartId:e,groupId:o},{isTips:!1});if(h.status&&h.status.code===T.Dl.GROUP_ORDER_LOCKED)return d.u_.alert({title:"Oops",content:(0,i.jsx)("p",{children:null===(s=h.status)||void 0===s?void 0:s.msg}),onOkText:"View Group Order",className:q().error_modal,closable:!1,onOk:()=>t.push("/group-order/order?shoppingCartId=".concat(e,"&itemGroupId=").concat(o))});P(r),V(p),S(!1)}catch(t){console.error(t)}},tL=async function(t,e){let o=!(arguments.length>2)||void 0===arguments[2]||arguments[2];try{var i;let{data:l}=await r.send({dishId:t,shopId:e,subChannelName:"App"});w(l),o&&(0,k.sn)(l,(null==ts?void 0:null===(i=ts.shop)||void 0===i?void 0:i.name)||"")}catch(t){console.error(t)}},tO=async(t,e)=>{try{var o;let{data:e}=await I.send({dishId:t,shopId:null==ts?void 0:null===(o=ts.shop)||void 0===o?void 0:o.id});w({...e,count:0})}catch(t){console.error(t)}},tb=async()=>{try{let{data:i}=await m.send({shoppingCartId:e,groupId:o});(null==i?void 0:i.lock)?d.u_.alert({content:"The group order has been submitted by creator. You cannot edit anymore.",title:"Oops",onOkText:"View Group Order",closable:!1,className:q().add_success_modal,onOk:()=>{t.push("/group-order/order?shoppingCartId=".concat(e,"&itemGroupId=").concat(o))}}):d.u_.alert({content:"Your order has been submitted.",title:"Thank You",onOkText:"View Group Order",closable:!1,className:q().add_success_modal,onOk:()=>{t.push("/group-order/order?shoppingCartId=".concat(e,"&itemGroupId=").concat(o))}})}catch(t){console.error(t)}},tE=async()=>{try{let i=M({dishList:tu,comboList:tv,deleteComboList:th}),{data:l}=await g.send({shoppingCartId:e,groupId:o,actionList:i});d.u_.alert({content:"Your order has been submitted.",title:"Thank You",onOkText:"View Group Order",closable:!1,className:q().add_success_modal,onOk:()=>{t.push("/group-order/order?shoppingCartId=".concat(e,"&itemGroupId=").concat(o))}})}catch(t){console.error(t)}},tC=async()=>{try{let t=null;if(!tN.dishList.find(t=>null==t?void 0:t.upSellId)&&(null==ta?void 0:ta.length)>0){let{data:e}=await p.send({...tN,subChannelName:"App"});Q(e),t=e}if(!(null==t?void 0:t.showUpSell)||tN.dishList.find(t=>null==t?void 0:t.upSellId)){(null==tu?void 0:tu.length)||tm?tE():tb(),tl({routerPullStatus:!1});return}tl({routerPullStatus:!1}),C(!0)}catch(t){tl({routerPullStatus:!1}),console.error(t)}},tN=(0,l.useMemo)(()=>{var t;let e=y(ta);return{dishList:e,shopId:null==ts?void 0:null===(t=ts.shop)||void 0===t?void 0:t.id}},[ta,ts]),ty=(0,l.useMemo)(()=>{var t;return null==j?void 0:null===(t=j.upSellList)||void 0===t?void 0:t.flatMap(t=>{let e=ta.find(e=>
1e.dishId===t.dishId);return e?{...t,...e,count:null==e?void 0:e.count}:t})},[j,ta]),tT=(0,l.useMemo)(()=>{var t;if(!j||!j.upSellList||!(null===(t=j.upSellList)||void 0===t?void 0:t.length))return;let e=null==j?void 0:j.upSellList.reduce((t,e)=>(t[e.dishId]=e,t),{});return ta.map(t=>{let o=e[t.dishId];return o?{...o,...t,count:o.count}:t})},[j,ta]),tk=(0,l.useCallback)(t=>{var e,o;if(null==t?void 0:t.comboId){tw(t);return}t&&t.dishId&&(null==ts?void 0:null===(e=ts.shop)||void 0===e?void 0:e.id)&&(A(null),te(null!=t&&!!t.imageUrl),b(!0),tL(t.dishId,String(null==ts?void 0:null===(o=ts.shop)||void 0===o?void 0:o.id)))},[R,ts]),tS=(0,l.useCallback)(t=>{var e;t&&t.dishId&&(A(t),(0,k.sn)(t,(null==ts?void 0:null===(e=ts.shop)||void 0===e?void 0:e.name)||""),te(null!=t&&!!t.imageUrl),b(!0),w(t),(null==t?void 0:t.upSellId)?tO(t.dishId,null==Z?void 0:Z.shopId):tL(t.dishId,(null==Z?void 0:Z.shopId)||"",!1))},[O,R,Z]),tD=(0,l.useCallback)(async()=>{C(!1),tu.length||(null==tv?void 0:tv.length)||(null==th?void 0:th.length)?await tE():tb()},[j,E,tE,tv,th]),tP=(0,l.useCallback)(t=>{te(null!=t&&!!t.imageUrl),b(!0),tO(t.dishId,t.storeId),A(null)},[j,O]);(0,l.useEffect)(()=>{ts&&tf()},[e,o,ts]);let tR=()=>{ti(!1),K(!1)},tw=async t=>{ti(null!=t&&!!t.imageUrl),K(!0);try{var e,o;let i=await _.send({comboId:t.comboId,shopId:null==ts?void 0:null===(e=ts.shop)||void 0===e?void 0:e.id,subChannelName:"App"},{isTips:!1}),l={...i.data,itemGroups:(0,G.Aj)(null===(o=i.data)||void 0===o?void 0:o.itemGroups)};$(l)}catch(t){$(null)}};return(0,i.jsxs)("div",{className:q().wrap,children:[(0,i.jsxs)("div",{className:q().content,children:[(0,i.jsx)("div",{className:"".concat(q().dish," ").concat(q().c_content),children:(0,i.jsx)(d.SX,{rootClassName:q().goods_tab_list,dataSource:D,isLoading:N,comboList:[...tv],cartList:[...ta],onGoodsItem:t=>{tk(t)},isQuickSelect:!1})}),(0,i.jsx)("div",{className:"".concat(q().cart," ").concat(q().c_content),children:(0,i.jsx)(L.Z,{comboList:tv,placeOrderText:"Add to Order",className:q().cart_content,dataSource:ta,onClick:tS,onChange:tc,onComboChange:(t,e)=>{console.log(t),t_(e,t.value)},onComboClick:(t,e)=>{z(t),X(e),tw(t)},isLoading:N,onPlaceOrder:()=>{tn||(tl({routerPullStatus:!0}),tC())},isPlaceOrderLoading:p.loading||m.loading||g.loading||tr||t.loading})})]}),(0,i.jsx)(d.GoodsDetail,{destroyOnClose:s.isPc,isBuy:(null==R?void 0:R.itemFormatEnum)!==Y.a.NOT_FOR_SALE,isLoading:r.loading||I.loading||tr,mask:s.isPc,havePicture:tt,isOpen:O,onCart:t=>{td(t),b(!1),te(!1)},onCancel:()=>{b(!1),te(!1)},dataSource:R,select:U,config:{remarks:null==Z?void 0:Z.enableItemNotes,quickNotes:null==Z?void 0:Z.notes.filter(t=>!t.type)}}),(0,i.jsx)(d.rT,{destroyOnClose:s.isPc,havePicture:to,isLoading:_.loading,isOpen:H,onCart:t=>{W&&null!==J?tg(J,t):tI(t),tR()},onCancel:tR,dataSource:B,select:W,config:{remarks:null==Z?void 0:Z.enableItemNotes,quickNotes:null==Z?void 0:Z.notes.filter(t=>!t.type)}}),(0,i.jsx)(d.UW,{className:q().upsell_modal,isOpen:E,title:null==j?void 0:j.name,goodsList:ty,onNoUpsell:tD,onGoodsItem:tP,selectGoods:ty,onChangeGoods:tp,checkoutText:"Add to Order",cartList:tT})]})}))},95053:function(t){t.exports={group_order_container:"groupOrderContainer_group_order_container__tfxUg",wrap:"groupOrderContainer_wrap__9Z0S2",tab_wrap:"groupOrderContainer_tab_wrap__ULO_x","text-animation":"groupOrderContainer_text-animation__ThCIk"}},55164:function(t){t.exports={group_order_header:"groupOrderHeader_group_order_header__8yxUa","text-animation":"groupOrderHeader_text-animation__D7R_V"}},57811:function(t){t.exports={wrap:"dish_wrap__ATzOz",content:"dish_content__LrQ8v",c_content:"dish_c_content__c3yMv",dish:"dish_dish__oya4j",cart:"dish_cart___PzaR",goods_tab_list:"dish_goods_tab_list__WZyb2",goods_detail:"dish_goods_detail__9atJr",add_success_modal:"dish_add_success_modal__VNVRj",upsell_modal:"dish_upsell_modal__g__au",error_modal:"dish_error_modal__7vf7r","text-animation":"dish_text-animation__zUwtv"}}},function(t){t.O(0,[85416,49774,92888,40179],function(){return t(t.s=76332)}),_N_E=t.O()}]);
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.