webpackJsonp([33],{"+Agz":function(t,e){},"5Fm7":function(t,e){},"7bg4":function(t,e){},FphS:function(t,e){},Gdbv:function(t,e){},ZLh3:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=i("Xxa5"),s=i.n(a),n=i("exGp"),l=i.n(n),o={props:{title:{type:String,default:"付费情况"},clearable:{type:Boolean,default:!0},reset:{type:Boolean,default:!1},width:{type:String},afferent_obj:{type:Object,default:function(){}}},watch:{reset:{handler:function(){this.initVal()},immediate:!0}},data:function(){return{visible:!1,radio:null,valueObj:{custom_radio:"number",radio:null,minValue:"",maxValue:""}}},methods:{initVal:function(){this.afferent_obj&&this.afferent_obj.payType?(this.valueObj.custom_radio=this.afferent_obj&&this.afferent_obj.payType,this.valueObj.radio=this.afferent_obj&&this.afferent_obj.payStatus,this.valueObj.minValue=this.afferent_obj&&this.afferent_obj.payMin,this.valueObj.maxValue=this.afferent_obj&&this.afferent_obj.payMax,this.radio=this.afferent_obj&&this.afferent_obj.payStatus):(this.valueObj.custom_radio="number",this.valueObj.radio=null,this.valueObj.minValue="",this.valueObj.maxValue="",this.radio=null)},visibleHide:function(){if("has"==this.radio){if(!this.valueObj.minValue||!this.valueObj.maxValue||Number(this.valueObj.maxValue)Number(s))return t.$message({message:"请正确填写时间",type:"warning"}),void(t.flag=!1)}else if("pay"==e.type){var n=e.condition,l=n.payStatus,o=n.payMin,r=n.payMax;n.payType;if(!l)return t.$message({message:"付费状态不可以为空",type:"warning"}),void(t.flag=!1);if("has"==l&&!o&&!r)return t.$message({message:"已付费时,最大或最小值不可以为空",type:"warning"}),void(t.flag=!1)}else if("label"==e.type){if(!e.condition.tag_id_list)return t.$message({message:"标签不可以为空",type:"warning"}),void(t.flag=!1)}})},confirmEvent:function(){var t=this;return l()(s.a.mark(function e(){return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(""!=t.iptName){e.next=3;break}return t.$message({message:"规则标题必填",type:"warning"}),e.abrupt("return");case 3:return e.next=5,t.handleAssignment();case 5:if(t.flag){e.next=7;break}return e.abrupt("return");case 7:t.$axios.post(t.URL.BASEURL+t.URL.phaseSet,{rule_id:t.echoObj?t.echoObj.rule_id:"",stage_title:t.iptName,stage_desc:t.iptDesc,stage_rule:t.ruleList}).then(function(e){(e=e.data)&&0==e.errno?(t.$message({message:"添加成功",type:"success"}),t.$emit("close",!0)):4002!=e.errno&&t.$message({message:e.err,type:"warning"})}).catch(function(t){});case 8:case"end":return e.stop()}},e,t)}))()}}},f={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("el-dialog",{staticClass:"dialogCon_permission",attrs:{title:t.dialogTitle,visible:t.dialogVisible,"append-to-body":!0,width:"660px"},on:{"update:visible":function(e){t.dialogVisible=e},close:t.closeEvent}},[i("div",{staticClass:"dialogCon"},[i("div",{staticClass:"itemBox",staticStyle:{"margin-top":"0"}},[i("div",{staticClass:"name"},[i("em",[t._v("*")]),t._v("阶段名称:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{staticStyle:{width:"100%"},attrs:{size:"small",placeholder:"请输入阶段名称"},model:{value:t.iptName,callback:function(e){t.iptName=e},expression:"iptName"}})],1)]),t._v(" "),i("div",{staticClass:"itemBox"},[i("div",{staticClass:"name"},[t._v("阶段描述:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{staticStyle:{width:"100%"},attrs:{size:"small",placeholder:"请输入阶段描述"},model:{value:t.iptDesc,callback:function(e){t.iptDesc=e},expression:"iptDesc"}})],1)]),t._v(" "),i("div",{staticClass:"itemBox",staticStyle:{"align-items":"baseline"}},[i("div",{staticClass:"name"},[i("em",[t._v("*")]),t._v("阶段规则:")]),t._v(" "),i("div",{staticClass:"ipt phaseBox"},[t._l(t.ruleList,function(e,a){return i("div",{key:a,staticClass:"flex-base"},[i("span",{staticClass:"f13 flexShrink0"},[t._v("规则:")]),t._v(" "),i("el-select",{staticStyle:{width:"120px"},attrs:{disabled:e.disabled,size:"mini",placeholder:"请选择"},model:{value:e.type,callback:function(i){t.$set(e,"type",i)},expression:"rItem.type"}},t._l(e.phaseList,function(t,e){return i("el-option",{key:e,attrs:{label:t.label,value:t.value}})}),1),t._v(" "),i("span",{staticClass:"lMar14 f13 flexShrink0"},[t._v("满足:")]),t._v(" "),i("div",["time"==e.type?i("addTime",{attrs:{reset:t.resetFlagNew,afferent_obj:e.condition},on:{getVal:function(t){e.condition.min=t.minVal,e.condition.max=t.maxVal}}}):t._e(),t._v(" "),"pay"==e.type?i("screen-pay",{attrs:{reset:t.resetFlagNew,title:"",afferent_obj:e.condition},on:{payChange:function(t){e.condition.payStatus=t.radio,e.condition.payMin=t.minValue,e.condition.payMax=t.maxValue,e.condition.payType=t.custom_radio}}}):t._e(),t._v(" "),"label"==e.type?i("enterprise-tag",{attrs:{resetNew:t.resetFlagNew,title:"",afferent_obj:e.condition},on:{tagDefine:function(t){e.condition=t}}}):t._e()],1),t._v(" "),t.ruleList&&t.ruleList.length>1?i("i",{staticClass:"el-icon-delete",on:{click:function(i){return t.delePhaseEvent(e)}}}):t._e()],1)}),t._v(" "),i("div",{staticClass:"addPhase",on:{click:t.addPhaseEvent}},[i("i",{staticClass:"el-icon-circle-plus "}),t._v(" 添加规则\n ")])],2)])]),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{size:"mini"},on:{click:t.closeEvent}},[t._v("取 消")]),t._v(" "),i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.confirmEvent()}}},[t._v("确 定")])],1)])],1)},staticRenderFns:[]};var g=i("VU/8")(v,f,!1,function(t){i("+Agz")},null,null).exports,b=i("/dO2"),y={name:"phaseConfig",components:{addEditDialog:g},data:function(){return{desCol:[{prop:"stage_title",label:"客户阶段",min_width:180,algin:"center"},{prop:"stage_desc",label:"阶段描述",min_width:180,algin:"center"}],height:"",tableData:[],dialogVisible:!1,total:0,page:1,pages:0,page_size:20,loading:!1,echoObj:{},operate_rule_id:"",front_rule_id:"",behind_rule_id:""}},created:function(){this.height=document.documentElement.clientHeight-280>400?document.documentElement.clientHeight-280:400,this.init()},mounted:function(){this.handleRowDrop()},methods:{fromTypeGetLabel:function(t){var e="";return"time"==t?e="客户添加时间":"pay"==t?e="付费情况":"label"==t&&(e="标签"),e},handleRowDrop:function(){var t=document.querySelector(".el-table__body-wrapper tbody"),e=this;b.a.create(t,{handle:".drag-handler",onEnd:function(t){var i=this,a=t.newIndex,n=t.oldIndex;if(a!=n){e.tableData.splice(a,0,e.tableData.splice(n,1)[0]);var o=e.tableData.slice(0);e.tableData=[],e.$nextTick(l()(s.a.mark(function t(){return s.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.tableData=o,t.next=3,e.getRuleId(a);case 3:return t.next=5,e.sortEvent();case 5:case"end":return t.stop()}},t,i)})))}}})},getRuleId:function(t){this.operate_rule_id=this.tableData[t].rule_id,0==t?(this.front_rule_id="",this.behind_rule_id=this.tableData[t+1].rule_id):t==this.tableData.length-1?(this.front_rule_id=this.tableData[t-1].rule_id,this.behind_rule_id=""):(this.front_rule_id=this.tableData[t-1].rule_id,this.behind_rule_id=this.tableData[t+1].rule_id)},sortEvent:function(){var t=this;this.$axios.post(this.URL.BASEURL+this.URL.phaseSort,{operate_rule_id:this.operate_rule_id,front_rule_id:this.front_rule_id,behind_rule_id:this.behind_rule_id}).then(function(e){e=e.data;t.$message({message:e.err,type:"info"}),"0"!==e.errno&&t.init()})},confirmEvent:function(){var t=this;this.$axios.get(this.URL.BASEURL+this.URL.phaseSetConfirm).then(function(e){(e=e.data)&&0==e.errno?t.init(1):t.$message({message:e.err,type:"warning"})})},addEditEvent:function(t){this.dialogVisible=!0,this.echoObj=t},deleEvent:function(t){var e=this;this.$axios.post(this.URL.BASEURL+this.URL.phaseDel,{rule_id:t}).then(function(t){(t=t.data)&&0==t.errno?e.init(1):4002!=t.errno&&e.$message({message:t.err,type:"warning"})}).catch(function(t){})},handleCurrentChange:function(){},closeEvent:function(t){this.dialogVisible=!1,t&&this.init(1)},init:function(t){var e=this;this.page=t||this.page,this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.phaseList,{params:{page:this.page,page_size:this.page_size}}).then(function(t){t=t.data;e.loading=!1,t&&0==t.errno?(e.tableData=t.rst.data,e.total=t.rst.pageInfo.total,e.pages=t.rst.pageInfo.pages):4002!=t.errno&&e.$message({message:t.err,type:"warning"})}).catch(function(t){e.loading=!1})}}},j={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("div",{staticClass:"screenBox"},[i("div",[i("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.addEditEvent}},[t._v("阶段配置")]),t._v(" "),i("el-button",{attrs:{type:"primary",size:"small",plain:""},on:{click:t.confirmEvent}},[t._v("确认阶段配置")])],1),t._v(" "),i("instructions",{attrs:{doc:"phaseConfig"}})],1),t._v(" "),i("div",{staticClass:"tableBox"},[i("div",{staticClass:"f12 bMar15 pad015 c-00B38A"},[t._v("*上下拖动列表可以调整排序,请确保阶段排序为初级到高级的顺序,规则设置完成后点击【确认阶段配置】后开始同步数据")]),t._v(" "),i("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],ref:"phaseTable",staticStyle:{width:"100%","margin-top":"10px"},attrs:{height:t.height,data:t.tableData,"tooltip-effect":"dark"}},[i("el-table-column",{attrs:{label:"拖拽排序",width:"100",align:"center"},scopedSlots:t._u([{key:"default",fn:function(t){return t.row,[i("div",{staticClass:"drag-handler"},[i("i",{staticClass:"el-icon-rank"})])]}}])}),t._v(" "),t._l(t.desCol,function(e,a){return i("el-table-column",{key:a+"des",attrs:{"min-width":e.min_width?e.min_width:"160",prop:e.prop,label:e.label,"show-overflow-tooltip":"",align:e.algin?e.algin:"left",fixed:"date"==e.prop&&"left"},scopedSlots:t._u([{key:"default",fn:function(a){return["enable"==e.prop?[1==a.row.enable?i("span",{staticClass:"c-448AFF"},[t._v("启用")]):i("span",{staticClass:"c-F03F5C"},[t._v("禁用")])]:i("span",[t._v(t._s(a.row[e.prop]))])]}}],null,!0)})}),t._v(" "),i("el-table-column",{attrs:{label:"阶段规则","min-width":"260",align:"left"},scopedSlots:t._u([{key:"default",fn:function(e){return t._l(JSON.parse(e.row.stage_rule),function(e){return i("div",{staticClass:"bMar10"},[t._v("\n "+t._s(t.fromTypeGetLabel(e.type))+" :\n "),"time"==e.type?i("span",[t._v("\n "+t._s(e.condition.min)+" - "+t._s(e.condition.max)+" 天\n ")]):t._e(),t._v(" "),"pay"==e.type?i("span",["not"==e.condition.payStatus?i("span",[t._v("未付费")]):t._e(),t._v(" "),"has"==e.condition.payStatus?i("span",[t._v("\n "+t._s("number"==e.condition.payType?"充值次数":"充值金额")+" :\n "+t._s(e.condition.payMin)+" - "+t._s(e.condition.payMax)+"\n "+t._s("number"==e.condition.payType?"次":"元")+"\n ")]):t._e()]):t._e(),t._v(" "),"label"==e.type?i("span",[t._v("\n "+t._s(e.condition.tag_name_list)+"\n ")]):t._e()])})}}])}),t._v(" "),i("el-table-column",{attrs:{label:"操作","min-width":"160",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(i){return t.addEditEvent(e.row)}}},[t._v("编辑")]),t._v(" "),i("el-popconfirm",{attrs:{title:"确定删除吗?"},on:{confirm:function(i){return t.deleEvent(e.row.rule_id)}}},[i("el-button",{attrs:{slot:"reference",type:"danger",size:"mini"},slot:"reference"},[t._v("删除")])],1)]}}])})],2),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total>0"}],staticClass:"pagination"},[i("el-pagination",{attrs:{background:"","current-page":t.page,layout:"prev, pager, next","page-count":Number(t.pages)},on:{"current-change":t.handleCurrentChange}})],1)],1),t._v(" "),i("addEditDialog",{attrs:{dialogVisible:t.dialogVisible,echoObj:t.echoObj},on:{close:t.closeEvent}})],1)},staticRenderFns:[]};var x=i("VU/8")(y,j,!1,function(t){i("Gdbv")},"data-v-46ed6b86",null);e.default=x.exports}});