text: webpackJsonp([20],{HkYm:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=a("rVsN"),o=a.n(s),l=(a("W956"),a("RHYT")),i={name:"goodsList",data:function(){return{request:new l.a,goodsCategories:[],goodsList:[],activeTab:"0",loading:!0,multipleSelection:[],isDelAll:!1,collapse:!1,totalCount:10,currentPage:1,pageSize:10,layout:"total, sizes, prev, pager, next, jumper",categoryId:"",searchText:"",searchSelect:"2"}},created:function(){this.getGoodsList(),this.getGoodsCategoryList()},methods:{getGoodsList:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a="";"1"==this.activeTab&&(a=0),"2"==this.activeTab&&(a=2),"3"==this.activeTab&&(a=1),"0"==this.activeTab&&(t.status="2"),t.goodsStatus=a,t.categoryId=t.categoryId||this.categoryId,t.pageNo=t.pageNo||this.currentPage,t.pageSize=t.pageSize||this.pageSize,this.request.getGoodsList(t).then(function(t){e.loading=!1,"200"==t.code?(e.goodsList=t.ext.list,e.currentPage=t.ext.pageNo,e.totalCount=t.ext.count):"983"==t.code?e.goodsList=[]:e.$message.error("请求失败")})},getGoodsCategoryList:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.request.fetchCategoryList(t).then(function(t){"200"==t.code?(e.goodsCategories=e.$utils.listToTree(t.ext),e.loading=!1):e.$message.error("分类数据, 请求失败")})},getCategoryGoods:function(e){var t={};t.pageNo=this.currentPage,t.categoryId=e,this.categoryId=e,this.loading=!0,this.getGoodsList(t)},searchGoodsList:function(){this.loading=!0,this.categoryId="";var e={},t=this.searchSelect;1==t&&(e.goodsSn=this.searchText),2==t&&(e.goodsName=this.searchText),e.pageNo=this.currentPage,this.getGoodsList(e)},resetGoodsList:function(){this.loading=!0,this.categoryId="",this.searchText="",this.searchSelect="1",this.currentPage=1;var e={};e.pageNo=this.currentPage;this.$refs.goodsCategoryMenu;this.getGoodsList(e)},changeTab:function(e){this.activeTab=e.name,this.loading=!0,this.categoryId="";var t={},a=this.searchSelect;1==a&&(t.goodsSn=this.searchText),2==a&&(t.goodsName=this.searchText),t.pageNo=this.currentPage,this.getGoodsList(t)},collapseMenu:function(){this.collapse=!this.collapse},handleSelectionChange:function(e){this.multipleSelection=e},handleGoodsCommand:function(e){"delete"==e.type&&(this.delVisible=!0,this.delItem=e.row,this.delIndex=e.index),"deleteAll"==e.type&&(this.delVisible=!0,this.isDelAll=!0),"handleMarketable"==e.type&&this.handleMarketable(1),"handleDisMarketable"==e.type&&this.handleMarketable(0),"marketable"==e.type&&this.changeMarketable(1,e.row.goodsSn),"disMarketable"==e.type&&this.changeMarketable(0,e.row.goodsSn)},turnToAddGoods:function(){this.$router.push("/goods/addGoods")},handleDelete:function(){this.isDelAll?this.deleteAll():this.deleteRow()},deleteRow:function(){var e=this,t=[];t.push(this.delItem.goodsSn),this.request.delGoods({goodsSns:t}).then(function(t){e.delVisible=!1,200==t.code?(e.$message.success("删除成功"),e.goodsList.splice(e.delIndex,1),e.delIndex="",e.delItem=""):e.$message.error("删除失败"),e.getGoodsList()})},deleteAll:function(){var e=this,t=(this.multipleSelection.length,this.multipleSelection.map(function(e){return e.goodsSn}));this.request.delGoods({goodsSns:t}).then(function(t){200==t.code?(e.$message.success("删除成功"),e.delVisible=!1,e.$refs.goodsListTable.clearSelection(),e.isDelAll=!1,e.multipleSelection=[],e.getGoodsList()):e.$message.error("删除失败"),e.getGoodsList()})},modifyGoodsStatus:function(e,t){return this.request.modifyGoodsStatus({goodsSn:t,isMarketable:e})},changeMarketable:function(e,t){var a=this,s=e?"上架":"下架";this.modifyGoodsStatus(e,t).then(function(e){200==e.code?a.$message.success(s+"成功"):a.$message.error(s+"失败"),a.loading=!0,a.getGoodsList()})},handleMarketable:function(e){var t=this,a=e?"上架":"下架",s=[];if(this.multipleSelection.length>0)this.multipleSelection.map(function(a){var o=t.modifyGoodsStatus(e,a.goodsSn);s.push(o)});o.a.all(s).then(function(){t.$refs.goodsListTable.clearSelection(),t.multipleSelection=[],t.$message.success("批量"+a+"成功"),t.getGoodsList()},function(){t.$message.error("批量"+a+"失败")})},handleSizeChange:function(e){this.pageSize=e,this.getGoodsList()},handleCurrentChange:function(e){this.currentPage=e,this.getGoodsList()}}},n={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"table"},[a("div",{staticClass:"crumbs"},[a("el-breadcrumb",{attrs:{separator:"/"}},[a("el-breadcrumb-item",[a("i",{staticClass:"el-icon-hh-goods"}),e._v(" 商品管理")]),e._v(" "),a("el-breadcrumb-item",[a("i",{staticClass:"el-icon-hh-list"}),e._v(" 商品列表")])],1)],1),e._v(" "),a("div",{staticClass:"container"},[a("div",{staticClass:"search-wrap"},[a("el-input",{attrs:{placeholder:"请输入内容",width:"286"},model:{value:e.searchText,callback:function(t){e.searchText=t},expression:"searchText"}},[a("el-select",{attrs:{slot:"prepend",placeholder:"请选择"},slot:"prepend",model:{value:e.searchSelect,callback:function(t){e.searchSelect=t},expression:"searchSelect"}},[a("el-option",{attrs:{label:"商品编号",value:"1"}}),e._v(" "),a("el-option",{attrs:{label:"商品名称",value:"2"}})],1)],1),e._v(" "),a("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.searchGoodsList}},[e._v("搜索")]),e._v(" "),a("el-button",{attrs:{type:"default",size:"small"},on:{click:e.resetGoodsList}},[e._v("清除条件")])],1),e._v(" "),a("el-container",[a("el-header",[a("el-tabs",{on:{"tab-click":e.changeTab},model:{value:e.activeTab,callback:function(t){e.activeTab=t},expression:"activeTab"}},[a("el-tab-pane",{attrs:{label:"全部",name:"0"}}),e._v(" "),a("el-tab-pane",{attrs:{label:"在售中",name:"1"}}),e._v(" "),a("el-tab-pane",{attrs:{label:"已售罄",name:"2"}}),e._v(" "),a("el-tab-pane",{attrs:{label:"已下架",name:"3"}})],1)],1),e._v(" "),a("el-container",{staticStyle:{height:"600px"}},[a("el-header",{staticClass:"tool-btns"},[a("div",{staticClass:"menu-title"},[e._v("商品分类"),a("i",{staticClass:"el-icon-menu",on:{click:e.collapseMenu}})]),e._v(" "),a("div",{staticClass:"btn-group"},[a("el-button",{attrs:{type:"primary"},on:{click:e.turnToAddGoods}},[e._v("新增商品")]),e._v(" "),a("el-dropdown",{on:{command:e.handleGoodsCommand}},[a("el-button",{attrs:{type:"default",size:"small"}},[e._v("\n                                更多菜单"),a("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),e._v(" "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item"),e._v(" "),"3"==e.activeTab?a("el-dropdown-item",{attrs:{command:{type:"handleMarketable"}}},[e._v("批量上架")]):e._e(),e._v(" "),"1"==e.activeTab?a("el-dropdown-item",{attrs:{command:{type:"handleDisMarketable"}}},[e._v("批量下架")]):e._e()],1)],1)],1)]),e._v(" "),a("el-container",{staticStyle:{height:"600px"}},[a("el-aside",{attrs:{width:"200px"}},[a("el-menu",{ref:"goodsCategoryMenu",staticClass:"goods-category",attrs:{collapse:e.collapse},on:{select:e.getCategoryGoods,open:e.getCategoryGoods}},[a("el-menu-item",{attrs:{index:""}},[e._v("全部")]),e._v(" "),e._l(e.goodsCategories,function(t){return[t.children?[a("el-submenu",{key:t.id,attrs:{index:t.id}},[a("template",{slot:"title"},[a("span",{attrs:{slot:"title"},slot:"title"},[e._v(e._s(t.name))])]),e._v(" "),e._l(t.children,function(t,s){return a("el-menu-item",{key:s,attrs:{index:t.id}},[e._v("\n                                        "+e._s(t.name)+"\n                                    ")])})],2)]:[a("el-menu-item",{key:t.id,attrs:{index:t.id}},[a("span",{attrs:{slot:"title"},slot:"title"},[e._v(e._s(t.name))])])]]})],2)],1),e._v(" "),a("el-main",[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"goodsListTable",staticStyle:{width:"100%"},attrs:{data:e.goodsList,"tooltip-effect":"dark",stripe:"",height:"500"},on:{"selection-change":e.handleSelectionChange}},[a("el-table-column",{attrs:{type:"selection",width:"50",fixed:""}}),e._v(" "),a("el-table-column",{attrs:{type:"index",width:"50",fixed:""}}),e._v(" "),a("el-table-column",{attrs:{prop:"goodsName",label:"商品名称",fixed:""}}),e._v(" "),a("el-table-column",{attrs:{prop:"sort",label:"权重",width:"80"}}),e._v(" "),a("el-table-column",{attrs:{label:"商品图片",width:"100"},scopedSlots:e._u([{key:"default",fn:function(e){return[a("img",{staticClass:"goods-cover",attrs:{src:e.row.thumbUrl}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"goodsSn",label:"商品编码",width:"120"}}),e._v(" "),a("el-table-column",{attrs:{prop:"categoryName",label:"商品分类","show-overflow-tooltip":""}}),e._v(" "),a("el-table-column",{attrs:{prop:"marketPrice",label:"售价","show-overflow-tooltip":"",width:"80"}}),e._v(" "),a("el-table-column",{attrs:{prop:"storage",label:"库存","show-overflow-tooltip":"",width:"60"}}),e._v(" "),a("el-table-column",{attrs:{prop:"unit",label:"单位","show-overflow-tooltip":"",width:"60"}}),e._v(" "),a("el-table-column",{attrs:{label:"是否上架","show-overflow-tooltip":"",width:"70"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(a){return e.changeMarketable(t.row.isMarketable,t.row.goodsSn)}},model:{value:t.row.isMarketable,callback:function(a){e.$set(t.row,"isMarketable",a)},expression:"scope.row.isMarketable"}})]}}])}),e._v(" "),a("el-table-column",{attrs:{label:"操作","show-overflow-tooltip":"",width:"60",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("router-link",{attrs:{to:{path:"editGoods",query:{goodsSn:t.row.goodsSn}}}},[a("el-button",{attrs:{type:"text",size:"small"}},[e._v("编辑")])],1)]}}])})],1)],1)],1)],1),e._v(" "),a("el-footer",[a("div",{staticClass:"pagination"},[a("el-pagination",{attrs:{"current-page":e.currentPage,"page-sizes":[10,20,40,60],"page-size":10,background:"",layout:e.layout,total:e.totalCount},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange,"update:currentPage":function(t){e.currentPage=t},"update:current-page":function(t){e.currentPage=t}}})],1)])],1)],1)])},staticRenderFns:[]};var r=a("C7Lr")(i,n,!1,function(e){a("tngw"),a("tHG8")},"data-v-4e39b2f2",null);t.default=r.exports},W956:function(e,t,a){"use strict";t.a={areaOptions:[{value:"zhinan",label:"重庆",children:[{value:"shejiyuanze",label:"江津",children:[{value:"yizhi",label:"恒大"},{value:"fankui",label:"双福"},{value:"xiaolv",label:"仁能大厦"},{value:"kekong",label:"其他"}]}]}]}},tHG8:function(e,t){},tngw:function(e,t){}});