PageSourceSearch

https://m-lab.today/_next/static/chunks/pages/dashboard/sitepromotion-206c68cfdca82bee.js

js m-lab.today collected 2026-10-08 20:01:24 UTC 13,330 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9934],{14843:function(a,b,c){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/sitepromotion",function(){return c(81442)}])},37612:function(a,b,c){"use strict";var d=c(26042),e=c(69396),f=c(85893),g=c(23100),h=c(204),i=function(a){return(0,f.jsx)(g.xu,(0,e.Z)((0,d.Z)({h:"100%",borderRadius:"8px",overflow:"hidden",bg:"white",color:"gray.700",border:"1px solid",borderColor:"gray.300",className:"list-table-container"},a),{children:(0,f.jsx)(h.k,{direction:"column",h:"100%",overflow:"auto",children:a.children})}))};b.Z=i},81442:function(a,b,c){"use strict";c.r(b),c.d(b,{default:function(){return am}});var d=c(26042),e=c(69396),f=c(828),g=c(85893),h=c(7335),i=c(204),j=c(88911),k=c(29222),l=c(28129),m=c(18691),n=c(93863),o=c(43775),p=c(94385),q=c(67294),r=c(42298),s=c(35812),t=c(75972),u=c(31963),v=c(21085),w=c(55819),x=c(44504),y=c(89154),z=c(73793),A=c(70654),B=c(96177),C=c(47580),D=c(20369),E=c(92752),F=c(31948),G=c(47018),H=function(a){var b=a.isOpen,c=a.onClose,d=a.detail,e=a.detailReducer,f=(0,q.useState)(d.name),h=f[0],i=f[1];return(0,g.jsxs)(E.u_,{size:"lg",isOpen:b,onClose:c,blockScrollOnMount:!1,children:[(0,g.jsx)(u.Z,{}),(0,g.jsxs)(F.h,{children:[(0,g.jsx)(x.x,{children:"編輯全站促銷名稱"}),(0,g.jsx)(w.o,{fontSize:"24px",top:"70px",right:"64px"}),(0,g.jsx)(z.f,{children:(0,g.jsxs)(A.NI,{mt:"8px",children:[(0,g.jsx)(B.l,{children:"請輸入全站促銷名稱"}),(0,g.jsx)(l.I,{placeholder:"",value:h||"",onChange:function(a){return i(a.target.value)}})]})}),(0,g.jsxs)(G.m,{children:[(0,g.jsx)(k.z,{flex:"1",variant:"outline",onClick:c,size:"lg",mr:"8px",children:"取消"}),(0,g.jsx)(k.z,{flex:"1",variant:"gray/500",size:"lg",onClick:function(){e.val("name",h),c()},children:"儲存"})]})]})]})},I=c(31708),J=c(776),K=c(33751),L=function(){return(0,g.jsx)(i.k,{direction:"column",gap:"28px",children:(0,g.jsxs)(I.r,{templateColumns:"repeat(3, 1fr)",gap:"24px",children:[(0,g.jsx)(J.P,{children:(0,g.jsxs)(K.Z,{h:"100%",children:[(0,g.jsx)(j.x,{textStyle:"h2",children:"銷售統計"}),(0,g.jsxs)(I.r,{templateColumns:"auto 1fr",gap:"16px",rowGap:"8px",children:[(0,g.jsx)(J.P,{children:"總金額"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"$000"}),(0,g.jsx)(J.P,{children:"平均日金額"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"$000"})]})]})}),(0,g.jsx)(J.P,{children:(0,g.jsxs)(K.Z,{h:"100%",children:[(0,g.jsx)(j.x,{textStyle:"h2",children:"商品統計"}),(0,g.jsxs)(I.r,{templateColumns:"auto 1fr",gap:"16px",rowGap:"8px",children:[(0,g.jsx)(J.P,{colSpan:2,fontSize:"18px",fontWeight:"600",children:"熱門商品"}),(0,g.jsx)(J.P,{children:"品名"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"銷售數量"}),(0,g.jsx)(J.P,{children:"商品-樣式"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"})]})]})}),(0,g.jsx)(J.P,{children:(0,g.jsxs)(K.Z,{h:"100%",children:[(0,g.jsx)(j.x,{textStyle:"h2",children:"訂單狀態"}),(0,g.jsxs)(I.r,{templateColumns:"auto 1fr",gap:"16px",rowGap:"8px",children:[(0,g.jsx)(J.P,{children:"總訂單數"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"}),(0,g.jsx)(J.P,{children:"已付款"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"}),(0,g.jsx)(J.P,{children:"未付款"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"}),(0,g.jsx)(J.P,{children:"棄單"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"}),(0,g.jsx)(J.P,{children:"退貨數量"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"}),(0,g.jsx)(J.P,{children:"平均日訂單"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"0"}),(0,g.jsx)(J.P,{children:"預購金額"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"$0,000,000"}),(0,g.jsx)(J.P,{children:"平均日金額"}),(0,g.jsx)(J.P,{justifySelf:"end",children:"$0,000,000"})]})]})}),(0,g.jsx)(J.P,{colSpan:3,children:(0,g.jsx)(K.Z,{h:"100%",children:(0,g.jsx)(j.x,{textStyle:"h2",children:"(圖表)"})})})]})})},M=c(5384),N=c(1603),O=c(46891),P=c(23014),Q=c(50744),R=c(4050),S=c(82005),T=function(a){var b=a.detail,c=a.detailReducer,f=a.disclosure,j=a.setUpdateCount,l=(0,q.useState)({}),m=l[0],n=l[1],o={name:(0,h.q)(),delete:(0,h.q)()},p={discountOnSave:function(a){c.exec(function(b){null==b.discounts&&(b.discounts=[]),b.discounts.some(function(b){return b.id==a.id})?b.discounts=b.discounts.map(function(b){return b.id==a.id?a:b}):b.discounts.push(a)})},discountOnDelete:function(a){c.exec(function(b){b.discounts=b.discounts.filter(function(b){return b.id!==a})})},discountProductsOnChange:function(a){c.exec(function(b){b.discount_products=a})},onDateTimeChange:function(a,b){c.exec(function(c){c[a]=b.toISOString()})},handleSave:function(){(0,R.Z)(b,[{key:"name",label:"全站促銷名稱"},{key:"start_datetime",label:"有效期間"},{key:"end_datetime",label:"有效期間"},],function(){n(function(a){return(0,e.Z)((0,d.Z)({},a),{save:!0})});var a=Q.Z.sitePromotion(b);S.Z.proxy({path:"sitePromotion",method:"update",payload:a}).then(function(a){n(function(a){return(0,e.Z)((0,d.Z)({},a),{save:!1})}),"success"==a.status?(j(function(a){return a+1}),f.editor.onClose()):toast.error(a.msg)})})}};return(0,g.jsxs)(g.Fragment,{children:[o.name.isOpen&&(0,g.jsx)(H,{isOpen:o.name.isOpen,onClose:o.name.onClose,detail:b,detailReducer:c}),o.delete.isOpen&&(0,g.jsx)(P.Z,{isOpen:o.delete.isOpen,onClose:o.delete.onClose,data:b}),(0,g.jsxs)(t.d,{isOpen:f.editor.isOpen,onClose:f.editor.onClose,placement:"right",variant:"full",children:[(0,g.jsx)(u.Z,{}),(0,g.jsxs)(v.s,{children:[(0,g.jsx)(w.o,{fontSize:"30px",top:"24px",right:"24px"}),(0,g.jsxs)(x.x,{children:[b.name?b.name:"請輸入全站促銷名稱",(0,g.jsx)(y.h,{"aria-label":"edit name",ml:"8px",icon:(0,g.jsx)(C.d,{}),onClick:o.name.onOpen})]}),(0,g.jsx)(z.f,{children:(0,g.jsxs)(i.k,{w:"100%",direction:"column",gap:"24px",children:[(0,g.jsx)(L,{}
1),(0,g.jsx)(O.Z,{children:"促銷設定"}),(0,g.jsxs)(A.NI,{w:"50%",children:[(0,g.jsx)(B.l,{fontWeight:"400",children:"有效期間"}),(0,g.jsx)(D.Z,{onDateTimeChange:p.onDateTimeChange,defaultStart:b.start_datetime,defaultEnd:b.end_datetime}),(0,g.jsx)(A.Q6,{children:"須於有效期間內結帳才能完成購買流程"})]}),(0,g.jsx)(O.Z,{sub:"全站促銷的條件為全站適用,當滿足優惠條件時便會在消費者進入購物車時出現",children:"促銷內容"}),(0,g.jsx)(N.Z,{data:b.discount_products,handleOnChange:p.discountProductsOnChange}),(0,g.jsx)(M.Z,{data:b,handleOnSave:p.discountOnSave,handleOnDelete:p.discountOnDelete}),(0,g.jsxs)(i.k,{w:"100%",gap:"24px",children:[(0,g.jsx)(k.z,{display:b.id?"inline-block":"none",variant:"outline",colorScheme:"red",size:"lg",mr:"8px",onClick:o.delete.onOpen,children:"刪除"}),(0,g.jsx)(k.z,{flex:"1",variant:"outline",size:"lg",mr:"8px",onClick:f.editor.onClose,children:"取消"}),(0,g.jsx)(k.z,{flex:"1",isLoading:m.save,variant:"gray/500",size:"lg",onClick:p.handleSave,children:"儲存"})]})]})})]})]})]})},U=c(36557),V=c(24304),W=c(36526),X=c(75421),Y=c(28650),Z=c(577),$=c(37612),_=c(40297),aa=function(a){var b=a.detailReducer,c=a.tableData,d=a.listTable,e=a.filtersReducer,f=a.disclosure,h={formatDate:function(a){return a?(0,r.default)(new Date(a),"yyyy-MM-dd HH:mm"):""}};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)($.Z,{children:(0,g.jsxs)(U.i,{children:[(0,g.jsx)(V.h,{className:"list-table-header",children:(0,g.jsxs)(W.Tr,{children:[(0,g.jsx)(X.Th,{children:"促銷名稱"}),(0,g.jsx)(X.Th,{w:"200px",children:"開始時間"}),(0,g.jsx)(X.Th,{w:"200px",children:"結束時間"})]})}),(0,g.jsx)(Y.p,{children:null==c?void 0:c.map(function(a,c){return(0,g.jsxs)(W.Tr,{onClick:function(){b.exec(function(b){return a}),f.editor.onOpen()},children:[(0,g.jsx)(Z.Td,{children:a.name}),(0,g.jsx)(Z.Td,{children:h.formatDate(a.start_datetime)}),(0,g.jsx)(Z.Td,{children:h.formatDate(a.end_datetime)})]},c)})})]})}),d&&(0,g.jsx)(_.Z,{listTable:d,filtersReducer:e})]})},ab=c(84970),ac=c(98566),ad=c(47568),ae=c(34051),af=c.n(ae),ag=c(55678),ah=function(){var a,b=(0,q.useState)([]),c=b[0],d=b[1],e=(0,q.useState)(null),f=e[0],g=e[1],h=(0,q.useState)(!1),i=h[0],j=h[1],k=(a=(0,ad.Z)(af().mark(function a(b){var c;return af().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(b){a.next=2;break}return a.abrupt("return");case 2:return j(!0),a.next=5,S.Z.proxy({path:"sitePromotion",method:"list",payload:b});case 5:return c=a.sent,j(!1),"success"===c.status?d(c.data):ag.Am.error("無法讀取全站促銷列表"),a.abrupt("return",c);case 9:case"end":return a.stop()}},a)})),function(b){return a.apply(this,arguments)}),l=function(a){g(a)};return(0,q.useEffect)(function(){k(f)},[f]),{isFetching:i,sitePromotionList:c,fetchSitePromotionList:l,fetchData:k}},ai=ah,aj=c(61847),ak=c(19476),al=function(){var a,b,c,t=ai(),u=t.isFetching,v=t.fetchData,w=(0,f.Z)((0,ak.Z)("site_promo_detail"),2),x=w[0],y=w[1],z=(0,f.Z)((0,ak.Z)("site_promo_table"),2),A=z[0],B=z[1],C=(0,f.Z)((0,ak.Z)("site_promo_filters"),2),D=C[0],E=C[1],F=(0,q.useState)(0),G=F[0],H=F[1],I={editor:(0,h.q)()};return(0,q.useEffect)(function(){var a=(0,aj.Z)();E.exec(function(b){b.range=a})},[]),(0,q.useEffect)(function(){D.range&&v(D).then(function(a){"success"===a.status&&B.exec(function(b){b.tableData=a.data,b.listTable=a.table})})},[G,D]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s.Z,{}),I.editor.isOpen&&(0,g.jsx)(T,{detail:x,detailReducer:y,disclosure:I,setUpdateCount:H}),(0,g.jsxs)(i.k,{direction:"column",gap:"24px",w:"100%",h:"100%",children:[(0,g.jsxs)(i.k,{justify:"space-between",children:[(0,g.jsx)(j.x,{textStyle:"dashboardPageTitle",children:"全站促銷"}),(0,g.jsx)(k.z,{variant:"gray/500",onClick:function(){y.exec(function(a){return ac.z.site_promo_detail.initState}),I.editor.onOpen()},children:"新增"})]}),(0,g.jsxs)(i.k,{w:"100%",gap:"8px",children:[(0,g.jsx)(l.I,{type:"datetime-local",flex:"1",value:(null===(a=D.filter)|| void 0===a?void 0:a.time_machine)||"",onChange:function(a){E.exec(function(b){b.filter={time_machine:(0,r.default)(new Date(a.target.value),"yyyy-MM-dd HH:mm:ss")},b.range=(0,aj.Z)()})}}),(0,g.jsxs)(m.P,{placeholder:"所有狀態",flex:"1",value:(null===(b=D.filter)|| void 0===b?void 0:b.status)||"",borderColor:(null===(c=D.filter)|| void 0===c?void 0:c.status)?"secondary":"inherit",onChange:function(a){E.exec(function(b){b.filter=(0,e.Z)((0,d.Z)({},b.filter),{status:a.target.value||null}),b.range=(0,aj.Z)()})},children:[(0,g.jsx)("option",{value:"online",children:"啟用中"}),(0,g.jsx)("option",{value:"offline",children:"尚未啟用"}),(0,g.jsx)("option",{value:"expired",children:"已結束"})]}),(0,g.jsxs)(n.B,{flex:"1",children:[(0,g.jsx)(o.Z,{children:(0,g.jsx)(p.W,{})}),(0,g.jsx)(l.I,{type:"text",placeholder:"輸入促銷名稱",onChange:function(a){E.exec(function(b){b.filter=(0,e.Z)((0,d.Z)({},b.filter),{search:a.target.value}),b.range=(0,aj.Z)()})}})]})]}),u?(0,g.jsx)(ab.Z,{}):(0,g.jsx)(aa,{detailReducer:y,tableData:A.tableData,listTable:A.listTable,filtersReducer:E,disclosure:I})]})]})},am=al},50744:function(a,b,c){"use strict";var d=c(26042),e=c(69396),f=c(99534),g=c(42298),h=c(24288);b.Z={voucher:function(a){var b,c=h.Z.obj.copy(a);return c.start_datetime=(0,g.default)(new Date(c.start_datetime),"yyyy-MM-dd HH:mm:ss"),c.end_datetime=(0,g.default)(new Date(c.end_datetime),"yyyy-MM-dd HH:mm:ss"),(null===(b=c.usage_range)|| void 0===b?void 0:b.inclusion)||(c.usage_range=(0,e.Z)((0,d.Z)({},c.usage_range),{inclusion:{type:"all_site",range:null}})),c},product:function(a){var b=h.Z.obj.copy(a);return b.shipping_time=b.shipping_time?(0,g.default)(new Date(b.shipping_time),"yyyy-MM-dd"):b.shipping_time,b.variations=h.Z.id.useTmpID(b.variations,!1).map(function(a){return null==a.image&&(a.image=b.image),a}),b.tags=b.tags||[],b},productBundle:function(a){var b=h.Z.obj.copy(a);return b.shipping_time=b.shipping_time?(0,g.default)(new Date(b.shipping_time),"yyyy-MM-dd"):b.shipping_time,b.tags=b.tags||[],b},sitePromotion:function(a){var b,c,d=h.Z.obj.copy(a);return d.start_datetime=(0,g.default)(new Date(d.start_datetime),"yyyy-MM-dd HH:mm:ss"),d.end_datetime=(0,g.default)(new Date(d.end_datetime),"yyyy-MM-dd HH:mm:ss"),null!==d.discount_products?(b=d.discount_products.map(function(a){return a.option,(0,f.Z)(a,["option"])}),d.discount_products=b):d.discount_products=[],null!==d.discounts&&(c=d.discounts.map(function(a){return a._delete,(0,f.Z)(a,["_delete"])}),d.discounts=c,d.discounts=h.Z.id.useTmpID(d.discounts,!1)),d},storePromotion:function(a){var b,c,d=h.Z.obj.copy(a);return d.start_datetime=(0,g.default)(new Date(d.start_datetime),"yyyy-MM-dd HH:mm:ss"),d.end_datetime=(0,g.default)(new Date(d.end_datetime),"yyyy-MM-dd HH:mm:ss"),null!==d.discount_products?(b=d.discount_products.map(function(a){return a.option,(0,f.Z)(a,["option"])}),d.discount_products=b):d.discount_products=[],null!==d.discounts&&(c=d.discounts.map(function(a){return a._delete,(0,f.Z)(a,["_delete"])}),d.discounts=c,d.discounts=h.Z.id.useTmpID(d.discounts,!1)),d}}},61847:function(a,b){"use strict";var c=function(a){var b;return(null===(b=document.querySelector(a))|| void 0===b?void 0:b.clientHeight)||0},d=function(){var a={start:0,end:-1},b=c(".list-table-container"),d=c(".list-table-additional-header"),e=c(".list-table-header");if(!b)return a;var f=Math.floor((b-d-e-66)/72);return a.end=f-1,a};b.Z=d}},function(a){a.O(0,[1228,5175,4544,8921,8470,9774,2888,179],function(){var b;return a(a.s=14843)}),_N_E=a.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.