chunk-2d2077f4.ef06732b.js 5.6 KB

1
  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._self._c;return e("div",{staticClass:"app-list-content"},[e("x-crud",{staticClass:"liu-crud-wrap",on:{load:t.onLoad},scopedSlots:t._u([{key:"table-column-img",fn:function(a){var o=a.scope;return[e("div",[e("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(a){var o=a.scope;return[e("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:"table-column-inTurn",fn:function(a){var o=a.scope;return[o.row._inTurn?e("el-input-number",{ref:"sort-input",attrs:{focus:"",size:"mini"},on:{blur:function(e){return t.changeSort(o.row)}},model:{value:o.row.inTurn,callback:function(e){t.$set(o.row,"inTurn",e)},expression:"scope.row.inTurn"}}):e("span",{on:{click:function(e){return t.showSort(o.row)}}},[t._v(t._s(o.row.inTurn))])]}},{key:"slot-poster",fn:function(a){var o=a.scope;return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.getPosterBtnFn(o.row)}}},[t._v("获取海报")])]}},{key:"slot-modify",fn:function(a){var o=a.scope;return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.modifyBtnFn(o.row)}}},[t._v("修改")])]}},{key:"slot-add-ad-btn",fn:function(){return[e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.addBtnFn}},[t._v("添加")])]},proxy:!0}])}),e("el-dialog",{attrs:{title:"".concat(1==t.addOrModify?"添加":"修改","分类"),visible:t.addDialog,"close-on-click-modal":!1,width:"400px"},on:{"update:visible":function(e){t.addDialog=e}}},[e("div",{staticClass:"ad-modal-content"},[e("el-form",{ref:"adForm",staticClass:"demo-form",attrs:{model:t.adForm,rules:t.adForm,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"分类名称",prop:"categoryName"}},[e("el-input",{attrs:{placeholder:"请输入名称",size:"small"},model:{value:t.adForm.categoryName,callback:function(e){t.$set(t.adForm,"categoryName",e)},expression:"adForm.categoryName"}})],1),e("el-form-item",{attrs:{label:"分类图片",prop:"img"}},[t._v(" "+t._s(t.adForm.img)+" "),e("cl-upload",{model:{value:t.adForm.img,callback:function(e){t.$set(t.adForm,"img",e)},expression:"adForm.img"}})],1),e("el-form-item",{attrs:{label:"马上启用",prop:"status"}},[e("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),e("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{size:"small"},on:{click:t.resetForm}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.confirmFn}},[t._v("确认")])],1)])],1)},n=[],r=a("1f77"),s=(a("b5e5"),a("d6d8"),a("3215"),a("45d2"),a("9052"),a("b144"),a("5f45"),a("dc93"),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"])(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})},showSort:function(t){var e=this;this.$set(t,"_inTurn",!0),this.$nextTick((function(){e.$refs["sort-input"].focus()}))},changeSort:function(t){var e=this;t._inTurn=!1,this.$service.category.sort({inTurn:t.inTurn,id:t.id}).then((function(){e.$message.success("修改成功")})).catch((function(t){e.$message.error(t)}))}}}),i=s,c=a("1805"),l=Object(c["a"])(i,o,n,!1,null,"d48db2a6",null);e["default"]=l.exports}}]);