Просмотр исходного кода

新增按地区匹配配送规则

hulh 8 лет назад
Родитель
Сommit
ad4c0c2c7e

+ 34 - 3
src/main/java/com/uas/platform/b2c/logistics/controller/DistributionRuleController.java

@@ -1,9 +1,11 @@
 package com.uas.platform.b2c.logistics.controller;
 
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.logistics.model.DistributionRule;
 import com.uas.platform.b2c.logistics.service.DistributionRuleService;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageParams;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -21,6 +23,8 @@ public class DistributionRuleController {
 	@Autowired
 	private DistributionRuleService distributionRuleService;
 
+	private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
 	/**
 	 * 分页获取配送规则
 	 * @param params
@@ -49,12 +53,22 @@ public class DistributionRuleController {
 	 * @return
 	 */
 	@RequestMapping(value = "/save", method = RequestMethod.POST)
-	public ResultMap saveRule(Boolean isAdd, Boolean isActive, @RequestBody String json){
-		System.out.println(json + "=" + isActive + "=" + isAdd);
+	public ResultMap saveRule(@RequestParam("isAdd") Boolean isAdd, @RequestParam("isActive") Boolean isActive, @RequestBody String json){
 		DistributionRule rule = FastjsonUtils.fromJson(json, DistributionRule.class);
 		return distributionRuleService.saveDistributionRule(isAdd, isActive, rule);
 	}
 
+	/**
+	 * 根据id修改配送规则的生效状态
+	 * @param id
+	 * @param isActive
+	 * @return
+	 */
+	@RequestMapping(value = "/status", method = RequestMethod.POST)
+	public ResultMap changeActive(@RequestParam("id") Long id, @RequestParam("isActive") Boolean isActive){
+		return distributionRuleService.changeRuleActive(id, isActive);
+	}
+
 	/**
 	 * 返回所有的配送规则名称
 	 * @return
@@ -82,7 +96,24 @@ public class DistributionRuleController {
 	 */
 	@RequestMapping(value = "/checkName", method = RequestMethod.GET)
 	public ResultMap checkRuleName(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "ruleName") String ruleName, @RequestParam(value = "newSave") Boolean newSave){
-		System.out.println("id=" + id + "=ruleName=" + ruleName + "newSave" + newSave);
 		return distributionRuleService.containsName(id, ruleName, newSave);
 	}
+
+	/**
+	 * 根据配送方式和地址信息匹配适用的配送规则
+	 * @param method 配送方式
+	 * @param area 地址信息
+	 * @return
+	 */
+	@RequestMapping(value = "/rule/matchArea", method = RequestMethod.GET)
+	public List<DistributionRule> ruleOfMatchArea(Integer method, String area, String uuid){
+		assert logger != null;
+		logger.log("匹配配送规则", "订单的配送方式为" + method + ", 地区为 : " + area);
+		return distributionRuleService.ruleMatchArea(method, area, uuid);
+	}
+
+	@RequestMapping
+	public DistributionRule getMinRule(){
+		return null;
+	}
 }

+ 2 - 2
src/main/java/com/uas/platform/b2c/logistics/dao/DistributionRuleDao.java

@@ -59,10 +59,10 @@ public interface DistributionRuleDao extends JpaSpecificationExecutor<Distributi
 	int findCountRuleName(@Param("enuu") Long enuu, @Param("ruleName") String ruleName);
 
 	/**
-	 * 根据配送方式和enuu获取配送规则列表
+	 * 根据配送方式和enuu获取生效的配送规则列表
 	 * @param enuu
 	 * @param shippingMethod
 	 * @return
 	 */
-	List<DistributionRule> findByEnuuAndShippingMethod(Long enuu, Integer shippingMethod);
+	List<DistributionRule> findByEnuuAndShippingMethodAndActive(Long enuu, Integer shippingMethod, Short active);
 }

+ 4 - 4
src/main/java/com/uas/platform/b2c/logistics/model/DistributionRule.java

@@ -45,10 +45,10 @@ public class DistributionRule {
 	private String ruleName;
 
 	/**
-	 * 适用店铺 1101-自营,1102-寄售
+	 * 适用店铺 0-自营,1-寄售
 	 */
 	@Column(name = "rule_store_type")
-	private Integer storeType;
+	private Short storeType;
 
 	/**
 	 * 适用类型 1201-普通订单,1202-预售订单,1203-发票
@@ -152,11 +152,11 @@ public class DistributionRule {
 		this.enuu = enuu;
 	}
 
-	public Integer getStoreType() {
+	public Short getStoreType() {
 		return storeType;
 	}
 
-	public void setStoreType(Integer storeType) {
+	public void setStoreType(Short storeType) {
 		this.storeType = storeType;
 	}
 

+ 15 - 1
src/main/java/com/uas/platform/b2c/logistics/service/DistributionRuleService.java

@@ -29,6 +29,14 @@ public interface DistributionRuleService {
 	 */
 	ResultMap saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule);
 
+	/**
+	 * 根据id修改配送规则的生效状态
+	 * @param id
+	 * @param isActive
+	 * @return
+	 */
+	ResultMap changeRuleActive(Long id, Boolean isActive);
+
 	/**
 	 * 根据id删除指定配送规则
 	 * @param id
@@ -56,5 +64,11 @@ public interface DistributionRuleService {
 	 */
 	ResultMap containsName(Long id, String ruleName, Boolean newSave);
 
-	List<DistributionRule> ruleMatchArea(Integer method, String area);
+	/**
+	 * 根据配送方式和地区匹配适用的配送规则
+	 * @param method
+	 * @param area
+	 * @return
+	 */
+	List<DistributionRule> ruleMatchArea(Integer method, String area, String uuid);
 }

+ 46 - 19
src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java

@@ -1,15 +1,21 @@
 package com.uas.platform.b2c.logistics.service.impl;
 
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.constant.ShortConstant;
 import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.logistics.dao.DistributionRuleDao;
 import com.uas.platform.b2c.logistics.model.DistributionRule;
 import com.uas.platform.b2c.logistics.model.RuleQtyArea;
 import com.uas.platform.b2c.logistics.service.DistributionRuleService;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
@@ -35,6 +41,12 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 	@Autowired
 	private DistributionRuleDao distributionRuleDao;
 
+	@Autowired
+	private StoreInDao storeInDao;
+
+	@Autowired
+	private SysConf sysConf;
+
 	@Override
 	public Page<DistributionRule> findPageRule(PageParams params) {
 		final PageInfo pageInfo = new PageInfo(params);
@@ -56,10 +68,10 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 		if (rule.getRuleName() == null || rule.getRuleName().isEmpty()){
 			return new ResultMap(CodeType.NO_INFO, "请填写规则名称");
 		}
-		if (rule.getQtyArea() == null || rule.getQtyArea().isEmpty()){
+		if (CollectionUtils.isEmpty(rule.getAreas())){
 			return new ResultMap(CodeType.NO_INFO, "您还没有选择任何地区");
 		}
-		if (rule.getFareType() == 2 && (rule.getQtyFare() == null || rule.getQtyArea().isEmpty())){
+		if (rule.getFareType() == 2 && CollectionUtils.isEmpty(rule.getFares())){
 			return new ResultMap(CodeType.NO_INFO, "请完善计费方式");
 		}
 		if (rule.getId() == null){
@@ -67,15 +79,17 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 			Long enuu = SystemSession.getUser().getEnterprise().getUu();
 			rule.setUseruu(uu);
 			rule.setEnuu(enuu);
-			/**
-			 * TODO 默认为自营的,后期再加入判断
-			 */
-			rule.setStoreType(1101);
+
+			if (enuu.longValue() == sysConf.getEnUU().longValue()){
+				rule.setStoreType(ShortConstant.YES_SHORT);
+			}else {
+				rule.setStoreType(ShortConstant.NO_SHORT);
+			}
 		}
 		if (isActive){
-			rule.setActive((short)1);
+			rule.setActive(ShortConstant.YES_SHORT);
 		}else {
-			rule.setActive((short)0);
+			rule.setActive(ShortConstant.NO_SHORT);
 		}
 		if (!isAdd){
 			if (rule.getId() != null){
@@ -83,10 +97,7 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 			}
 		}
 		int count = distributionRuleDao.findCountByEnuu(rule.getEnuu());
-		System.out.println(rule.getNum());
-		System.out.println("count=" + count);
 		int num = count == 0 ? 1 : ++count;
-		System.out.println(num);
 		if (rule.getId() == null){
 			if (rule.getNum() == null){
 				rule.setNum(num);
@@ -114,6 +125,18 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 		return ResultMap.success(null);
 	}
 
+	@Override
+	public ResultMap changeRuleActive(Long id, Boolean isActive) {
+		DistributionRule rule = distributionRuleDao.findOne(id);
+		if (isActive){
+			rule.setActive((short)1);
+		}else {
+			rule.setActive((short)0);
+		}
+		distributionRuleDao.save(rule);
+		return ResultMap.success(null);
+	}
+
 	public void sortRule(Long id, int num){
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
 		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
@@ -175,12 +198,12 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 	public ResultMap containsName(Long id, String ruleName, Boolean newSave) {
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
 		Boolean repeat = null;
-		System.out.println("id=" + id);
+//		System.out.println("id=" + id);
 		if (id != null){
 			//修改配送规则情况,分保存和另存为两种
 			if (newSave){ //另存为
 				int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
-				System.out.println("count=" + count);
+//				System.out.println("count=" + count);
 				if (count != 0){
 					repeat = true;
 				}else {
@@ -192,7 +215,7 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 					repeat = false;
 				}else {
 					int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
-					System.out.println("count=" + count);
+//					System.out.println("count=" + count);
 					if (count != 0){
 						repeat = true;
 					}else {
@@ -202,7 +225,7 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 			}
 		}else { //新增配送规则情况
 			int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
-			System.out.println("count=" + count);
+//			System.out.println("count=" + count);
 			if (count != 0){
 				repeat = true;
 			}else {
@@ -213,11 +236,12 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 	}
 
 	@Override
-	public List<DistributionRule> ruleMatchArea(Integer method, String area) {
-		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+	public List<DistributionRule> ruleMatchArea(Integer method, String area, String uuid) {
+		StoreIn store = storeInDao.findByUuid(uuid);
+
 		List<DistributionRule> resultList = new ArrayList<>();
 		// 根据配送方式找出所有的配送规则
-		List<DistributionRule> methodList = distributionRuleDao.findByEnuuAndShippingMethod(enuu, method);
+		List<DistributionRule> methodList = distributionRuleDao.findByEnuuAndShippingMethodAndActive(store.getEnUU(), method, ShortConstant.YES_SHORT);
 
 		for (DistributionRule rule : methodList){
 			List<RuleQtyArea> qtyArea = rule.getAreas();
@@ -237,8 +261,11 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
 	 * @return
 	 */
 	public Map<String, Map<String, List<String>>> convertArea(List<RuleQtyArea> qtyArea){
-		Map<String, Map<String, List<String>>> areaMap = new HashMap<>();
+		if (qtyArea == null) {
+			throw new IllegalOperatorException("地区信息丢失,请刷新后重试");
+		}
 
+		Map<String, Map<String, List<String>>> areaMap = new HashMap<>();
 		for (RuleQtyArea a : qtyArea){
 			if (a.getProvince() != null && a.getProvince().length() != 0){
 				//判断该RuleQtyArea是否包含省字段

+ 9 - 0
src/main/webapp/resources/js/common/query/logisticsPort.js

@@ -96,6 +96,10 @@ define([ 'ngResource' ], function() {
 				method: 'GET',
 				isArray : true
 			},
+			changeActive : {
+				url: 'trade/distributionRule/status',
+				method: 'POST'
+			},
 			findCountOfRule : {
 				url: 'trade/distributionRule/count',
 				method: 'GET'
@@ -103,6 +107,11 @@ define([ 'ngResource' ], function() {
 			checkRuleName : {
 				url: 'trade/distributionRule/checkName',
 				method: 'GET'
+			},
+			findMatchRule : {
+				url: 'trade/distributionRule/rule/matchArea',
+				method: 'GET',
+				isArray : true
 			}
 		})
 	}]);

+ 9 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -3,7 +3,7 @@
  *  订单付款的界面
  */
 define(['app/app'], function(app) {
-	app.register.controller('orderPayCtrl', ['$scope', '$rootScope', '$stateParams', '$modal', '$state', 'Bill', 'toaster', 'Order', '$filter', 'ShippingAddress', 'Ysepay', '$q', 'NumberService', 'Cart', '$timeout', function($scope, $rootScope, $stateParams, $modal, $state, Bill, toaster, Order, $filter, ShippingAddress, Ysepay, $q, NumberService, Cart, $timeout) {
+	app.register.controller('orderPayCtrl', ['$scope', '$rootScope', '$stateParams', '$modal', '$state', 'Bill', 'toaster', 'Order', '$filter', 'ShippingAddress', 'Ysepay', '$q', 'NumberService', 'Cart', '$timeout', 'DistributionRule', function($scope, $rootScope, $stateParams, $modal, $state, Bill, toaster, Order, $filter, ShippingAddress, Ysepay, $q, NumberService, Cart, $timeout, DistributionRule) {
 
 		$rootScope.active = 'buyer_cart';
 
@@ -324,6 +324,14 @@ define(['app/app'], function(app) {
 			});
 		};
 
+		$scope.getRule = function (uuid) {
+			DistributionRule.findMatchRule({method:1301, area:$scope.payment.address.area, uuid:uuid},{},function (data) {
+				if (data){
+					console.log(data);
+				}
+			})
+		};
+
 		// 产生要提交的单个订单数据
 		var generateOrderInfo = function() {
 			/*订单信息:orderInfo含有信息:id、orderid、deliverytype、add_id、invoicetype、invoiceid、paytype、totalprice(price)、

+ 95 - 61
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_ctrl.js

@@ -91,7 +91,9 @@ define([ 'app/app' ], function(app) {
                 $scope.mapArray = [];
                 if ($scope.modifyRule.areas){
                     var data = angular.fromJson($scope.modifyRule.areas);
-                    $scope.mapArray = data;
+                    $scope.tree = $scope.tree ? $scope.tree : new TreeData($scope.cityData);
+                    $scope.tree.newInitData(data);
+                    $scope.mapArray = $scope.tree.getChecked();
                 }
             }else {
                 $scope.isModify = false;
@@ -107,12 +109,19 @@ define([ 'app/app' ], function(app) {
                 Enterprise.getCurrencyByRegisterAddress({}, {} ,function (data) {
                     if (data){
                         $scope.modifyRule.currencyName = data.data;
-                        $scope.currencySymbol = $scope.modifyRule.currencyName == "RMB" ? "¥" : "$";
                     }
                 }, function (error) {
                     toaster.pop('error', "获取企业币别信息失败");
                 });
 
+                /**
+                 * 目前存在没有注册地址的公司,暂时设为RMB
+                 */
+                if (!$scope.modifyRule.currencyName){
+                    $scope.modifyRule.currencyName = 'RMB';
+                }
+                $scope.currencySymbol = $scope.modifyRule.currencyName == "RMB" ? "¥" : "$";
+
                 DistributionRule.findCountOfRule({}, {}, function (data) {
                     if (data){
                         var num = data.data;
@@ -197,7 +206,7 @@ define([ 'app/app' ], function(app) {
          */
         $scope.addQtyFare = function (data) {
             if (Number(data.start) == 1000000){
-                toaster.pop('warning', '提示', '允许输入的最大金额为'+$scope.currencySymbol+'1,000,000,请修改后再新增');
+                toaster.pop('warning', '提示', '已达到最大值1,000,000,请修改后再新增');
                 return;
             }
             var index = $scope.fareArray.length-1;
@@ -219,10 +228,6 @@ define([ 'app/app' ], function(app) {
         };
 
         $scope.inputFare = function (data) {
-            // if(!data.fare) {
-            //     data.fare = 0;
-            //     return false;
-            // }
             if(isNaN(data.fare)){
                 data.fare = "";
                 toaster.pop('warning', '提示', '运费必须是整数');
@@ -235,6 +240,7 @@ define([ 'app/app' ], function(app) {
             }
             if(Number(data.fare) > 100000){
                 data.fare = 100000;
+                toaster.pop('warning', '提示', '请勿超过100,100');
             }
             if(data.fare.length > 0){
                 data.fare = Number(data.fare);
@@ -272,19 +278,19 @@ define([ 'app/app' ], function(app) {
             }
             if(Number(data.end) > 1000000){
                 data.end = "";
-                toaster.pop('warning', '提示', '允许输入的最大金额为'+$scope.currencySymbol+'1,000,000');
+                toaster.pop('warning', '提示', '请勿超过1,000,000');
                 return;
             }
             if(Number(data.end) <= Number(data.start)) {
                 data.end = "";
-                toaster.pop('warning', '提示', '所输金额不能比该行初始金额小');
+                toaster.pop('warning', '提示', '输入值应大于该行起始金额');
                 return;
             }
             if ($scope.fareArray[index+1].end){
                 if($scope.fareArray[index+1].end.length != 0){
                     if (Number(data.end) >= Number($scope.fareArray[index+1].end)){
                         data.end = "";
-                        toaster.pop('warning', '提示', '所输金额不能比下一行结束金额大');
+                        toaster.pop('warning', '提示', '输入值应小于下一行结束金额');
                         return;
                     }
                 }
@@ -350,7 +356,23 @@ define([ 'app/app' ], function(app) {
                 return false;
             }
             if ($scope.mapArray.length > 0){
-                $scope.modifyRule.qtyArea = angular.toJson($scope.mapArray);
+                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);
+                                })
+                            }
+                        });
+                    }
+                });
+                $scope.modifyRule.qtyArea = angular.toJson(resultArray);
             }else {
                 toaster.pop('error', "您还没有选择任何地区");
                 return false;
@@ -453,7 +475,28 @@ define([ 'app/app' ], function(app) {
         $scope.chooseBox = false;
         $scope.cancel = function () {
             $scope.resetData($scope.tree.$data);
-            $scope.tree.initData($scope.mapArray);
+            if ($scope.mapArray.length > 0){
+                var resultArray = [];
+                angular.forEach($scope.mapArray, function (item) {
+                    if (item.mainland && !item.province){
+                        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);
+                                })
+                            }
+                        })
+                    }
+                });
+                if (resultArray.length == 0){
+                    $scope.tree.newInitData($scope.mapArray);
+                }else {
+                    $scope.tree.newInitData(resultArray);
+                }
+            }
             $scope.chooseBox = false;
         };
 
@@ -484,7 +527,7 @@ define([ 'app/app' ], function(app) {
                 toaster.pop("info", "您还没有选择任何地区");
                 return;
             }
-            $scope.tree.initData($scope.mapArray);
+            $scope.tree.newInitData($scope.mapArray);
             $scope.chooseBox = false;
         };
 
@@ -564,8 +607,8 @@ define([ 'app/app' ], function(app) {
         // 选择地区
         $scope.chooseAddress = function () {
             $scope.chooseBox = true;
-            $scope.tree = new TreeData($scope.cityData);
-            $scope.tree.initData($scope.mapArray);
+            $scope.tree = $scope.tree ? $scope.tree : new TreeData($scope.cityData);
+            $scope.tree.newInitData($scope.mapArray);
         }
 
         /**
@@ -574,8 +617,8 @@ define([ 'app/app' ], function(app) {
          * @param isAdd
          * @param active
          */
-        $scope.changeActive = function (rule, isAdd, active) {
-            DistributionRule.saveRule({isAdd:isAdd,isActive:active}, rule, function (data) {
+        $scope.changeActive = function (ruleId, active) {
+            DistributionRule.changeActive({id:ruleId, isActive:active}, {}, function (data) {
                 if (data){
                     $scope.ruleTableParams.reload();
                 }
@@ -622,69 +665,60 @@ define([ 'app/app' ], function(app) {
             var me = this;
             me.$data = tree;
 
-            me.initData = function (initData) {
-                console.log(initData);
+            /**
+             * 根据已选地区映射到树对象中
+             * @param initData
+             */
+            me.newInitData = function (initData) {
+                if (initData){
+                     angular.forEach(me.$data, function (v) {
+                         me.initData(v.items, initData);
+                    })
+                }
+                me._updateParentsCheck(me.$data);
+            };
+
+            me.initData = function (data, initData) {
                 if(initData) {
                     angular.forEach(initData, function (v) {
                         var p = {};
-                        for(var i in me.$data) {
-                            var value = me.$data[i];
-                            if(value.label == v.mainland) {
+                        for(var i in data) {
+                            var value = data[i];//获取单个省
+                            if(value.label == v.province) {
                                 p = value; break;
                             }
                         }
                         p.checked = true;
-                        if(v.province) {
+                        if(v.city) {
                             var c = {};
                             for(var i in p.items) {
-                                var value = p.items[i];
-                                if(value.label == v.province) {
+                                var value = p.items[i];//获取单个市
+                                if(value.label == v.city) {
                                     c = value; break;
                                 }
                             }
                             c.checked = true;
-                            if(v.city) {
-                                var a = {};
+                            if(v.area) {
                                 for(var i in c.items) {
-                                    var value = c.items[i];
-                                    if(value.label == v.city) {
-                                        a = value; break;
-                                    }
-                                }
-                                a.checked = true;
-                                if (v.area){
-                                    for(var i in a.items){
-                                        var m = a.items[i];
-                                        if (m.label == v.area){
-                                            m.checked = true;break;
-                                        }
+                                    var a = c.items[i];//获取单个区
+                                    if(a.label == v.area) {
+                                        a.checked = true; break;
                                     }
-                                }else {
-                                    angular.forEach(a.items, function (area) {
-                                        area.checked = true;
-                                    })
                                 }
-                            } else {
-                                angular.forEach(c.items, function (city) {
-                                    city.checked = true;
-                                    angular.forEach(city.items, function (area) {
-                                        area.checked = true;
-                                    })
+                            }else {
+                                angular.forEach(c.items, function (area) {
+                                    area.checked = true;
                                 })
                             }
-                        } else {
-                            angular.forEach(p.items, function (province) {
-                                province.checked = true;
-                                angular.forEach(province.items, function (city) {
-                                    city.checked = true;
-                                    angular.forEach(city.items, function (area) {
-                                        area.checked = true;
-                                    })
+                        }else {
+                            angular.forEach(p.items, function (city) {
+                                city.checked = true;
+                                angular.forEach(city.items, function (area) {
+                                    area.checked = true;
                                 })
                             })
                         }
                     })
-                    me._updateParentsCheck(me.$data);
                 }
             };
 
@@ -857,7 +891,7 @@ define([ 'app/app' ], function(app) {
                                 if (data.checked){
                                     if(!data.semiChecked) {
                                         var second = {
-                                            mainland : v.label,
+                                            // mainland : v.label,
                                             province : data.label
                                         };
                                         addressArray.push(second);
@@ -865,7 +899,7 @@ define([ 'app/app' ], function(app) {
                                         angular.forEach(data.items, function (item) {
                                             if(!item.semiChecked) {
                                                 var third = {
-                                                    mainland : v.label,
+                                                    // mainland : v.label,
                                                     province : data.label,
                                                     city : item.label
                                                 };
@@ -874,7 +908,7 @@ define([ 'app/app' ], function(app) {
                                                 angular.forEach(item.items, function (m) {
                                                     if (m.checked){
                                                         var forth = {
-                                                            mainland : v.label,
+                                                            // mainland : v.label,
                                                             province : data.label,
                                                             city : item.label,
                                                             area : m.label

+ 1 - 0
src/main/webapp/resources/view/usercenter/forstore/order_pay.html

@@ -527,6 +527,7 @@
 								</select>
 								<em ng-if="order.status != 501">物流配送</em>
 								<!--<i>满1000元包邮,未满足的订单收取运费20元</i>-->
+								<!--<button ng-click="getRule(order.storeid)">获取配送规则</button>-->
 							</span>
 								<span class="total-price">
 								<p><strong>运费:</strong><em ng-bind="0 | formateNumber : 2 | currencySysmbol : order.currency.substring(0,3)" style="font-weight: bold"></em></p>

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

@@ -255,10 +255,10 @@
 						<td ng-bind="rule.ruleName">深圳市内满100元包邮,不满1000元邮费20元不满1000元</td>
 						<td>
 							<p class="switch">
-								<span class="checkbox" ng-click="changeActive(rule, true, true)" ng-if="rule.active == 0">
+								<span class="checkbox" ng-click="changeActive(rule.id, true)" ng-if="rule.active == 0">
 									<span><em></em></span>
 								</span>
-								<span class="checkbox active" ng-click="changeActive(rule, true, false)" ng-if="rule.active == 1">
+								<span class="checkbox active" ng-click="changeActive(rule.id, false)" ng-if="rule.active == 1">
 										<span><em></em></span>
 								</span>
 							</p>
@@ -344,7 +344,7 @@
 					<span><strong>*</strong>适用地区</span>
 					<div class="area-content" ng-if="mapArray.length >0">
 						<span ng-repeat="data in mapArray">
-							<em ng-if="!data.province">{{data.mainland}}</em>
+							<em ng-if="data.mainland">{{data.mainland}}</em>
 							<em ng-if="data.province">{{data.province}}</em>
 							<em ng-if="data.city">/{{data.city}}</em>
 							<em ng-if="data.area">/{{data.area}}</em>
@@ -454,10 +454,10 @@
 						<!--<div class="prompt"><strong>*</strong>公式说明内容将会在购物车中显示,可自行修改</div>-->
 						<!--</div>-->
 						<!--不可以编辑的状态-->
-						<div class="no-edit" style="margin-top: 6px; position: relative;">全国统一运费
+						<div class="no-edit" style="margin-top: 6px; position: relative;">适用范围内统一运费
 							<em ng-bind="currencySymbol"></em>
 							<div ng-bind="modifyRule.uniformPrice" style="width: 80px;overflow: hidden;float: left;
-    position: absolute;top: 0;left: 97px;"></div>
+    position: absolute;top: 0;left: 133px;"></div>
 						</div>
 					</div>
 				</div>
@@ -536,7 +536,8 @@
 									<i class="currency" ng-bind="currencySymbol">¥</i><i class="input-text" ng-bind="data.start"></i>
 									-&nbsp;<i class="input-text" ng-bind="data.end"></i>&nbsp;,
 									运费为
-									<i class="currency" ng-bind="currencySymbol">¥</i>{{data.fare}}
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									<i class="input-text" ng-bind="data.fare"></i>
 								</p>
 								<p ng-if="$index != 0 && $index != fareArray.length - 1">
 									总金额在
@@ -545,7 +546,8 @@
 									-&nbsp;<i class="input-text" ng-bind="data.end"></i>(含
 									<i class="currency" ng-bind="currencySymbol">¥</i>{{data.start}}),
 									运费为
-									<i class="currencys" ng-bind="currencySymbol">¥</i>{{data.fare}}
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									<i class="input-text" ng-bind="data.fare"></i>
 								</p>
 								<p ng-if="$index == fareArray.length-1">
 									总金额在
@@ -553,7 +555,8 @@
 									<i class="input-text">{{data.start}}</i>(含
 									<i class="currency" ng-bind="currencySymbol">¥</i>
 									{{data.start}})以上,运费为
-									<i class="currency" ng-bind="currencySymbol">¥</i>{{data.fare}}
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									<i class="input-text" ng-bind="data.fare"></i>
 								</p>
 							</div>
 						</div>