(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a0b18bc0"],{"52b5":function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i("b775"),s=i("d722");function n(e){return Object(r["a"])({url:s["a"].getClassify,method:"get",params:e})}},5914:function(e,t,i){"use strict";i.r(t);var r=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"app-container"},[i("el-card",{staticClass:"box-card"},[i("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[i("span",[e._v("优惠券设置")])]),i("div",{staticClass:"spaceline"}),i("el-form",{directives:[{name:"loading",rawName:"v-loading",value:e.infoLoading,expression:"infoLoading"}],ref:"form",staticClass:"common-form",attrs:{model:e.form,"label-width":"180px",rules:e.rules,"inline-message":!0}},[i("el-form-item",{staticClass:"is-required",attrs:{label:"开启优惠券功能"}},[i("el-switch",{model:{value:e.form.is_open,callback:function(t){e.$set(e.form,"is_open",t)},expression:"form.is_open"}})],1),i("el-form-item",{attrs:{label:"到期提前几天提醒",prop:"remind_days"}},[i("el-input",{attrs:{type:"number",min:"0"},model:{value:e.form.remind_days,callback:function(t){e.$set(e.form,"remind_days",e._n(t))},expression:"form.remind_days"}}),i("span",{staticClass:"smalltip"},[i("i",{staticClass:"el-icon-info"}),e._v(" 0为不提醒 ")])],1),i("el-form-item",{staticClass:"is-required",attrs:{label:"新注册会员赠送优惠券"}},[i("el-switch",{model:{value:e.form.is_reg_gift,callback:function(t){e.$set(e.form,"is_reg_gift",t)},expression:"form.is_reg_gift"}})],1),!0===e.form.is_reg_gift?i("el-form-item",{staticClass:"is-required",attrs:{label:"新注册会员赠送优惠券",prop:"reg_gift_list"}},[i("el-checkbox-group",{model:{value:e.form.reg_gift_list,callback:function(t){e.$set(e.form,"reg_gift_list",t)},expression:"form.reg_gift_list"}},e._l(e.options_coupon,(function(t){return i("el-checkbox",{key:t.id,attrs:{label:t.id,value:t.id}},[e._v(" "+e._s(t.name)+" ")])})),1)],1):e._e(),i("el-form-item",{attrs:{label:""}},[i("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit("form")}}},[e._v(" 保存 ")])],1)],1)],1)],1)},s=[],n=(i("4160"),i("159b"),i("5530")),o=i("1063"),a=i("52b5"),f={data:function(){var e=this,t=function(t,i,r){!0===e.form.is_reg_gift&&0==i.length?r(new Error("请选择要赠送的优惠券")):r()};return{infoLoading:!0,form:{is_open:!1,remind_days:0,is_reg_gift:!0,reg_gift_list:[]},options_coupon:[],rules:{remind_days:[{required:!0,message:"请输入到期提前几天提醒",trigger:"blur"},{type:"number",message:"请正确输入到期提前几天提醒",trigger:"blur"}],reg_gift_list:[{validator:t,trigger:"blur"}]}}},created:function(){this.fetchInfo()},methods:{fetchInfo:function(){var e=this;this.infoLoading=!0,Object(a["a"])({type:"couponList"}).then((function(t){return e.options_coupon=t.data,Object(o["j"])({},"get")})).then((function(t){e.form=Object(n["a"])(Object(n["a"])({},e.form),t.data.coupon_config),e.form.is_open=1==e.form.is_open,e.form.is_reg_gift=1==e.form.is_reg_gift,e.form.remind_days=parseInt(e.form.remind_days),e.form.reg_gift_list.forEach((function(t,i){e.form.reg_gift_list[i]=parseInt(t)})),e.infoLoading=!1})).catch((function(){}))},onSubmit:function(e){var t=this,i=Object(n["a"])({},this.form);this.$refs[e].validate((function(e){if(!e)return!1;i.is_open=!0===i.is_open?1:0,i.is_reg_gift=!0===i.is_reg_gift?1:0,Object(o["j"])({coupon_config:i}).then((function(e){return t.$store.dispatch("config/getConfigInfo"),t.$message.success(e.message),!0})).catch((function(){}))}))}}},c=f,l=(i("7ff5"),i("2877")),m=Object(l["a"])(c,r,s,!1,null,"ca03949c",null);t["default"]=m.exports},"65a3":function(e,t,i){},"7ff5":function(e,t,i){"use strict";var r=i("65a3"),s=i.n(r);s.a}}]);