Files
wechat_wc/dist/pages/designList/index.js
T

1 line
6.0 KiB
JavaScript

"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[319],{3512:function(e,s,n){var a=n(7842),t=n(5544),c=n(118),i=n(758),l=n.n(i),d=n(6540),r=n(8594),o=n(5234),u=n(8199),h=n(9703),g=n(9201),m=n(5414),x=n(7723),b=n(9674),p=n(4848),j=[{code:"all",label:"\u5168\u90e8"},{code:"toDesign",label:"\u5f85\u8bbe\u8ba1"},{code:"undesigned",label:"\u672a\u8bbe\u8ba1"},{code:"designing",label:"\u8bbe\u8ba1\u4e2d"},{code:"ordered",label:"\u5df2\u4e0b\u5355"}],f={undesigned:{label:"\u672a\u8bbe\u8ba1",cls:"badge-pink"},designing:{label:"\u8bbe\u8ba1\u4e2d",cls:"badge-blue"},ordered:{label:"\u5df2\u4e0b\u5355",cls:"badge-green"}};function S(){var e=(0,h.wR)(),s=e.resolvedTheme,n=(0,g.c)();(0,m.l)(s);var a=(0,d.useState)("all"),i=(0,t.A)(a,2),S=i[0],N=i[1],w=(0,d.useState)([]),v=(0,t.A)(w,2),T=v[0],E=v[1],Y=(0,d.useState)(!1),y=(0,t.A)(Y,2),k=y[0],A=y[1],z=(0,d.useState)(new Set),I=(0,t.A)(z,2),P=I[0],B=I[1],C=(0,d.useCallback)(function(){E((0,r.p_)())},[]),L=(0,d.useCallback)(function(){var e=l().getStorageSync("designList:filter");e&&j.some(function(s){return s.code===e})&&(N(e),l().removeStorageSync("designList:filter")),C()},[C]);(0,d.useEffect)(function(){var e=l().getCurrentInstance().page;if(e){var s=e.onShow;e.onShow=function(){L(),s&&s.apply(this)}}L()},[L]);var M="all"===S?T:"toDesign"===S?T.filter(function(e){return"undesigned"===e.status||"designing"===e.status}):T.filter(function(e){return e.status===S}),F=function(e){"ordered"!==e.status?l().navigateTo({url:"/pages/diy/index?source=designList&designId=".concat(e.id)}):l().showToast({title:"\u8be5\u5546\u54c1\u5df2\u4e0b\u5355\uff0c\u8bf7\u67e5\u770b\u8ba2\u5355",icon:"none"})},_=function(e){var s=new Set(P);s.has(e)?s.delete(e):s.add(e),B(s)},q=function(){P.size===M.length?B(new Set):B(new Set(M.map(function(e){return e.id})))},D=function(){0!==P.size&&l().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u786e\u5b9a\u5220\u9664\u9009\u4e2d\u7684 ".concat(P.size," \u4e2a\u6761\u76ee\u5417\uff1f"),success:function(e){e.confirm&&((0,r.kh)(Array.from(P)),B(new Set),A(!1),C())}})},J=function(){k?(A(!1),B(new Set)):A(!0)};return(0,p.jsxs)(c.Ss,{className:"theme-".concat(s),children:[(0,p.jsx)(b.A,{}),(0,p.jsx)(x.A,{children:(0,p.jsxs)(c.Ss,{className:"design-page",children:[(0,p.jsx)(c.Ss,{className:"page-header dashed-card mt-20",style:{marginTop:"".concat(n.headerPaddingTop,"px")},children:(0,p.jsxs)(c.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,p.jsx)(c.EY,{className:"back-btn",onTap:function(){return l().navigateBack()},children:"\u2190"}),(0,p.jsx)(c.EY,{className:"page-title",children:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355"}),(0,p.jsx)(c.EY,{className:"manage-btn",onTap:J,children:k?"\u5b8c\u6210":"\u7ba1\u7406"})]})}),(0,p.jsx)(c.Ss,{className:"status-tabs",children:(0,p.jsx)(c.BM,{className:"tabs-scroll",scrollX:!0,children:j.map(function(e){return(0,p.jsxs)(c.Ss,{className:"tab-item ".concat(S===e.code?"active":""),onTap:function(){return N(e.code)},children:[(0,p.jsx)(c.EY,{className:"tab-label",children:e.label}),S===e.code&&(0,p.jsx)(c.Ss,{className:"tab-underline"})]},e.code)})})}),k&&(0,p.jsx)(c.Ss,{className:"batch-bar dashed-card",children:(0,p.jsxs)(c.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,p.jsxs)(c.Ss,{className:"batch-select-all",onTap:q,children:[(0,p.jsx)(c.Ss,{className:"batch-checkbox ".concat(P.size===M.length&&M.length>0?"checked":"")}),(0,p.jsxs)(c.EY,{className:"batch-text",children:["\u5168\u9009 (",P.size,"/",M.length,")"]})]}),(0,p.jsx)(c.Ss,{className:"batch-delete ".concat(P.size>0?"active":""),onTap:D,children:(0,p.jsx)(c.EY,{children:"\u5220\u9664"})})]})}),(0,p.jsxs)(c.BM,{className:"design-list",scrollY:!0,children:[M.map(function(e){var s,n=f[e.status],a=null!==(s=e.productIcon)&&void 0!==s&&s.startsWith("/icon/")||/^https?:/i.test(e.productIcon||"")?e.productIcon:o.rj[e.productId]||"/icon/\u56db\u89d2\u661f.png",t=(0,u.uq)(a),i=P.has(e.id);return(0,p.jsxs)(c.Ss,{className:"design-card dashed-card ".concat(i?"selected":""),onTap:function(){return k?_(e.id):void 0},children:[(0,p.jsxs)(c.Ss,{className:"design-body",children:[k&&(0,p.jsx)(c.Ss,{className:"batch-checkbox ".concat(i?"checked":"")}),(0,p.jsx)(c._V,{className:"design-icon-img",src:t,mode:"aspectFit"}),(0,p.jsxs)(c.Ss,{className:"design-info",children:[(0,p.jsxs)(c.Ss,{className:"design-title-row",children:[(0,p.jsx)(c.EY,{className:"design-name",children:e.productName}),(0,p.jsx)(c.EY,{className:"badge ".concat(n.cls),children:n.label})]}),(0,p.jsxs)(c.EY,{className:"design-meta",children:["\u6570\u91cf: ",e.count," \u4ef6 | \u5355\u4ef7: \xa5",e.unitPrice]}),(0,p.jsxs)(c.EY,{className:"design-total",children:["\u5c0f\u8ba1: \xa5",(e.unitPrice*e.count).toFixed(2)]})]})]}),!k&&(0,p.jsxs)(c.Ss,{className:"design-actions",children:["ordered"!==e.status&&(0,p.jsx)(c.Ss,{className:"btn-gradient design-btn",onTap:function(){return F(e)},children:(0,p.jsx)(c.EY,{children:"undesigned"===e.status?"\u5f00\u59cb\u8bbe\u8ba1":"\u7ee7\u7eed\u8bbe\u8ba1"})}),"ordered"===e.status&&(0,p.jsx)(c.Ss,{className:"btn-outline design-btn",onTap:function(){return l().switchTab({url:"/pages/orders/index"})},children:(0,p.jsx)(c.EY,{children:"\u67e5\u770b\u8ba2\u5355"})})]})]},e.id)}),0===M.length&&(0,p.jsxs)(c.Ss,{className:"empty-state",children:[(0,p.jsx)(c._V,{className:"empty-icon-img",src:(0,u.uq)("/icon/\u8c03\u8272\u76d8.png"),mode:"aspectFit"}),(0,p.jsx)(c.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u8bbe\u8ba1\u6e05\u5355"}),(0,p.jsx)(c.EY,{className:"empty-sub",children:"\u53bb\u9996\u9875\u901b\u901b\uff0c\u627e\u5230\u559c\u6b22\u7684\u5b9a\u5236\u54c1"}),(0,p.jsx)(c.Ss,{className:"btn-gradient",onTap:function(){return l().switchTab({url:"/pages/index/index"})},children:(0,p.jsx)(c.EY,{children:"\u53bb\u901b\u901b"})})]})]}),(0,p.jsx)(c.Ss,{style:{height:"40px"}})]})})]})}var N={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8bbe\u8ba1\u6e05\u5355"};Page((0,a.createPageConfig)(S,"pages/designList/index",{root:{cn:[]}},N||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(3512)});e.O()}]);