(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[166],{7166:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return p}});var r=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{staticClass:"box-card",staticStyle:{"margin-top":"10px"}},[e("el-form",{ref:"group",attrs:{rules:t.rules,model:t.group,"label-width":"80px"}},[e("el-form-item",{attrs:{label:"活动标题",prop:"title"}},[e("el-input",{staticStyle:{width:"500px"},attrs:{type:"textarea"},model:{value:t.group.title,callback:function(e){t.$set(t.group,"title",e)},expression:"group.title"}})],1),e("el-form-item",{attrs:{label:"团购商品"}},[e("el-button",{on:{click:function(e){return t.importGoods()}}},[t._v("从商品列表导入")]),e("el-input",{staticStyle:{"margin-left":"20px",width:"400px"},attrs:{placeholder:"搜索商品名称、编码"},model:{value:t.groupGoodsSearch.external_sku_id,callback:function(e){t.$set(t.groupGoodsSearch,"external_sku_id",e)},expression:"groupGoodsSearch.external_sku_id"}},[e("el-button",{attrs:{slot:"append"},on:{click:function(e){return t.getGroupGoodsList()}},slot:"append"},[t._v("查询")])],1),e("div",{staticStyle:{display:"flex","align-items":"center"}},[e("span",{staticStyle:{"margin-right":"20px"}},[t._v("商品状态")]),e("el-radio-group",{on:{change:function(e){return t.getGroupGoodsList()}},model:{value:t.groupGoodsSearch.has_stock,callback:function(e){t.$set(t.groupGoodsSearch,"has_stock",e)},expression:"groupGoodsSearch.has_stock"}},[e("el-radio",{attrs:{label:2}},[t._v("全部")]),e("el-radio",{attrs:{label:1}},[t._v("在售中")]),e("el-radio",{attrs:{label:0}},[t._v("已售罄")])],1)],1),e("div",{staticStyle:{display:"flex","align-items":"center"}},[e("span",{staticStyle:{"margin-right":"20px"}},[t._v("商品分类")]),e("el-radio-group",{attrs:{size:"small"},on:{change:function(e){return t.getGroupGoodsList()}},model:{value:t.groupGoodsSearch.type_id,callback:function(e){t.$set(t.groupGoodsSearch,"type_id",e)},expression:"groupGoodsSearch.type_id"}},[e("el-radio-button",{attrs:{label:"0"}},[t._v("全部")]),t._l(t.types,(function(o){return e("el-radio-button",{key:o.id,attrs:{label:o.id}},[t._v(" "+t._s(o.name))])}))],2)],1),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.groupLoading,expression:"groupLoading"}],ref:"multipleTableGroup",staticStyle:{width:"100%"},attrs:{data:t.groupGoods.data,border:"",height:"800","row-key":t.getRowKeys}},[e("el-table-column",{attrs:{type:"selection","reserve-selection":!0,width:"55"}}),e("el-table-column",{attrs:{prop:"goods_name",label:" 商品名称"}}),e("el-table-column",{attrs:{prop:"external_sku_id",label:"编码"}}),e("el-table-column",{attrs:{prop:"category_name",label:"分类"}}),e("el-table-column",{attrs:{prop:"stock",label:"库存"}}),e("el-table-column",{attrs:{label:"限购数量"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input",{attrs:{placeholder:"限购数量"},on:{change:function(e){return t.handleCellChange(o.row)}},model:{value:o.row.limit_buy,callback:function(e){t.$set(o.row,"limit_buy",e)},expression:"scope.row.limit_buy"}})]}}])}),e("el-table-column",{attrs:{label:"成本"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input",{attrs:{placeholder:"成本"},on:{change:function(e){return t.handleCellChange(o.row)}},model:{value:o.row.price_in_fen,callback:function(e){t.$set(o.row,"price_in_fen",e)},expression:"scope.row.price_in_fen"}})]}}])}),e("el-table-column",{attrs:{prop:"options",label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text",size:"small"},on:{click:function(e){return t.remove(o.row)}}},[t._v("删除")])]}}])})],1),e("div",{staticStyle:{display:"flex","justify-content":"space-between","align-items":"center","line-height":"32px","margin-top":"20px"}},[e("el-button",{attrs:{type:"danger",size:"small"},on:{click:function(e){return t.batchRemove()}}},[t._v("批量删除")]),e("el-pagination",{attrs:{"current-page":t.groupGoods.meta.current_page,"page-sizes":[20,30,50,100],"page-size":t.groupGoods.meta.per_page,layout:"sizes, prev, pager, next",total:t.groupGoods.meta.total},on:{"size-change":t.handleSizeChangeGroup,"current-change":t.getGroupGoodsList,"update:currentPage":function(e){return t.$set(t.groupGoods.meta,"current_page",e)},"update:current-page":function(e){return t.$set(t.groupGoods.meta,"current_page",e)}}})],1)],1),e("el-form-item",{attrs:{label:"团购时间",prop:"datetimerange"}},[e("el-date-picker",{attrs:{type:"datetimerange","range-separator":"至","start-placeholder":"开始时间","end-placeholder":"结束时间","value-format":"yyyy-MM-dd HH:mm:ss"},model:{value:t.group.datetimerange,callback:function(e){t.$set(t.group,"datetimerange",e)},expression:"group.datetimerange"}})],1),e("el-form-item",{staticStyle:{display:"flex","justify-content":"flex-end"}},[e("el-button",{on:{click:function(e){return t.onAdd(1)}}},[t._v("保存预览")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.onAdd(0)}}},[t._v("发布")])],1)],1)],1),e("el-dialog",{attrs:{title:t.dialogTitle,visible:t.centerDialogVisible,width:"80%","close-on-click-modal":!1},on:{"update:visible":function(e){t.centerDialogVisible=e}}},[e("el-form",{ref:"goodsList",attrs:{model:t.goodsList,"label-width":"80px"}},[e("el-form-item",{attrs:{label:"商品分类",prop:"type_id"}},[e("el-radio-group",{attrs:{size:"small"},on:{change:function(e){return t.goodsSearch()}},model:{value:t.goodsList.type_id,callback:function(e){t.$set(t.goodsList,"type_id",e)},expression:"goodsList.type_id"}},[e("el-radio-button",{attrs:{label:"0"}},[t._v("全部")]),t._l(t.types,(function(o){return e("el-radio-button",{key:o.id,attrs:{label:o.id}},[t._v(" "+t._s(o.name))])}))],2)],1),e("el-form-item",{attrs:{label:"商品品牌",prop:"brand_id"}},[e("el-radio-group",{attrs:{size:"small"},on:{change:function(e){return t.goodsSearch()}},model:{value:t.goodsList.brand_id,callback:function(e){t.$set(t.goodsList,"brand_id",e)},expression:"goodsList.brand_id"}},[e("el-radio-button",{attrs:{label:"0"}},[t._v("全部")]),t._l(t.brands,(function(o){return e("el-radio-button",{key:o.id,attrs:{label:o.id}},[t._v(" "+t._s(o.name))])}))],2)],1),e("el-form-item",{attrs:{label:"搜索",prop:"goods_keyword"}},[e("el-input",{staticStyle:{width:"400px"},attrs:{placeholder:"搜索商品名称、编码"},model:{value:t.goodsList.goods_keyword,callback:function(e){t.$set(t.goodsList,"goods_keyword",e)},expression:"goodsList.goods_keyword"}}),e("el-radio-group",{staticStyle:{margin:"0 30px"},model:{value:t.goodsList.has_stock,callback:function(e){t.$set(t.goodsList,"has_stock",e)},expression:"goodsList.has_stock"}},[e("el-radio",{attrs:{label:1}},[t._v("有库存")]),e("el-radio",{attrs:{label:0}},[t._v("全部")])],1),e("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(e){return t.goodsSearch()}}},[t._v("查询")]),e("el-button",{attrs:{size:"small"},on:{click:function(e){return t.resetForm()}}},[t._v("重置")])],1)],1),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.goodsLoading,expression:"goodsLoading"}],ref:"multipleTable",staticStyle:{width:"100%"},attrs:{data:t.goods.data,border:"",height:"520","row-key":t.getRowKeys},on:{select:t.handleSelect,"select-all":t.selectCurrentGoods}},[e("el-table-column",{attrs:{type:"selection","reserve-selection":!0,width:"55"}}),e("el-table-column",{attrs:{label:"商品信息"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.goods.title+" "+e.row.title)+" ")]}}])}),e("el-table-column",{attrs:{label:"编码"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.goods.goods_code+"_"+e.row.sku_code)+" ")]}}])}),e("el-table-column",{attrs:{label:"品牌"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.goods.brand?e.row.goods.brand.name:"")+" ")]}}])}),e("el-table-column",{attrs:{prop:"goods.type.name",label:"分类"}}),e("el-table-column",{attrs:{prop:"stock",label:"库存"}})],1),e("div",{staticStyle:{display:"flex","flex-direction":"row-reverse","align-items":"center","margin-top":"10px"}},[e("el-pagination",{attrs:{"current-page":t.goods.meta.current_page,"page-sizes":[20,30,50,100],"page-size":t.goods.meta.per_page,layout:"sizes, prev, pager, next",total:t.goods.meta.total},on:{"size-change":t.handleSizeChange,"current-change":t.goodsSearch,"update:currentPage":function(e){return t.$set(t.goods.meta,"current_page",e)},"update:current-page":function(e){return t.$set(t.goods.meta,"current_page",e)}}})],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("div",{staticStyle:{display:"flex","justify-content":"space-between","align-items":"center"}},[e("div",[e("el-button",{on:{click:function(e){return t.toggleSelection(1)}}},[t._v("全选")]),e("el-button",{on:{click:function(e){return t.toggleSelection(0)}}},[t._v("取消全选")])],1),e("div",[t._v("已选 "+t._s(t.selectNum)+" 件")]),e("div",[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.addGoods()}}},[t._v("确 定")]),e("el-button",{on:{click:function(e){t.centerDialogVisible=!1}}},[t._v("取 消")])],1)])])],1)],1)},s=[],n=(o(560),o(5157)),i=o(2346),a=o(9036),l={data(){return{group:{title:"",is_save_preview:1,datetimerange:[]},rules:{title:[{required:!0,message:"请输入活动标题",trigger:"blur"}],datetimerange:[{required:!0,message:"请选择团购时间",trigger:"blur"}]},groupGoods:{data:[],meta:{total:0,current_page:1,per_page:20}},groupGoodsSearch:{external_sku_id:"",has_stock:2,type_id:0,page:1,per_page:20},groupLoading:!1,goodsLoading:!0,goods:{data:[],meta:{total:0,current_page:1,per_page:20}},centerDialogVisible:!1,types:[],brands:[],goodsList:{goods_keyword:"",has_stock:1,type_id:0,brand_id:0,has_ids:[]},goodsListPage:{page:1,per_page:20},dialogTitle:"您的商品库中已有 0 件商品",selectNum:0,selectGoods:[],allGoods:[],changeData:[]}},mounted(){this.getbrandType(),this.getgoodsType(),this.goodsSearch()},methods:{onAdd(t){this.group.is_save_preview=t,this.group.new_ids=this.goodsList.has_ids;let e=[];this.changeData.forEach(((t,o)=>{t&&e.push(t)})),this.group.change_data=e,this.$refs.group.validate((t=>{if(!t)return!1;{const t=this.$loading({lock:!0,text:"Loading",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(0,n.Rp)(this.group).then((e=>{t.close(),this.$message(e.data.message),this.$router.push({path:"GROUP_MANAGEMENT"})}))}}))},handleSizeChangeGroup(t){this.groupGoodsSearch.per_page=t,this.getGroupGoodsList()},getGroupGoodsList(t=1){let e={page:t,per_page:this.groupGoodsSearch.per_page,goods_keyword:this.groupGoodsSearch.external_sku_id,has_stock:this.groupGoodsSearch.has_stock,type_id:this.groupGoodsSearch.type_id,has_ids:this.goodsList.has_ids};(0,n.ni)(e).then((t=>{this.groupGoods=t.data,this.groupGoods.data.forEach(((t,e)=>{void 0!==this.changeData[t.id]&&(this.groupGoods.data[e].limit_buy=this.changeData[t.id].limit_buy,this.groupGoods.data[e].price_in_fen=this.changeData[t.id].price_in_fen)})),this.groupGoods.meta.per_page=parseInt(this.groupGoods.meta.per_page)}))},getgoodsType(){let t={per_page:9999};(0,i.Ci)(t).then((t=>{this.types=t.data.data}))},getbrandType(){let t={per_page:9999};(0,i.ar)(t).then((t=>{this.brands=t.data.data}))},batchRemove(){this.$refs.multipleTableGroup.selection.forEach((t=>{let e=this.goodsList.has_ids.indexOf(t.id);e>0&&delete this.goodsList.has_ids[e]})),this.$refs.multipleTableGroup.clearSelection(),this.getGroupGoodsList()},remove(t){this.goodsList.has_ids.forEach(((e,o)=>{e==t.id&&delete this.goodsList.has_ids[o]})),this.getGroupGoodsList()},handleCellChange(t){this.changeData[t.id]={id:t.id,limit_buy:t.limit_buy,price_in_fen:t.price_in_fen}},importGoods(){this.dialogTitle="您的商品库中已有 "+this.groupGoods.meta.total+" 件商品",this.goodsSearch(),this.centerDialogVisible=!0},goodsSearch(t=1){this.goodsList.page=t,this.goodsList.per_page=this.goodsListPage.per_page,this.goodsLoading=!0,(0,a.od)(this.goodsList).then((t=>{this.goods=t.data,this.goods.meta.per_page=parseInt(this.goods.meta.per_page),this.goods.data.forEach(((t,e)=>{void 0!==this.selectGoods[t.id]&&this.$refs.multipleTable.toggleRowSelection(t,!0)})),this.goodsLoading=!1})),1===t&&this.getAllGoods(this.goodsList)},getAllGoods(t){t.page=1,t.per_page=9999,(0,a.od)(t).then((t=>{this.allGoods=t.data.data}))},handleSizeChange(t){this.goodsListPage.per_page=t,this.goodsSearch()},getRowKeys(t){return t.id},toggleSelection(t){t?(this.allGoods.forEach(((t,e)=>{void 0===this.selectGoods[t.id]&&this.selectNum++,this.selectGoods[t.id]=1})),this.goods.data.forEach(((t,e)=>{this.$refs.multipleTable.toggleRowSelection(t,!0)}))):(this.allGoods.forEach(((t,e)=>{void 0!==this.selectGoods[t.id]&&(delete this.selectGoods[t.id],this.selectNum--)})),this.$refs.multipleTable.clearSelection())},handleSelect(t,e){void 0===this.selectGoods[e.id]?(this.selectGoods[e.id]=1,this.selectNum++):(delete this.selectGoods[e.id],this.selectNum--)},resetForm(){this.$refs.goodsList.resetFields(),this.goodsSearch()},addGoods(){let t=[];this.selectGoods.forEach(((e,o)=>{void 0!==o&&t.push(o)}));let e={has_ids:this.goodsList.has_ids,new_ids:t,per_page:this.groupGoods.meta.per_page};this.goodsList.has_ids.push(...t),(0,n.ni)(e).then((t=>{this.groupGoods=t.data,this.groupGoods.meta.per_page=parseInt(this.groupGoods.meta.per_page)})),this.$refs.goodsList.resetFields(),this.$refs.multipleTable.clearSelection(),this.selectGoods=[],this.selectNum=0,this.centerDialogVisible=!1},selectCurrentGoods(t){t.length?(t.forEach((t=>{void 0===this.selectGoods[t.id]&&(this.selectGoods[t.id]=1)})),this.selectNum+=t.length):(this.goods.data.forEach((t=>{void 0!==this.selectGoods[t.id]&&delete this.selectGoods[t.id]})),this.selectNum-=this.goods.data.length)}}},u=l,d=o(1001),c=(0,d.Z)(u,r,s,!1,null,null,null),p=c.exports},4865:function(t,e,o){var r,s; /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress * @license MIT */(function(n,i){r=i,s="function"===typeof r?r.call(e,o,e,t):r,void 0===s||(t.exports=s)})(0,(function(){var t={version:"0.2.0"},e=t.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'