|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1587,1322],{38376:function(we,re,t){"use strict";t.r(re),t.d(re,{default:function(){return Ie}});var Fe=t(57663),V=t(71577),Pe=t(43358),$=t(34041),Re=t(34792),i=t(48086),f=t(3182),C=t(2824),le=t(94043),n=t.n(le),m=t(67294),xe=t(30381),se=t(16894),ie=t(78009),oe=t(85224),Ee=t(71194),de=t(50146),w=t(11849),Oe=t(77883),te=t(85482),De=t(49111),pe=t(19650),$e=t(48736),ce=t(27049),be=t(9715),g=t(86835),Be=t(47673),Y=t(4107),fe=t(86582),he=t(49101),F=t(48971);function ve(d){return J.apply(this,arguments)}function J(){return J=(0,f.Z)(n().mark(function d(s){return n().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 me(d){return L.apply(this,arguments)}function L(){return L=(0,f.Z)(n().mark(function d(s){return n().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 ye(d){return U.apply(this,arguments)}function U(){return U=(0,f.Z)(n().mark(function d(s){return n().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 ge(d){return z.apply(this,arguments)}function z(){return z=(0,f.Z)(n().mark(function d(s){return n().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)(n().mark(function d(){return n().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)(n().mark(function d(s){return n().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=t(85893),Ce=0,Se=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)(n().mark(function Z(){var j,R;return n().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()}},Z)}));return function(){return S.apply(this,arguments)}}(),G={labelCol:{sm:{span:4}},wrapperCol:{}},k={wrapperCol:{sm:{span:500,offset:1}}},W=function(Z){O(Z.target.value)},_=function(){var S=(0,f.Z)(n().mark(function Z(j){return n().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return j.preventDefault(),x([].concat((0,fe.Z)(b),[{label:E,value:Ce++}])),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()}},Z)}));return function(j){return S.apply(this,arguments)}}();return(0,r.jsx)(de.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)(g.Z,(0,w.Z)((0,w.Z)({},G),{},{layout:"Horizontal",preserve:!1,initialValues:s.values,onFinish:s.onFinish,children:[(0,r.jsx)(g.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(Y.Z,{})}),(0,r.jsx)(g.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)(g.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(Z){return(0,r.jsxs)(r.Fragment,{children:[Z,(0,r.jsx)(ce.Z,{style:{margin:"8px 0"}}),(0,r.jsxs)(pe.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)(he.Z,{}),onClick:_,children:"\u65B0\u589E"})]})]})},options:b})}),(0,r.jsx)(g.Z.Item,(0,w.Z)((0,w.Z)({},k),{},{style:{height:32},children:(0,r.jsx)(g.Z.Item,{label:"\u4F18\u60E0\u91D1\u989D",style:{float:"left"},rules:[{required:!0}],children:(0,r.jsx)(g.Z.Item,{name:"money",noStyle:!0,children:(0,r.jsx)(te.Z,{placeholder:"\u91D1\u989D",min:0,precision:2})})})})),(0,r.jsx)(g.Z.Item,(0,w.Z)((0,w.Z)({},k),{},{style:{height:32},children:(0,r.jsx)(g.Z.Item,{label:"\u5E73\u53F0\u91D1\u989D",style:{float:"left"},rules:[{required:!0}],children:(0,r.jsx)(g.Z.Item,{name:"soureMoney",noStyle:!0,children:(0,r.jsx)(te.Z,{placeholder:"\u91D1\u989D",min:0,precision:2})})})})),(0,r.jsx)(g.Z.Item,{children:(0,r.jsx)(V.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})})]}))})},Te=Se,je=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],G=O[1],k=(0,m.useState)(),W=(0,C.Z)(k,2),_=W[0],S=W[1];(0,m.useEffect)(function(){Z()},[]);var Z=function(){var p=(0,f.Z)(n().mark(function o(){var a,c;return n().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,ae();case 2:a=l.sent,c=[],a.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)(n().mark(function o(a){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.default.loading("\u6B63\u5728\u6DFB\u52A0...",h),e.prev=1,!(a.validEndTime<a.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,me(JSON.stringify(a)).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(a){return p.apply(this,arguments)}}(),R=function(){var p=(0,f.Z)(n().mark(function o(a){return n().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,ye(JSON.stringify(a)).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(a){return p.apply(this,arguments)}}(),I=function(){var p=(0,f.Z)(n().mark(function o(a){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.default.loading("\u6B63\u5728\u4FEE\u6539...",h),e.prev=1,!(a.validEndTime<a.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,ge(JSON.stringify(a)).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(a){return p.apply(this,arguments)}}(),v=function(o){console.log(o),G(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,a){var c=[(0,r.jsx)("a",{type:"primary",onClick:function(){T(!0),A(function(){return a})},children:"\u66F4\u65B0"},"primary")];return c.push((0,r.jsx)("a",{type:"primary",onClick:function(){R(a.id)},children:a.enable?"\u7981\u7528":"\u542F\u7528"},"primary")),c}}];return(0,r.jsxs)(ie.ZP,{children:[(0,r.jsx)(se.ZP,{headerTitle:"\u4F18\u60E0\u5377",actionRef:s,rowKey:"id",search:{labelWidth:120},pagination:{pageSize:10},onReset:function(){G("")},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)(n().mark(function o(a,c){var e,l;return n().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return e=[],l=0,a.dateRange!=null&&a.dateRange.length>=2&&(a.validStartTime=a.dateRange[0],a.validEndTime=a.dateRange[1]),a.CTypeId=N,console.log(c),console.log(a),D.next=8,ve(a).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,a){return p.apply(this,arguments)}}()}),(P==null?void 0:P.length)>0&&(0,r.jsx)(oe.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)(Te,{onFinish:function(){var p=(0,f.Z)(n().mark(function o(a){var c;return n().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=!1,!a.id){l.next=7;break}return l.next=4,I(a);case 4:c=l.sent,l.next=10;break;case 7:return l.next=9,j(a);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||{}})]})},Ie=je}}]);
|