Sfoglia il codice sorgente

修复配送规则页面的bug问题

hulh 8 anni fa
parent
commit
92a9dd6065

+ 15 - 27
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_ctrl.js

@@ -108,20 +108,19 @@ define([ 'app/app' ], function(app) {
                 };
                 Enterprise.getCurrencyByRegisterAddress({}, {} ,function (data) {
                     if (data){
-                        $scope.modifyRule.currencyName = data.data;
+                        /**
+                         * 目前存在没有注册地址的公司,暂时设为RMB
+                         */
+                        $scope.modifyRule.currencyName = data.data ? data.data : 'RMB';
                     }
                 }, function (error) {
                     toaster.pop('error', "获取企业币别信息失败");
                 });
 
-                /**
-                 * 目前存在没有注册地址的公司,暂时设为RMB
-                 */
-                if (!$scope.modifyRule.currencyName){
-                    $scope.modifyRule.currencyName = 'RMB';
-                }
                 $scope.currencySymbol = $scope.modifyRule.currencyName == "RMB" ? "¥" : "$";
 
+                console.log($scope.currencySymbol);
+
                 DistributionRule.findCountOfRule({}, {}, function (data) {
                     if (data){
                         var num = data.data;
@@ -155,12 +154,12 @@ define([ 'app/app' ], function(app) {
 
         $scope.inputNum = function (data) {
             if(isNaN(data.num)){
-                data.num = 1;
+                data.num = null;
                 toaster.pop('warning', '提示', '请输入大于0的整数');
                 return false;
             }
-            if(Number(data.num) < 0 || Number(data.num) % 1 != 0) {
-                data.num = 1;
+            if(Number(data.num) < 1 || Number(data.num) % 1 != 0) {
+                data.num = null;
                 toaster.pop('warning', '提示', '请输入大于0的整数');
                 return false;
             }
@@ -356,22 +355,7 @@ define([ 'app/app' ], function(app) {
                 return false;
             }
             if ($scope.mapArray.length > 0){
-                var resultArray = angular.copy($scope.mapArray);
-                angular.forEach($scope.mapArray, function (item, index) {
-                    if (item.mainland && !item.province){
-                        resultArray.splice(index, 1);
-                        angular.forEach($scope.tree.$data, function (v) {
-                            if (v.label == item.mainland){
-                                angular.forEach(v.items, function (p) {
-                                    var object = {
-                                        province : p.label
-                                    };
-                                    resultArray.push(object);
-                                })
-                            }
-                        });
-                    }
-                });
+                var resultArray = convertArray($scope.mapArray);
                 $scope.modifyRule.qtyArea = angular.toJson(resultArray);
             }else {
                 toaster.pop('error', "您还没有选择任何地区");
@@ -475,9 +459,10 @@ define([ 'app/app' ], function(app) {
 
         var convertArray = function (array) {
             var resultArray = angular.copy(array);
+            var indexArray = [];
             angular.forEach(array, function (item, index) {
                 if (item.mainland && !item.province){
-                    resultArray.splice(index, 1);
+                    indexArray.push(index);
                     angular.forEach($scope.tree.$data, function (v) {
                         if (v.label == item.mainland){
                             angular.forEach(v.items, function (p) {
@@ -490,6 +475,9 @@ define([ 'app/app' ], function(app) {
                     });
                 }
             });
+            angular.forEach(indexArray, function (index) {
+                resultArray.splice(index, 1);
+            });
             return resultArray;
         };
 

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_delivery_rule.html

@@ -386,7 +386,7 @@
 															<i ng-if="city.items" class="fa fa-fw" ng-class="city.folded?'fa-caret-right':'fa-caret-down'" ng-click="tree.toggleFold(city)"></i>
 															<span ng-bind="::city.label" ng-click="tree.toggleFold(city)"></span><em ng-if="city.selectedNum!=0 && city.selectedNum!=city.items.length"></span>({{city.selectedNum}})</em>
 															<div class="check-1">
-																<label class="check-act">
+																<label class="check-act" ng-class="{'intermediate': tree.isSemiChecked(city)}">
 																	<input type="checkbox" ng-model="city.checked" ng-change="tree.check(city)" id="{{city.label}}">
 																	<label for="{{city.label}}"></label>
 																</label>