| 1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2077f4"],{a17e:function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-list-content"},[a("cl-crud",{staticClass:"liu-crud-wrap",on:{load:t.onLoad},scopedSlots:t._u([{key:"table-column-img",fn:function(e){var o=e.scope;return[a("div",[a("cl-avatar",{style:{margin:"auto"},attrs:{shape:"square",size:40,src:t._f("default_avatar")(o.row.img)}})],1)]}},{key:"table-column-status",fn:function(e){var o=e.scope;return[a("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},on:{change:function(e){return t.changeStatus(o.row)}},model:{value:o.row.status,callback:function(e){t.$set(o.row,"status",e)},expression:"scope.row.status"}})]}},{key:"slot-poster",fn:function(e){var o=e.scope;return[a("el-button",{attrs:{type:"text"},on:{click:function(e){return t.getPosterBtnFn(o.row)}}},[t._v("获取海报")])]}},{key:"slot-modify",fn:function(e){var o=e.scope;return[a("el-button",{attrs:{type:"text"},on:{click:function(e){return t.modifyBtnFn(o.row)}}},[t._v("修改")])]}},{key:"slot-add-ad-btn",fn:function(e){e.scope;return[a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.addBtnFn}},[t._v("添加")])]}}])}),a("el-dialog",{attrs:{title:(1==t.addOrModify?"添加":"修改")+"分类",visible:t.addDialog,"close-on-click-modal":!1,width:"400px"},on:{"update:visible":function(e){t.addDialog=e}}},[a("div",{staticClass:"ad-modal-content"},[a("el-form",{ref:"adForm",staticClass:"demo-form",attrs:{model:t.adForm,rules:t.adForm,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"分类名称",prop:"categoryName"}},[a("el-input",{attrs:{placeholder:"请输入名称",size:"small"},model:{value:t.adForm.categoryName,callback:function(e){t.$set(t.adForm,"categoryName",e)},expression:"adForm.categoryName"}})],1),a("el-form-item",{attrs:{label:"分类图片",prop:"img"}},[t._v(" "+t._s(t.adForm.img)+" "),a("cl-upload",{model:{value:t.adForm.img,callback:function(e){t.$set(t.adForm,"img",e)},expression:"adForm.img"}})],1),a("el-form-item",{attrs:{label:"马上启用",prop:"status"}},[a("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},model:{value:t.adForm.status,callback:function(e){t.$set(t.adForm,"status",e)},expression:"adForm.status"}})],1)],1)],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"small"},on:{click:t.resetForm}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.confirmFn}},[t._v("确认")])],1)])],1)},n=[],r=(a("a15b"),a("d81d"),a("5530")),s=(a("51be"),{name:"goods-category",data:function(){return{modifyData:{},addOrModify:1,addDialog:!1,adForm:{categoryName:"",img:"",status:"1"}}},methods:{addBtnFn:function(){this.addDialog=!0,this.addOrModify=1},modifyBtnFn:function(t){this.modifyData=t,this.addOrModify=2,this.addDialog=!0},changeStatus:function(t){var e=this;this.$service.category.updateStatus({categoryId:t.id,status:t.status}).then((function(t){e.$message.success("操作成功!")}))},addOrModifyFn:function(){var t=this,e={};e=JSON.parse(JSON.stringify(this.adForm)),e.img=this.$util.getShortUrl(e.img);var a=null;a=1==this.addOrModify?function(){return t.$service.category.add(e)}:function(){return t.$service.category.update({categoryId:t.modifyData.id,form:e})},a().then((function(e){t.$message.success("操作成功!"),t.resetForm(),t.app.refresh({type:t.tabIndex})}))},confirmFn:function(){this.addOrModifyFn()},resetForm:function(){this.$refs["adForm"].resetFields(),this.addDialog=!1},getPosterBtnFn:function(){this.$message("提示功能开发中!")},onLoad:function(t){var e=t.ctx,a=t.app;this.app=a,e.service(this.$service.category).set("table",{columns:[{prop:"id",label:"id",align:"center","min-width":100},{prop:"categoryName",label:"分类名称",align:"center"},{prop:"img",label:"图片",align:"center"},{prop:"goodsNum",label:"商品数",align:"center"},{prop:"sold",label:"销量",align:"center"},{prop:"status",label:"启用状态",align:"center"},{prop:"inTurn",label:"排序",align:"center"}]}).set("layout",[["slot-tabs"],["flex1","slot-add-ad-btn","refresh-btn"],["data-table"],["flex1","pagination"]]).set("upsert",{props:{width:"500px"},items:[{label:"分类名称",prop:"categoryName",component:{name:"el-input"}},{label:"图片",prop:"img",component:{name:"cl-upload"}},{label:"启用状态",prop:"status",component:{name:"el-switch"}}]}).on("info",(function(t,e){var a=e.done;a(Object(r["a"])({},t,{status:"1"==t.status}))})).on("delete",(function(t,e){var a=e.next;a({categoryId:t.map((function(t){return t.id})).join(",")})})).on("submit",(function(t,e,a){var o=a.next;o({categoryId:e.id,categoryName:e.categoryName,status:e.status,img:e.img})})).done(),a.refresh({type:this.tabIndex})}}}),i=s,l=a("2877"),c=Object(l["a"])(i,o,n,!1,null,"fcb2be4e",null);e["default"]=c.exports}}]);
|