(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5c09ecc2"],{"1c53":function(t,e,o){"use strict";var n=o("a52a"),a=o.n(n);a.a},4419:function(t,e,o){},"52b5":function(t,e,o){"use strict";o.d(e,"a",(function(){return r}));var n=o("b775"),a=o("d722");function r(t){return Object(n["a"])({url:a["a"].getClassify,method:"get",params:t})}},"67c4":function(t,e,o){"use strict";o.r(e);var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"app-container"},[o("el-card",{staticClass:"box-card"},[o("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[o("span",[t._v("发放优惠券")])]),o("el-form",{ref:"form",staticClass:"common-form",attrs:{model:t.form,"label-width":"100px",rules:t.rules,"inline-message":!0}},[o("el-form-item",{attrs:{label:"优惠券",prop:"coupon_id"}},[o("el-checkbox-group",{model:{value:t.form.coupon_id,callback:function(e){t.$set(t.form,"coupon_id",e)},expression:"form.coupon_id"}},t._l(t.options_coupon,(function(e){return o("el-checkbox",{key:e.id,attrs:{label:e.id,value:e.id}},[t._v(" "+t._s(e.name)+" ")])})),1)],1),o("el-form-item",{attrs:{label:"企业"}},[o("el-radio-group",{model:{value:t.form.setmeal_id,callback:function(e){t.$set(t.form,"setmeal_id",e)},expression:"form.setmeal_id"}},[o("el-radio",{key:0,attrs:{label:0,value:0}},[t._v(" 全部企业 ")]),t._l(t.options_setmeal,(function(e){return o("el-radio",{key:e.id,attrs:{label:e.id,value:e.id}},[t._v(" "+t._s(e.name)+" ")])})),o("el-radio",{key:-1,attrs:{label:-1,value:-1}},[t._v(" 自定义 ")])],2)],1),-1==t.form.setmeal_id?o("el-form-item",{attrs:{label:" ",prop:"uid"}},[o("el-transfer",{staticStyle:{"margin-top":"22px"},attrs:{titles:["可选企业","已选企业"],filterable:"","filter-placeholder":"请输入企业名称",data:t.options_companylist},model:{value:t.form.uid,callback:function(e){t.$set(t.form,"uid",e)},expression:"form.uid"}})],1):t._e(),o("el-form-item",{staticStyle:{"margin-top":"22px"},attrs:{label:""}},[o("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.onSubmit("form")}}},[t._v(" 确定发放 ")])],1)],1)],1)],1)},a=[],r=(o("4160"),o("b0c0"),o("159b"),o("5530")),i=o("cbfe"),c=o("52b5"),u={data:function(){var t=this,e=function(e,o,n){-1==t.form.setmeal_id&&0==o.length?n(new Error("请选择企业")):n()};return{options_setmeal:[],options_coupon:[],options_companylist:[],form:{coupon_id:[],setmeal_id:-1,uid:[]},rules:{coupon_id:[{required:!0,message:"请选择优惠券",trigger:"change"}],uid:[{validator:e,trigger:"change"}]}}},created:function(){this.fetchInfo()},methods:{fetchInfo:function(){var t=this;Object(c["a"])({type:"setmealList,couponList,companyList"}).then((function(e){t.options_setmeal=e.data.setmealList,t.options_coupon=e.data.couponList;var o=e.data.companyList;o.forEach((function(e,o){t.options_companylist.push({label:e.name,key:e.id})}))})).catch((function(){}))},onSubmit:function(t){var e=this,o=Object(r["a"])({},e.form);-1!=o.setmeal_id&&(o.uid=[]),e.$refs[t].validate((function(t){if(!t)return!1;Object(i["g"])(o).then((function(t){return e.$message.success(t.message),setTimeout((function(){e.$router.push("/tool/coupon/log")}),1500),!0})).catch((function(){}))}))}}},s=u,l=(o("f6d6"),o("1c53"),o("2877")),d=Object(l["a"])(s,n,a,!1,null,"22769e8e",null);e["default"]=d.exports},a52a:function(t,e,o){},cbfe:function(t,e,o){"use strict";o.d(e,"d",(function(){return r})),o.d(e,"a",(function(){return i})),o.d(e,"c",(function(){return c})),o.d(e,"b",(function(){return u})),o.d(e,"e",(function(){return s})),o.d(e,"f",(function(){return l})),o.d(e,"g",(function(){return d}));var n=o("b775"),a=o("d722");function r(t){return Object(n["a"])({url:a["a"].couponList,method:"get",params:t})}function i(t){return Object(n["a"])({url:a["a"].couponAdd,method:"post",data:t})}function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"post";return"post"==e?Object(n["a"])({url:a["a"].couponEdit,method:e,data:t}):Object(n["a"])({url:a["a"].couponEdit,method:e,params:t})}function u(t){return Object(n["a"])({url:a["a"].couponDelete,method:"post",data:t})}function s(t){return Object(n["a"])({url:a["a"].couponLog,method:"get",params:t})}function l(t){return Object(n["a"])({url:a["a"].couponRecord,method:"get",params:t})}function d(t){return Object(n["a"])({url:a["a"].couponSend,method:"post",data:t})}},f6d6:function(t,e,o){"use strict";var n=o("4419"),a=o.n(n);a.a}}]);