(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-648f00b5"],{"741a":function(t,e,a){"use strict";a.r(e);var l=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox"},[a("el-card",{staticClass:"box-card"},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("div",{staticClass:"container"},[a("el-form",{attrs:{inline:"",size:"small","label-width":"120px"}},[a("el-form-item",{attrs:{label:"标签名称:"}},[a("el-input",{staticClass:"selWidth",attrs:{placeholder:"请输入标签名称"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.getList(1)}},model:{value:t.tableFrom.keyword,callback:function(e){t.$set(t.tableFrom,"keyword",e)},expression:"tableFrom.keyword"}},[a("el-button",{staticClass:"el-button-solt",attrs:{slot:"append",icon:"el-icon-search"},on:{click:function(e){return t.getList(1)}},slot:"append"})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:"标签类型:"}},[a("el-select",{staticClass:"filter-item selWidth mr20",attrs:{placeholder:"请选择",clearable:""},on:{change:function(e){return t.getList(1)}},model:{value:t.tableFrom.type,callback:function(e){t.$set(t.tableFrom,"type",e)},expression:"tableFrom.type"}},t._l(t.labelTypeList,(function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)],1)],1)],1),t._v(" "),a("el-button",{attrs:{size:"small",type:"primary"},on:{click:t.onAdd}},[t._v("设置自动标签")])],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:t.tableData.data,size:"small","highlight-current-row":""}},[a("el-table-column",{attrs:{label:"ID",prop:"label_rule_id","min-width":"60"}}),t._v(" "),a("el-table-column",{attrs:{label:"标签名称",prop:"label.label_name","min-width":"120"}}),t._v(" "),a("el-table-column",{attrs:{label:"标签类型","min-width":"90"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(0===e.row.type?"订单数":"订单金额"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"标签规则","min-width":"180"},scopedSlots:t._u([{key:"default",fn:function(e){return["0.00"===e.row.min&&"0.00"===e.row.max?a("span",[t._v("从未支付的客户")]):a("span",[1===e.row.type?a("span",[t._v("订单金额在"+t._s(e.row.min)+" - "+t._s(e.row.max)+"的客户")]):a("span",[t._v("支付订单数在"+t._s(Math.trunc(e.row.min))+" - "+t._s(Math.trunc(e.row.max))+"的客户")])])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"客户数",prop:"user_num","min-width":"60"}}),t._v(" "),a("el-table-column",{attrs:{label:"更新时间","min-width":"180"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.update_time?e.row.update_time:"未更新"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"100",fixed:"right",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.onUpdate(e.row.label_rule_id)}}},[t._v("更新")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.onEdit(e.row)}}},[t._v("编辑")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleDelete(e.row.label_rule_id,e.$index)}}},[t._v("删除")])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("el-pagination",{attrs:{"page-sizes":[20,40,60,80],"page-size":t.tableFrom.limit,"current-page":t.tableFrom.page,layout:"total, sizes, prev, pager, next, jumper",total:t.tableData.total},on:{"size-change":t.handleSizeChange,"current-change":t.pageChange}})],1)],1),t._v(" "),a("el-dialog",{attrs:{title:t.title,visible:t.dialogVisible,width:"900px"},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("el-form",{directives:[{name:"loading",rawName:"v-loading",value:t.fullscreenLoading,expression:"fullscreenLoading"}],ref:"formValidate",staticClass:"formValidate mt20",attrs:{model:t.formValidate,"label-width":"120px"},nativeOn:{submit:function(t){t.preventDefault()}}},[a("el-form-item",{attrs:{label:"标签类型:"}},[a("el-radio-group",{on:{change:t.initCount},model:{value:t.formValidate.type,callback:function(e){t.$set(t.formValidate,"type",e)},expression:"formValidate.type"}},[a("el-radio",{attrs:{label:0}},[t._v("订单次数标签")]),t._v(" "),a("el-radio",{attrs:{label:1}},[t._v("订单金额标签")])],1)],1),t._v(" "),a("el-form-item",{attrs:{label:"标签名称:"}},[a("el-input",{attrs:{placeholder:"请输入标签名称"},model:{value:t.formValidate.label_name,callback:function(e){t.$set(t.formValidate,"label_name",e)},expression:"formValidate.label_name"}})],1),t._v(" "),1===t.formValidate.type?a("el-form-item",{attrs:{label:"消费金额设置:"}},[a("el-input",{staticClass:"number_input",attrs:{type:"number",min:1},model:{value:t.formValidate.min,callback:function(e){t.$set(t.formValidate,"min",e)},expression:"formValidate.min"}}),t._v("元\n "),a("span",[t._v("-")]),t._v(" "),a("el-input",{staticClass:"number_input",staticStyle:{"margin-left":"10px"},attrs:{type:"number",min:t.formValidate.min},model:{value:t.formValidate.max,callback:function(e){t.$set(t.formValidate,"max",e)},expression:"formValidate.max"}}),t._v("元\n ")],1):a("el-form-item",{attrs:{label:"消费次数设置:"}},[a("el-input",{staticClass:"number_input",attrs:{type:"number",value:Math.trunc(t.formValidate.min),min:1},nativeOn:{keyup:function(e){return t.number(e)}},model:{value:t.formValidate.min,callback:function(e){t.$set(t.formValidate,"min",t._n(e))},expression:"formValidate.min"}}),t._v("次\n "),a("span",[t._v("-")]),t._v(" "),a("el-input",{staticClass:"number_input",staticStyle:{"margin-left":"10px"},attrs:{type:"number",min:t.formValidate.min},nativeOn:{keyup:function(e){return t.number(e)}},model:{value:t.formValidate.max,callback:function(e){t.$set(t.formValidate,"max",t._n(e))},expression:"formValidate.max"}}),t._v("次\n ")],1),t._v(" "),a("el-form-item",{staticStyle:{"margin-top":"30px"}},[a("el-button",{staticClass:"submission",attrs:{type:"primary",size:"small"},on:{click:function(e){return t.handleSubmit("formValidate")}}},[t._v("提交")])],1)],1)],1)],1)},i=[],n=a("c80c"),s=(a("96cf"),a("3b8d")),r=(a("84b4"),a("6b54"),a("a481"),a("c24f")),o={name:"UserGroup",data:function(){return{tableFrom:{page:1,limit:20,type:"",keyword:""},labelTypeList:[{label:"订单次数",value:0},{label:"订单金额",value:1}],tableData:{data:[],total:0},formValidate:{type:0,label_name:"",min:"",max:""},listLoading:!0,dialogVisible:!1,fullscreenLoading:!1,title:"添加标签",label_id:""}},mounted:function(){this.getList("")},methods:{number:function(){this.formValidate.min=this.formValidate.min.toString().replace(/[^\.\d]/g,""),this.formValidate.min=this.formValidate.min.toString().replace(".",""),this.formValidate.max=this.formValidate.max.toString().replace(/[^\.\d]/g,""),this.formValidate.max=this.formValidate.max.toString().replace(".","")},initCount:function(){this.formValidate.min=this.formValidate.max=""},getList:function(t){var e=this;this.listLoading=!0,this.tableFrom.page=t||this.tableFrom.page,Object(r["c"])(this.tableFrom).then((function(t){e.tableData.data=t.data.list,e.tableData.total=t.data.count,console.log(e.tableData),e.listLoading=!1})).catch((function(t){e.listLoading=!1,e.$message.error(t.message)}))},pageChange:function(t){this.tableFrom.page=t,this.getList("")},handleSizeChange:function(t){this.tableFrom.limit=t,this.getList("")},onAdd:function(){this.dialogVisible=!0,this.title="添加标签",this.label_id="",this.formValidate={type:0,label_name:"",min:"",max:""}},onEdit:function(t){this.dialogVisible=!0,this.title="编辑标签",this.label_id=t.label_rule_id,this.formValidate={type:t.type,label_name:t.label&&t.label.label_name?t.label.label_name:"",min:1===t.type?t.min:Math.trunc(t.min),max:1===t.type?t.max:Math.trunc(t.max)}},onUpdate:function(t){var e=this;Object(r["d"])(t).then(function(){var t=Object(s["a"])(Object(n["a"])().mark((function t(a){return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.$message.success(a.message),e.getList("");case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){e.$message.error(t.message)}))},handleDelete:function(t,e){var a=this;this.$modalSure("删除该标签").then((function(){Object(r["b"])(t).then((function(t){var l=t.message;a.$message.success(l),a.tableData.data.splice(e,1)})).catch((function(t){var e=t.message;a.$message.error(e)}))}))},handleSubmit:function(t){var e=this;this.label_id?Object(r["e"])(this.label_id,this.formValidate).then(function(){var t=Object(s["a"])(Object(n["a"])().mark((function t(a){return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.fullscreenLoading=!1,e.$message.success(a.message),e.dialogVisible=!1,e.getList("");case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){e.fullscreenLoading=!1,e.$message.error(t.message)})):Object(r["a"])(this.formValidate).then(function(){var t=Object(s["a"])(Object(n["a"])().mark((function t(a){return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.fullscreenLoading=!1,e.$message.success(a.message),e.dialogVisible=!1,e.getList("");case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){e.fullscreenLoading=!1,e.$message.error(t.message)}))}}},c=o,m=(a("b3bc"),a("2877")),u=Object(m["a"])(c,l,i,!1,null,"66612fbc",null);e["default"]=u.exports},"84b4":function(t,e,a){var l=a("5ca1");l(l.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},a641:function(t,e,a){},b3bc:function(t,e,a){"use strict";a("a641")}}]);