"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[82092],{82092:function(e,t,r){r.r(t),r.d(t,{default:function(){return u}});var l=function(){var e=this,t=e._self._c;return t("div",[t("div",{staticStyle:{backgroud:"white"}},[t("el-table",{staticStyle:{width:"100%"},attrs:{"row-key":"id",data:e.resources}},[t("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"desc",label:"规则名称"}}),t("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"ruleContent",label:"规则内容"},scopedSlots:e._u([{key:"default",fn:function(r){return[t("el-form",[r.row.show?e._e():t("el-form-item",{attrs:{prop:"resources."+r.$index+".ruleContent"}},[r.row.frontFlag?t("el-col",{staticClass:"line"},[e._v(e._s(r.row.front))]):e._e(),r.row.inputFlag1?t("el-col",{staticStyle:{position:"relative",top:"50%",left:"40%"},attrs:{span:8}},[t("el-input",{attrs:{clearable:""},model:{value:r.row.input1,callback:function(t){e.$set(r.row,"input1",t)},expression:"scope.row.input1"}})],1):e._e(),r.row.middleFlag?t("el-col",{staticClass:"line"},[e._v(e._s(r.row.middle))]):e._e(),r.row.inputFlag2?t("el-col",{staticStyle:{position:"relative",top:"50%",left:"40%"},attrs:{span:8}},[t("el-input",{attrs:{clearable:""},model:{value:r.row.input2,callback:function(t){e.$set(r.row,"input2",t)},expression:"scope.row.input2"}})],1):e._e(),r.row.rearFlag?t("el-col",{staticClass:"line"},[e._v(e._s(r.row.rear))]):e._e()],1),r.row.show?t("div",[e._v(e._s(r.row.ruleContent))]):e._e()],1)]}}])}),t("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"riskScore",label:"风险分值"}}),t("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"actions",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(r){return[r.row.show&&0===r.row.status?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.changeFlag(r.row.id,1)}}},[e._v("启用")]):e._e(),r.row.show&&1===r.row.status?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.changeFlag(r.row.id,0)}}},[e._v("停用")]):e._e(),r.row.show?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.editRule(r.$index,r.row.id)}}},[e._v("编辑")]):e._e(),r.row.show?e._e():t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.saveRule(r.row)}}},[e._v("保存")])]}}])})],1)],1)])},s=[],n=(r(44114),r(98992),r(3949),{data(){return{records:[{id:1,desc:"首单金额限制",ruleContentTemplate:"金额>=%P%欧",riskScore:"6分",status:0,show:!0,frontFlag:!0,front:"金额>=",inputFlag1:!0,input1:"",middleFlag:!1,middle:"",inputFlag2:!1,input2:"",rearFlag:!0,rear:"欧"},{id:2,desc:"单笔限购",ruleContentTemplate:"单笔订单商品购买数量>=%P%件",riskScore:"5分",status:0,show:!0,frontFlag:!0,front:"单笔订单商品购买数量>=",inputFlag1:!0,input1:"",middleFlag:!1,middle:"",inputFlag2:!1,input2:"",rearFlag:!0,rear:"件"},{id:3,desc:"高频交易",ruleContentTemplate:"%P%小时内支付成功的订单笔数>%P%笔",riskScore:"7分",status:0,show:!0,frontFlag:!1,front:"",inputFlag1:!0,input1:"",middleFlag:!0,middle:"小时内支付成功的订单笔数>",inputFlag2:!0,input2:"",rearFlag:!0,rear:"笔"},{id:4,desc:"用户注册时长",ruleContentTemplate:"注册时间<=%P%小时",riskScore:"2分",status:0,show:!0,frontFlag:!0,front:"注册时间<=",inputFlag1:!0,input1:"",middleFlag:!1,middle:"",inputFlag2:!1,input2:"",rearFlag:!0,rear:"小时"},{id:5,desc:"高风险地区",ruleContentTemplate:"收货地址命中Zipcode黑名单",riskScore:"4分",status:0,show:!0,frontFlag:!0,front:"收货地址命中Zipcode黑名单",inputFlag1:!1,input1:"",middleFlag:!1,middle:"",inputFlag2:!1,input2:"",rearFlag:!1,rear:""}],queryResult:[],resources:[]}},mounted(){this.onSearch()},methods:{onSearch(){this.queryRiskRules()},editRule(e,t){if(this.resources[e].value&&(this.resources[e].show=!1,this.resources[e].value)){const t=this.resources[e].value.split(",");Array.isArray(t)&&t.length>1?(this.resources[e].input1=t[0],this.resources[e].input2=t[1]):this.resources[e].input1=t[0]}},async saveRule(e){""===e.input2?e.values=e.input1:e.values=e.input1+","+e.input2;const t={id:e.id,value:e.values};await this.$store.dispatch({type:"riskControlCenter/editRiskRule",payload:t}),this.queryRiskRules()},async queryRiskRules(){this.resources=[];const e={},t=await this.$store.dispatch({type:"riskControlCenter/queryRiskRule",payload:e});if(t){this.queryResult=t;const e={};this.queryResult.forEach((t=>{const r=t.id;e[r]=t}));const r=[];this.records.forEach((t=>{const l=e[t.id],s=t.ruleContentTemplate;if(t.value=l.value,l.value){const e=l.value.split(",");e.forEach((e=>{t.ruleContentTemplate=t.ruleContentTemplate.replace("%P%",e)}))}t.ruleContent=t.ruleContentTemplate,t.ruleContentTemplate=s,t.status=l.status,t.show=!0,r.push(t)})),this.resources=r}},async changeFlag(e,t){const r={id:e,status:t};await this.$store.dispatch({type:"riskControlCenter/editRiskRule",payload:r}),this.queryRiskRules()}}}),a=n,o=r(81656),i=(0,o.A)(a,l,s,!1,null,null,null),u=i.exports}}]);