zx/public/mer/js/chunk-680ee201.0dca5a7a.js

1 line
17 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-680ee201"],{"0bbe":function(t,e,a){"use strict";a("9564")},"5b55":function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox"},[a("el-card",{staticClass:"box-card"},[a("el-row",{staticClass:"acea-row row-middle row-center"},[a("el-col",{attrs:{span:24}},[a("el-form",{ref:"formValidate",staticClass:"form",attrs:{rules:t.ruleValidate,model:t.formValidate,"label-width":"100px"},nativeOn:{submit:function(t){t.preventDefault()}}},[a("el-row",{directives:[{name:"show",rawName:"v-show",value:0===t.current,expression:"current === 0"}]},[a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"套餐名称:",prop:"title"}},[a("el-input",{attrs:{placeholder:"请输入套餐名称",size:"small"},model:{value:t.formValidate.title,callback:function(e){t.$set(t.formValidate,"title",e)},expression:"formValidate.title"}})],1)],1),t._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"套餐时间:",prop:1==t.formValidate.is_time?"time":""}},[a("el-radio-group",{attrs:{"element-id":"is_time"},model:{value:t.formValidate.is_time,callback:function(e){t.$set(t.formValidate,"is_time",e)},expression:"formValidate.is_time"}},[a("el-radio",{attrs:{label:0}},[t._v("不限时")]),t._v(" "),a("el-radio",{staticClass:"radio",attrs:{label:1}},[t._v("限时")])],1),t._v(" "),1==t.formValidate.is_time?a("div",{staticClass:"acea-row row-middle",staticStyle:{display:"inline-block","margin-left":"15px"}},[a("el-date-picker",{attrs:{type:"datetimerange","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期",align:"right"},on:{change:t.onchangeTime},model:{value:t.timeVal,callback:function(e){t.timeVal=e},expression:"timeVal"}})],1):t._e()],1)],1),t._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"套餐类型:",prop:"type","label-for":"type"}},[a("el-radio-group",{attrs:{"element-id":"type"},model:{value:t.formValidate.type,callback:function(e){t.$set(t.formValidate,"type",e)},expression:"formValidate.type"}},[a("el-radio",{staticClass:"radio",attrs:{label:0}},[t._v("固定套餐")]),t._v(" "),a("el-radio",{attrs:{label:1}},[t._v("搭配套餐")])],1),t._v(" "),a("div",{staticClass:"ml100 grey"},[t._v("\n "+t._s(0==t.formValidate.type?"套餐内所有商品打包销售,消费者需成套购买整个套餐":"套餐内主商品必选搭配商品任意选择1件及以上即可购买套餐")+"\n ")])],1)],1),t._v(" "),1==t.formValidate.type?a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"套餐主商品:",prop:"products","label-for":"products"}},[a("el-table",{staticClass:"table",attrs:{data:t.specsMainData,size:"small"}},[a("el-table-column",{attrs:{prop:"store_name",label:"商品名称","min-width":"260"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"product-data"},[a("img",{staticClass:"image",attrs:{src:e.row.image}}),t._v(" "),a("div",[t._v(t._s(e.row.store_name))])])]}}],null,!1,338878098)}),t._v(" "),a("el-table-column",{attrs:{label:"参与规格","min-width":"150"},scopedSlots:t._u([{key:"default",fn:function(e){return t._l(e.row.attr,(function(e,i){return a("div",{key:i},[t._v("\n "+t._s(e.sku||"默认")+" | "+t._s(e.active_price||e.price)+"\n ")])}))}}],null,!1,1237844034)}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.editGoods(e.row,e.$index,"Main")}}},[t._v("设置规格")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteGoods(e.$index,"Main")}}},[t._v("删除")])]}}],null,!1,1942046363)})],1),t._v(" "),t.specsMainData.length<1?a("el-button",{staticClass:"mt20",attrs:{type:"primary",size:"small"},on:{click:function(e){return t.addGoods("Main")}}},[t._v("添加商品")]):t._e()],1)],1):t._e(),t._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:1==t.formValidate.type?"套餐搭配商品:":"套餐商品:",prop:"products","label-for":"products"}},[a("el-table",{staticClass:"table",attrs:{data:t.specsData,size:"small"}},[a("el-table-column",{attrs:{prop:"store_name",label:"商品名称","min-width":"260"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"product-data"},[a("img",{staticClass:"image",attrs:{src:e.row.image}}),t._v(" "),a("div",[t._v(t._s(e.row.store_name))])])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"参与规格","min-width":"150"},scopedSlots:t._u([{key:"default",fn:function(e){return t._l(e.row.attr,(function(e,i){return a("div",{key:i},[t._v("\n "+t._s(e.sku||"默认")+" | "+t._s(e.active_price||e.price)+"\n ")])}))}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.editGoods(e.row,e.$index,"Other")}}},[t._v("设置规格")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteGoods(e.$index,"Other")}}},[t._v("删除")])]}}])})],1),t._v(" "),t.specsData.length<50?a("el-button",{staticClass:"mr15 mt20",attrs:{type:"primary",size:"small"},on:{click:function(e){return t.addGoods("Other")}}},[t._v("添加商品")]):t._e()],1)],1),t._v(" "),a("el-col",[a("el-form-item",{attrs:{label:"套餐数量:",prop:1==t.formValidate.is_limit?"limit_num":"","label-for":"limit_num"}},[a("el-radio-group",{attrs:{"element-id":"is_limit"},model:{value:t.formValidate.is_limit,callback:function(e){t.$set(t.formValidate,"is_limit",e)},expression:"formValidate.is_limit"}},[a("el-radio",{attrs:{label:0}},[t._v("不限量")]),t._v(" "),a("el-radio",{staticClass:"radio",attrs:{label:1}},[t._v("限量")])],1),t._v(" "),1==t.formValidate.is_limit?a("el-input-number",{staticStyle:{"margin-left":"15px"},attrs:{placeholder:"请输入限量数量",min:0,max:99999,precision:0},model:{value:t.formValidate.limit_num,callback:function(e){t.$set(t.formValidate,"limit_num",e)},expression:"formValidate.limit_num"}}):t._e()],1)],1),t._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"排序:","label-for":"sort"}},[a("el-input-number",{attrs:{placeholder:"请输入排序序号",min:0,max:999999,precision:0,size:"small"},model:{value:t.formValidate.sort,callback:function(e){t.$set(t.formValidate,"sort",e)},expression:"formValidate.sort"}})],1)],1),t._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"套餐包邮:",prop:"free_shipping","label-for":"status"}},[a("el-switch",{attrs:{"active-value":1,"inactive-value":0,"active-text":"是","inactive-text":"否"},model:{value:t.formValidate.free_shipping,callback:function(e){t.$set(t.formValidate,"free_shipping",e)},expression:"formValidate.free_shipping"}}),t._v(" "),a("div",{staticClass:"ml100 grey"},[t._v("\n 不包邮时,将按照商品的运费模板进行计算\n ")])],1)],1),t._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"上架状态:",prop:"status","label-for":"status"}},[a("el-switch",{attrs:{"active-value":1,"inactive-value":0,width:55,"active-text":"上架","inactive-text":"下架"},model:{value:t.formValidate.status,callback:function(e){t.$set(t.formValidate,"status",e)},expression:"formValidate.status"}})],1)],1)],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",loading:t.submitOpen},on:{click:function(e){return t.next("formValidate")}}},[t.submitOpen?a("div",[t._v("提交中")]):a("div",[t._v("提交")])])],1)],1)],1)],1)],1),t._v(" "),a("el-dialog",{staticClass:"paymentFooter",attrs:{visible:t.modals,title:"商品列表",width:"900px"},on:{"update:visible":function(e){t.modals=e}}},[t.modals?a("goods-list",{ref:"goodslist",attrs:{ischeckbox:!0,isDiscount:!0},on:{getProductId:t.getProductId,close:t.closeModals}}):t._e()],1),t._v(" "),a("el-dialog",{staticClass:"paymentFooter",attrs:{visible:t.ggModel,title:"规格设置",width:"800px"},on:{"update:visible":function(e){t.ggModel=e}}},[a("div",{staticClass:"df mt15"},[a("el-form",{attrs:{inline:""}},[a("el-form-item",{attrs:{label:"优惠价:"}},[a("el-input-number",{attrs:{min:0},model:{value:t.rate_price,callback:function(e){t.rate_price=e},expression:"rate_price"}}),t._v(" "),a("el-button",{attrs:{size:"small",type:"primary"},on:{click:function(e){return t.changeRatePrice()}}},[t._v("批量添加")])],1)],1)],1),t._v(" "),a("el-table",{ref:"multipleSelection",attrs:{data:t.manyFormValidate,"row-key":function(t){return t.unique},height:"420",size:"small"},on:{"selection-change":t.selectOne}},[a("el-table-column",{attrs:{type:"selection","reserve-selection":!0,width:"80"}}),t._v(" "),a("el-table-column",{attrs:{label:"图片",width:"100"},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)]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"规格",prop:"sku",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.sku||"默认"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"售价",prop:"price",width:"100"}}),t._v(" "),a("el-table-column",{attrs:{label:"会员价",prop:"is_svip_price",width:"100"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"优惠价","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input-number",{staticStyle:{width:"100px"},attrs:{controls:!1,precision:2,min:0,max:e.row["price"]},on:{blur:function(a){return t.limitPrice(e.row)}},model:{value:e.row["active_price"],callback:function(a){t.$set(e.row,"active_price",a)},expression:"scope.row['active_price']"}})]}}])})],1),t._v(" "),a("el-button",{staticClass:"mt10",staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.getAttr}},[a("div",[t._v("提交")])])],1)],1)},s=[],r=a("c80c"),l=(a("96cf"),a("3b8d")),n=(a("7f7f"),a("2d63")),o=(a("ac6a"),a("c4ad")),c=a("83d6"),u=a("b7be"),d={title:[{required:!0,message:"请输入套餐名称",trigger:"blur"}],type:[{required:!0,type:"number",message:"请选择套餐类型",trigger:"change"}],time:[{required:!0,validator:m,trigger:"change"}],limit_num:[{required:!0,type:"number",message:"请输入套餐数量",trigger:"blur"}],image:[{required:!0,message:"请上传套餐主图",trigger:"change"}]};function m(t,e,a){if(console.log(e),Array.isArray(e))e.map((function(t){if(""===t)return a("日期不能为空")}));else if(""===e)return a("日期不能为空");return a()}var p=a("61f7"),f={name:"lotteryCreate",components:{goodsList:o["a"]},data:function(){return{roterPre:c["roterPre"],ggModel:!1,modals:!1,loading:!1,timeVal:"",manyFormValidate:[],multipleSelection:[],submitOpen:!1,spinShow:!1,addGoodsModel:!1,isChoice:"单选",current:0,modalPic:!1,modal_loading:!1,images:[],goodsAddType:"",specsMainData:[],specsData:[],formValidate:{title:"",type:0,is_time:0,is_limit:0,limit_num:0,link_ids:[],time:[],sort:0,free_shipping:1,status:1,products:[]},ruleValidate:d,currentid:"",picTit:"",tableIndex:0,copy:0,editIndex:null,id:"",rate_price:0}},computed:{},mounted:function(){this.$route.params.id&&(this.setTagsViewTitle(),this.id=parseInt(this.$route.params.id),this.current=0,this.copy=this.$route.params.copy||0,this.getInfo())},methods:{setTagsViewTitle:function(){var t="编辑套餐",e=Object.assign({},this.tempRoute,{title:"".concat(t,"-").concat(this.$route.params.id)});this.$store.dispatch("tagsView/updateVisitedView",e)},selectOne:function(t){var e=this;this.multipleSelection=[],t.forEach((function(t,a){t.product_id==e.product_id&&e.multipleSelection.push(t)}))},getAttr:function(){if(!this.multipleSelection.length)return this.$message.warning("请先选择规格");var t;t="Main"===this.goodsAddType?this.specsMainData:this.specsData,this.$set(t[this.tabIndex],"attr",this.multipleSelection);for(var e=[],a=0;a<this.multipleSelection.length;a++){if(""==this.multipleSelection[a]["active_price"]||!this.multipleSelection[a]["active_price"])return this.$message.warning("请填写优惠价格");e.push({active_price:this.multipleSelection[a]["active_price"],unique:this.multipleSelection[a]["unique"]})}this.$set(t[this.tabIndex],"items",e),this.ggModel=!1},limitPrice:function(t){t.active_price-t.price>0&&(t.active_price=t.price)},changeRatePrice:function(){var t,e=Object(n["a"])(this.manyFormValidate);try{for(e.s();!(t=e.n()).done;)for(var a=t.value,i=this.multipleSelection,s=0;s<i.length;s++)a.unique===i[s].unique&&this.$set(a,"active_price",this.rate_price)}catch(r){e.e(r)}finally{e.f()}},generate:function(t,e){var a=this;this.product_id=t,Object(u["bb"])(t).then((function(t){a.ggModel=!0;var e=JSON.parse(JSON.stringify(t.data));console.log(e);var i="Main"===a.goodsAddType?a.specsMainData[a.tabIndex].attr||[]:a.specsData[a.tabIndex].attr||[],s=[];if(i.length)for(var r=0;r<e.length;r++)for(var l=0;l<i.length;l++){var n=i[l];n.sku===e[r].sku&&(a.$set(e[l],"active_price",n.productSku&&n.productSku.active_price||n.active_price),s.push(e[l]))}a.$nextTick((function(){s.forEach((function(t){a.$refs.multipleSelection.toggleRowSelection(t,!0)})),a.multipleSelection=s})),a.manyFormValidate=e})).catch((function(t){a.$message.error(t.message)}))},getProductId:function(t){var e=this;if("Main"===this.goodsAddType&&(t.length>1||this.specsMainData.length>0))this.$message.warning("最多添加一个商品");else{for(var a=JSON.parse(JSON.stringify(t)),i=0;i<a.length;i++)a[i].attr=[];this.$nextTick((function(t){if("Main"===e.goodsAddType){var i=e.concat_arr(e.specsData,a);if(i.length)return e.$message.warning("已存在搭配商品");e.specsMainData=e.specsMainData.concat(a)}else{console.log(e.specsData,a);var s=e.concat_arr(e.specsData,a),r=e.concat_arr(e.specsMainData,a);if(s.length||r.length)return e.$message.warning("已存在相同主商品/搭配商品");e.specsData=e.specsData.concat(a)}e.modals=!1}))}},closeModals:function(){this.modals=!1},onchangeTime:function(t){this.timeVal=t,this.formValidate.time[0]=t?this.moment(t[0]).format("YYYY-MM-DD HH:mm:ss"):"",this.formValidate.time[1]=t?this.moment(t[1]).format("YYYY-MM-DD HH:mm:ss"):""},getInfo:function(){var t=this;Object(u["O"])(this.id).then((function(e){t.formValidate=e.data,t.timeVal=[new Date(t.formValidate.time[0]),new Date(t.formValidate.time[1])];for(var a=0;a<e.data.discountsProduct.length;a++){var i=e.data.discountsProduct[a];i.attr=[],i.items=[];for(var s=i["product"]&&i["product"]["attrValue"]||[],r=0;r<s.length;r++){var l=s[r];l.productSku&&(l["active_price"]=l["productSku"]["active_price"],i.attr.push(l),i.items.push({active_price:l["productSku"]["active_price"],unique:l["unique"]}))}1==i.type?t.specsMainData.push(i):t.specsData.push(i)}}))},next:function(t){var e,a=this;if(1===this.formValidate.type&&!this.specsMainData.length)return this.$message.warning("请选择主商品");if(0===this.formValidate.type&&!this.specsData.length)return this.$message.warning("请选择套餐商品");if(this.specsMainData.forEach((function(t){t.type=1})),this.specsData.forEach((function(t){t.type=0})),e=1==this.formValidate.type?this.specsMainData.concat(this.specsData):this.specsData,e.length<2)return this.$message.warning("套餐内商品不能少于2个");for(var i=0;i<e.length;i++){e[i].temp_id=0;var s=e[i];if(!s.items)return console.log(s),this.$message.warning("请选择 ".concat(s.store_name," 的规格"))}if(this.formValidate.products=e,this.formValidate.temp_id=0,this.submitOpen)return!1;this.$refs[t].validate((function(t){if(!t)return!1;a.submitOpen=!0,a.id&&!a.copy?Object(u["R"])(a.id,a.formValidate).then(function(){var t=Object(l["a"])(Object(r["a"])().mark((function t(e){return Object(r["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:a.$message.success(e.message),setTimeout((function(){a.submitOpen=!1,a.$router.push({path:"".concat(c["roterPre"],"/marketing/discounts/list")})}),500);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){a.submitOpen=!1,a.$message.error(t.message)})):Object(u["Q"])(a.formValidate).then(function(){var t=Object(l["a"])(Object(r["a"])().mark((function t(e){return Object(r["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:a.$message.success(e.message),setTimeout((function(){a.submitOpen=!1,a.$router.push({path:"".concat(c["roterPre"],"/marketing/discounts/list")})}),500);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){a.submitOpen=!1,a.$message.error(t.message)}))}))},concat_arr:function(t,e){for(var a=[],i=0;i<t.length;i++){for(var s=t[i],r=s.product_id,l=!1,n=0;n<e.length;n++){var o=e[n],c=o.product_id;if(c==r){l=!0;break}}l&&a.push(s)}return a},modalPicTap:function(t,e,a){var i=this;this.$modalUpload((function(a){"1"!=t||e||(i.formValidate.image=a[0])}),t)},handleRemove:function(){this.formValidate.image=""},validate:function(t,e,a){return!1!==e||(this.$message.error(a),!1)},addGoods:function(t){this.goodsAddType=t,this.modals=!0},editGoods:function(t,e,a){this.goodsAddType=a,this.tabIndex=e,this.rate_price=0,this.generate(t.product_id,0)},deleteGoods:function(t,e){"Main"===e?this.specsMainData.splice(t,1):this.specsData.splice(t,1)},formatDate:function(t){if(t){var e=new Date(1e3*t);return Object(p["formatDate"])(e,"yyyy-MM-dd hh:mm")}return""}}},h=f,v=(a("0bbe"),a("2877")),_=Object(v["a"])(h,i,s,!1,null,"9d56c31c",null);e["default"]=_.exports},9564:function(t,e,a){}}]);