(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-743b9db1"],{"586e":function(t,e,a){"use strict";a.r(e);var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox"},[a("el-card",{staticClass:"box-card mb20",attrs:{"body-style":{padding:"0 20px 20px"}}},[t.tabList.length>0?a("el-tabs",{on:{"tab-click":function(e){return t.onChangeType("formValidate")}},model:{value:t.currentTab,callback:function(e){t.currentTab=e},expression:"currentTab"}},t._l(t.tabList,(function(t,e){return a("el-tab-pane",{key:e,attrs:{name:t.value,label:t.title}})})),1):t._e(),t._v(" "),a("el-form",{directives:[{name:"loading",rawName:"v-loading",value:t.fullscreenLoading,expression:"fullscreenLoading"}],ref:"formValidate",staticClass:"formValidate mt20",attrs:{rules:t.ruleValidate,model:t.formValidate,"label-width":"120px"},nativeOn:{submit:function(t){t.preventDefault()}}},[a("div",{directives:[{name:"show",rawName:"v-show",value:1==t.currentTab,expression:"currentTab == 1"}]},[a("el-form-item",{attrs:{label:"活动名称",prop:"name"}},[a("el-input",{staticClass:"selWidth",attrs:{size:"small",placeholder:"请输入活动名称"},model:{value:t.formValidate.name,callback:function(e){t.$set(t.formValidate,"name",e)},expression:"formValidate.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"活动时间:",prop:"timeVal"}},[a("el-date-picker",{staticClass:"mb10",staticStyle:{width:"550px"},attrs:{"default-time":["00:00:00","23:59:59"],type:"datetimerange","range-separator":"至","value-format":"yyyy-MM-dd HH:mm:ss","start-placeholder":"开始日期","picker-options":t.pickerOptions,"end-placeholder":"结束日期"},on:{change:t.onchangeTime},model:{value:t.formValidate.timeVal,callback:function(e){t.$set(t.formValidate,"timeVal",e)},expression:"formValidate.timeVal"}}),t._v(" "),a("p",{staticClass:"desc"},[t._v("设置活动氛围图在商城展示时间")])],1),t._v(" "),a("el-form-item",{attrs:{label:1===t.activityTpye?"活动氛围框":"活动边框",prop:"style"}},[a("div",{staticClass:"upLoadPicBox mb10",on:{click:function(e){return t.modalPicTap("1","dan")}}},[t.formValidate.style?a("div",{staticClass:"pictrue"},[a("img",{attrs:{src:t.formValidate.style}})]):a("div",{staticClass:"upLoad"},[a("i",{staticClass:"el-icon-camera cameraIconfont"})])]),t._v(" "),a("p",{staticClass:"desc"},[t._v(t._s(1===t.activityTpye?"750*100px":"750*750px"))])]),t._v(" "),a("el-form-item",{attrs:{label:"是否开启:"}},[a("el-switch",{attrs:{width:56,"active-value":!0,"inactive-value":!1,"active-text":"开启","inactive-text":"关闭"},model:{value:t.formValidate.status,callback:function(e){t.$set(t.formValidate,"status",e)},expression:"formValidate.status"}})],1)],1),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:2==t.currentTab,expression:"currentTab == 2"}]},[a("el-form-item",{attrs:{"label-width":"0"}},[a("el-radio-group",{model:{value:t.formValidate.method,callback:function(e){t.$set(t.formValidate,"method",e)},expression:"formValidate.method"}},[a("el-radio",{attrs:{label:0}},[t._v("全部商品参与")]),t._v(" "),a("el-radio",{attrs:{label:1}},[t._v("指定商品参与")]),t._v(" "),a("el-radio",{attrs:{label:2}},[t._v("指定品牌参与")]),t._v(" "),a("el-radio",{attrs:{label:3}},[t._v("指定分类参与")]),t._v(" "),a("el-radio",{attrs:{label:4}},[t._v("指定商户参与")])],1)],1),t._v(" "),1==t.formValidate.method?a("el-form-item",{attrs:{"label-width":"0"}},[a("el-button",{attrs:{size:"small",type:"primary"},on:{click:t.addGoods}},[t._v("添加商品")]),t._v(" "),a("el-button",{attrs:{size:"small",disabled:!t.multipleSelection.length},on:{click:t.batchDel}},[t._v("批量删除")])],1):t._e(),t._v(" "),1==t.formValidate.method?a("el-form-item",{attrs:{"label-width":"0"}},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],ref:"tableList",staticStyle:{width:"100%"},attrs:{data:t.tableData.data,size:"mini"},on:{"selection-change":t.handleSelectionChange,"select-all":t.selectAll,select:t.selectOne}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),t._v(" "),a("el-table-column",{attrs:{prop:"id",label:"ID",width:"55"}}),t._v(" "),a("el-table-column",{attrs:{label:"商品图","min-width":"80"},scopedSlots:t._u([{key:"default",fn:function(t){return[a("div",{staticClass:"demo-image__preview"},[a("el-image",{attrs:{src:t.row.image,"preview-src-list":[t.row.image]}})],1)]}}],null,!1,1825039654)}),t._v(" "),a("el-table-column",{attrs:{"show-overflow-tooltip":!0,prop:"name",label:"商品名称","min-width":"200"}}),t._v(" "),a("el-table-column",{attrs:{prop:"price",label:"售价","min-width":"90"}}),t._v(" "),a("el-table-column",{attrs:{prop:"stock",label:"库存","min-width":"70"}}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"140",fixed:"right",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleDelete(e.$index,e.row)}}},[t._v("删除")])]}}],null,!1,1945863928)})],1)],1):t._e(),t._v(" "),2==t.formValidate.method?a("el-form-item",{attrs:{label:"选择品牌:",span:24,"label-width":"100px",prop:"proBrandList"}},[a("el-select",{staticClass:"selWidth",attrs:{clearable:"",filterable:"",loading:t.loading,remote:"",multiple:"",placeholder:"请选择品牌"},model:{value:t.formValidate.proBrandList,callback:function(e){t.$set(t.formValidate,"proBrandList",e)},expression:"formValidate.proBrandList"}},t._l(t.productBrand,(function(t,e){return a("el-option",{key:e,attrs:{label:t.name,value:t.id,disabled:!t.isShow}})})),1)],1):t._e(),t._v(" "),3==t.formValidate.method?a("el-form-item",{attrs:{label:"选择分类:",span:24,"label-width":"100px",prop:"proCategorylist"}},[a("el-cascader",{staticClass:"selWidth",attrs:{props:t.props,options:t.adminProductClassify,filterable:"",placeholder:"","show-all-levels":!1,clearable:""},model:{value:t.formValidate.proCategorylist,callback:function(e){t.$set(t.formValidate,"proCategorylist",e)},expression:"formValidate.proCategorylist"}})],1):t._e(),t._v(" "),4==t.formValidate.method?a("el-form-item",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["platform:merchant:page:list"],expression:"['platform:merchant:page:list']"}],attrs:{label:"选择商户:",span:24,"label-width":"100px",prop:"merIds"}},[a("merchant-name",{attrs:{multiple:t.multiple,merIdChecked:t.formValidate.merIds},on:{getMerId:t.getMerId}})],1):t._e()],1)])],1),t._v(" "),a("el-card",{staticClass:"fixed-card"},[a("el-button",{directives:[{name:"show",rawName:"v-show",value:1==t.currentTab,expression:"currentTab == 1"}],attrs:{size:"small",type:"primary"},on:{click:function(e){return t.submitForm("formValidate",1)}}},[t._v("下一步")]),t._v(" "),a("el-button",{directives:[{name:"show",rawName:"v-show",value:2==t.currentTab,expression:"currentTab == 2"}],attrs:{size:"small"},on:{click:function(e){t.currentTab="1"}}},[t._v("上一步")]),t._v(" "),a("el-button",{directives:[{name:"show",rawName:"v-show",value:2==t.currentTab,expression:"currentTab == 2"}],attrs:{size:"small",type:"primary"},on:{click:function(e){return t.submitForm("formValidate",2)}}},[t._v("保存")])],1)],1)},i=[],l=a("b7be"),o=a("8492"),n=a("c4c8"),s=a("2f62"),c=a("2c2c");function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function m(t,e){var a="undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=f(t))||e&&t&&"number"===typeof t.length){a&&(t=a);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,o=!0,n=!1;return{s:function(){a=a.call(t)},n:function(){var t=a.next();return o=t.done,t},e:function(t){n=!0,l=t},f:function(){try{o||null==a.return||a.return()}finally{if(n)throw l}}}}function u(t){return b(t)||h(t)||f(t)||p()}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(t,e){if(t){if("string"===typeof t)return v(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?v(t,e):void 0}}function h(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function b(t){if(Array.isArray(t))return v(t)}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);aDate.now()+5184e7}},props:{value:"id",label:"name",children:"childList",expandTrigger:"hover",checkStrictly:!1,multiple:!0,emitPath:!1},currentTab:"1",tabList:[{value:"1",title:"基础设置"},{value:"2",title:"使用范围"}],fullscreenLoading:!1,formValidate:{name:"",starttime:"",endtime:"",style:"",status:0,method:0,products:null,proBrandList:[],proCategorylist:[],merIds:[],type:null,timeVal:[],id:null},ruleValidate:{name:[{required:!0,message:"请输入名称",trigger:"blur"}],style:[{required:!0,message:"请选择图片",trigger:"blur"}],proBrandList:[{type:"array",required:!0,message:"请至少选择一个品牌",trigger:"change"}],proCategorylist:[{type:"array",required:!0,message:"请至少选择一个分类",trigger:"change"}],merIds:[{type:"array",required:!0,message:"请至少选择一个商户",trigger:"change"}],timeVal:[{type:"array",required:!0,message:"请选择时间",trigger:"change"}]},listLoading:!1,selectGoods:!1,multipleSelection:[],merSelect:[],tableData:{data:[],total:0},options:[{value:"all",label:"所有页"},{value:"one",label:"当前页"}],tableFrom:{page:1,limit:20,spu_ids:[]},ids:[],search:{limit:10,page:1},brandList:[],loading:!1,tempRoute:{}}},created:function(){this.tempRoute=Object.assign({},this.$route)},computed:y(y({},Object(s["b"])(["adminProductClassify","productBrand"])),{},{isEdit:function(){return!!this.$route.params.id},activityTpye:function(){return-1!==this.$route.path.indexOf("border")?0:1}}),mounted:function(){localStorage.getItem("adminProductClassify")||this.$store.dispatch("product/getAdminProductClassify"),localStorage.getItem("productBrand")||this.$store.dispatch("product/getMerProductBrand"),this.$route.params.id&&(this.setTagsViewTitle(),this.getInfo(this.$route.params.id)),this.getMerchantList()},methods:{onChangeType:function(t){},getproductListbyids:function(){var t=this;Object(n["C"])(this.formValidate.products).then((function(e){t.tableData.data=e}))},getMerId:function(t){this.formValidate.merIds=t},onchangeTime:function(t){this.$set(this.formValidate,"timeVal",t),this.formValidate.starttime=t?t[0]:"",this.formValidate.endtime=t?t[1]:""},modalPicTap:function(t,e){var a=this;this.$modalUpload((function(t){a.formValidate.style=t[0].sattDir,a.formValidate.style&&a.$refs.formValidate.clearValidate(["style"])}),t,"activitystyle")},setTagsViewTitle:function(){var t=1===this.activityTpye?"编辑氛围图":"编辑活动边框",e=Object.assign({},this.tempRoute,{title:"".concat(t,"-").concat(this.$route.params.id)});this.$store.dispatch("tagsView/updateVisitedView",e)},getMerchantList:function(){var t=this;Object(o["j"])().then((function(e){t.merSelect=e}))},getInfo:function(t){this.fullscreenLoading=!0;var e=JSON.parse(localStorage.getItem("activitystyle")),a=JSON.parse(JSON.stringify(e));switch(this.formValidate.starttime=a.starttime,this.formValidate.endtime=a.endtime,this.formValidate.style=a.style,this.formValidate.status=a.status,this.formValidate.method=a.method,this.formValidate.name=a.name,this.formValidate.products=a.products,this.formValidate.type=this.activityTpye,this.formValidate.timeVal=[a.starttime,a.endtime],1===a.method&&this.getproductListbyids(),a.method){case 0:this.formValidate.products="";break;case 1:this.formValidate.products="";break;case 2:this.formValidate.proBrandList=a.products.split(",").map((function(t){return 1*t}));break;case 3:this.formValidate.proCategorylist=a.products.split(",").map((function(t){return 1*t}));break;default:this.formValidate.merIds=a.products.split(",").map((function(t){return 1*t}));break}this.fullscreenLoading=!1,this.fullscreenLoading=!1},addGoods:function(){var t=this;this.$modalGoodList((function(e){t.listLoading=!1,t.tableData.data=e}),"many",t.tableData.data)},getList:function(t){var e=this;this.tableFrom.page=t||this.tableFrom.page,Object(l["Z"])({spu_ids:this.tableFrom.spu_ids.toString(),page:this.tableFrom.page,limit:this.tableFrom.limit}).then((function(t){var a;(e.tableData.data=t.data.list,e.tableData.total=t.data.count,"all"==e.selectAllPage)&&((a=e.multipleSelection).push.apply(a,u(e.tableData.data)),e.multipleSelection.forEach((function(t){e.$refs.tableList.toggleRowSelection(t,!0)})));e.listLoading=!1})).catch((function(t){e.$message.error(t.message),e.listLoading=!1}))},handleDelete:function(t,e){var a=this;this.$modalSure("删除该秒杀商品吗?").then((function(){a.tableData.data.splice(t,1)}))},batchDel:function(){var t=this;this.$modalSure("批量删除秒杀商品吗?").then((function(){var e,a=[],r=m(t.tableData.data);try{var i=function(){var r=e.value,i=t.multipleSelection.findIndex((function(t){return t.id===r.id}));-1===i&&a.push(r)};for(r.s();!(e=r.n()).done;)i()}catch(l){r.e(l)}finally{r.f()}t.tableData.data=a}))},handleSelectionChange:function(t){this.multipleSelection=t},selectAll:function(t){var e=t.map((function(t,e){return t.spu_id}));this.ids=Array.from(new Set([].concat(u(this.ids),u(e))))},selectOne:function(t,e){var a=t.map((function(t,e){return t.spu_id})),r=this.ids.findIndex((function(t){return t==e.spu_id}));this.ids.splice(r,1),this.ids=Array.from(new Set([].concat(u(this.ids),u(a))))},handleCommand:function(t){var e=this;this.$message("click on item "+t),this.selectAllPage="all"===t,this.$nextTick((function(){e.$refs.tableList.toggleAllSelection()}))},submitForm:function(t,e){var a=this;this.$refs[t].validate((function(t){if(!t)return!1;if(1===e)a.currentTab="2";else{switch(a.formValidate.method){case 0:a.formValidate.products="";break;case 1:if(!a.tableData.data.length)return a.$message.error("请选择至少一个商品");var r=[];a.tableData.data.map((function(t){return r.push(t.id)})),a.formValidate.products=r.toString();break;case 2:a.formValidate.products=a.formValidate.proBrandList.toString();break;case 3:a.formValidate.products=a.formValidate.proCategorylist.toString();break;default:a.formValidate.products=a.formValidate.merIds.toString();break}if(a.formValidate.type=a.activityTpye,""==a.formValidate.style)return a.$message.error("请上传氛围图");a.isEdit&&(a.formValidate.id=a.$route.params.id),a.isEdit?Object(l["d"])(a.formValidate).then((function(t){a.$message.success("编辑成功"),a.$router.push({path:1===a.activityTpye?"/marketing/atmosphere/list":"/marketing/border/list"})})):Object(l["o"])(a.formValidate).then((function(t){a.$message.success("新增成功"),a.$router.push({path:1===a.activityTpye?"/marketing/atmosphere/list":"/marketing/border/list"})}))}}))},pageChange:function(t){this.tableFrom.page=t,this.getList("")},handleSizeChange:function(t){this.tableFrom.limit=t,this.getList("")}}},k=S,T=(a("ed4e"),a("2877")),x=Object(T["a"])(k,r,i,!1,null,"095405d0",null);e["default"]=x.exports},b90c:function(t,e,a){},ed4e:function(t,e,a){"use strict";a("b90c")}}]);