@ -5,38 +5,40 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
function ( angular , $ ) {
'use strict' ;
var mailTemplate = {
let mailTemplate = {
"1" : "代购、综合商城类" ,
"2" : "飞机票、旅行社类" ,
"3" : "教育类、中介类"
"3" : "教育类、中介类" ,
"4" : "Chargeback"
} ;
var orderTypesMap = {
let orderTypesMap = {
"1" : "微信调单" ,
"2" : "支付宝调单" ,
"3" : "RoyalPay调单" ,
"4" : "警告" ,
"5" : "通用号调单"
"5" : "通用号调单" ,
"6" : "卡支付ChargeBack"
} ;
var orderTypesMapForBD = {
let orderTypesMapForBD = {
"1" : "微信调单" ,
"2" : "支付宝调单" ,
"3" : "RoyalPay调单"
} ;
var royalpayOrderTypesMap = {
let royalpayOrderTypesMap = {
"0" : "正常调单" ,
"1" : "单纯大金额频繁刷单"
} ;
var warningOrderTypesMap = {
let warningOrderTypesMap = {
"0" : "单人多次大金额交易" ,
"1" : "退款频繁"
} ;
var resultTypesMap = {
let resultTypesMap = {
"0" : "未处理" ,
"1" : "已发送邮件" ,
"2" : "已提交材料,等待审核" ,
@ -45,7 +47,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"5" : "已处理"
} ;
var resultTypeSearchMap = {
let resultTypeSearchMap = {
"0" : "未处理" ,
"1" : "资料完善中" ,
"2" : "等待风控" ,
@ -54,7 +56,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"5" : "已处理"
} ;
var resultTypeSearchMapForBD = {
let resultTypeSearchMapForBD = {
"1" : "材料待上传" ,
"2" : "材料已提交" ,
"3" : "风控初审完成,渠道方审核中" ,
@ -62,14 +64,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"5" : "已处理"
} ;
var emailStatusMap = {
let emailStatusMap = {
"0" : "未发送" ,
"1" : "已发送" ,
"2" : "打回并已发送" ,
"3" : "已发送催促邮件"
} ;
var amountSectionMap = {
let amountSectionMap = {
"0-500" : "0-500" ,
"500-1000" : "500-1000" ,
"1000-1500" : "1000-1500" ,
@ -81,7 +83,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"4000-4500" : "4000-4500"
} ;
var channelResultArray = [
let channelResultArray = [
"关闭支付" ,
"恢复支付" ,
"单日10" ,
@ -95,7 +97,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"其他"
] ;
var app = angular . module ( 'riskBusinessApp' , [ 'ui.router' ] ) ;
let app = angular . module ( 'riskBusinessApp' , [ 'ui.router' ] ) ;
app . config ( [ '$stateProvider' , function ( $stateProvider ) {
$stateProvider . state ( 'analysis_monitoring.risk_business' , {
url : '/risk_business' ,
@ -148,7 +150,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . amountSection = amountSectionMap ;
$scope . pagination = { } ;
$scope . params = { } ;
var industries = new Array ( ) ;
let industries = [ ] ;
angular . forEach ( $scope . industries , function ( industry ) {
industries . push ( industry . label ) ;
} ) ;
@ -160,14 +162,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// console.log(industries);
// 加载风险注册事件
$scope . loadRiskEvents = function ( page ) {
var params = angular . copy ( $scope . params ) ;
let params = angular . copy ( $scope . params ) ;
params . page = page || $scope . pagination . page || 1 ;
params . replyEmailDateBegin = $filter ( 'date' ) ( params . replyEmailDateBegin , 'yyyy-MM-dd' ) ;
params . replyEmailDateEnd = $filter ( 'date' ) ( params . replyEmailDateEnd , 'yyyy-MM-dd' ) ;
params . receiveEmailDateBegin = $filter ( 'date' ) ( params . receiveEmailDateBegin , 'yyyy-MM-dd' ) ;
params . receiveEmailDateEnd = $filter ( 'date' ) ( params . receiveEmailDateEnd , 'yyyy-MM-dd' ) ;
if ( params . section != null ) {
var sectionArray = params . section . split ( '-' ) ;
let sectionArray = params . section . split ( '-' ) ;
params . startAmount = sectionArray [ 0 ] ;
params . endAmount = sectionArray [ 1 ] ;
}
@ -186,7 +188,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ;
var industryAmount = function ( industries ) {
let industryAmount = function ( industries ) {
return {
chart : {
tooltip : {
@ -229,7 +231,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}
} ;
var intervalsAmount = function ( ) {
let intervalsAmount = function ( ) {
return {
chart : {
tooltip : {
@ -286,7 +288,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . mailTemplate = mailTemplate ;
$scope . resultTypes = resultTypesMap ;
$scope . channelResults = channelResultArray ;
if ( riskEvent . data . is _send _client == 1 )
if ( riskEvent . data . is _send _client == = 1 )
riskEvent . data . is _send _client = true ;
$scope . riskEvent = riskEvent . data ;
@ -299,7 +301,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ;
$scope . checkTemplate = function ( ) {
var url = "" ;
let url = "" ;
switch ( $scope . riskEvent . mail _template ) {
case "1" :
url = "https://file.royalpay.com.au/open/2019/03/27/1553658222567_BzfAtsEgsBdMQLl3jGOAlfcYmFUL1F.png" ;
@ -323,13 +325,13 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图
$scope . riskEventEdit = angular . copy ( riskEvent . data ) ;
// var index = $scope.riskEvent.order_ids.lastIndexOf(",");
// let index = $scope.riskEvent.order_ids.lastIndexOf(",");
//$scope.riskEvent.order_ids = $scope.riskEvent.order_ids.substring(0, index) + ", " + $scope.riskEvent.order_ids.substring(index + 1);
// 获取数据库中对应的渠道字段
var orderChannel = 'enable_' ;
if ( $scope . riskEvent . order _type == 1 ) {
let orderChannel = 'enable_' ;
if ( $scope . riskEvent . order _type == = 1 ) {
orderChannel += 'wechat' ;
} else if ( $scope . riskEvent . order _type == 2 ) {
} else if ( $scope . riskEvent . order _type == = 2 ) {
orderChannel += 'alipay' ;
} else {
orderChannel = null ;
@ -342,7 +344,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ) . then ( function ( ) {
$http . delete ( '/risk/business/ban/' + $scope . riskEvent . risk _id ) . then ( function ( ) {
$state . go ( 'analysis_monitoring.risk_business' ) ;
commonDialog . alert ( { title : 'Delete' , content : 'Risk Event Already Disabled' , type : 'error' } ) ;
commonDialog . alert ( {
title : 'Delete' ,
content : 'Risk Event Already Disabled' ,
type : 'error'
} ) ;
} , function ( resp ) {
commonDialog . alert ( { title : 'Error' , content : resp . data . message , type : 'error' } ) ;
} )
@ -350,10 +356,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ;
$scope . commitWaitRiskStatus = function ( ) {
var index = $scope . riskEvent . submit _url . lastIndexOf ( '=' ) ;
let index = $scope . riskEvent . submit _url . lastIndexOf ( '=' ) ;
if ( index < 0 )
index = $scope . riskEvent . submit _url . lastIndexOf ( '/' ) ;
var codeKey = $scope . riskEvent . submit _url . substring ( index + 1 ) ;
let codeKey = $scope . riskEvent . submit _url . substring ( index + 1 ) ;
commonDialog . confirm ( {
title : '确认已提交资料' ,
content : '确认已收到商户资料,更新风控状态为等待风控审核?'
@ -368,6 +374,18 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} )
} ;
$scope . commitChargebackStatus = function ( std ) {
commonDialog . confirm ( { title : '确认操作' , content : '当前操作不可逆,并会将风控项标记为办结状态,确认操作?' } ) . then ( function ( ) {
$http . put ( '/risk/business/chargebacks/' + $scope . riskEvent . risk _id + '/status' , { status : std } ) . then ( function ( ) {
$state . reload ( ) ;
commonDialog . alert ( { title : 'Success' , content : '修改成功' , type : success } )
} , function ( res ) {
commonDialog . alert ( { title : 'Error' , content : resp . data . message , type : 'error' } )
} )
} )
}
/ * *
* order _ids在指定位置换行
* @ param str
@ -375,15 +393,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
* @ returns { * }
* /
$scope . splitStr = function ( str , position ) {
if ( str == null || str == '' )
if ( str == null || str == = '' )
return ;
var strArr = str . split ( "," ) ;
var resultStr = '' ;
for ( var i = 0 ; i < strArr . length ; i ++ ) {
let strArr = str . split ( "," ) ;
let resultStr = '' ;
for ( let i = 0 ; i < strArr . length ; i ++ ) {
resultStr += strArr [ i ] ;
if ( i == ( strArr . length - 1 ) )
if ( i == = ( strArr . length - 1 ) )
break ;
if ( ( i + 1 ) % position == 0 )
if ( ( i + 1 ) % position == = 0 )
resultStr += ", " ;
else
resultStr += "," ;
@ -454,10 +472,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
* @ param temporaryFlag 是否临时关停
* /
$scope . updateChannel = function ( orderType , channelFlag , temporaryFlag ) {
var channel ;
if ( orderType == "1" )
let channel ;
if ( orderType == = "1" )
channel = 'wechat' ;
else if ( orderType == "2" )
else if ( orderType == = "2" )
channel = 'alipay' ;
$scope . riskEvent . temporary _close _channel = temporaryFlag ;
commonDialog . confirm ( {
@ -497,8 +515,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
title : 'Warning' ,
content : 'Please confirm sending mail.'
} ) . then ( function ( ) {
var url = '/risk/business/' + $scope . riskEvent . risk _id + '/upload_mail' ;
if ( $scope . riskEvent . result _type == 1 )
let url = '/risk/business/' + $scope . riskEvent . risk _id + '/upload_mail' ;
if ( $scope . riskEvent . result _type == = 1 )
url = '/risk/business/' + $scope . riskEvent . risk _id + '/urge' ;
$http . put ( url ) . then ( function ( ) {
$state . reload ( ) ;
@ -517,11 +535,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . material = { } ;
$scope . uploadFile = function ( files , index ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
let urls = [ ] ;
let value = 0 ;
$scope . allMaterialInfo . material [ index ] . fileProgressValue = 0 ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
for ( let i = 0 ; i < files . length ; i ++ ) {
let file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
@ -540,11 +558,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ;
$scope . submit = function ( form ) {
var codeKey = $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '=' ) + 1 ) || $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '/' ) + 1 ) ;
let codeKey = $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '=' ) + 1 ) || $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '/' ) + 1 ) ;
$scope . material . update _time = $filter ( 'date' ) ( new Date ( ) , 'yyyy-MM-dd HH:mm:ss' ) ;
$scope . material . risk _id = $scope . riskEvent . risk _id ;
for ( var i = 0 ; i < $scope . allMaterialInfo . material . length ; i ++ ) {
var key = 'file' + ( i + 1 ) + "_url" ;
for ( let i = 0 ; i < $scope . allMaterialInfo . material . length ; i ++ ) {
let key = 'file' + ( i + 1 ) + "_url" ;
$scope . material [ key ] = $scope . allMaterialInfo . material [ i ] . uploadFile ;
}
$scope . material . description = $scope . allMaterialInfo . description ;
@ -579,7 +597,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ;
// BD是否可上传
$scope . uploadShowFlag = ( $scope . riskEvent . result _type == 1 || $scope . riskEvent . result _type == 3 || $scope . riskEvent . result _type == 4 ) ? true : false ;
$scope . uploadShowFlag = ( $scope . riskEvent . result _type == = 1 || $scope . riskEvent . result _type = == 3 || $scope . riskEvent . result _type == = 4 ) ;
//if (!$scope.uploadShowFlag)
$scope . loadRiskMaterial ( ) ;
}
@ -605,8 +623,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// $scope.file5 = resp.data.file5;
// $scope.file6 = resp.data.file6;
//
// // for ( var i = 1; i <= 10; i++) {
// // var key = "file" + i;
// // for ( let i = 1; i <= 10; i++) {
// // let key = "file" + i;
// // if (riskMaterial[key + '_url'] != null)
// // $scope.fileObject[key] = riskMaterial[key + '_url'];
// // }
@ -620,16 +638,16 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . loadRiskMaterial ( ) ;
//审核通过也要可以传图片
$scope . uploadShowFlag = ( $scope . riskEvent . result _type == 1 || $scope . riskEvent . result _type == 3 || $scope . riskEvent . result _type == 4 ) ? true : false ;
$scope . uploadShowFlag = ( $scope . riskEvent . result _type == = 1 || $scope . riskEvent . result _type = == 3 || $scope . riskEvent . result _type == = 4 ) ;
// 材料上传
$scope . uploadFile = function ( files , index ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
let urls = [ ] ;
let value = 0 ;
$scope . riskMaterial . material [ index ] . fileProgressValue = 0 ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
for ( let i = 0 ; i < files . length ; i ++ ) {
let file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
@ -649,14 +667,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ;
$scope . submit = function ( form ) {
var index = $scope . riskEvent . submit _url . lastIndexOf ( '=' ) ;
let index = $scope . riskEvent . submit _url . lastIndexOf ( '=' ) ;
if ( index < 0 )
index = $scope . riskEvent . submit _url . lastIndexOf ( '/' ) ;
var codeKey = $scope . riskEvent . submit _url . substring ( index + 1 ) ;
let codeKey = $scope . riskEvent . submit _url . substring ( index + 1 ) ;
$scope . material . update _time = $filter ( 'date' ) ( new Date ( ) , 'yyyy-MM-dd HH:mm:ss' ) ;
$scope . material . risk _id = $scope . riskEvent . risk _id ;
for ( var i = 0 ; i < $scope . riskMaterial . material . length ; i ++ ) {
var key = 'file' + ( i + 1 ) + "_url" ;
for ( let i = 0 ; i < $scope . riskMaterial . material . length ; i ++ ) {
let key = 'file' + ( i + 1 ) + "_url" ;
$scope . material [ key ] = $scope . riskMaterial . material [ i ] . file ;
}
$scope . material . description = $scope . riskMaterial . description ;
@ -679,9 +697,9 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 材料审核
$scope . auditMaterial = function ( auditType ) {
var url = '/risk/business/events/pass' ;
var warningMessageHTML = '是否确定<span style="color: green; font-weight: bolder; font-size: 20px;">通过</span>该材料?' ;
if ( auditType == 3 ) {
let url = '/risk/business/events/pass' ;
let warningMessageHTML = '是否确定<span style="color: green; font-weight: bolder; font-size: 20px;">通过</span>该材料?' ;
if ( auditType == = 3 ) {
commonDialog . confirm ( {
title : 'Warning' ,
contentHtml : $sce . trustAsHtml ( warningMessageHTML )
@ -698,8 +716,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ) ;
} ) ;
} ) ;
}
else if ( auditType == 4 ) {
} else if ( auditType === 4 ) {
url = '/risk/business/' + $scope . riskEvent . risk _id + '/refuse' ;
//warningMessageHTML = '是否确定<span style="color: red; font-weight: bolder; font-size: 20px;">拒绝</span>该材料?'
commonDialog . inputText ( { title : 'Input Refuse Description' , size : 'lg' } ) . then ( function ( text ) {
@ -732,8 +749,21 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . materials = [ { key : 0 , value : "" } ] ;
$scope . canMinus = false ;
$scope . riskEvent = { } ;
$scope . searchForChargeback = function ( ) {
$scope . riskEvent . order _ids = null ;
let channelOrderId = $scope . riskEvent . channel _order _id ;
$http . get ( '/risk/business/chargeback_orders' , { channel _order _id : channelOrderId } ) . then ( function ( res ) {
$scope . channel _orders = res . data ;
} , function ( res ) {
commonDialog . alert ( { type : 'error' , title : 'Error' , content : res . data . message } )
} ) ;
} ;
$scope . chooseOrderForChargeback = function ( chargebackOrder ) {
$scope . riskEvent . order _ids = chargebackOrder . channel _order _id ;
$scope . riskEvent . client _moniker = chargebackOrder . client _moniker ;
}
$scope . checkTemplate = function ( ) {
var url = "" ;
let url = "" ;
switch ( $scope . riskEvent . mail _template ) {
case "1" :
url = "https://file.royalpay.com.au/open/2019/03/27/1553658222567_BzfAtsEgsBdMQLl3jGOAlfcYmFUL1F.png" ;
@ -763,23 +793,23 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . materials . splice ( $index , 1 ) ;
}
// 如果回复数为1, 不允许删除
if ( $scope . materials . length == 1 ) {
if ( $scope . materials . length == = 1 ) {
$scope . canMinus = false ;
}
} ;
var array = new Array ( ) ;
var validIndex = 0 ;
let array = [ ] ;
let validIndex = 0 ;
$scope . combineMaterials = function ( ) {
for ( var i = 0 ; i < $scope . materials . length ; i ++ ) {
var value = $scope . materials [ i ] . value ;
if ( value == '' )
for ( let i = 0 ; i < $scope . materials . length ; i ++ ) {
let value = $scope . materials [ i ] . value ;
if ( value == = '' )
continue ;
var cr = { } ;
let cr = { } ;
cr [ 'question' + ( validIndex + 1 ) ] = $scope . materials [ i ] . value ;
array [ validIndex ] = cr ;
validIndex ++ ;
}
if ( array . length == 0 )
if ( array . length == = 0 )
return null ;
return JSON . stringify ( array ) ;
} ;
@ -803,7 +833,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
if ( $scope . riskEvent . receive _email _date == null )
$scope . riskEvent . receive _email _date = new Date ( ) ;
// 默认设置邮件回复截止日期为收到邮件的七天后,如果是内部调单,设置三天后
var replyDeadline = angular . copy ( $scope . riskEvent . receive _email _date ) ;
let replyDeadline = angular . copy ( $scope . riskEvent . receive _email _date ) ;
if ( $scope . riskEvent . order _type > 2 )
replyDeadline . setDate ( replyDeadline . getDate ( ) + 3 ) ;
else
@ -818,8 +848,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . riskEvent . send _clean _days = $scope . send _clean _days ;
var saveRiskBtn = document . getElementById ( 'save-risk-btn' ) ;
var saveRiskBtnInnerHtmlBak = saveRiskBtn . innerHTML ;
let saveRiskBtn = document . getElementById ( 'save-risk-btn' ) ;
let saveRiskBtnInnerHtmlBak = saveRiskBtn . innerHTML ;
saveRiskBtn . disabled = true ;
saveRiskBtn . innerHTML = "<i class='fa fa-spinner fa-spin '></i> Processing" ;
$http . post ( '/risk/business/events' , $scope . riskEvent ) . then ( function ( resp ) {
@ -848,10 +878,9 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . partners = resp . data ;
if ( $scope . partners != null && $scope . partners . length > 0 ) {
// 由于通用号调单可能无法提供商户client_moniker,所以后台无法查询到订单
if ( $scope . partners . length == 1 || $scope . riskEvent . order _type ! = 5 )
if ( $scope . partners . length == = 1 || $scope . riskEvent . order _type ! = = 5 )
$scope . riskEvent . client _moniker = $scope . partners [ 0 ] . client _moniker ;
}
else {
} else {
commonDialog . confirm ( {
title : 'Warning' ,
content : '该微信子商户号下暂时没有商户或者商户被禁用,是否继续?'
@ -863,7 +892,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope . riskEvent . sub _merchant _id = '' ;
} ) ;
}
if ( $scope . partners != null && $scope . partners . length > 1 && $scope . riskEvent . order _type != 5 )
if ( $scope . partners != null && $scope . partners . length > 1 && $scope . riskEvent . order _type != = 5 )
commonDialog . confirm ( {
title : 'Warning' ,
content : '该微信子商户号下有多个商户,是否将调单类型改为通用号调单?'