"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7316],{85968:function(T,f,e){var R=e(23674),u=e(62086),C=function(h){var d=(0,R.useModel)("@@initialState"),p=d.initialState,g=d.loading,O=d.error,P=d.refresh,j=d.setInitialState,v=p==null?void 0:p.authPermissionAction;if(!v)return(0,u.jsx)("span",{children:h.children});var D=v.indexOf(h.action);return D>=0?(0,u.jsx)("span",{children:h.children}):(0,u.jsx)(u.Fragment,{})};f.Z=C},74514:function(T,f,e){e.r(f);var R=e(57213),u=e.n(R),C=e(25359),c=e.n(C),h=e(49811),d=e.n(h),p=e(54306),g=e.n(p),O=e(93236),P=e(23674),j=e(71516),v=e(61385),D=e(14649),U=e(50336),K=e(87708),I=e(85968),b=e(90627),s=e(62086),M=b.Z.GoodsController,B=M.goodsItems,L=M.goodsCreate,W=M.goodsDelete,S=M.goodsUpdate;f.default=function(){var E=(0,O.useRef)(),y={id:"",type:1,cover:null,detail:null},$=(0,O.useState)(y),A=g()($,2),Z=A[0],x=A[1],F=function(){var l=d()(c()().mark(function n(a){var _,o,r;return c()().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,W(a);case 2:_=t.sent,o=_.success,o&&(E.current.clearSelected(),(r=E.current)===null||r===void 0||r.reload());case 5:case"end":return t.stop()}},n)}));return function(a){return l.apply(this,arguments)}}(),G=function(){var l=d()(c()().mark(function n(a){var _,o,r;return c()().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return x(a),t.next=3,L(u()({},a));case 3:_=t.sent,o=_.success,o&&(x(y),(r=E.current)===null||r===void 0||r.reload(),setCreateFormModal(!1));case 6:case"end":return t.stop()}},n)}));return function(a){return l.apply(this,arguments)}}(),z=function(){var l=d()(c()().mark(function n(a){var _,o,r;return c()().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,S(u()({},a));case 2:_=t.sent,o=_.success,o&&((r=E.current)===null||r===void 0||r.reload(),setUpdateFormModal(!1));case 5:case"end":return t.stop()}},n)}));return function(a){return l.apply(this,arguments)}}(),w=[{title:"ID",dataIndex:"id",search:!1},{title:"\u5546\u54C1\u540D",dataIndex:"name",search:!0},{title:"\u5C01\u9762\u56FE",dataIndex:"cover",valueType:"avatar",search:!1,render:function(n,a){return(0,s.jsx)(j.Z,{width:100,src:a.cover[0]})}},{title:"\u539F\u4EF7",dataIndex:"original_price",search:!1},{title:"\u73B0\u4EF7",dataIndex:"current_price",search:!1},{title:"\u8D60\u9001\u79EF\u5206",dataIndex:"integral",search:!1},{title:"\u5E93\u5B58",dataIndex:"stock",search:!1},{title:"\u9500\u91CF",dataIndex:"sales",search:!1},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"created_at",search:!1},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(n,a){return(0,s.jsx)(v.Z,{children:(0,s.jsx)(I.Z,{action:"admin/goods/update",children:(0,s.jsx)(D.ZP,{type:"link",onClick:function(){P.history.push("goods/".concat(a.id,"/update"))},children:"\u7F16\u8F91"})},"admin/goods/update")})}}];return(0,s.jsx)(U._z,{ghost:!0,children:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(K.Z,{actionRef:E,rowKey:"id",search:{defaultCollapsed:!1},toolBarRender:function(){return[(0,s.jsx)(I.Z,{action:"admin/goods/create",children:(0,s.jsx)(D.ZP,{type:"primary",onClick:function(){P.history.push("goods/0/create")},children:"\u6DFB\u52A0"})},"admin/goods/create")]},request:function(){var l=d()(c()().mark(function n(a,_,o){var r,i,t;return c()().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,B(u()(u()({},a),{},{sorter:_,filter:o}));case 2:return r=m.sent,i=r.data,t=r.success,m.abrupt("return",{data:(i==null?void 0:i.data)||[],total:i==null?void 0:i.total,success:t});case 6:case"end":return m.stop()}},n)}));return function(n,a,_){return l.apply(this,arguments)}}(),columns:w,tableAlertRender:function(n){var a=n.selectedRowKeys,_=n.selectedRows,o=n.onCleanSelected;return(0,s.jsxs)(v.Z,{size:24,children:[(0,s.jsxs)("span",{children:["\u5DF2\u9009 ",a.length," \u9879"]}),(0,s.jsx)("span",{children:(0,s.jsx)("a",{style:{marginInlineStart:8},onClick:o,children:"\u53D6\u6D88\u9009\u62E9"})})]})},tableAlertOptionRender:function(n){var a=n.selectedRowKeys,_=n.selectedRows,o=n.onCleanSelected},pagination:{showSizeChanger:!0}})})})}}}]);
