diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js index fea7a0443..a882aa33e 100644 --- a/src/main/ui/static/payment/merchantid/merchant_id_manager.js +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -23,20 +23,20 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS // 前端渲染的end索引 $scope.endIndexMap = {}; - // 初始化索引是60 - const initEndIndex = 60; + // 初始化索引是30 + $scope.initEndIndex = 30; $scope.loadClient = function () { $http.get('/sys/merchant_id').then(function (resp) { $scope.clientsMap = resp.data; $scope.client_loading = false; // 加入对应项的end索引值 - // 如果数据小于60,索引值为数据长度 - // 否则设置为60 + // 如果数据小于initEndIndex,索引值为数据长度 + // 否则设置为initEndIndex for (var key in $scope.clientsMap) { - $scope.endIndexMap[key] = initEndIndex; + $scope.endIndexMap[key] = $scope.initEndIndex; var length = $scope.clientsMap[key].length; - if (length <= initEndIndex) + if (length <= $scope.initEndIndex) $scope.endIndexMap[key] = length; } @@ -46,12 +46,12 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS /** * 点击更多加载 - * 判断加60后的索引是否超出数组长度 + * 判断加initEndIndex后的索引是否超出数组长度 * @param key */ $scope.more = function(key) { - var endIndex = $scope.endIndexMap[key] + initEndIndex; + var endIndex = $scope.endIndexMap[key] + $scope.initEndIndex; $scope.endIndexMap[key] = endIndex; if (endIndex > $scope.clientsMap[key].length) { @@ -65,9 +65,9 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS * @param key */ $scope.packup = function(key) { - $scope.endIndexMap[key] = initEndIndex; + $scope.endIndexMap[key] = $scope.initEndIndex; var length = $scope.clientsMap[key].length; - if (length <= initEndIndex) + if (length <= $scope.initEndIndex) $scope.endIndexMap[key] = length; }; @@ -87,12 +87,27 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.params = {}; $scope.isCollapsed = true; + // 前端渲染的end索引 + $scope.endIndexMap = {}; + // 初始化索引是30 + $scope.initEndIndex = 30; + $scope.loadNotTradeClient = function () { $scope.disable_button = true; $http.get('/sys/merchant_id/trade').then(function (resp) { $scope.notTradeClientsMap = resp.data.merchant_id_map; $scope.refresh_time = resp.data.refresh_time; $scope.disable_button = false; + + // 加入对应项的end索引值 + // 如果数据小于initEndIndex,索引值为数据长度 + // 否则设置为initEndIndex + for (var key in $scope.notTradeClientsMap) { + $scope.endIndexMap[key] = $scope.initEndIndex; + var length = $scope.notTradeClientsMap[key].length; + if (length <= $scope.initEndIndex) + $scope.endIndexMap[key] = length; + } }); }; $scope.loadNotTradeClient(); @@ -116,6 +131,35 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS size: 'sm' }) }; + + /** + * 点击更多加载 + * 判断加initEndIndex后的索引是否超出数组长度 + * @param key + */ + $scope.more = function(key) { + + var endIndex = $scope.endIndexMap[key] + $scope.initEndIndex; + $scope.endIndexMap[key] = endIndex; + + if (endIndex > $scope.notTradeClientsMap[key].length) { + $scope.endIndexMap[key] = $scope.notTradeClientsMap[key].length; + } + + }; + + /** + * 收起 + * @param key + */ + $scope.packup = function(key) { + + $scope.endIndexMap[key] = $scope.initEndIndex; + + var length = $scope.notTradeClientsMap[key].length; + if (length <= $scope.initEndIndex) + $scope.endIndexMap[key] = length; + }; }]); app.controller('showClientsCtrl', ['$scope', '$http','qrJson', function ($scope, $http,qrJson) { $scope.qrJson = qrJson.data; diff --git a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html index 608e5bc56..8fb25455d 100644 --- a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html +++ b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html @@ -156,7 +156,7 @@ --> - + ng-if="endIndexMap[key] > initEndIndex"> 收起 diff --git a/src/main/ui/static/payment/merchantid/templates/no_trade_sub_merchant_id.html b/src/main/ui/static/payment/merchantid/templates/no_trade_sub_merchant_id.html index ed0bcf80d..925e83c5c 100644 --- a/src/main/ui/static/payment/merchantid/templates/no_trade_sub_merchant_id.html +++ b/src/main/ui/static/payment/merchantid/templates/no_trade_sub_merchant_id.html @@ -15,26 +15,55 @@
+ ng-repeat="(key, clients) in notTradeClientsMap"> + - {{client.sub_merchant_id}}  - + ng-repeat="client in clients.slice(0, endIndexMap[key]) | orderBy:'client_count':true" + ng-click="showClient(client.sub_merchant_id)"> + {{client.sub_merchant_id}}  + + + + - - {{client.sub_merchant_id}}  - + ng-click="showClient(client.sub_merchant_id)" + ng-if="$index>59"> + {{client.sub_merchant_id}}  + + + + + + --> + + + 更多 + + + 收起 +