You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
15 KiB
1 lines
15 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-56cc40d4"],{"084c":function(t,e,a){},2279:function(t,e,a){},"8c9d":function(t,e,a){"use strict";a("084c")},de0e:function(t,e,a){"use strict";a.r(e);var i=a("d708"),r=a("2f62"),o=a("b0e7"),s=a("f1c7"),n=a("c4ad"),l=a("c4c8"),c=a("b7be");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})(t)}function u(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 m(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?u(Object(a),!0).forEach((function(e){f(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):u(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function f(t,e,a){return(e=function(t){var e=function(t,e){if("object"!=d(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,e||"default");if("object"!=d(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==d(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var p={components:{uploadPictures:o.a,storeLabelList:s.a,goodsList:n.default},computed:m(m({},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:m(m({},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}})},b=(a("eb91"),a("2877")),h=Object(b.a)(p,(function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"i-layout-page-header"},[e("PageHeader",{staticClass:"product_tabs",attrs:{"hidden-breadcrumb":""}},[e("div",{attrs:{slot:"title"},slot:"title"},[e("router-link",{attrs:{to:{path:"".concat(t.roterPre,"/marketing/activity_background")}}},[e("div",{staticClass:"font-sm after-line"},[e("span",{staticClass:"iconfont iconfanhui"}),e("span",{staticClass:"pl10"},[t._v("返回")])])]),e("span",{staticClass:"mr20 ml16",domProps:{textContent:t._s(0!=t.$route.params.id?"编辑活动背景":"添加活动背景")}})],1)])],1),e("Card",{attrs:{bordered:!1,padding:0,"dis-hover":""}},[e("Form",{ref:"formValidate",attrs:{model:t.formValidate,rules:t.ruleValidate,"label-width":109}},[e("Tabs",{model:{value:t.currentTab,callback:function(e){t.currentTab=e},expression:"currentTab"}},[e("TabPane",{attrs:{label:"基础设置",name:"1"}},[e("FormItem",{attrs:{label:"活动名称:",prop:"name"}},[e("Row",[e("Col",[e("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),e("FormItem",{attrs:{label:"活动时间:",required:""}},[e("Row",[e("Col",[e("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),e("Col",{staticClass:"ml18 mr18",staticStyle:{"text-align":"center"}},[t._v("-")]),e("Col",[e("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),e("Row",[e("Col",{staticClass:"tips"},[t._v("设置活动开始时间与结束时间")])],1)],1),e("FormItem",{attrs:{label:"上传活动图:",prop:"image"}},[e("Row",[e("Col",{attrs:{span:"24"}},[t.formValidate.image?e("div",{staticClass:"upload-list"},[e("div",{staticClass:"upload-item",class:t.formValidate.image?"on":""},[e("img",{directives:[{name:"lazy",rawName:"v-lazy",value:t.formValidate.image,expression:"formValidate.image"}]}),e("Button",{attrs:{shape:"circle",icon:"ios-close"},on:{click:t.delImage}})],1)]):e("Button",{staticClass:"upload-select",attrs:{type:"dashed",icon:"ios-add"},on:{click:function(e){return t.modalPicTap("dan","image",1)}}})],1)],1),e("Row",[e("Col",{staticClass:"tips"},[t._v("\n 建议上传大小:宽750px,高100px\n "),e("Poptip",{attrs:{placement:"bottom",trigger:"hover",width:"256",transfer:"",padding:"8px"}},[e("a",[t._v("查看示例")]),e("div",{staticClass:"exampleImg",attrs:{slot:"content"},slot:"content"},[e("img",{attrs:{src:"".concat(t.baseURL,"/statics/system/activityBackground.png"),alt:""}})])])],1)],1)],1),e("FormItem",{attrs:{label:"是否开启:"}},[e("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"}},[e("span",{attrs:{slot:"open"},slot:"open"},[t._v("开启")]),e("span",{attrs:{slot:"close"},slot:"close"},[t._v("关闭")])])],1)],1),e("TabPane",{attrs:{label:"添加商品",name:"2"}},[e("FormItem",{staticStyle:{"margin-top":"-12px"},attrs:{"label-width":20}},[e("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"}},[e("Radio",{attrs:{label:"1"}},[t._v("全部商品参与")]),e("Radio",{attrs:{label:"2"}},[t._v("指定商品参与")]),e("Radio",{attrs:{label:"4"}},[t._v("指定品牌参与")]),e("Radio",{attrs:{label:"5"}},[t._v("指定商品标签参与")])],1)],1),"2"===t.formValidate.product_partake_type?e("Row",{attrs:{type:"flex",justify:"space-between"}},[e("Col",[e("Button",{attrs:{type:"primary"},on:{click:t.addGoods}},[t._v("添加商品")])],1)],1):t._e(),"4"===t.formValidate.product_partake_type?e("FormItem",{attrs:{label:"选择品牌:",required:""}},[e("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?e("FormItem",{attrs:{label:"选择标签:",required:""}},[e("Row",[e("Col",{attrs:{span:"11"}},[e("div",{staticClass:"select-tag",on:{click:t.openStoreLabel}},[t.storeDataLabel.length?e("div",t._l(t.storeDataLabel,(function(a){return e("Tag",{key:a.id,attrs:{closable:""},on:{"on-close":function(e){return t.closeLabel(a)}}},[t._v(t._s(a.label_name))])})),1):e("span",{staticClass:"placeholder"},[t._v("请选择")]),e("Icon",{attrs:{type:"ios-arrow-down"}})],1)])],1)],1):t._e(),"2"===t.formValidate.product_partake_type?e("Table",{attrs:{columns:t.columns,data:t.tableData},scopedSlots:t._u([{key:"goodInfo",fn:function(a){var i=a.row;return a.index,[e("div",{staticClass:"imgPic acea-row row-middle"},[e("viewer",[e("div",{staticClass:"pictrue"},[e("img",{directives:[{name:"lazy",rawName:"v-lazy",value:i.image,expression:"row.image"}]})])]),e("div",{staticClass:"info"},[e("Tooltip",{attrs:{"max-width":"200",placement:"bottom",transfer:""}},[e("span",{staticClass:"line2"},[t._v(t._s(i.store_name))]),e("p",{attrs:{slot:"content"},slot:"content"},[t._v(t._s(i.store_name))])])],1)],1)]}},{key:"action",fn:function(a){a.row;var i=a.index;return[e("a",{on:{click:function(e){return t.del(i)}}},[t._v("删除")])]}}],null,!1,3756554290)}):t._e()],1)],1)],1)],1),e("Card",{staticClass:"fixed-card",style:{left:"".concat(t.menuCollapse?t.isMobile?"0":"80px":"200px")},attrs:{bordered:!1,"dis-hover":""}},[e("Form",[e("FormItem",["1"!==t.currentTab?e("Button",{staticStyle:{"margin-right":"10px"},on:{click:t.upTab}},[t._v("上一步")]):t._e(),"2"!==t.currentTab?e("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.downTab("formValidate")}}},[t._v("下一步")]):e("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.handleSubmit("formValidate")}}},[t._v("保存并发布")])],1)],1)],1),e("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?e("uploadPictures",{attrs:{isChoice:"单选",gridBtn:t.gridBtn,gridPic:t.gridPic},on:{getPic:t.getPic}}):t._e()],1),e("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"}},[e("storeLabelList",{ref:"storeLabel",on:{activeData:t.activeStoreData,close:t.storeLabelClose}})],1),e("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?e("goods-list",{ref:"goodslist",attrs:{ischeckbox:!0,isdiy:!0},on:{getProductId:t.getProductId}}):t._e()],1)],1)}),[],!1,null,"1cccf41e",null);e.default=h.exports},eb91:function(t,e,a){"use strict";a("2279")},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.jb)().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")}}},o=(a("8c9d"),a("2877")),s=Object(o.a)(r,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"label-wrapper"},[e("div",{staticClass:"list-box"},[t._l(t.labelList,(function(a,i){return t.isStore?e("div",{key:i,staticClass:"label-box"},[a.children&&a.children.length?e("div",{staticClass:"title"},[t._v(t._s(a.label_name))]):t._e(),a.children&&a.children.length?e("div",{staticClass:"list"},t._l(a.children,(function(a,i){return e("div",{key:i,staticClass:"label-item",class:{on:a.disabled},on:{click:function(e){return t.selectLabel(a)}}},[t._v(t._s(a.label_name))])})),0):t._e()]):t._e()})),t.isStore?t._e():e("div",[t._v("暂无标签")])],2),e("div",{staticClass:"footer"},[e("Button",{staticClass:"btns",attrs:{type:"primary"},on:{click:t.subBtn}},[t._v("确定")]),e("Button",{staticClass:"btns",attrs:{type:"primary",ghost:""},on:{click:t.cancel}},[t._v("取消")])],1)])}),[],!1,null,"96f98f60",null);e.a=s.exports}}]); |