huangb 7 years ago
parent
commit
4665972f1f

+ 7 - 5
src/main/webapp/resources/js/admin/controllers/checkMoney/exchangeRate.js

@@ -3,17 +3,19 @@ define(['app/app'], function(app) {
 	app.register.controller('exchangeRateCtrl', ['$scope', 'exchangeRateService', 'toaster', function($scope, exchangeRateService, toaster) {
 		$scope.edit = false;
 		exchangeRateService.getUSD(null, function(date) {
-			$scope.usdExchangeRate = date;
+			$scope.usdExchangeRate = date.data;
 		}, function(response) {
 			toaster.pop('error', '获取信息失败:' + response.data);
 		});
 		
 		$scope.save = function() {
-			$scope.usdExchangeRate.fromCurrency = 'USD';
-			$scope.usdExchangeRate.toCurrency = 'CNY';
-			$scope.usdExchangeRate.type = 'USD';
+			if ($scope.usdExchangeRate.fromCurrency == null || $scope.usdExchangeRate.fromCurrency == '') {
+                $scope.usdExchangeRate.fromCurrency = 'USD';
+                $scope.usdExchangeRate.toCurrency = 'CNY';
+                $scope.usdExchangeRate.type = 'USD';
+			}
 			exchangeRateService.save(null, $scope.usdExchangeRate, function(data) {
-				$scope.usdExchangeRate = data;
+				$scope.usdExchangeRate = data.data;
 				$scope.edit = false;
 				toaster.pop('success', '保存成功');
 			}, function(response) {