"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[973],{7166:function(t,e,o){o.r(e),o.d(e,{default:function(){return p}});var s=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)},r=[],a=(o(560),o(5157)),i=o(2346),n=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,a.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,a.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,n.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,n.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,a.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)}}},d=l,u=o(1001),c=(0,u.Z)(d,s,r,!1,null,null,null),p=c.exports},9036:function(t,e,o){o.d(e,{CD:function(){return b},JS:function(){return y},K1:function(){return u},NR:function(){return h},Rq:function(){return a},Vx:function(){return d},b9:function(){return v},cM:function(){return c},e3:function(){return l},gM:function(){return _},lO:function(){return r},no:function(){return f},od:function(){return p},rQ:function(){return i},sx:function(){return m},t5:function(){return n},zl:function(){return g}});var s=o(8430);function r(t){return(0,s.Z)({url:"/api/goods_skus",method:"get",params:t})}function a(t){return(0,s.Z)({url:"/api/goods",method:"post",data:t})}function i(t){return(0,s.Z)({url:`/api/goods_skus/${t}`,method:"get"})}function n(t){return(0,s.Z)({url:"/api/goods",method:"get",params:t})}function l(t,e){return(0,s.Z)({url:`/api/goods_skus/${t}`,method:"patch",data:e})}function d(t){return(0,s.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}function u(t,e){return(0,s.Z)({url:`/api/single/goods_skus/${t}`,method:"patch",data:e})}function c(t,e){return(0,s.Z)({url:"/api/upload",Headers:e,method:"post",data:t})}function p(t){return(0,s.Z)({url:"/api/goodsList",method:"get",params:t})}function g(t){return(0,s.Z)({url:"/api/goods_sku_location",method:"get",params:t})}function h(t){return(0,s.Z)({url:"/api/goodsSkusList",method:"get",params:{title:t}})}function m(){return(0,s.Z)({url:"/api/stock/goods_skus",method:"get"})}function f(t){return(0,s.Z)({url:"/api/goods/filter/"+t,method:"get"})}function _(t){return(0,s.Z)({url:"/api/goods_combination",method:"post",data:t})}function b(t){return(0,s.Z)({url:"/api/goods_combination",method:"get",params:t})}function y(t){return(0,s.Z)({url:"/api/goods_combination/"+t,method:"get"})}function v(t){return(0,s.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}},5157:function(t,e,o){o.d(e,{Rp:function(){return a},Tv:function(){return n},X8:function(){return r},Y6:function(){return i},ni:function(){return d},sC:function(){return l}});var s=o(8430);function r(t){return(0,s.Z)({url:"/api/group",method:"get",params:t})}function a(t){return(0,s.Z)({url:"/api/group",method:"post",data:t})}function i(t){return(0,s.Z)({url:`/api/group/${t}`,method:"get"})}function n(t,e){return(0,s.Z)({url:`/api/group/${t}`,method:"patch",data:e})}function l(t){return(0,s.Z)({url:"/api/groupGoods",method:"get",params:t})}function d(t){return(0,s.Z)({url:"/api/groupGoods",method:"post",params:t})}},2346:function(t,e,o){o.d(e,{At:function(){return n},Ci:function(){return r},ER:function(){return i},Mr:function(){return c},ar:function(){return d},e9:function(){return u},io:function(){return a},yH:function(){return l},yq:function(){return p}});var s=o(8430);function r(t){return(0,s.Z)({url:"/api/goodsTypes/tree",method:"get",params:t})}function a(t){return(0,s.Z)({url:`/api/goods_types/${t}`,method:"get"})}function i(t){return(0,s.Z)({url:`/api/goods_types/${t}`,method:"delete"})}function n(t){return(0,s.Z)({url:"/api/goods_types/",method:"post",data:t})}function l(t,e){return(0,s.Z)({url:`/api/goods_types/${t}`,method:"patch",data:e})}function d(t){return(0,s.Z)({url:"/api/goods_brands",method:"get",params:t})}function u(t){return(0,s.Z)({url:`/api/goods_brands/${t}`,method:"delete"})}function c(t){return(0,s.Z)({url:"/api/goods_brands",method:"post",data:t})}function p(t,e){return(0,s.Z)({url:`/api/goods_brands/${t}`,method:"patch",data:e})}}}]); //# sourceMappingURL=973.712e2997.js.map