chunk-527f4b0d.120ef992.js 15 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-527f4b0d"],{3539:function(t,e,a){},"4f9c":function(t,e,a){"use strict";var i=a("3539");a.n(i).a},a014:function(t,e,a){},de0e:function(t,e,a){"use strict";a.r(e);var i=a("d708"),r=a("2f62"),s=a("b0e7"),o=a("f1c7"),n=a("c4ad"),l=a("c4c8"),c=a("b7be");function d(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function u(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?d(a,!0).forEach((function(e){m(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):d(a).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function m(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var f={components:{uploadPictures:s.a,storeLabelList:o.a,goodsList:n.default},computed:u({},Object(r.e)("admin/layout",["isMobile","menuCollapse"]),{startPickOptions:function(){var t=this;return{disabledDate:function(e){return t.endTime?e.getTime()>new Date(t.endTime).getTime():""}}},endPickOptions:function(){var t=this;return{disabledDate:function(e){return t.startTime?e.getTime()<new Date(t.startTime).getTime():""}}}}),data:function(){return{roterPre:i.a.roterPre,baseURL:i.a.apiBaseURL.replace(/adminapi/,""),currentTab:"1",startTime:"",endTime:"",formValidate:{name:"",section_time:[],image:"",status:1,product_partake_type:"1",product_id:[],brand_id:[],store_label_id:[]},modalPic:!1,gridBtn:{xl:4,lg:8,md:8,sm:8,xs:8},gridPic:{xl:6,lg:8,md:12,sm:12,xs:12},brandData:[],props:{emitPath:!1,multiple:!0},storeLabelShow:!1,storeDataLabel:[],ruleValidate:{name:[{required:!0,message:"请输入活动名称",trigger:"blur"}],image:[{required:!0,message:"请上传活动图",trigger:"change"}]},disabledDate:function(t){return t&&t.valueOf()<Date.now()-864e5},columns:[{title:"商品信息",slot:"goodInfo",align:"left",minWidth:300},{title:"商品分类",key:"cate_name",align:"left",minWidth:250},{title:"售价",key:"price",align:"left",minWidth:80},{title:"库存",key:"stock",align:"left",minWidth:80},{title:"操作",slot:"action",align:"center",minWidth:50}],tableData:[],modals:!1}},mounted:function(){this.setCopyrightShow({value:!1}),0!=this.$route.params.id&&this.getInfo()},destroyed:function(){this.setCopyrightShow({value:!0})},methods:u({},Object(r.d)("admin/layout",["setCopyrightShow"]),{getInfo:function(){var t=this;Object(c.a)(this.$route.params.id).then((function(e){t.formValidate=e.data.info,t.startTime=e.data.info.start_time,t.endTime=e.data.info.stop_time,t.formValidate.product_partake_type=e.data.info.product_partake_type.toString(),t.tableData=e.data.info.products,t.storeDataLabel=e.data.info.store_label_id,4==e.data.info.product_partake_type&&t.getBrandList()})).catch((function(e){t.$Message.error(e.msg)}))},closeLabel:function(t){var e=this.storeDataLabel.indexOf(this.storeDataLabel.filter((function(e){return e.id==t.id}))[0]);this.storeDataLabel.splice(e,1)},goodTap:function(t){4==t&&this.getBrandList()},getBrandList:function(){var t=this;Object(l.f)().then((function(e){t.brandData=e.data})).catch((function(e){t.$Message.error(e.msg)}))},del:function(t){this.tableData.splice(t,1)},addGoods:function(){this.modals=!0},cancel:function(){this.modals=!1},unique:function(t){var e=new Map;return t.filter((function(t){return!e.has(t.id)&&e.set(t.id,1)}))},getProductId:function(t){this.modals=!1;var e=this.tableData.concat(t),a=this.unique(e);this.tableData=a},onchangeStart:function(t){this.startTime=t},onchangeEnd:function(t){this.endTime=t},upTab:function(){"2"==this.currentTab&&(this.currentTab=(Number(this.currentTab)-1).toString())},downTab:function(t){var e=this;this.$refs[t].validate((function(t){if(t){if(!e.startTime||!e.endTime)return e.$Message.warning("请选择活动时间");e.currentTab="2"}else e.$Message.warning("请完善数据")}))},handleSubmit:function(t){var e=this;this.$refs[t].validate((function(t){if(t){if(!e.startTime||!e.endTime)return e.$Message.warning("请选择活动时间");var a=[];if(a.push(e.startTime),a.push(e.endTime),e.formValidate.section_time=a,"2"==e.formValidate.product_partake_type){var i=[];if(e.tableData.forEach((function(t){i.push(t.id)})),!i.length)return e.$Message.error("请添加商品");e.formValidate.product_id=i}if("4"==e.formValidate.product_partake_type&&!e.formValidate.brand_id.length)return e.$Message.error("请添加指定品牌");if("5"==e.formValidate.product_partake_type){var r=[];if(e.storeDataLabel.forEach((function(t){r.push(t.id)})),!r.length)return e.$Message.error("请添加指定标签");e.formValidate.store_label_id=r}Object(c.c)(e.$route.params.id,e.formValidate).then((function(t){e.$router.push({path:"".concat(e.roterPre,"/marketing/activity_background")}),e.$Message.success(t.msg)})).catch((function(t){e.$Message.error(t.msg)}))}else e.$Message.warning("请完善数据")}))},modalPicTap:function(){this.modalPic=!0},getPic:function(t){this.modalPic=!1,this.formValidate.image=t.att_dir,this.$refs.formValidate.validateField("image")},delImage:function(){this.formValidate.image="",this.$refs.formValidate.validateField("image")},openStoreLabel:function(){this.storeLabelShow=!0,this.$refs.storeLabel.storeLabel(JSON.parse(JSON.stringify(this.storeDataLabel)))},activeStoreData:function(t){this.storeLabelShow=!1,this.storeDataLabel=t},storeLabelClose:function(){this.storeLabelShow=!1}})},p=(a("dfad"),a("2877")),b=Object(p.a)(f,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("div",{staticClass:"i-layout-page-header"},[a("PageHeader",{staticClass:"product_tabs",attrs:{"hidden-breadcrumb":""}},[a("div",{attrs:{slot:"title"},slot:"title"},[a("router-link",{attrs:{to:{path:t.roterPre+"/marketing/activity_background"}}},[a("div",{staticClass:"font-sm after-line"},[a("span",{staticClass:"iconfont iconfanhui"}),a("span",{staticClass:"pl10"},[t._v("返回")])])]),a("span",{staticClass:"mr20 ml16",domProps:{textContent:t._s(0!=t.$route.params.id?"编辑活动背景":"添加活动背景")}})],1)])],1),a("Card",{attrs:{bordered:!1,padding:0,"dis-hover":""}},[a("Form",{ref:"formValidate",attrs:{model:t.formValidate,rules:t.ruleValidate,"label-width":109}},[a("Tabs",{model:{value:t.currentTab,callback:function(e){t.currentTab=e},expression:"currentTab"}},[a("TabPane",{attrs:{label:"基础设置",name:"1"}},[a("FormItem",{attrs:{label:"活动名称:",prop:"name"}},[a("Row",[a("Col",[a("Input",{staticClass:"w_input",attrs:{placeholder:"请输入活动名称"},model:{value:t.formValidate.name,callback:function(e){t.$set(t.formValidate,"name",e)},expression:"formValidate.name"}})],1)],1)],1),a("FormItem",{attrs:{label:"活动时间:",required:""}},[a("Row",[a("Col",[a("DatePicker",{staticStyle:{width:"210px"},attrs:{type:"datetime",options:t.startPickOptions,value:t.startTime,placeholder:"开始时间"},on:{"on-change":t.onchangeStart},model:{value:t.startTime,callback:function(e){t.startTime=e},expression:"startTime"}})],1),a("Col",{staticClass:"ml18 mr18",staticStyle:{"text-align":"center"}},[t._v("-")]),a("Col",[a("DatePicker",{staticStyle:{width:"210px"},attrs:{type:"datetime",options:t.endPickOptions,placeholder:"结束时间"},on:{"on-change":t.onchangeEnd},model:{value:t.endTime,callback:function(e){t.endTime=e},expression:"endTime"}})],1)],1),a("Row",[a("Col",{staticClass:"tips"},[t._v("设置活动开始时间与结束时间")])],1)],1),a("FormItem",{attrs:{label:"上传活动图:",prop:"image"}},[a("Row",[a("Col",{attrs:{span:"24"}},[t.formValidate.image?a("div",{staticClass:"upload-list"},[a("div",{staticClass:"upload-item",class:t.formValidate.image?"on":""},[a("img",{directives:[{name:"lazy",rawName:"v-lazy",value:t.formValidate.image,expression:"formValidate.image"}]}),a("Button",{attrs:{shape:"circle",icon:"ios-close"},on:{click:t.delImage}})],1)]):a("Button",{staticClass:"upload-select",attrs:{type:"dashed",icon:"ios-add"},on:{click:function(e){return t.modalPicTap("dan","image",1)}}})],1)],1),a("Row",[a("Col",{staticClass:"tips"},[t._v("\n 建议上传大小:宽750px,高100px\n "),a("Poptip",{attrs:{placement:"bottom",trigger:"hover",width:"256",transfer:"",padding:"8px"}},[a("a",[t._v("查看示例")]),a("div",{staticClass:"exampleImg",attrs:{slot:"content"},slot:"content"},[a("img",{attrs:{src:t.baseURL+"/statics/system/activityBackground.png",alt:""}})])])],1)],1)],1),a("FormItem",{attrs:{label:"是否开启:"}},[a("i-switch",{attrs:{"true-value":1,"false-value":0,size:"large"},model:{value:t.formValidate.status,callback:function(e){t.$set(t.formValidate,"status",e)},expression:"formValidate.status"}},[a("span",{attrs:{slot:"open"},slot:"open"},[t._v("开启")]),a("span",{attrs:{slot:"close"},slot:"close"},[t._v("关闭")])])],1)],1),a("TabPane",{attrs:{label:"添加商品",name:"2"}},[a("FormItem",{staticStyle:{"margin-top":"-12px"},attrs:{"label-width":20}},[a("RadioGroup",{on:{"on-change":t.goodTap},model:{value:t.formValidate.product_partake_type,callback:function(e){t.$set(t.formValidate,"product_partake_type",e)},expression:"formValidate.product_partake_type"}},[a("Radio",{attrs:{label:"1"}},[t._v("全部商品参与")]),a("Radio",{attrs:{label:"2"}},[t._v("指定商品参与")]),a("Radio",{attrs:{label:"4"}},[t._v("指定品牌参与")]),a("Radio",{attrs:{label:"5"}},[t._v("指定商品标签参与")])],1)],1),"2"===t.formValidate.product_partake_type?a("Row",{attrs:{type:"flex",justify:"space-between"}},[a("Col",[a("Button",{attrs:{type:"primary"},on:{click:t.addGoods}},[t._v("添加商品")])],1)],1):t._e(),"4"===t.formValidate.product_partake_type?a("FormItem",{attrs:{label:"选择品牌:",required:""}},[a("el-cascader",{staticClass:"w_input",attrs:{placeholder:"请选择商品品牌",size:"mini",options:t.brandData,props:t.props,filterable:"",clearable:""},model:{value:t.formValidate.brand_id,callback:function(e){t.$set(t.formValidate,"brand_id",e)},expression:"formValidate.brand_id"}})],1):t._e(),"5"===t.formValidate.product_partake_type?a("FormItem",{attrs:{label:"选择标签:",required:""}},[a("Row",[a("Col",{attrs:{span:"11"}},[a("div",{staticClass:"select-tag",on:{click:t.openStoreLabel}},[t.storeDataLabel.length?a("div",t._l(t.storeDataLabel,(function(e){return a("Tag",{key:e.id,attrs:{closable:""},on:{"on-close":function(a){return t.closeLabel(e)}}},[t._v(t._s(e.label_name))])})),1):a("span",{staticClass:"placeholder"},[t._v("请选择")]),a("Icon",{attrs:{type:"ios-arrow-down"}})],1)])],1)],1):t._e(),"2"===t.formValidate.product_partake_type?a("Table",{attrs:{columns:t.columns,data:t.tableData},scopedSlots:t._u([{key:"goodInfo",fn:function(e){var i=e.row;return e.index,[a("div",{staticClass:"imgPic acea-row row-middle"},[a("viewer",[a("div",{staticClass:"pictrue"},[a("img",{directives:[{name:"lazy",rawName:"v-lazy",value:i.image,expression:"row.image"}]})])]),a("div",{staticClass:"info"},[a("Tooltip",{attrs:{"max-width":"200",placement:"bottom",transfer:""}},[a("span",{staticClass:"line2"},[t._v(t._s(i.store_name))]),a("p",{attrs:{slot:"content"},slot:"content"},[t._v(t._s(i.store_name))])])],1)],1)]}},{key:"action",fn:function(e){e.row;var i=e.index;return[a("a",{on:{click:function(e){return t.del(i)}}},[t._v("删除")])]}}],null,!1,3756554290)}):t._e()],1)],1)],1)],1),a("Card",{staticClass:"fixed-card",style:{left:t.menuCollapse?t.isMobile?"0":"80px":"200px"},attrs:{bordered:!1,"dis-hover":""}},[a("Form",[a("FormItem",["1"!==t.currentTab?a("Button",{staticStyle:{"margin-right":"10px"},on:{click:t.upTab}},[t._v("上一步")]):t._e(),"2"!==t.currentTab?a("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.downTab("formValidate")}}},[t._v("下一步")]):a("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.handleSubmit("formValidate")}}},[t._v("保存并发布")])],1)],1)],1),a("Modal",{attrs:{width:"960px",scrollable:"","footer-hide":"",closable:"",title:"上传活动图","mask-closable":!1,"z-index":500},model:{value:t.modalPic,callback:function(e){t.modalPic=e},expression:"modalPic"}},[t.modalPic?a("uploadPictures",{attrs:{isChoice:"单选",gridBtn:t.gridBtn,gridPic:t.gridPic},on:{getPic:t.getPic}}):t._e()],1),a("Modal",{attrs:{scrollable:"",title:"选择商品标签",closable:!0,width:"540","footer-hide":!0,"mask-closable":!1},model:{value:t.storeLabelShow,callback:function(e){t.storeLabelShow=e},expression:"storeLabelShow"}},[a("storeLabelList",{ref:"storeLabel",on:{activeData:t.activeStoreData,close:t.storeLabelClose}})],1),a("Modal",{staticClass:"paymentFooter",attrs:{title:"商品列表",footerHide:"",scrollable:"",width:"900"},on:{"on-cancel":t.cancel},model:{value:t.modals,callback:function(e){t.modals=e},expression:"modals"}},[t.modals?a("goods-list",{ref:"goodslist",attrs:{ischeckbox:!0,isdiy:!0},on:{getProductId:t.getProductId}}):t._e()],1)],1)}),[],!1,null,"1cccf41e",null);e.default=b.exports},dfad:function(t,e,a){"use strict";var i=a("a014");a.n(i).a},f1c7:function(t,e,a){"use strict";var i=a("c4c8"),r={name:"storeLabelList",props:{},data:function(){return{labelList:[],dataLabel:[],isStore:!1}},mounted:function(){},methods:{inArray:function(t,e){for(var a in e)if(e[a].id===t)return!0;return!1},storeLabel:function(t){var e=this;this.dataLabel=t,Object(i.cb)().then((function(t){t.data.map((function(t){t.children&&t.children.length&&(e.isStore=!0,t.children.map((function(t){e.inArray(t.id,e.dataLabel)?t.disabled=!0:t.disabled=!1})))})),e.labelList=t.data})).catch((function(t){e.$Message.error(t.msg)}))},selectLabel:function(t){if(t.disabled){var e=this.dataLabel.indexOf(this.dataLabel.filter((function(e){return e.id===t.id}))[0]);this.dataLabel.splice(e,1),t.disabled=!1}else this.dataLabel.push({label_name:t.label_name,id:t.id}),t.disabled=!0},subBtn:function(){this.$emit("activeData",JSON.parse(JSON.stringify(this.dataLabel)))},cancel:function(){this.$emit("close")}}},s=(a("4f9c"),a("2877")),o=Object(s.a)(r,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"label-wrapper"},[a("div",{staticClass:"list-box"},[t._l(t.labelList,(function(e,i){return t.isStore?a("div",{key:i,staticClass:"label-box"},[e.children&&e.children.length?a("div",{staticClass:"title"},[t._v(t._s(e.label_name))]):t._e(),e.children&&e.children.length?a("div",{staticClass:"list"},t._l(e.children,(function(e,i){return a("div",{key:i,staticClass:"label-item",class:{on:e.disabled},on:{click:function(a){return t.selectLabel(e)}}},[t._v(t._s(e.label_name))])})),0):t._e()]):t._e()})),t.isStore?t._e():a("div",[t._v("暂无标签")])],2),a("div",{staticClass:"footer"},[a("Button",{staticClass:"btns",attrs:{type:"primary"},on:{click:t.subBtn}},[t._v("确定")]),a("Button",{staticClass:"btns",attrs:{type:"primary",ghost:""},on:{click:t.cancel}},[t._v("取消")])],1)])}),[],!1,null,"96f98f60",null);e.a=o.exports}}]);