| 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({scope:a}){return[e("div",[e("cl-avatar",{style:{margin:"auto"},attrs:{shape:"square",size:40,src:t._f("default_avatar")(a.row.img)}})],1)]}},{key:"table-column-status",fn:function({scope:a}){return[e("el-switch",{attrs:{"active-value":"1","inactive-value":"0"},on:{change:function(e){return t.changeStatus(a.row)}},model:{value:a.row.status,callback:function(e){t.$set(a.row,"status",e)},expression:"scope.row.status"}})]}},{key:"table-column-inTurn",fn:function({scope:a}){return[a.row._inTurn?e("el-input-number",{ref:"sort-input",attrs:{focus:"",size:"mini"},on:{blur:function(e){return t.changeSort(a.row)}},model:{value:a.row.inTurn,callback:function(e){t.$set(a.row,"inTurn",e)},expression:"scope.row.inTurn"}}):e("span",{on:{click:function(e){return t.showSort(a.row)}}},[t._v(t._s(a.row.inTurn))])]}},{key:"slot-poster",fn:function({scope:a}){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.getPosterBtnFn(a.row)}}},[t._v("获取海报")])]}},{key:"slot-modify",fn:function({scope:a}){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.modifyBtnFn(a.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:(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)},s=[],r=(a("8f26"),a("963e"),a("209c"),a("f803"),a("51be"),{name:"goods-category",data(){return{modifyData:{},addOrModify:1,addDialog:!1,adForm:{categoryName:"",img:"",status:"1"}}},methods:{addBtnFn(){this.addDialog=!0,this.addOrModify=1},modifyBtnFn(t){this.modifyData=t,this.addOrModify=2,this.addDialog=!0},changeStatus(t){this.$service.category.updateStatus({categoryId:t.id,status:t.status}).then(t=>{this.$message.success("操作成功!")})},addOrModifyFn(){let t={};t=JSON.parse(JSON.stringify(this.adForm)),t.img=this.$util.getShortUrl(t.img);let e=null;e=1==this.addOrModify?()=>this.$service.category.add(t):()=>this.$service.category.update({categoryId:this.modifyData.id,form:t}),e().then(t=>{this.$message.success("操作成功!"),this.resetForm(),this.app.refresh({type:this.tabIndex})})},confirmFn(){this.addOrModifyFn()},resetForm(){this.$refs["adForm"].resetFields(),this.addDialog=!1},getPosterBtnFn(){this.$message("提示功能开发中!")},onLoad({ctx:t,app:e}){this.app=e,t.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",(t,{done:e})=>{e({...t,status:"1"==t.status})}).on("delete",(t,{next:e})=>{e({categoryId:t.map(t=>t.id).join(",")})}).on("submit",(t,e,{next:a})=>{a({categoryId:e.id,categoryName:e.categoryName,status:e.status,img:e.img})}).done(),e.refresh({type:this.tabIndex})},showSort(t){this.$set(t,"_inTurn",!0),this.$nextTick(()=>{this.$refs["sort-input"].focus()})},changeSort(t){t._inTurn=!1,this.$service.category.sort({inTurn:t.inTurn,id:t.id}).then(()=>{this.$message.success("修改成功")}).catch(t=>{this.$message.error(t)})}}}),n=r,i=a("1805"),l=Object(i["a"])(n,o,s,!1,null,"c95f9734",null);e["default"]=l.exports}}]);
|