| 1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-1a08d4e8"],{"846a":function(t,e,a){},9612:function(t,e,a){a.r(e),a("fb6a"),a("4e82"),a("b0c0");var o=a("c14f"),l=a("1da1"),i=a("5530"),s=(a("c740"),a("a434"),a("e9f5"),a("7d54"),a("d3b7"),a("159b"),a("2f62")),r=a("c4c8");i={name:"labelList",data:function(){return{treeId:"",grid1:{xl:4,lg:4,md:6,sm:8,xs:0},grid2:{xl:20,lg:20,md:18,sm:16,xs:24},loading:!1,labelFrom:{page:1,limit:15,cate_id:""},labelLists:[],total:0,theme3:"light",labelSort:[],sortName:"",current:0,modals:!1,isEdit:!1,form:{id:0,cate_id:"",name:"",type:1,font_color:"#e93323",bg_color:"#fff",border_color:"#e93323",sort:0,is_show:1,image:"",status:1},rules:{name:[{required:!0,message:"请输入标签名称",trigger:"blur"},{min:2,max:6,message:"长度在 2 到 6 个字符",trigger:"blur"}],cate_id:[{required:!0,message:"请选择分组"}]}}},computed:Object(i.a)(Object(i.a)({},Object(s.d)("media",["isMobile"])),{},{labelWidth:function(){return this.isMobile?void 0:"80px"},labelPosition:function(){return this.isMobile?"top":"right"}}),created:function(){this.getLabelLabelAll()},methods:{add:function(){this.modals=!0,this.isEdit=!1},modalPicTap:function(){var t=this;this.$imgModal((function(e){t.form.image=e.att_dir}))},getList:function(){var t=this;this.loading=!0,Object(r.G)(this.labelFrom).then((()=>{var e=Object(l.a)(Object(o.a)().m((function e(a){var l;return Object(o.a)().w((function(e){for(;;)switch(e.n){case 0:l=a.data,t.labelLists=l.list,t.total=l.count,t.loading=!1;case 1:return e.a(2)}}),e)})));return function(t){return e.apply(this,arguments)}})()).catch((function(e){t.loading=!1,t.$message.error(e.msg)}))},edit:function(t){var e=this;Object(r.F)({id:t}).then((function(t){e.form=t.data,e.isEdit=!0,e.modals=!0}))},del:function(t,e,a){var o=this;e={title:e,num:a,url:"product/label/del/".concat(t.id),method:"DELETE",ids:""};this.$modalSure(e).then((function(t){o.$message.success(t.msg),o.labelLists.splice(a,1),o.getList()})).catch((function(t){o.$message.error(t.msg)}))},onchangeStatus:function(t){var e=this;Object(r.q)(t).then((()=>{var t=Object(l.a)(Object(o.a)().m((function t(a){return Object(o.a)().w((function(t){for(;;)switch(t.n){case 0:e.$message.success(a.msg);case 1:return t.a(2)}}),t)})));return function(e){return t.apply(this,arguments)}})()).catch((function(t){e.$message.error(t.msg)}))},onchangeShow:function(t){var e=this;Object(r.o)(t).then((()=>{var t=Object(l.a)(Object(o.a)().m((function t(a){return Object(o.a)().w((function(t){for(;;)switch(t.n){case 0:e.$message.success(a.msg);case 1:return t.a(2)}}),t)})));return function(e){return t.apply(this,arguments)}})()).catch((function(t){e.$message.error(t.msg)}))},getLabelLabelAll:function(t){var e=this;Object(r.n)().then((function(a){a.data.unshift({name:"全部",id:""}),a.data.forEach((function(t){t.status=!1})),t||(e.sortName=a.data[0].id,e.labelFrom.cate_id=a.data[0].id,e.getList()),e.labelSort=a.data}))},showMenu:function(t){this.labelSort.forEach((function(e){e.id==t.id?e.status=!t.status:e.status=!1}))},addWordsConfirm:function(){var t=this;if(!this.form.cate_id)return this.$message.error("请选择分组");this.$refs.form.validate((function(e){e&&Object(r.H)(t.form).then((function(e){t.$message.success(e.msg),t.modals=!1,t.cancel(),t.labelFrom.page=1,t.getList()})).catch((function(e){t.$message.error(e.msg)}))}))},cancel:function(){this.form={id:0,cate_id:"",name:"",type:1,font_color:"#e93323",bg_color:"#ffffff",border_color:"#e93323",sort:0,is_show:1,image:"",status:1},this.modals=!1},labelEdit:function(t){var e=this;this.$modalForm(Object(r.E)(t.id)).then((function(){return e.getLabelLabelAll(1)}))},addSort:function(){var t=this;this.$modalForm(Object(r.E)(0)).then((function(){return t.getLabelLabelAll()}))},deleteSort:function(t,e){var a=this,o=this.labelSort.findIndex((function(e){return e.id==t.id}));e={title:e,num:o,url:"product/label_cate/del/".concat(t.id),method:"DELETE",ids:""};this.$modalSure(e).then((function(t){a.$message.success(t.msg),a.labelSort.splice(o,1),a.labelSort=[],a.getLabelLabelAll()})).catch((function(t){a.$message.error(t.msg)}))},clickMenu:function(t,e){1==e?this.labelEdit(t):2==e&&this.deleteSort(t,"删除分类")},bindMenuItem:function(t,e){this.labelFrom.page=1,this.current=e,this.labelSort.forEach((function(t){t.status=!1})),this.labelFrom.cate_id=t.id,this.form.cate_id=t.id,this.getList()}}},a("e0fa"),s=a("2877"),s=Object(s.a)(i,(function(){var t=this,e=t._self._c;return e("div",[e("el-row",{staticClass:"ivu-mt box-wrapper"},[e("el-col",t._b({staticClass:"left-wrapper"},"el-col",t.grid1,!1),[e("div",{directives:[{name:"db-click",rawName:"v-db-click"}],staticClass:"tree_tit",on:{click:t.addSort}},[e("i",{staticClass:"el-icon-circle-plus"}),t._v("\n 添加分组\n ")]),e("div",{staticClass:"tree"},[e("el-tree",{attrs:{data:t.labelSort,"node-key":"id","default-expand-all":"","highlight-current":"","expand-on-click-node":!1,"current-node-key":t.treeId},on:{"node-click":t.bindMenuItem},scopedSlots:t._u([{key:"default",fn:function(o){var l=o.data;return e("span",{staticClass:"custom-tree-node"},[e("div",{staticClass:"file-name"},[e("img",{staticClass:"icon",attrs:{src:a("c583")}}),e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:l.name,placement:"top"}},[e("div",{staticClass:"text line1"},[t._v("\n "+t._s(l.name)+"\n ")])])],1),l.id?e("span",[e("el-dropdown",{on:{command:function(e){return t.clickMenu(l,e)}}},[e("i",{staticClass:"el-icon-more el-icon--right"}),e("template",{slot:"dropdown"},[e("el-dropdown-menu",[e("el-dropdown-item",{attrs:{command:"1"}},[t._v("编辑分类")]),l.id?e("el-dropdown-item",{attrs:{command:"2"}},[t._v("删除分类")]):t._e()],1)],1)],2)],1):t._e()])}}])})],1)]),e("el-col",t._b({ref:"rightBox"},"el-col",t.grid2,!1),[e("el-card",{attrs:{bordered:!1,shadow:"never"}},[e("el-row",[e("el-col",[e("el-button",{directives:[{name:"db-click",rawName:"v-db-click"}],attrs:{type:"primary"},on:{click:t.add}},[t._v("添加标签")])],1)],1),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],ref:"table",staticClass:"mt14",attrs:{data:t.labelLists,"highlight-current-row":"","no-userFrom-text":"暂无数据","no-filtered-userFrom-text":"暂无筛选结果"}},[e("el-table-column",{attrs:{label:"ID",width:"80"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("span",[t._v(t._s(a.row.id))])]}}])}),e("el-table-column",{attrs:{label:"标签名称",width:"180"},scopedSlots:t._u([{key:"default",fn:function(a){return[1==a.row.type?e("div",{staticClass:"words-tag",style:{backgroundColor:a.row.bg_color,color:a.row.font_color,border:a.row.border_color?"1px solid "+a.row.border_color:"none"}},[e("span",[t._v(t._s(a.row.name))])]):e("img",{staticClass:"tag-img",attrs:{src:a.row.image}})]}}])}),e("el-table-column",{attrs:{label:"分类名称","min-width":"140"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("span",[t._v(t._s(a.row.cate_name))])]}}])}),e("el-table-column",{attrs:{label:"状态","min-width":"140"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("el-switch",{staticClass:"defineSwitch",attrs:{"active-value":1,"inactive-value":0,value:a.row.status,size:"large","active-text":"开启","inactive-text":"关闭"},on:{change:function(e){return t.onchangeStatus(a.row)}},model:{value:a.row.status,callback:function(e){t.$set(a.row,"status",e)},expression:"scope.row.status"}})]}}])}),e("el-table-column",{attrs:{label:"移动端展示","min-width":"140"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("el-switch",{staticClass:"defineSwitch",attrs:{"active-value":1,"inactive-value":0,value:a.row.is_show,size:"large","active-text":"开启","inactive-text":"关闭"},on:{change:function(e){return t.onchangeShow(a.row)}},model:{value:a.row.is_show,callback:function(e){t.$set(a.row,"is_show",e)},expression:"scope.row.is_show"}})]}}])}),e("el-table-column",{attrs:{fixed:"right",label:"操作",width:"100"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("a",{directives:[{name:"db-click",rawName:"v-db-click"}],on:{click:function(e){return t.edit(a.row.id)}}},[t._v("修改")]),e("el-divider",{attrs:{direction:"vertical"}}),e("a",{directives:[{name:"db-click",rawName:"v-db-click"}],on:{click:function(e){return t.del(a.row,"删除",a.$index)}}},[t._v("删除")])]}}])})],1),e("div",{staticClass:"acea-row row-right page"},[t.total?e("pagination",{attrs:{total:t.total,page:t.labelFrom.page,limit:t.labelFrom.limit},on:{"update:page":function(e){return t.$set(t.labelFrom,"page",e)},"update:limit":function(e){return t.$set(t.labelFrom,"limit",e)},pagination:t.getList}}):t._e()],1)],1),e("el-dialog",{attrs:{visible:t.modals,closable:"",title:t.isEdit?"编辑标签":"添加标签",width:"560"},on:{"update:visible":function(e){t.modals=e},close:t.cancel}},[e("div",[e("el-form",{ref:"form",attrs:{"label-position":"right",size:"small",rules:t.rules,model:t.form,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"标签名称:",prop:"name"}},[e("el-input",{staticClass:"w-420",model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),e("el-form-item",{attrs:{label:"分组选择:",prop:"label_cate"}},[e("el-select",{staticClass:"w-420",attrs:{clearable:""},model:{value:t.form.cate_id,callback:function(e){t.$set(t.form,"cate_id",e)},expression:"form.cate_id"}},t._l(t.labelSort.slice(1),(function(t){return e("el-option",{key:t.id,attrs:{value:t.id,label:t.name}})})),1)],1),e("el-form-item",{attrs:{label:"移动端展示:"}},[e("el-switch",{attrs:{"active-value":1,"inactive-value":0},model:{value:t.form.is_show,callback:function(e){t.$set(t.form,"is_show",e)},expression:"form.is_show"}})],1),e("el-form-item",{attrs:{label:"效果设置:"}},[e("el-radio-group",{attrs:{"true-value":1,"false-value":2},model:{value:t.form.type,callback:function(e){t.$set(t.form,"type",e)},expression:"form.type"}},[e("el-radio",{attrs:{label:1}},[t._v("自定义")]),e("el-radio",{attrs:{label:2}},[t._v("图片")])],1)],1),1==t.form.type?e("el-form-item",{attrs:{label:"字体颜色:"}},[e("el-color-picker",{attrs:{"show-alpha":""},model:{value:t.form.font_color,callback:function(e){t.$set(t.form,"font_color",e)},expression:"form.font_color"}}),e("p",{staticClass:"tip"},[t._v("若未设置颜色,则为默认色")])],1):t._e(),1==t.form.type?e("el-form-item",{attrs:{label:"背景颜色:"}},[e("el-color-picker",{attrs:{"show-alpha":""},model:{value:t.form.bg_color,callback:function(e){t.$set(t.form,"bg_color",e)},expression:"form.bg_color"}}),e("p",{staticClass:"tip"},[t._v("若未设置颜色,则为默认色")])],1):t._e(),1==t.form.type?e("el-form-item",{attrs:{label:"边框颜色:"}},[e("el-color-picker",{attrs:{"show-alpha":""},model:{value:t.form.border_color,callback:function(e){t.$set(t.form,"border_color",e)},expression:"form.border_color"}}),e("p",{staticClass:"tip"},[t._v("若未设置颜色,则无边框")])],1):t._e(),2==t.form.type?e("el-form-item",{attrs:{label:"上传图标:"}},[t.form.image?e("div",{staticClass:"upload-list"},[e("div",{staticClass:"upload-item"},[e("img",{attrs:{src:t.form.image}}),e("div",{staticClass:"close",on:{click:function(e){t.form.image=""}}},[e("i",{staticClass:"el-icon-close"})])])]):e("el-button",{staticClass:"upload-select",attrs:{type:"dashed",icon:"el-icon-plus"},on:{click:function(e){return t.modalPicTap(1)}}}),e("p",{staticClass:"tip"},[t._v("建议尺寸:80px*30px,若未上传则为空白")])],1):t._e(),e("el-form-item",{attrs:{label:"排序:"}},[e("el-input-number",{staticClass:"selWidth",attrs:{min:0,max:999},model:{value:t.form.sort,callback:function(e){t.$set(t.form,"sort",e)},expression:"form.sort"}})],1),e("el-form-item",{attrs:{label:"是否开启:"}},[e("el-switch",{attrs:{"active-value":1,"inactive-value":0,size:"large"},model:{value:t.form.status,callback:function(e){t.$set(t.form,"status",e)},expression:"form.status"}},[e("span",{attrs:{slot:"open"},slot:"open"},[t._v("开启")]),e("span",{attrs:{slot:"close"},slot:"close"},[t._v("关闭")])])],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.cancel}},[t._v("取 消")]),e("el-button",{directives:[{name:"db-click",rawName:"v-db-click"}],attrs:{type:"primary"},on:{click:t.addWordsConfirm}},[t._v("确 定")])],1)])],1)],1)],1)}),[],!1,null,"afae01a0",null);e.default=s.exports},e0fa:function(t,e,a){a("846a")}}]);
|