(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6c2b228e"],{1085:function(e,t,a){"use strict";a("4bb8")},"4bb8":function(e,t,a){},"4fb3":function(e,t,a){"use strict";a.r(t);var l=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"app-form"},[a("div",{staticClass:"app-form-group"},[a("div",{staticClass:"app-form-ti"},[e._v("基础配置")]),a("form-generator",{ref:"basicForm",attrs:{"form-config":e.formConfig,"show-footer":!0,showCancel:!0,cancelText:"返回"},on:{submit:e.handleBasicSubmit,cancel:e.handleCancel},scopedSlots:e._u([{key:"rule",fn:function(t){var l=t.form;return[a("el-form-item",{attrs:{label:"奖励规则",prop:"rule"}},[a("div",{staticClass:"rule-container"},[e._l(l.rule||[],(function(t,l){return a("div",{key:l,staticClass:"rule-item"},[a("div",{staticClass:"rule-card"},[a("div",{staticClass:"rule-header",attrs:{slot:"header"},slot:"header"},[a("span",[e._v("规则 "+e._s(l+1))]),a("el-button",{staticStyle:{color:"#f56c6c"},attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(t){return e.removeRule(l)}}},[e._v("删除")])],1),a("div",{staticClass:"rule-content"},[a("el-form-item",{attrs:{label:"等级",prop:"rule."+l+".level"}},[a("el-select",{staticStyle:{width:"400px"},attrs:{multiple:"",placeholder:"请选择等级"},model:{value:t.level,callback:function(a){e.$set(t,"level",a)},expression:"item.level"}},e._l(e.levels,(function(e){return a("el-option",{key:e.id,attrs:{label:e.title,value:e.id}})})),1)],1),a("el-form-item",{attrs:{label:"用户",prop:"rule."+l+".user"}},[a("seluser",{attrs:{multiple:!0},model:{value:t.user,callback:function(a){e.$set(t,"user",a)},expression:"item.user"}})],1),a("el-form-item",{attrs:{label:"奖励比例",prop:"rule."+l+".reward_rate"}},[a("el-input",{staticStyle:{width:"400px"},attrs:{placeholder:"请输入奖励比例"},model:{value:t.reward_rate,callback:function(a){e.$set(t,"reward_rate",e._n(a))},expression:"item.reward_rate"}},[a("div",{attrs:{slot:"append"},slot:"append"},[e._v("%")])])],1)],1)])])})),a("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.addRule}},[e._v("添加规则")])],2)])]}}]),model:{value:e.formData,callback:function(t){e.formData=t},expression:"formData"}})],1)])])},r=[],i=a("7f70"),s=(a("e8d6"),a("baf6"),a("9226")),o=a("8327"),n={name:"apabonus",components:{seluser:s["a"]},data:function(){return{formData:{status:0,reward_rate:0,rule:[],jiesuan_date:"",jiesuan_confirm:0,jiesuan_confirm_user:""},levels:[]}},computed:Object(i["a"])(Object(i["a"])({},Object(o["b"])(["config"])),{},{formConfig:function(){var e=[{type:"radio",label:"状态",prop:"status",required:!0,width:"400px",options:[{label:"启用",value:1},{label:"禁用",value:0}]}];return 1==this.formData.status&&e.push({type:"radio",label:"显示本月收益",prop:"show_month_income",required:!0,width:"400px",options:[{label:"开启",value:1},{label:"关闭",value:0}]},{type:"integer",label:"指定发放日期",prop:"jiesuan_day",required:!0,width:"400px",min:1,max:31,placeholder:"请输入1-31之间的日期",tip:"每月某日，范围1-31",tipType:"info"},{type:"radio",label:"去除大区业绩",prop:"remove_daqu",required:!0,width:"400px",options:[{label:"开启",value:1},{label:"关闭",value:0}]},{type:"radio",label:"业绩计算",prop:"achievement_jisuan",required:!0,width:"400px",options:[{label:"月业绩",value:1},{label:"季业绩",value:2},{label:"年业绩",value:3}]},{type:"rule",label:"奖励规则",prop:"rule",required:!1}),e}}),created:function(){this.init()},watch:{config:{handler:function(e){this.init()},deep:!0,immediate:!0}},methods:{init:function(){var e=this;this.api.get("fenxiao/level/all").then((function(t){1==t.code&&(e.levels=t.data.list)}));var t=this.$util.restJson(this.config.apabonus);t?this.formData=t:this.formData.rule||this.$set(this.formData,"rule",[])},addRule:function(){this.formData.rule||this.$set(this.formData,"rule",[]),this.formData.rule.push({level:[],user:[],reward_rate:""})},removeRule:function(e){var t=this;this.$confirm("确定要删除该规则吗？","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){t.formData.rule.splice(e,1)})).catch((function(){}))},handleBasicSubmit:function(e){var t=this;this.api.post("apabonus/config/set",e).then((function(e){1==e.code?(t.$util.success(e.message),t.$store.dispatch("settings/getSetting")):t.$util.error(e.message)}))},handleCancel:function(){this.$router.back()}}},u=n,c=(a("1085"),a("3d7a")),p=Object(c["a"])(u,l,r,!1,null,"1b6f0f91",null);t["default"]=p.exports}}]);