(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-52c37249"],{"059d":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"padding24 color_white"},[r("div",{staticClass:"header-box"},[r("a-select",{staticStyle:{width:"120px"},attrs:{"default-value":"1"},on:{change:t.handleChange},model:{value:t.isParent,callback:function(e){t.isParent=e},expression:"isParent"}},[r("a-select-option",{attrs:{value:1}},[t._v("一级分类")]),r("a-select-option",{attrs:{value:0}},[t._v("二级分类")])],1),r("a-button",{attrs:{type:"primary"},on:{click:t.addClick}},[t._v(" 添加商品分类 ")])],1),r("a-table",{attrs:{columns:t.GoodsTypesColumn,"data-source":t.tabledData,pagination:!1,loading:t.tableLoading,"row-key":function(t){return t.id}},scopedSlots:t._u([{key:"number",fn:function(e,n,a){return r("span",{},[r("span",[t._v(t._s((t.pageNo-1)*t.pageSize+a+1))])])}},{key:"state",fn:function(e,n){return r("span",{},[t._v(t._s(1===e?"显示":"隐藏"))])}},{key:"action",fn:function(e,n){return r("span",{staticClass:"action"},[t.operation.edit?r("a",{on:{click:function(e){return t.editClick(n)}}},[t._v("编辑")]):t._e(),r("a-popconfirm",{attrs:{title:"删除成功的商品分类无法撤销和恢复,请谨慎操作。","ok-text":"确定","cancel-text":"取消"},on:{confirm:function(e){return t.delClick(n)}}},[t.operation.del?r("a",[t._v("删除")]):t._e()]),r("a-popconfirm",{attrs:{title:(1===n.state?"修改后在APP中不展示分类信息":"修改后将在APP中会展示分类信息")+" ","ok-text":"确定","cancel-text":"取消"},on:{confirm:function(e){return t.showClick(n)}}},[t.operation.show?r("a",[t._v(t._s(1===n.state?"隐藏":"显示"))]):t._e()])],1)}}])}),r("MyPagination",{directives:[{name:"show",rawName:"v-show",value:!t.tableLoading,expression:"!tableLoading"}],attrs:{count:t.total,pageNo:t.pageNo},on:{showSizeChangeFn:t.paginationCallBack}}),r("AddGoodsTypes",{attrs:{visible:t.modalVisible,record:t.curRecord},on:{cancel:function(e){t.modalVisible=!1},ok:t.handleOk}})],1)},a=[],o=r("1da1"),i=(r("96cf"),r("b893")),c=r("6ffe"),s=r("456f"),u=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-modal",{attrs:{visible:t.visible,title:"添加商品分类",destroyOnClose:""},on:{ok:t.handleOk,cancel:function(){return t.$emit("cancel")}}},[r("a-form-model",{ref:"ruleForm",attrs:{model:t.form,rules:t.rules,labelAlign:"right","label-col":t.labelCol,"wrapper-col":t.wrapperCol}},[r("a-form-model-item",{attrs:{label:"分类名称",prop:"name","wrapper-col":{span:8}}},[r("a-input",{attrs:{placeholder:"请输入分类名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),r("a-form-model-item",{attrs:{label:"上级分类",prop:"parentId"}},[r("a-select",{staticStyle:{width:"40%"},attrs:{options:t.typeList},on:{select:t.onSelect},model:{value:t.form.parentId,callback:function(e){t.$set(t.form,"parentId",e)},expression:"form.parentId"}}),r("div",{staticClass:"tips"},[t._v("上级分类选择“无”,则新增的此分类为一级分类。")])],1)],1)],1)},l=[],f=(r("159b"),r("b0c0"),r("99af"),r("acda")),h={props:{visible:{type:Boolean,default:!1},record:{type:Object,Object:{}}},watch:{visible:function(t){this.typeList=this.$options.data().typeList,t&&(this.record.id?Object.assign(this.form,this.record,{parentId:this.record.parent_id}):this.form=this.$options.data().form,this.getList())}},data:function(){return{labelCol:{span:4},wrapperCol:{span:20},form:{id:"",name:"",parentId:0,state:1},rules:{name:[{required:!0,message:"请输入分类名称",trigger:"blur"}]},typeList:[{label:"无",value:0}]}},methods:{getList:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var r,n,a,o;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r={pageNo:t.pageNo,pageSize:t.pageSize,isParent:1},e.next=3,Object(f["n"])(r);case 3:if(n=e.sent,a=n.code,o=n.data.data,200===a){e.next=8;break}return e.abrupt("return");case 8:o.forEach((function(t){Object.assign(t,{label:t.name,value:t.id})})),t.typeList=t.typeList.concat(o);case 10:case"end":return e.stop()}}),e)})))()},onSelect:function(t){this.form.parentId=t},handleOk:function(){var t=this;this.$refs.ruleForm.validate(function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return");case 2:t.record.id?t.edit():t.add(),t.$emit("ok");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},add:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var r,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return delete t.form.id,e.next=3,Object(f["i"])(t.form);case 3:if(r=e.sent,n=r.code,200===n){e.next=7;break}return e.abrupt("return");case 7:t.$message.success("添加成功");case 8:case"end":return e.stop()}}),e)})))()},edit:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var r,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return delete t.form.parent_id,delete t.form.parent_name,e.next=4,Object(f["l"])(t.form);case 4:if(r=e.sent,n=r.code,200===n){e.next=8;break}return e.abrupt("return");case 8:t.$message.success("修改成功");case 9:case"end":return e.stop()}}),e)})))()}}},p=h,d=r("2877"),m=Object(d["a"])(p,u,l,!1,null,null,null),v=m.exports,g={name:"GoodsTypeList",components:{MyPagination:c["a"],AddGoodsTypes:v},data:function(){return{operation:{add:!1,edit:!1,del:!1,show:!1},GoodsTypesColumn:s["b"],tabledData:[],tableLoading:!1,total:0,pageNo:1,pageSize:20,isParent:0,modalVisible:!1,curRecord:{}}},created:function(){this.operation.add=Object(i["a"])("addGoodsTypes"),this.operation.edit=Object(i["a"])("editGoodsTypes"),this.operation.del=Object(i["a"])("showGoodsTypes"),this.operation.show=Object(i["a"])("delGoodsTypes"),this.fetchData()},methods:{handleChange:function(){this.pageNo=1,this.fetchData()},fetchData:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var r,n,a,o;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.tableLoading=!0,r={pageNo:t.pageNo,pageSize:t.pageSize,isParent:t.isParent},e.next=4,Object(f["n"])(r);case 4:if(n=e.sent,a=n.code,o=n.data,t.tableLoading=!1,200===a){e.next=10;break}return e.abrupt("return");case 10:t.total=o.count,t.tabledData=o.data;case 12:case"end":return e.stop()}}),e)})))()},paginationCallBack:function(t,e){this.pageNo=t,this.pageSize=e,this.fetchData()},editClick:function(t){this.curRecord=t,this.modalVisible=!0},delClick:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function r(){var n,a;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,Object(f["j"])({id:t.id});case 2:if(n=r.sent,a=n.code,200===a){r.next=6;break}return r.abrupt("return");case 6:e.$message.success("删除成功"),e.fetchData();case 8:case"end":return r.stop()}}),r)})))()},showClick:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function r(){var n,a,o;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return n={id:t.id,state:1===t.state?2:1},r.next=3,Object(f["s"])(n);case 3:if(a=r.sent,o=a.code,200===o){r.next=7;break}return r.abrupt("return");case 7:e.$message.success("修改成功"),e.fetchData();case 9:case"end":return r.stop()}}),r)})))()},addClick:function(){this.curRecord={},this.modalVisible=!0},handleOk:function(){this.modalVisible=!1,this.fetchData()}}},y=g,b=(r("9de6"),Object(d["a"])(y,n,a,!1,null,"5b317aca",null));e["default"]=b.exports},"1da1":function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("d3b7");function n(t,e,r,n,a,o,i){try{var c=t[o](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,a)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(a,o){var i=t.apply(e,r);function c(t){n(i,a,o,c,s,"next",t)}function s(t){n(i,a,o,c,s,"throw",t)}c(void 0)}))}}},"96cf":function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,a="function"===typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(S){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,o=Object.create(a.prototype),i=new P(n||[]);return o._invoke=_(t,r,i),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(S){return{type:"throw",arg:S}}}t.wrap=u;var f="suspendedStart",h="suspendedYield",p="executing",d="completed",m={};function v(){}function g(){}function y(){}var b={};b[o]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(R([])));x&&x!==r&&n.call(x,o)&&(b=x);var k=y.prototype=v.prototype=Object.create(b);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(a,o,i,c){var s=l(t[a],t,o);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"===typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(f).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(s.arg)}var a;function o(t,n){function o(){return new e((function(e,a){r(t,n,e,a)}))}return a=a?a.then(o,o):o()}this._invoke=o}function _(t,e,r){var n=f;return function(a,o){if(n===p)throw new Error("Generator is already running");if(n===d){if("throw"===a)throw o;return N()}r.method=a,r.arg=o;while(1){var i=r.delegate;if(i){var c=j(i,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var s=l(t,e,r);if("normal"===s.type){if(n=r.done?d:h,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}function j(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var a=l(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var r=t[o];if(r)return r.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){while(++a=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;C(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:R(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=n}catch(a){Function("r","regeneratorRuntime = r")(n)}},"9de6":function(t,e,r){"use strict";r("d6af")},d6af:function(t,e,r){}}]); //# sourceMappingURL=chunk-52c37249.bafa2492.js.map