|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1587,1322],{38376:function(Ie,re,a){"use strict";a.r(re),a.d(re,{default:function(){return je}});var we=a(57663),V=a(71577),Fe=a(43358),$=a(34041),Pe=a(34792),i=a(48086),n=a(39428),f=a(3182),C=a(2824),m=a(67294),Re=a(30381),le=a(16894),se=a(78009),ie=a(85224),xe=a(71194),oe=a(50146),w=a(11849),Ee=a(77883),te=a(85986),Oe=a(49111),de=a(19650),De=a(48736),pe=a(27049),$e=a(9715),Z=a(55843),be=a(47673),Y=a(4107),ce=a(86582),fe=a(49101),F=a(48971);function he(d){return J.apply(this,arguments)}function J(){return J=(0,f.Z)((0,n.Z)().mark(function d(s){return(0,n.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,F.WY)("/kitchen/api/papercoupon/paperCouponPgage",{method:"POST",data:s}));case 1:case"end":return u.stop()}},d)})),J.apply(this,arguments)}function ve(d){return L.apply(this,arguments)}function L(){return L=(0,f.Z)((0,n.Z)().mark(function d(s){return(0,n.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,F.WY)("/kitchen/api/papercoupon/addPaperCoupon",{method:"POST",data:s}));case 1:case"end":return u.stop()}},d)})),L.apply(this,arguments)}function me(d){return U.apply(this,arguments)}function U(){return U=(0,f.Z)((0,n.Z)().mark(function d(s){return(0,n.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,F.WY)("/kitchen/api/papercoupon/updatePaperCouponEnable?Ids="+s,{method:"GET"}));case 1:case"end":return u.stop()}},d)})),U.apply(this,arguments)}function ye(d){return z.apply(this,arguments)}function z(){return z=(0,f.Z)((0,n.Z)().mark(function d(s){return(0,n.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,F.WY)("/kitchen/api/papercoupon/updatePaperCoupon",{method:"POST",data:s}));case 1:case"end":return u.stop()}},d)})),z.apply(this,arguments)}function ae(){return H.apply(this,arguments)}function H(){return H=(0,f.Z)((0,n.Z)().mark(function d(){return(0,n.Z)().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.abrupt("return",(0,F.WY)("/kitchen/api/papercoupon/getPaperCouponType",{method:"GET"}));case 1:case"end":return y.stop()}},d)})),H.apply(this,arguments)}function Ze(d){return K.apply(this,arguments)}function K(){return K=(0,f.Z)((0,n.Z)().mark(function d(s){return(0,n.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,F.WY)("/kitchen/api/papercoupon/addPaperCouponType",{method:"POST",data:s}));case 1:case"end":return u.stop()}},d)})),K.apply(this,arguments)}var r=a(85893),ge=0,Ce=function(s){var y=$.Z.Option,u=$.Z.OptGroup,P=(0,m.useState)(),Q=(0,C.Z)(P,2),b=Q[0],x=Q[1],X=(0,m.useState)(),T=(0,C.Z)(X,2),ne=T[0],q=T[1],B=(0,m.useRef)(null),A=(0,m.useState)(""),h=(0,C.Z)(A,2),E=h[0],O=h[1];(0,m.useEffect)(function(){N()},[]);var N=function(){var S=(0,f.Z)((0,n.Z)().mark(function g(){var j,R;return(0,n.Z)().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,ae();case 2:j=v.sent,R=[],j.data.map(function(M){return R.push({label:M.value,value:M.key})}),x(R);case 6:case"end":return v.stop()}},g)}));return function(){return S.apply(this,arguments)}}(),k={labelCol:{sm:{span:4}},wrapperCol:{}},G={wrapperCol:{sm:{span:500,offset:1}}},W=function(g){O(g.target.value)},_=function(){var S=(0,f.Z)((0,n.Z)().mark(function g(j){return(0,n.Z)().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return j.preventDefault(),x([].concat((0,ce.Z)(b),[{label:E,value:ge++}])),O(""),setTimeout(function(){var v;(v=B.current)===null||v===void 0||v.focus()},0),I.next=6,Ze(JSON.stringify({Name:E})).then(function(v){v.data?(i.default.success("\u6DFB\u52A0\u6210\u529F"),N()):i.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 6:case"end":return I.stop()}},g)}));return function(j){return S.apply(this,arguments)}}();return(0,r.jsx)(oe.Z,{maskClosable:!1,title:s.values.id?"\u7F16\u8F91\u4F18\u60E0\u5377":"\u65B0\u5EFA\u4F18\u60E0\u5377",width:700,visible:s.createModalVisible,footer:null,onCancel:function(){s.onCancel()},destroyOnClose:!0,children:(0,r.jsxs)(Z.Z,(0,w.Z)((0,w.Z)({},k),{},{layout:"Horizontal",preserve:!1,initialValues:s.values,onFinish:s.onFinish,children:[(0,r.jsx)(Z.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(Y.Z,{})}),(0,r.jsx)(Z.Z.Item,{name:"title",label:"\u4F18\u60E0\u5377\u6807\u9898",rules:[{required:!0,max:200}],children:(0,r.jsx)(Y.Z,{placeholder:"\u8BF7\u8F93\u5165\u4F18\u60E0\u5377\u6807\u9898"})}),(0,r.jsx)(Z.Z.Item,{name:"cTypeId",label:"\u4F18\u60E0\u5377\u7C7B\u578B",defaultValue:s.values.cTypeId,rules:[{required:!0}],children:(0,r.jsx)($.Z,{placeholder:"\u8BF7\u9009\u62E9\u4F18\u60E0\u5377\u7C7B\u578B",dropdownRender:function(g){return(0,r.jsxs)(r.Fragment,{children:[g,(0,r.jsx)(pe.Z,{style:{margin:"8px 0"}}),(0,r.jsxs)(de.Z,{style:{padding:"0 8px 4px"},children:[(0,r.jsx)(Y.Z,{placeholder:"\u8BF7\u8F93\u5165\u9009\u9879",ref:B,value:E,onChange:W}),(0,r.jsx)(V.Z,{type:"text",icon:(0,r.jsx)(fe.Z,{}),onClick:_,children:"\u65B0\u589E"})]})]})},options:b})}),(0,r.jsx)(Z.Z.Item,(0,w.Z)((0,w.Z)({},G),{},{style:{height:32},children:(0,r.jsx)(Z.Z.Item,{label:"\u4F18\u60E0\u91D1\u989D",style:{float:"left"},rules:[{required:!0}],children:(0,r.jsx)(Z.Z.Item,{name:"money",noStyle:!0,children:(0,r.jsx)(te.Z,{placeholder:"\u91D1\u989D",min:0,precision:2})})})})),(0,r.jsx)(Z.Z.Item,(0,w.Z)((0,w.Z)({},G),{},{style:{height:32},children:(0,r.jsx)(Z.Z.Item,{label:"\u5E73\u53F0\u91D1\u989D",style:{float:"left"},rules:[{required:!0}],children:(0,r.jsx)(Z.Z.Item,{name:"soureMoney",noStyle:!0,children:(0,r.jsx)(te.Z,{placeholder:"\u91D1\u989D",min:0,precision:2})})})})),(0,r.jsx)(Z.Z.Item,{children:(0,r.jsx)(V.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})})]}))})},Se=Ce,Te=function(){var s=(0,m.useRef)(),y=(0,m.useState)([]),u=(0,C.Z)(y,2),P=u[0],Q=u[1],b=(0,m.useState)(!1),x=(0,C.Z)(b,2),X=x[0],T=x[1],ne=(0,m.useState)(),q=(0,C.Z)(ne,2),B=q[0],A=q[1],h="coupon",E=(0,m.useState)(),O=(0,C.Z)(E,2),N=O[0],k=O[1],G=(0,m.useState)(),W=(0,C.Z)(G,2),_=W[0],S=W[1];(0,m.useEffect)(function(){g()},[]);var g=function(){var p=(0,f.Z)((0,n.Z)().mark(function o(){var t,c;return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,ae();case 2:t=l.sent,c=[],t.data.map(function(ee){return c.push({label:ee.value,value:ee.key})}),S(c);case 6:case"end":return l.stop()}},o)}));return function(){return p.apply(this,arguments)}}(),j=function(){var p=(0,f.Z)((0,n.Z)().mark(function o(t){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.default.loading("\u6B63\u5728\u6DFB\u52A0...",h),e.prev=1,!(t.validEndTime<t.validStartTime)){e.next=5;break}return i.default.error("\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u5927\u4E8E\u7ED3\u675F\u65F6\u95F4"),e.abrupt("return",!1);case 5:return e.next=7,ve(JSON.stringify(t)).then(function(l){i.default.destroy(h),l.data?i.default.success("\u6DFB\u52A0\u6210\u529F"):i.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 7:return s.current.reload(),e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(1),i.default.destroy(h),i.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 16:case"end":return e.stop()}},o,null,[[1,11]])}));return function(t){return p.apply(this,arguments)}}(),R=function(){var p=(0,f.Z)((0,n.Z)().mark(function o(t){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.default.loading("\u6B63\u5728\u6267\u884C...",h),e.prev=1,e.next=4,me(JSON.stringify(t)).then(function(l){console.log(l),i.default.destroy(h),l.data?(i.default.destroy(h),i.default.success("\u6267\u884C\u6210\u529F")):i.default.error(l.errors)});case 4:return s.current.reload(),e.abrupt("return",!0);case 8:return e.prev=8,e.t0=e.catch(1),i.default.destroy(h),i.default.error("\u6267\u884C\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 13:case"end":return e.stop()}},o,null,[[1,8]])}));return function(t){return p.apply(this,arguments)}}(),I=function(){var p=(0,f.Z)((0,n.Z)().mark(function o(t){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.default.loading("\u6B63\u5728\u4FEE\u6539...",h),e.prev=1,!(t.validEndTime<t.validStartTime)){e.next=5;break}return i.default.error("\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u5927\u4E8E\u7ED3\u675F\u65F6\u95F4"),e.abrupt("return",!1);case 5:return e.next=7,ye(JSON.stringify(t)).then(function(l){i.default.destroy(h),l.data?i.default.success("\u4FEE\u6539\u6210\u529F"):i.default.error(JSON.sstringify(l.errors))});case 7:return s.current.reload(),e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(1),i.default.destroy(h),i.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 16:case"end":return e.stop()}},o,null,[[1,11]])}));return function(t){return p.apply(this,arguments)}}(),v=function(o){console.log(o),k(o)},M=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u6807\u9898",dataIndex:"title",valueType:"textarea"},{title:"\u4F18\u60E0\u5377\u7C7B\u578B",width:90,dataIndex:"cTypeName",key:"cTypeName",renderFormItem:function(){return(0,r.jsx)($.Z,{options:_,onChange:v,allowClear:!0})}},{title:"\u4F18\u60E0\u91D1\u989D",dataIndex:"money",width:80,valueType:"money"},{title:"\u5E73\u53F0\u91D1\u989D",dataIndex:"soureMoney",width:80,valueType:"soureMoney"},{title:"\u521B\u5EFA\u65F6\u95F4",width:90,dataIndex:"crateTimeAt",valueType:"date",hideInSearch:!1},{title:"\u64CD\u4F5C",dataIndex:"option",width:250,valueType:"option",render:function(o,t){var c=[(0,r.jsx)("a",{type:"primary",onClick:function(){T(!0),A(function(){return t})},children:"\u66F4\u65B0"},"primary")];return c.push((0,r.jsx)("a",{type:"primary",onClick:function(){R(t.id)},children:t.enable?"\u7981\u7528":"\u542F\u7528"},"primary")),c}}];return(0,r.jsxs)(se.ZP,{children:[(0,r.jsx)(le.ZP,{headerTitle:"\u4F18\u60E0\u5377",actionRef:s,rowKey:"id",search:{labelWidth:120},pagination:{pageSize:10},onReset:function(){k("")},toolBarRender:function(){return[(0,r.jsx)(V.Z,{type:"primary",onClick:function(){T(!0)},children:"\u65B0\u5EFA"},"primary")]},columns:M,request:function(){var p=(0,f.Z)((0,n.Z)().mark(function o(t,c){var e,l;return(0,n.Z)().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return e=[],l=0,t.dateRange!=null&&t.dateRange.length>=2&&(t.validStartTime=t.dateRange[0],t.validEndTime=t.dateRange[1]),t.CTypeId=N,console.log(c),console.log(t),D.next=8,he(t).then(function(ue){e=ue.data.data,l=ue.data.total});case 8:return D.abrupt("return",{data:e,success:!0,total:l});case 9:case"end":return D.stop()}},o)}));return function(o,t){return p.apply(this,arguments)}}()}),(P==null?void 0:P.length)>0&&(0,r.jsx)(ie.Z,{extra:(0,r.jsxs)("div",{children:[" ","\u5DF2\u9009\u62E9 ",(0,r.jsxs)("a",{style:{fontWeight:600},children:[P.length," "]})," \u9879 \xA0\xA0"," "]})}),(0,r.jsx)(Se,{onFinish:function(){var p=(0,f.Z)((0,n.Z)().mark(function o(t){var c;return(0,n.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=!1,!t.id){l.next=7;break}return l.next=4,I(t);case 4:c=l.sent,l.next=10;break;case 7:return l.next=9,j(t);case 9:c=l.sent;case 10:c&&(T(!1),s.current&&s.current.reload());case 11:case"end":return l.stop()}},o)}));return function(o){return p.apply(this,arguments)}}(),onCancel:function(){A(void 0),T(!1)},createModalVisible:X,values:B||{}})]})},je=Te}}]);
|