chunk-43c2b192.efbee77e.js 16 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-43c2b192"],{"26a2":function(t,e,s){"use strict";s.r(e);var i=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"app-container"},[s("div",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:t.loadingFull,expression:"loadingFull",modifiers:{fullscreen:!0,lock:!0}}]}),s("div",{staticClass:"filter-container"},[s("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-edit"},on:{click:t.handleAdd}},[t._v("添加")]),t.choosedList.length?s("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?s("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?s("el-button",{staticClass:"filter-item",attrs:{type:"success",icon:"el-icon-arrow-down"},on:{click:t.handlerStartEndList}},[t._v("批量定时上/下架")]):t._e()],1),s("el-table",{ref:"goodsList",staticClass:"tableBorder",attrs:{data:t.goodList,"header-cell-style":{background:"#f8fbfc"},border:"",stripe:""}},[s("el-table-column",{attrs:{label:"序号",type:"index",align:"center",width:"60",index:function(e){return 15*(t.params.page_index-1)+e+1}}}),s("el-table-column",{attrs:{prop:"img",align:"center",label:"图片",width:"70"},scopedSlots:t._u([{key:"default",fn:function(t){var e=t.row;return[s("el-image",{staticClass:"hoverImg",attrs:{src:e.img,fit:"contain"}})]}}])}),s("el-table-column",{attrs:{prop:"name",align:"center",label:"名称",width:"260px"}}),s("el-table-column",{attrs:{prop:"price",label:"价格",align:"center"}}),s("el-table-column",{attrs:{prop:"vip_price",label:"Vip价格",align:"center"}}),s("el-table-column",{attrs:{prop:"sale_num",label:"商品尺码",align:"center",width:"450"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[s("div",{staticClass:"size_box"},t._l(i.good_sku,(function(e){return s("el-tag",{key:e.id},[t._v(" "+t._s(e.type)+"-"+t._s(e.size)+" ")])})),1)]}}])}),s("el-table-column",{attrs:{label:"商品状态",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[s("el-tag",{attrs:{type:t.goodsStatus(e.row).type}},[t._v(t._s(t.goodsStatus(e.row).message))])]}}])}),s("el-table-column",{attrs:{prop:"updated_at",align:"center",label:"更新时间",width:"180"}}),s("el-table-column",{attrs:{label:"操作",align:"center",width:"280"},scopedSlots:t._u([{key:"default",fn:function(e){return[s("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(s){return t.handleEdit(e.row)}}},[t._v("编辑")]),s("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(s){t.handleUpDown(e.row,"下架"===t.goodsStatus(e.row).message?"上架":"下架")}}},[t._v(" "+t._s("下架"===t.goodsStatus(e.row).message?"上架":"下架")+" ")]),s("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(s){return t.handleDelete(e.row)}}},[t._v("删除")]),s("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(s){return t.handleRemark(e.row)}}},[t._v("尺码备注")])]}}])})],1),s("div",{staticClass:"batch-container"},[s("pagination",{attrs:{total:t.goodListTotal,limit:t.params.page_size,page:t.params.page_index},on:{pagination:t.changePagination,"update:limit":t.changePagination}})],1),s("el-dialog",{attrs:{title:"商品详情",top:"50px",width:"425px",visible:t.dialogGoodsVisible},on:{"update:visible":function(e){t.dialogGoodsVisible=e}}},[s("div",{staticClass:"goods_info"},[t.goodsInfo.banner_url?s("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 s("el-carousel-item",{key:t},[s("el-image",{staticStyle:{width:"100%",height:"100%"},attrs:{src:t,fit:"scale-down"}})],1)})),1):t._e(),s("p",{staticClass:"title"},[t._v("商品名称: "+t._s(t.goodsInfo.name))]),s("p",[t._v("副标题: "+t._s(t.goodsInfo.desc))]),s("p",{staticClass:"title"},[t._v("商品价格: "+t._s(t.goodsInfo.hgPrice))]),t.goodsInfo.tagList?s("div",{staticClass:"title"},[t._v(" 商品尺寸: "),t._l(t.goodsInfo.tagList.size,(function(e,i){return s("p",{key:e,staticStyle:{"text-indent":"2em"}},[t._v(" "+t._s(e+" : "+t.goodsInfo.tagList.num[i])+" ")])}))],2):t._e(),s("div",{staticClass:"bottom"},[s("p",[t._v("商品详情:")]),s("div",{staticClass:"goodsInfoDesc",domProps:{innerHTML:t._s(t.goodsInfo.content)}})])],1)]),s("el-dialog",{attrs:{title:"尺码备注",visible:t.sizeRemarkShow,width:"45%"},on:{"update:visible":function(e){t.sizeRemarkShow=e}}},[[s("div",{staticClass:"size_remark"},[s("div",{staticClass:"remark_title"},[t._v(t._s(t.goodsName))]),s("div",{staticClass:"remark_con",staticStyle:{margin:"20px 0"}},[s("div",[t._v("款式")]),s("div",[t._v("尺码")]),s("div",[t._v("尺码描述")])]),t._l(t.remarkList,(function(e,i){return s("div",{key:i,staticClass:"remark_con"},[s("span",[t._v(t._s(e.type))]),s("span",[t._v(t._s(e.size))]),s("span",[s("el-input",{staticStyle:{width:"230px",height:"50px"},attrs:{placeholder:"例:适合体重100-120斤"},model:{value:e.size_desc,callback:function(s){t.$set(e,"size_desc",s)},expression:"item.size_desc"}})],1)])}))],2),s("div",t._l(t.sizeImgList,(function(e,i){return s("div",{key:i},[s("div",{staticClass:"size_img"},[s("div",{staticClass:"img_title"},[t._v("上传"+t._s(e.type)+"尺码图")]),s("div",[s("el-upload",{ref:"bannerUpload",refInFor:!0,attrs:{limit:15,action:"","show-file-list":!1,"http-request":function(e){return t.sizePictureUpload(e,i)}}},[s("el-button",{attrs:{size:"mini"}},[t._v("点击上传")]),s("div",{staticClass:"el-upload__tip",staticStyle:{"margin-top":"10px"},attrs:{slot:"tip"},slot:"tip"},[t._v(" (建议尺寸画布600*480,大小50K) ")])],1)],1)]),e.size_img?s("div",{staticClass:"img_box"},[s("img",{attrs:{src:e.size_img,alt:""}}),s("div",{staticClass:"remove",on:{click:function(e){return t.deleteSize(i)}}},[t._v("删除")])]):t._e()])})),0)],s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(e){t.sizeRemarkShow=!1}}},[t._v("取 消")]),s("el-button",{attrs:{type:"primary"},on:{click:t.confirmRemark}},[t._v("确 定")])],1)],2),s("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}}},[s("el-table",{attrs:{id:"sortList",data:t.sortList,border:"",stripe:""}},[s("el-table-column",{attrs:{label:"编号",type:"index",align:"center",width:"50"}}),s("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[s("el-image",{staticClass:"hoverImg",attrs:{src:e,fit:"contain"}})]}}])}),s("el-table-column",{attrs:{prop:"name",align:"center",label:"名称"}})],1),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{on:{click:function(e){t.dialogSortVisible=!1,t.sortList=[],t.sortIdList=[]}}},[t._v(" 取 消 ")]),s("el-button",{attrs:{type:"primary"},on:{click:t.comfirmSort}},[t._v("确 定")])],1)],1)],1)},n=[],o=s("c7eb"),a=s("1da1"),r=(s("d81d"),s("a434"),s("d3b7"),s("25f0"),s("b0c0"),s("caad"),s("b64b"),s("e9c4"),s("c40e")),c=(s("ed08"),{contents:"",id:"",img_url:"",name:"",sku:[],spec:{},status:0,title:""}),l={name:"GoodsList",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:c,dialogSortVisible:!1,dialogGoodsVisible:!1,dialogStartEndVisible:!1,loadingFull:!1,updownType:"",attrList:[],attr:"",sizeRemarkShow:!1,remarkList:[],sizeImgList:[],goodsName:"",goods_id:""}},created:function(){this.getList()},methods:{sizePictureUpload:function(t,e){var s=this;this.thumbLoad=!0;var i=t.file,n=["image/png","image/jpg","image/jpeg"];if(-1===n.indexOf(i.type))return this.$message.warning("上传图片格式必须为: png或jpg格式"),!1;var o=new FormData;o.append("img",i),Object(r["i"])(o).then((function(t){s.thumbLoad=!1;try{var i=t.message,n=t.code,o=t.data;200===n?s.sizeImgList[e].size_img=o:s.$message.error(i)}catch(a){console.log("上传尺码图失败: ".concat(a))}})).catch((function(){s.thumbLoad=!1}))},deleteSize:function(t){this.sizeImgList[t].size_img=""},confirmRemark:function(){var t=this,e=this.remarkList,s=[],i=[];e.map((function(t){t.size_desc&&(s.push(t.size_desc),i.push([t.id,t.size_desc]))})),0!==s.length?Object(r["f"])({sizes:i,size_img:this.sizeImgList,id:this.goods_id}).then((function(e){200===e.code?(t.$message.success("尺码描述保存成功!"),t.sizeRemarkShow=!1):t.$message.success(e.msg||"尺码描述保存失败!")})):this.$message.warning("请至少填写一个尺码描述")},goodsStatus:function(t){var e=t.is_shelves,s="",i="";switch(+e){case 0:s="下架",i="danger";break;case 1:s="上架",i="success";break}return{message:s,type:i}},handleUpDown:function(t,e){var s=this,i=t.id;this.$confirm("确认要".concat(e,"该商品吗?"),"".concat(e,"确认")).then(Object(a["a"])(Object(o["a"])().mark((function t(){var n,a,c,l;return Object(o["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(r["h"])({id:i});case 2:n=t.sent;try{a=n.code,c="".concat(e,200===a?"成功":"失败"),s.$message({message:c,type:200===a?"success":"error"}),200===a&&s.getList()}catch(o){l=n.message?n.message:o.message,l=o.message?o.message:"请求失败",s.$message.error(l)}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 s=e.list;t.dialogSortVisible=!0,t.sortList=s,t.sortIdList=t.sortList.map((function(t){return t.attr_id})),t.$nextTick((function(){new Sortable(document.querySelector("#sortList tbody"),{onUpdate:function(e){var s=e.oldIndex,i=e.newIndex,n=t.sortIdList[s];t.sortIdList.splice(s,1),t.sortIdList.splice(i,0,n)}})}))}))},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(a["a"])(Object(o["a"])().mark((function e(){var s,i,n,a,c,l,d,u,g,p;return Object(o["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loadingFull=!0,e.prev=1,s=t.params,i=s.page_size,n=s.page_index,a=s.status,e.next=5,Object(r["g"])({page_size:i,page_index:n,status:a});case 5:c=e.sent,l=c.message,d=c.code,u=c.data,200===d?(g=u.list,p=u.total,t.goodList=g,t.goodListTotal=p):t.$message.error(l),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},handleRemark:function(t){var e=this,s=t.size_img?JSON.parse(t.size_img):[];if(s.length>0)this.sizeImgList=s;else{this.sizeImgList=[];var i=[],n=t.good_sku;n.map((function(t){i.includes(t.type)||(i.push(t.type),e.sizeImgList.push({type:t.type,size_img:""}))})),console.log(this.sizeImgList,"LIST")}this.sizeRemarkShow=!0,this.goodsName=t.name,this.remarkList=t.good_sku,this.goods_id=t.id},handleDelete:function(t){var e=this,s=t.id;this.$confirm("确认要删除该商品吗?","删除确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.deleteGoods(s)}))},deleteGoods:function(t){var e=this;return Object(a["a"])(Object(o["a"])().mark((function s(){var i,n,a;return Object(o["a"])().wrap((function(s){while(1)switch(s.prev=s.next){case 0:return s.next=2,Object(r["c"])({id:t});case 2:i=s.sent;try{i.message,n=i.code,e.$message({message:"删除成功!",type:200===n?"success":"error"}),200===n&&e.getList()}catch(o){a=i.message?i.message:o.message,a=o.message?o.message:"请求失败",e.$message.error(a)}case 4:case"end":return s.stop()}}),s)})))()},changePagination:function(t){var e=t.page,s=t.limit;this.params.page_size=s,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(a["a"])(Object(o["a"])().mark((function s(){var i,n,a,r;return Object(o["a"])().wrap((function(s){while(1)switch(s.prev=s.next){case 0:return e.loadingFull=!0,s.prev=1,s.next=4,getInfo({id:t});case 4:i=s.sent,n=i.message,a=i.code,r=i.data,200===a?(e.goodsInfo=r,e.dialogGoodsVisible=!0,e.loadingFull=!1):(e.$message.error(n),e.loadingFull=!1),s.next=13;break;case 9:s.prev=9,s.t0=s["catch"](1),console.log("查看商品详情失败:".concat(s.t0)),e.loadingFull=!1;case 13:case"end":return s.stop()}}),s,null,[[1,9]])})))()})),skuShow:function(t){if(t.length<1)return[];var e=t[0],s=Object.keys(e);return s},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,s=e.page_index,i=e.page_size;return t+=(s-1)*i+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()}))}}},d=l,u=(s("e73c"),s("c5a9"),s("2877")),g=Object(u["a"])(d,i,n,!1,null,"dbb025c8",null);e["default"]=g.exports},"950e":function(t,e,s){},c40e:function(t,e,s){"use strict";s.d(e,"g",(function(){return n})),s.d(e,"h",(function(){return o})),s.d(e,"a",(function(){return a})),s.d(e,"i",(function(){return r})),s.d(e,"c",(function(){return c})),s.d(e,"e",(function(){return l})),s.d(e,"f",(function(){return d}));var i=s("b775"),n=function(t){return Object(i["a"])({url:"/goods/list",method:"get",params:t})},o=function(t){return Object(i["a"])({url:"/goods/shelves",method:"post",data:t})},a=function(t){return Object(i["a"])({url:"/goods/add_goods",method:"post",data:t})},r=function(t){return Object(i["a"])({url:"/goods/upload_img",method:"post",data:t})},c=function(t){return Object(i["a"])({url:"/goods/destroy",method:"post",data:t})},l=function(t){return Object(i["a"])({url:"/goods/edit_goods",method:"post",data:t})},d=function(t){return Object(i["a"])({url:"/goods/edit_size_desc",method:"post",data:t})}},c5a9:function(t,e,s){"use strict";s("950e")},e5c4:function(t,e,s){},e73c:function(t,e,s){"use strict";s("e5c4")}}]);