1 line
5.8 KiB
JavaScript
1 line
5.8 KiB
JavaScript
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[402],{2307:function(e,s,a){var n=a(7842),r=a(5544),c=a(118),t=a(758),o=a.n(t),l=a(6540),i=a(1457),d=a(8199),p=a(9703),u=a(9201),h=a(5414),m=a(7723),x=a(9674),g=a(3053),b=a(4848),j=[{code:"all",label:"\u5168\u90e8"},{code:"pending",label:"\u5f85\u4ed8\u6b3e"},{code:"paid",label:"\u5f85\u53d1\u8d27"},{code:"shipping",label:"\u5f85\u6536\u8d27"},{code:"done",label:"\u5df2\u5b8c\u6210"}],f={pending:{label:"\u5f85\u4ed8\u6b3e",badge:"badge-pink"},paid:{label:"\u5f85\u53d1\u8d27",badge:"badge-blue"},shipping:{label:"\u5f85\u6536\u8d27",badge:"badge-blue"},done:{label:"\u5df2\u5b8c\u6210",badge:"badge-green"},cancelled:{label:"\u5df2\u53d6\u6d88",badge:"badge-gray"}};function N(){var e=(0,p.wR)(),s=(e.theme,e.resolvedTheme),a=(0,u.c)();(0,h.l)(s);var n=(0,l.useState)("all"),t=(0,r.A)(n,2),N=t[0],S=t[1],v=(0,l.useState)([]),E=(0,r.A)(v,2),Y=E[0],y=E[1],T=function(){return y((0,i.n7)())};(0,l.useEffect)(T,[]),(0,l.useEffect)(function(){var e=function(){var e=o().getStorageSync("orders:filter");e&&j.some(function(s){return s.code===e})&&(S(e),o().removeStorageSync("orders:filter")),T()};e();var s=o().getCurrentInstance().page;if(s){var a=s.onShow;s.onShow=function(){e(),a&&a.apply(this)}}},[]),(0,l.useEffect)(function(){return o().eventCenter&&o().eventCenter.once("orders:refresh",T),T(),function(){o().eventCenter&&o().eventCenter.off("orders:refresh",T)}},[]);var w="all"===N?Y:Y.filter(function(e){return e.statusCode===N}),C=function(e){o().navigateTo({url:"/pages/orderDetail/index?orderId=".concat(e.id)})};return(0,b.jsxs)(c.Ss,{className:"theme-".concat(s),children:[(0,b.jsx)(x.A,{}),(0,b.jsx)(g.A,{title:"\u6211\u7684\u8ba2\u5355",targetSelector:".orders-page .page-header"}),(0,b.jsx)(m.A,{children:(0,b.jsxs)(c.Ss,{className:"orders-page",children:[(0,b.jsx)(c.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,b.jsx)(c.EY,{className:"page-title",children:"\u6211\u7684\u8ba2\u5355"})}),(0,b.jsx)(c.Ss,{className:"status-tabs",children:(0,b.jsx)(c.BM,{className:"tabs-scroll",scrollX:!0,children:j.map(function(e){return(0,b.jsxs)(c.Ss,{className:"tab-item ".concat(N===e.code?"active":""),onTap:function(){return S(e.code)},children:[(0,b.jsx)(c.EY,{className:"tab-label",children:e.label}),N===e.code&&(0,b.jsx)(c.Ss,{className:"tab-underline"})]},e.code)})})}),(0,b.jsxs)(c.BM,{className:"orders-list",scrollY:!0,children:[w.map(function(e){var s=f[e.statusCode]||f.pending,a=(e.productIcon||"").startsWith("/icon/")||/^https?:/i.test(e.productIcon||"")?e.productIcon:"/icon/\u56db\u89d2\u661f.svg",n=(0,d.uq)(a);return(0,b.jsxs)(c.Ss,{className:"order-card surface-card",onTap:function(){return C(e)},children:[(0,b.jsxs)(c.Ss,{className:"order-header",children:[(0,b.jsx)(c.EY,{className:"order-date",children:e.date}),(0,b.jsx)(c.EY,{className:"badge ".concat(s.badge),children:s.label})]}),(0,b.jsxs)(c.Ss,{className:"order-body",children:[(0,b.jsx)(c.Ss,{className:"order-icon-wrapper",children:(0,b.jsx)(c._V,{className:"order-icon-img",src:n,mode:"aspectFit"})}),(0,b.jsxs)(c.Ss,{className:"order-info",children:[(0,b.jsx)(c.EY,{className:"order-product",children:e.productName}),(0,b.jsx)(c.EY,{className:"order-sku",children:e.sku}),(0,b.jsxs)(c.EY,{className:"order-meta",children:["\u6570\u91cf: ",e.count," \u4ef6 | ",e.id]})]})]}),(0,b.jsxs)(c.Ss,{className:"order-footer",children:[(0,b.jsxs)(c.Ss,{className:"order-price-bar",children:[(0,b.jsx)(c.EY,{className:"price-label",children:"\u5b9e\u4ed8\u6b3e"}),(0,b.jsx)(c.EY,{className:"price-value",children:e.price})]}),(0,b.jsxs)(c.Ss,{className:"order-actions",children:["pending"===e.statusCode&&(0,b.jsx)(c.Ss,{className:"btn-primary order-btn",children:(0,b.jsx)(c.EY,{children:"\u7acb\u5373\u4ed8\u6b3e"})}),"paid"===e.statusCode&&(0,b.jsx)(c.Ss,{className:"btn-secondary order-btn",children:(0,b.jsx)(c.EY,{children:"\u50ac\u53d1\u8d27"})}),"shipping"===e.statusCode&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(c.Ss,{className:"btn-secondary order-btn",onTap:function(e){e.stopPropagation(),o().showToast({title:"\u67e5\u770b\u7269\u6d41",icon:"none"})},children:(0,b.jsx)(c.EY,{children:"\u67e5\u770b\u7269\u6d41"})}),(0,b.jsx)(c.Ss,{className:"btn-primary order-btn",onTap:function(e){e.stopPropagation(),o().showToast({title:"\u786e\u8ba4\u6536\u8d27",icon:"none"})},children:(0,b.jsx)(c.EY,{children:"\u786e\u8ba4\u6536\u8d27"})})]}),"done"===e.statusCode&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(c.Ss,{className:"btn-secondary order-btn",onTap:function(e){e.stopPropagation(),o().showToast({title:"\u7533\u8bf7\u552e\u540e",icon:"none"})},children:(0,b.jsx)(c.EY,{children:"\u7533\u8bf7\u552e\u540e"})}),(0,b.jsx)(c.Ss,{className:"btn-primary order-btn",onTap:function(e){e.stopPropagation(),o().showToast({title:"\u518d\u6765\u4e00\u5355",icon:"none"})},children:(0,b.jsx)(c.EY,{children:"\u518d\u6765\u4e00\u5355"})})]}),(0,b.jsx)(c.Ss,{className:"btn-secondary order-btn",onTap:function(s){s.stopPropagation(),C(e)},children:(0,b.jsx)(c.EY,{children:"\u8be6\u60c5"})})]})]})]},e.id)}),0===w.length&&(0,b.jsxs)(c.Ss,{className:"empty-state",children:[(0,b.jsx)(c._V,{className:"empty-icon-img",src:(0,d.uq)("/icon/\u5305\u88f9.png"),mode:"aspectFit"}),(0,b.jsx)(c.EY,{className:"empty-text",children:"\u6682\u65e0\u8ba2\u5355"}),(0,b.jsx)(c.EY,{className:"empty-sub",children:"\u53bb\u9996\u9875\u5f00\u59cb\u5b9a\u5236\u5427"}),(0,b.jsx)(c.Ss,{className:"btn-primary",onTap:function(){return o().switchTab({url:"/pages/index/index"})},children:(0,b.jsx)(c.EY,{children:"\u53bb\u5b9a\u5236"})})]})]})]})})]})}var S={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8ba2\u5355\u5217\u8868"};Page((0,n.createPageConfig)(N,"pages/orders/index",{root:{cn:[]}},S||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(2307)});e.O()}]); |