chunk-be65c012.e9f40db5.js 13 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-be65c012"],{"26a2":function(t,e,n){"use strict";n.r(e);var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"app-container"},[n("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:t.loadingFull,expression:"loadingFull",modifiers:{fullscreen:!0,lock:!0}}]}),n("div",{staticClass:"filter-container"},[n("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-edit"},on:{click:t.handleAdd}},[t._v("添加")]),t.choosedList.length?n("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-arrow-up"},on:{click:function(e){return t.upDownList(1)}}},[t._v("批量上架")]):t._e(),t.choosedList.length?n("el-button",{staticClass:"filter-item",attrs:{type:"danger",icon:"el-icon-arrow-down"},on:{click:function(e){return t.upDownList(0)}}},[t._v("批量下架")]):t._e(),t.choosedList.length?n("el-button",{staticClass:"filter-item",attrs:{type:"success",icon:"el-icon-arrow-down"},on:{click:t.handlerStartEndList}},[t._v("批量定时上/下架")]):t._e()],1),n("el-table",{ref:"goodsList",staticClass:"tableBorder",attrs:{data:t.goodList,"header-cell-style":{background:"#f8fbfc"},border:"",stripe:""}},[n("el-table-column",{attrs:{label:"序号",type:"index",align:"center",width:"60",index:function(e){return 15*(t.params.page_index-1)+e+1}}}),n("el-table-column",{attrs:{prop:"img",align:"center",label:"图片",width:"70"},scopedSlots:t._u([{key:"default",fn:function(t){var e=t.row;return[n("el-image",{staticClass:"hoverImg",attrs:{src:e.img,fit:"contain"}})]}}])}),n("el-table-column",{attrs:{prop:"name",align:"center",label:"名称",width:"260px"}}),n("el-table-column",{attrs:{prop:"price",label:"价格",align:"center"}}),n("el-table-column",{attrs:{prop:"vip_price",label:"Vip价格",align:"center"}}),n("el-table-column",{attrs:{prop:"sale_num",label:"商品尺码",align:"center",width:"450"},scopedSlots:t._u([{key:"default",fn:function(e){var s=e.row;return[n("div",{staticClass:"size_box"},t._l(s.good_sku,(function(e){return n("el-tag",{key:e.id},[t._v(" "+t._s(e.type)+"-"+t._s(e.size)+" ")])})),1)]}}])}),n("el-table-column",{attrs:{label:"商品状态",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-tag",{attrs:{type:t.goodsStatus(e.row).type}},[t._v(t._s(t.goodsStatus(e.row).message))])]}}])}),n("el-table-column",{attrs:{prop:"updated_at",align:"center",label:"更新时间",width:"180"}}),n("el-table-column",{attrs:{label:"操作",align:"center",width:"280"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.handleEdit(e.row)}}},[t._v("编辑")]),n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){t.handleUpDown(e.row,"下架"===t.goodsStatus(e.row).message?"上架":"下架")}}},[t._v(" "+t._s("下架"===t.goodsStatus(e.row).message?"上架":"下架")+" ")]),n("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(n){return t.handleDelete(e.row)}}},[t._v("删除")])]}}])})],1),n("div",{staticClass:"batch-container"},[n("pagination",{attrs:{total:t.goodListTotal,limit:t.params.page_size,page:t.params.page_index},on:{pagination:t.changePagination,"update:limit":t.changePagination}})],1),n("el-dialog",{attrs:{title:"商品详情",top:"50px",width:"425px",visible:t.dialogGoodsVisible},on:{"update:visible":function(e){t.dialogGoodsVisible=e}}},[n("div",{staticClass:"goods_info"},[t.goodsInfo.banner_url?n("el-carousel",{staticClass:"banner_img",attrs:{trigger:"click",loop:!0}},t._l(t.goodsInfo.banner_url.length?t.goodsInfo.banner_url:[t.goodsInfo.main_img],(function(t){return n("el-carousel-item",{key:t},[n("el-image",{staticStyle:{width:"100%",height:"100%"},attrs:{src:t,fit:"scale-down"}})],1)})),1):t._e(),n("p",{staticClass:"title"},[t._v("商品名称: "+t._s(t.goodsInfo.name))]),n("p",[t._v("副标题: "+t._s(t.goodsInfo.desc))]),n("p",{staticClass:"title"},[t._v("商品价格: "+t._s(t.goodsInfo.hgPrice))]),t.goodsInfo.tagList?n("div",{staticClass:"title"},[t._v(" 商品尺寸: "),t._l(t.goodsInfo.tagList.size,(function(e,s){return n("p",{key:e,staticStyle:{"text-indent":"2em"}},[t._v(" "+t._s(e+" : "+t.goodsInfo.tagList.num[s])+" ")])}))],2):t._e(),n("div",{staticClass:"bottom"},[n("p",[t._v("商品详情:")]),n("div",{staticClass:"goodsInfoDesc",domProps:{innerHTML:t._s(t.goodsInfo.content)}})])],1)]),n("el-dialog",{attrs:{title:"商品排序",width:"666px",visible:t.dialogSortVisible,"destroy-on-close":!0,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogSortVisible=e}}},[n("el-table",{attrs:{id:"sortList",data:t.sortList,border:"",stripe:""}},[n("el-table-column",{attrs:{label:"编号",type:"index",align:"center",width:"50"}}),n("el-table-column",{attrs:{prop:"img_url",align:"center",label:"图片",width:"70"},scopedSlots:t._u([{key:"default",fn:function(t){var e=t.row.main_img;return[n("el-image",{staticClass:"hoverImg",attrs:{src:e,fit:"contain"}})]}}])}),n("el-table-column",{attrs:{prop:"name",align:"center",label:"名称"}})],1),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(e){t.dialogSortVisible=!1,t.sortList=[],t.sortIdList=[]}}},[t._v(" 取 消 ")]),n("el-button",{attrs:{type:"primary"},on:{click:t.comfirmSort}},[t._v("确 定")])],1)],1)],1)},i=[],o=n("1da1"),a=(n("d81d"),n("a434"),n("d3b7"),n("25f0"),n("b0c0"),n("b64b"),n("96cf"),n("c40e")),r={contents:"",id:"",img_url:"",name:"",sku:[],spec:{},status:0,title:""},c={name:"goods_list",data:function(){return{params:{page_size:20,page_index:1,search_name:"",status:"-1"},goodList:[],sortList:[],sortIdList:[],choosedList:[],startEndInfo:{},goodListTotal:0,startEndInfoDate:[],dialogVisible:!1,goodsInfo:r,dialogSortVisible:!1,dialogGoodsVisible:!1,dialogStartEndVisible:!1,loadingFull:!1,updownType:"",attrList:[],attr:""}},created:function(){this.getList()},methods:{goodsStatus:function(t){var e=t.is_shelves,n="",s="";switch(+e){case 0:n="下架",s="danger";break;case 1:n="上架",s="success";break}return{message:n,type:s}},handleUpDown:function(t,e){var n=this,s=t.id;this.$confirm("确认要".concat(e,"该商品吗?"),"".concat(e,"确认")).then(Object(o["a"])(regeneratorRuntime.mark((function t(){var i,o,r,c;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(a["g"])({id:s});case 2:i=t.sent;try{o=i.code,r="".concat(e,200===o?"成功":"失败"),n.$message({message:r,type:200===o?"success":"error"}),200===o&&n.getList()}catch(l){c=i.message?i.message:l.message,c=l.message?l.message:"请求失败",n.$message.error(c)}case 4:case"end":return t.stop()}}),t)})))).catch((function(){}))},getAttr:function(){var t=this;goodsAttr().then((function(e){200===e.code&&(t.attrList=e.data,t.attrList.unshift("全部"))}))},handlerSort:function(){var t=this;this.$request(getSortList(),(function(e){var n=e.list;t.dialogSortVisible=!0,t.sortList=n,t.sortIdList=t.sortList.map((function(t){return t.attr_id})),t.$nextTick((function(){new Sortable(document.querySelector("#sortList tbody"),{onUpdate:function(e){var n=e.oldIndex,s=e.newIndex,i=t.sortIdList[n];t.sortIdList.splice(n,1),t.sortIdList.splice(s,0,i)}})}))}))},comfirmSort:function(){var t=this;this.$request(sortGood({attr_id:this.sortIdList}),(function(e){t.sortList=t.sortIdList=[],t.dialogSortVisible=!1,t.getList()}))},handleSelectionChange:function(t){this.choosedList=t},upDownList:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){var e=this;this.$confirm("此操作将通过批量".concat(+t?"上架":"下级","选中商品, 是否继续?"),"提示").then((function(){e.$request(upDownList({action:t,list:e.choosedList.map((function(t){return t.id}))}),(function(t){e.$refs.goodsList.clearSelection(),e.getList()}))})).catch((function(){}))})),handleTagToggle:function(t){this.params.status=t.name,this.getList()},handleAdd:function(){this.$router.push({name:"goods_add"})},getList:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var n,s,i,o,r,c,l,d,u,g;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loadingFull=!0,e.prev=1,n=t.params,s=n.page_size,i=n.page_index,o=n.status,e.next=5,Object(a["f"])({page_size:s,page_index:i,status:o});case 5:r=e.sent,c=r.message,l=r.code,d=r.data,200===l?(u=d.list,g=d.total,t.goodList=u,t.goodListTotal=g):t.$message.error(c),e.next=14;break;case 10:e.prev=10,e.t0=e["catch"](1),console.log("获取商品列表失败:".concat(e.t0)),t.loadingFull=!1;case 14:t.loadingFull=!1;case 15:case"end":return e.stop()}}),e,null,[[1,10]])})))()},changeKeyShow:function(t){var e;switch(t){case"size":e="尺码";break;case"color":e="颜色";break;case"type":e="款式";break;case"price":e="价格";break;default:e="规格"}return e},handleDelete:function(t){var e=this,n=t.id;this.$confirm("确认要删除该商品吗?","删除确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.deleteGoods(n)}))},deleteGoods:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function n(){var s,i,o;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,Object(a["c"])({id:t});case 2:s=n.sent;try{s.message,i=s.code,e.$message({message:"删除成功!",type:200===i?"success":"error"}),200===i&&e.getList()}catch(r){o=s.message?s.message:r.message,o=r.message?r.message:"请求失败",e.$message.error(o)}case 4:case"end":return n.stop()}}),n)})))()},changePagination:function(t){var e=t.page,n=t.limit;this.params.page_size=n,this.params.page_index=e,this.getList()},handleSeeInfo:function(t){var e=t.id;this.getInfo(e)},getInfo:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function n(){var s,i,o,a;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loadingFull=!0,n.prev=1,n.next=4,getInfo({id:t});case 4:s=n.sent,i=s.message,o=s.code,a=s.data,200===o?(e.goodsInfo=a,e.dialogGoodsVisible=!0,e.loadingFull=!1):(e.$message.error(i),e.loadingFull=!1),n.next=13;break;case 9:n.prev=9,n.t0=n["catch"](1),console.log("查看商品详情失败:".concat(n.t0)),e.loadingFull=!1;case 13:case"end":return n.stop()}}),n,null,[[1,9]])})))()})),skuShow:function(t){if(t.length<1)return[];var e=t[0],n=Object.keys(e);return n},handleEdit:function(t){console.log(t),window.localStorage.setItem("goods",JSON.stringify(t)),this.$router.push({name:"goods_edit"})},indexMethod:function(t){var e=this.params,n=e.page_index,s=e.page_size;return t+=(n-1)*s+1,t},handlerStartEnd:function(t){this.startEndInfo=t,this.dialogStartEndVisible=!0},handlerStartEndList:function(){this.updownType="list",this.startEndInfo=this.choosedList[0],this.dialogStartEndVisible=!0},startEnd:function(){var t=this;this.startEndInfoDate&&this.startEndInfoDate.length?"list"===this.updownType?this.$request(startEndList({id:this.choosedList.map((function(t){return t.id})),start:+this.startEndInfoDate[0]/1e3,end:+this.startEndInfoDate[1]/1e3}),(function(e){t.updownType="",t.dialogStartEndVisible=!1,t.$refs.goodsList.clearSelection(),t.getList()})):this.$request(upDownGoods({id:this.startEndInfo.id,start:+this.startEndInfoDate[0]/1e3,end:+this.startEndInfoDate[1]/1e3}),(function(e){t.$message.success("设置成功"),t.dialogStartEndVisible=!1,t.startEndInfoDate=null,t.getList()})):this.$message.error("请选择定时上下架的时间区间")},clearStartEnd:function(){var t=this;"list"===this.updownType?this.$request(startEndList({id:this.choosedList.map((function(t){return t.id}))}),(function(e){t.updownType="",t.dialogStartEndVisible=!1,t.$refs.goodsList.clearSelection(),t.getList()})):this.$request(clearUpDown({id:this.startEndInfo.id}),(function(e){t.$message.success("设置成功"),t.dialogStartEndVisible=!1,t.startEndInfoDate=null,t.getList()}))}}},l=c,d=(n("797a"),n("7330"),n("2877")),u=Object(d["a"])(l,s,i,!1,null,"cea84c9e",null);e["default"]=u.exports},"32f5":function(t,e,n){},7115:function(t,e,n){},7330:function(t,e,n){"use strict";n("7115")},"797a":function(t,e,n){"use strict";n("32f5")},c40e:function(t,e,n){"use strict";n.d(e,"f",(function(){return i})),n.d(e,"g",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"h",(function(){return r})),n.d(e,"c",(function(){return c})),n.d(e,"e",(function(){return l}));var s=n("b775"),i=function(t){return Object(s["a"])({url:"/goods/list",method:"get",params:t})},o=function(t){return Object(s["a"])({url:"/goods/shelves",method:"post",data:t})},a=function(t){return Object(s["a"])({url:"/goods/add_goods",method:"post",data:t})},r=function(t){return Object(s["a"])({url:"/goods/upload_img",method:"post",data:t})},c=function(t){return Object(s["a"])({url:"/goods/destroy",method:"post",data:t})},l=function(t){return Object(s["a"])({url:"/goods/edit_goods",method:"post",data:t})}}}]);