(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d221e1f"],{cbf0:function(e,t,o){"use strict";o.r(t);var r=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"app-container"},[o("xy-table",{ref:"tableRef",attrs:{table:e.table,columns:e.columns},scopedSlots:e._u([{key:"isShow",fn:function(t){var o=t.scope;return[e._v(" "+e._s("1"===o.row.isShow?"否":"是")+" ")]}}])}),o("el-dialog",{attrs:{title:e.title,visible:e.open,width:"500px","append-to-body":""},on:{"update:visible":function(t){e.open=t}}},[o("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"120px"}},[o("el-form-item",{attrs:{label:"分类名称",prop:"categoryName"}},[o("el-input",{attrs:{placeholder:"请输入分类名称"},model:{value:e.form.categoryName,callback:function(t){e.$set(e.form,"categoryName",t)},expression:"form.categoryName"}})],1),o("el-form-item",{attrs:{label:"是否前端展示",prop:"isShow"}},[o("el-radio-group",{model:{value:e.form.isShow,callback:function(t){e.$set(e.form,"isShow",t)},expression:"form.isShow"}},e._l(e.dict.type.classify_isshow,(function(t){return o("el-radio",{key:t.value,attrs:{label:t.value}},[e._v(e._s(t.label))])})),1)],1)],1),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("确 定")]),o("el-button",{on:{click:e.cancel}},[e._v("取 消")])],1)],1)],1)},n=[],a=o("1da1"),i=(o("96cf"),o("b775"));function s(e){return Object(i["a"])({url:"/coupon/category/list",method:"get",params:e})}function c(e){return Object(i["a"])({url:"/coupon/category/"+e,method:"get"})}function l(e){return Object(i["a"])({url:"/coupon/category",method:"post",data:e})}function u(e){return Object(i["a"])({url:"/coupon/category/edit",method:"post",data:e})}function f(e){return Object(i["a"])({url:"/coupon/category/"+e,method:"put"})}var d={name:"Classify",dicts:["classify_isshow"],data:function(){var e=this;return{open:!1,title:void 0,form:{id:void 0,categoryName:void 0,isShow:"0"},rules:{categoryName:[{required:!0,message:"分类名称不能为空",trigger:"blur"}]},table:{rowKey:"id",data:[],firstColumn:{type:"index"},hiddenLine:!0,operator:[{text:"编辑",icon:"el-icon-edit",fun:function(t){return e.handleEdit(t)}},{text:"删除",icon:"el-icon-delete",fun:function(t){return e.handleDelete(t)}}],operatorConfig:{width:140},toolbar:[{text:"新增分类",icon:"el-icon-plus",type:"primary",fun:function(){return e.handleAdd()}}],page:{total:0,pageNum:1,pageSize:10},request:s},columns:[{prop:"categoryName",label:"分类名称"},{prop:"couponNum",label:"关联优惠券数量"},{prop:"isShow",label:"是否前端展示",slotName:"isShow"}]}},methods:{getList:function(){this.$refs.tableRef.getData()},handleAdd:function(){this.reset(),this.open=!0,this.title="新增分类"},handleEdit:function(e){var t=this;this.reset();var o=e.id;c(o).then((function(e){t.form=e.data,t.open=!0,t.title="修改分类"}))},handleDelete:function(e){var t=this;return Object(a["a"])(regeneratorRuntime.mark((function o(){var r,n,a;return regeneratorRuntime.wrap((function(o){while(1)switch(o.prev=o.next){case 0:return r=e.id,o.next=3,t.$confirm("是否确认删除当前记录？","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).catch((function(e){return e}));case 3:if(n=o.sent,"confirm"===n){o.next=6;break}return o.abrupt("return");case 6:return o.next=8,f(r);case 8:if(a=o.sent,200===a.code){o.next=11;break}return o.abrupt("return",t.$message.error("删除失败！"));case 11:t.$message.success("删除成功!"),t.getList();case 13:case"end":return o.stop()}}),o)})))()},submitForm:function(){var e=this;this.$refs["form"].validate((function(t){t&&(void 0!=e.form.id?u(e.form).then((function(t){e.$modal.msgSuccess("修改成功"),e.open=!1,e.getList()})):l(e.form).then((function(t){e.$modal.msgSuccess("新增成功"),e.open=!1,e.getList()})))}))},reset:function(){this.form={id:void 0,categoryName:void 0,isShow:"0"},this.resetForm("form")},cancel:function(){this.open=!1,this.reset()}}},m=d,p=o("2877"),h=Object(p["a"])(m,r,n,!1,null,null,null);t["default"]=h.exports}}]);