diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index 258a62429..699123f32 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -117,6 +117,48 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot } } }; + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + + $scope.toggleClientPayType = function (type) { + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + var removeClientPayDesc = function (items, key) { + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (item.indexOf(key)>=0) { + items.splice(items.indexOf(item), 1); + i = i - 1; + } + } + }; + + $scope.toggleClientPayDesc = function (type) { + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc,'2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; $scope.uploadStorePhoto = function (file) { if (file != null) { @@ -165,6 +207,34 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot } var content = ''; + if ($scope.partner.client_pay_type.length==0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length==0) { + alert('请选择商户支付方式') + return; + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ( $scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); $http.put('/client/partner_info/update/partnerInfo', $scope.partner).then(function () { if (content != '') { commonDialog.alert({ @@ -303,6 +373,49 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot } }; + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + + $scope.toggleClientPayType = function (type) { + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + var removeClientPayDesc = function (items, key) { + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (item.indexOf(key)>=0) { + items.splice(items.indexOf(item), 1); + i = i - 1; + } + } + }; + + $scope.toggleClientPayDesc = function (type) { + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc,'2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; + $scope.updatePartner = function (form) { if (form.$invalid) { angular.forEach(form, function (item, key) { @@ -328,6 +441,34 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot } var content = ''; + if ($scope.partner.client_pay_type.length==0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length==0) { + alert('请选择商户支付方式') + return; + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ( $scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); $http.put('/client/partner_info/update/partnerInfo', $scope.partner).then(function () { if (content != '') { commonDialog.alert({ diff --git a/src/main/ui/static/payment/partner/templates/client_partner_detail.html b/src/main/ui/static/payment/partner/templates/client_partner_detail.html index 6ebd7bb0e..e185467ba 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_detail.html @@ -1,3 +1,13 @@ + +