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

Merge branch 'vendor_logistics_v2' of ssh://10.10.101.21/source/platform-b2c into vendor_logistics_v2

ouxq 8 лет назад
Родитель
Сommit
6cb78de6c6

+ 75 - 0
src/main/java/com/uas/platform/b2c/logistics/controller/DistributionRuleController.java

@@ -0,0 +1,75 @@
+package com.uas.platform.b2c.logistics.controller;
+
+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.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则controller
+ */
+@RestController
+@RequestMapping(value = "trade/distributionRule")
+public class DistributionRuleController {
+
+	@Autowired
+	private DistributionRuleService distributionRuleService;
+
+	/**
+	 * 分页获取配送规则
+	 * @param params
+	 * @return
+	 */
+	@RequestMapping(value = "/page", method = RequestMethod.GET)
+	public Page findPageRule(PageParams params){
+		return distributionRuleService.findPageRule(params);
+	}
+
+	/**
+	 * 根据id删除指定配送规则
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/delete/{id}", method = RequestMethod.PUT)
+	public void deleteOne(@PathVariable("id") Long id){
+		distributionRuleService.deleteOne(id);
+	}
+
+	/**
+	 * 保存配送规则
+	 * @param isActive
+	 * @param json
+	 * @param isAdd true-新增,false-另存
+	 * @return
+	 */
+	@RequestMapping(value = "/save", method = RequestMethod.POST)
+	public DistributionRule saveRule(Boolean isAdd, Boolean isActive, @RequestBody String json){
+		System.out.println(json + "=" + isActive + "=" + isAdd);
+		DistributionRule rule = FastjsonUtils.fromJson(json, DistributionRule.class);
+		return distributionRuleService.saveDistributionRule(isAdd, isActive, rule);
+	}
+
+	/**
+	 * 返回所有的配送规则名称
+	 * @return
+	 */
+	@RequestMapping(value = "/ruleName", method = RequestMethod.GET)
+	public List<String> findAllRuleName(){
+		return distributionRuleService.findAllRuleName();
+	}
+
+	/**
+	 * 返回当前enuu配送规则总数
+	 * @return
+	 */
+	@RequestMapping(value = "/count", method = RequestMethod.GET)
+	public ResultMap findRuleCount(){
+		return distributionRuleService.findCountRule();
+	}
+}

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

@@ -0,0 +1,51 @@
+package com.uas.platform.b2c.logistics.dao;
+
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ */
+public interface DistributionRuleDao extends JpaSpecificationExecutor<DistributionRule>, JpaRepository<DistributionRule, Long> {
+
+	/**
+	 * 根据指定id删除配送规则
+	 * @param id
+	 * @return
+	 */
+	@Transactional
+	@Modifying
+	@Query(value = "delete from DistributionRule d where d.id=:id")
+	void deleteOneById(@Param("id") Long id);
+
+	/**
+	 * 根据enuu查找配送规则总数
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select count(1) from DistributionRule d where d.enuu = :enuu")
+	int findCountByEnuu(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据enuu获取所有的配送规则
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select d from DistributionRule d where d.enuu = :enuu order by d.num asc")
+	List<DistributionRule> findAllByEnuu(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据enuu获取所有的配送规则名称
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select d.ruleName from DistributionRule d where d.enuu = :enuu")
+	List<String> findAllRuleNameByEnuu(@Param("enuu") Long enuu);
+}

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

@@ -0,0 +1,277 @@
+package com.uas.platform.b2c.logistics.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2c.core.utils.FastjsonUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.*;
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则
+ */
+@Entity
+@Table(name = "logistics$distributor_rule")
+public class DistributionRule {
+
+	/**
+	 * 主键id
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "logistics$distributor_gen")
+	@SequenceGenerator(name = "logistics$distributor_gen", sequenceName = "logistics$distributor_seq", allocationSize = 1)
+	@Column(name = "rule_id")
+	private Long id;
+
+	/**
+	 * 用户uu
+	 */
+	@Column(name = "rule_uu")
+	private Long useruu;
+
+	/**
+	 * 企业enuu
+	 */
+	@Column(name = "rule_enuu")
+	private Long enuu;
+
+	/**
+	 * 配送规则名称
+	 */
+	@Column(name = "rule_name")
+	private String ruleName;
+
+	/**
+	 * 适用店铺 1101-自营,1102-寄售
+	 */
+	@Column(name = "rule_store_type")
+	private Integer storeType;
+
+	/**
+	 * 适用类型 1201-普通订单,1202-预售订单,1203-发票
+	 */
+	@Column(name = "rule_order_type")
+	private String orderType;
+
+	/**
+	 * 适用用户 1301-所有用户
+	 * TODO 目前暂时展示所有用户
+	 */
+	@Column(name = "rule_user_type")
+	private Integer userType;
+
+	/**
+	 * 配送方式
+	 * 1301-第三方配送,1302-卖家配送,1303-上门自提
+	 */
+	@Column(name = "rule_method")
+	private Integer shippingMethod;
+
+	/**
+	 * 是否生效,1-生效,0-不生效
+	 */
+	@Column(name = "rule_active")
+	private Short active;
+
+	/**
+	 * 配送规则排序
+	 */
+	@Column(name = "rule_num")
+	private Integer num;
+
+	/**
+	 * 币别 RMB-USD
+	 */
+	@Column(name = "rule_currency")
+	private String currencyName;
+
+	/**
+	 * 计费方式
+	 * 1-统一规定运费,2-按总金额计算
+	 */
+	@Column(name = "rule_fare_type")
+	private Short fareType;
+
+	/**
+	 * 分段运费(JSON串)
+	 */
+	@Column(name = "rule_qtyFare")
+	private String qtyFare;
+
+	/**
+	 * 统一运费
+	 */
+	@Column(name = "rule_uniform_price")
+	private Double uniformPrice;
+
+	/**
+	 * 分段运费
+	 */
+	@Transient
+	private List<RuleQtyFare> fares;
+
+	/**
+	 * 分段地区(JSON串)
+	 */
+	@Column(name = "rule_qtyArea")
+	private String qtyArea;
+
+	/**
+	 * 分段地区(list)
+	 */
+	@Transient
+	private List<RuleQtyArea> areas;
+
+	/**
+	 * TODO 是否需要记录计算说明文案
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getUseruu() {
+		return useruu;
+	}
+
+	public void setUseruu(Long useruu) {
+		this.useruu = useruu;
+	}
+
+	public Long getEnuu() {
+		return enuu;
+	}
+
+	public void setEnuu(Long enuu) {
+		this.enuu = enuu;
+	}
+
+	public Integer getStoreType() {
+		return storeType;
+	}
+
+	public void setStoreType(Integer storeType) {
+		this.storeType = storeType;
+	}
+
+	public String getOrderType() {
+		return orderType;
+	}
+
+	public void setOrderType(String orderType) {
+		this.orderType = orderType;
+	}
+
+	public Integer getUserType() {
+		return userType;
+	}
+
+	public void setUserType(Integer userType) {
+		this.userType = userType;
+	}
+
+	public Integer getShippingMethod() {
+		return shippingMethod;
+	}
+
+	public void setShippingMethod(Integer shippingMethod) {
+		this.shippingMethod = shippingMethod;
+	}
+
+	public Short getActive() {
+		return active;
+	}
+
+	public void setActive(Short active) {
+		this.active = active;
+	}
+
+	public Short getFareType() {
+		return fareType;
+	}
+
+	public void setFareType(Short fareType) {
+		this.fareType = fareType;
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public String getQtyFare() {
+		return qtyFare;
+	}
+
+	public void setQtyFare(String qtyFare) {
+		this.qtyFare = qtyFare;
+	}
+
+	public Double getUniformPrice() {
+		return uniformPrice;
+	}
+
+	public void setUniformPrice(Double uniformPrice) {
+		this.uniformPrice = uniformPrice;
+	}
+
+
+	public List<RuleQtyFare> getFares() {
+		if (CollectionUtils.isEmpty(fares) && StringUtils.hasText(qtyFare)) {
+			return FastjsonUtils.fromJsonArray(qtyFare, RuleQtyFare.class);
+		} else {
+			return fares;
+		}
+	}
+
+	public void setFares(List<RuleQtyFare> fares) {
+		this.fares = fares;
+	}
+
+	public String getQtyArea() {
+		return qtyArea;
+	}
+
+	public void setQtyArea(String qtyArea) {
+		this.qtyArea = qtyArea;
+	}
+
+	public List<RuleQtyArea> getAreas() {
+		if (CollectionUtils.isEmpty(areas) && StringUtils.hasText(qtyArea)) {
+			return FastjsonUtils.fromJsonArray(qtyArea, RuleQtyArea.class);
+		} else {
+			return areas;
+		}
+	}
+
+	public void setAreas(List<RuleQtyArea> areas) {
+		this.areas = areas;
+	}
+
+	public String getRuleName() {
+		return ruleName;
+	}
+
+	public void setRuleName(String ruleName) {
+		this.ruleName = ruleName;
+	}
+
+	public Integer getNum() {
+		return num;
+	}
+
+	public void setNum(Integer num) {
+		this.num = num;
+	}
+
+	public String getCurrencyName() {
+		return currencyName;
+	}
+
+	public void setCurrencyName(String currencyName) {
+		this.currencyName = currencyName;
+	}
+}

+ 44 - 0
src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyArea.java

@@ -0,0 +1,44 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 分段地区
+ */
+public class RuleQtyArea {
+	/**
+	 * 地区:省
+	 */
+	private String province;
+	/**
+	 * 地区:市
+	 */
+	private String city;
+	/**
+	 * 地区:区
+	 */
+	private String area;
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getArea() {
+		return area;
+	}
+
+	public void setArea(String area) {
+		this.area = area;
+	}
+}

+ 24 - 0
src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyFare.java

@@ -0,0 +1,24 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 分段运费
+ */
+public class RuleQtyFare {
+	/**
+	 * 分段开始
+	 */
+	private Double start;
+	/**
+	 * 分段结束
+	 */
+	private Double end;
+	/**
+	 * 分段费用
+	 */
+	private Double fare;
+	/**
+	 * 分段币别
+	 */
+	private String currency;
+}

+ 46 - 0
src/main/java/com/uas/platform/b2c/logistics/service/DistributionRuleService.java

@@ -0,0 +1,46 @@
+package com.uas.platform.b2c.logistics.service;
+
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则service
+ */
+public interface DistributionRuleService {
+
+	/**
+	 * 分页获取配送规则
+	 * @param params
+	 * @return
+	 */
+	Page<DistributionRule> findPageRule(PageParams params);
+
+	/**
+	 * 保存配送规则
+	 * @param isAdd
+	 * @param isActive
+	 * @param rule
+	 * @return
+	 */
+	DistributionRule saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule);
+
+	/**
+	 * 根据id删除指定配送规则
+	 * @param id
+	 */
+	void deleteOne(Long id);
+
+	/**
+	 * 返回所有的配送规则名称
+	 * @return
+	 */
+	List<String> findAllRuleName();
+
+	ResultMap findCountRule();
+
+}

+ 140 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java

@@ -0,0 +1,140 @@
+package com.uas.platform.b2c.logistics.service.impl;
+
+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.service.DistributionRuleService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则实现类
+ */
+@Service
+@Transactional
+public class DistributionRuleServiceImpl implements DistributionRuleService{
+
+	@Autowired
+	private DistributionRuleDao distributionRuleDao;
+
+	@Override
+	public Page<DistributionRule> findPageRule(PageParams params) {
+		final PageInfo pageInfo = new PageInfo(params);
+		pageInfo.filter("enuu", SystemSession.getUser().getEnterprise().getUu());
+		return distributionRuleDao.findAll(new Specification<DistributionRule>() {
+			@Override
+			public Predicate toPredicate(Root<DistributionRule> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+				query.where(pageInfo.getPredicates(root, query, cb));
+				return null;
+			}
+		}, pageInfo);
+	}
+
+	@Override
+	public DistributionRule saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule) {
+		if (rule.getId() == null){
+			Long uu = SystemSession.getUser().getUserUU();
+			Long enuu = SystemSession.getUser().getEnterprise().getUu();
+			rule.setUseruu(uu);
+			rule.setEnuu(enuu);
+			/**
+			 * TODO 默认为自营的,后期再加入判断
+			 */
+			rule.setStoreType(1101);
+		}
+		if (isActive){
+			rule.setActive((short)1);
+		}else {
+			rule.setActive((short)0);
+		}
+		if (!isAdd){
+			if (rule.getId() != null){
+				rule.setId(null);
+			}
+		}
+		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);
+			}else {
+				if (rule.getNum() < num){
+					sortRule(rule.getNum());
+				}else {
+					rule.setNum(num);
+				}
+			}
+		}else {
+			DistributionRule oldRule = distributionRuleDao.findOne(rule.getId());
+			if (rule.getNum() < oldRule.getNum()){
+				sortRule(rule.getId(), rule.getNum());
+			}
+		}
+		return distributionRuleDao.save(rule);
+	}
+
+	public void sortRule(Long id, int num){
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int start = 1;
+		for (DistributionRule rule : ruleList){
+			if (rule.getId() != id){
+				if (start == num){
+					start++;
+					System.out.println("start=" + start);
+				}
+				rule.setNum(start++);
+			}
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	public void sortRule(int num){
+		System.out.println("num=" + num);
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int start = 1;
+		for (DistributionRule rule : ruleList){
+			if (start == num){
+				start++;
+				System.out.println("start=" + start);
+			}
+			rule.setNum(start++);
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	@Transactional
+	@Override
+	public void deleteOne(Long id) {
+		distributionRuleDao.deleteOneById(id);
+	}
+
+	@Override
+	public List<String> findAllRuleName() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		return distributionRuleDao.findAllRuleNameByEnuu(enuu);
+	}
+
+	@Override
+	public ResultMap findCountRule() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		int count = distributionRuleDao.findCountByEnuu(enuu);
+		return ResultMap.success(count);
+	}
+}

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

@@ -77,5 +77,29 @@ define([ 'ngResource' ], function() {
 				isArray : true
 			}
 		});
+	}]).factory('DistributionRule', ['$resource', function ($resource) {
+		return $resource('trade/distributionRule', {}, {
+			saveRule : {
+				url: 'trade/distributionRule/save',
+				method: 'POST'
+			},
+			deleteOne : {
+				url: 'trade/distributionRule/delete/:id',
+				method: 'PUT'
+			},
+			findAllRule : {
+				url: 'trade/distributionRule/page',
+				method: 'GET'
+			},
+			findAllRuleName : {
+				url: 'trade/distributionRule/ruleName',
+				method: 'GET',
+				isArray : true
+			},
+			findCountOfRule : {
+				url: 'trade/distributionRule/count',
+				method: 'GET'
+			}
+		})
 	}]);
 });

+ 6 - 0
src/main/webapp/resources/js/vendor/app.js

@@ -539,6 +539,12 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 			templateUrl : 'static/view/vendor/forstore/vendor_take_self.html',
 			controller: 'vendorTakeSelfCtrl',
 			controllerUrl: 'app/controllers/forstore/vendor_takeSelf_ctrl'
+		})).state('vendor_deliveryRule_add', angularAMD.route({
+			title : '新增配送规则',
+			url: '/vendor_deliveryRule_add?rule',
+			templateUrl : 'static/view/vendor/forstore/vendor_delivery_add_rule.html',
+			controller: 'vendorDeliveryRuleAddCtrl',
+			controllerUrl: 'app/controllers/forstore/vendor_deliveryRule_add_ctrl'
 		})).state('messagePersonal', angularAMD.route({
 			url: '/messagePersonal',
 			templateUrl: 'static/view/vendor/forstore/messagePersonal.html',

+ 125 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_add_ctrl.js

@@ -0,0 +1,125 @@
+define([ 'app/app' ], function(app) {
+    'use strict';
+    app.register.controller('vendorDeliveryRuleAddCtrl', ['$scope', '$rootScope', '$stateParams', 'Enterprise', 'toaster', 'DistributionRule', function ($scope, $rootScope, $stateParams, Enterprise, toaster, DistributionRule) {
+        $rootScope.active = 'vendor_deliveryRule';
+        // $scope.tab = 'deliverRule';
+        $scope.title = '新增配送规则';
+
+        var initData = function () {
+            if ($stateParams.rule){
+                $scope.rule = angular.fromJson($stateParams.rule);
+                $scope.isModify = true;
+                $scope.isActive = $scope.rule.active == 1;
+                if ($scope.rule.orderType){
+                    var orderTypeArray = $scope.rule.orderType.split("-");
+                    $scope.orderType = {
+                        normal : false,
+                        preSale : false,
+                        bill : false
+                    };
+
+                    angular.forEach(orderTypeArray, function (data) {
+                        if (data == 1201){
+                            $scope.orderType.normal = true;
+                        }else if(data == 1202){
+                            $scope.orderType.preSale = true;
+                        }else if(data == 1203){
+                            $scope.orderType.bill = true;
+                        }
+                    })
+                }
+            }else {
+                $scope.isModify = false;
+                $scope.rule = {};
+                $scope.isActive = true;
+                $scope.rule.fareType = 1;
+                $scope.rule.userType = 1301;
+                $scope.orderType = {
+                    normal : true,
+                    preSale : true,
+                    bill : false
+                };
+                Enterprise.getCurrencyByRegisterAddress({}, {} ,function (data) {
+                    if (data){
+                        $scope.rule.currencyName = data.data;
+                    }
+                }, function (error) {
+                    toaster.pop('error', "获取企业币别信息失败");
+                });
+
+                DistributionRule.findCountOfRule({}, {}, function (data) {
+                    if (data){
+                        var num = data.data;
+                        $scope.rule.num = num + 1;
+                    }
+                });
+
+                $scope.fareArray = [];
+                var firstFare = {
+                    start : 0,
+                    fare : 0
+                };
+                var secondFare = {
+                    start : 0,
+                    end : 0,
+                    fare : 0
+                };
+                $scope.fareArray.push(firstFare);
+                $scope.fareArray.push(secondFare);
+            }
+        };
+        initData();
+
+        $scope.saveDistributionRule = function (isAdd) {
+            if (!$scope.rule.shippingMethod){
+                toaster.pop('error', "请选择配送方式");
+                return;
+            }
+            if(!$scope.rule.ruleName){
+                toaster.pop('error', "请填写规则名称");
+                return;
+            }
+            if(!$scope.orderType.normal && !$scope.orderType.preSale && !$scope.orderType.bill){
+                toaster.pop('error', "请选择适用类型");
+                return;
+            }
+            if(!$scope.rule.userType){
+                toaster.pop('error', "请选择适用类型");
+                return;
+            }
+            if($scope.repeatError){
+                toaster.pop('error', "该规则名称已存在,请修改");
+                return;
+            }
+
+            //拼接适用类型
+            var typeArray = [];
+            if ($scope.orderType.normal){
+                typeArray.push(1201);
+            }
+            if ($scope.orderType.preSale){
+                typeArray.push(1202);
+            }
+            if ($scope.orderType.bill){
+                typeArray.push(1203);
+            }
+            $scope.rule.orderType = typeArray.join("-");
+            DistributionRule.saveRule({isAdd:isAdd, isActive:$scope.isActive}, $scope.rule , function (data) {
+                if (data){
+                    // $scope.loadDeliveryRule();
+                }
+            },function (error) {
+                toaster.pop('error', "保存配送规则失败");
+            })
+        };
+
+        $scope.close = function () {
+            window.open("vendor#/vendor_deliveryRule", '_blank');
+        };
+
+        // 切换tab
+        $scope.checkTab = function (t) {
+            $scope.rule.fareType = t;
+        };
+    }]);
+});

+ 86 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_ctrl.js

@@ -1,8 +1,93 @@
 define([ 'app/app' ], function(app) {
     'use strict';
-    app.register.controller('vendorDeliveryRuleCtrl', ['$scope', '$rootScope', function ($scope, $rootScope) {
+    app.register.controller('vendorDeliveryRuleCtrl', ['$scope', '$rootScope', 'ngTableParams', 'DistributionRule', 'BaseService', 'toaster', '$state', function ($scope, $rootScope, ngTableParams, DistributionRule, BaseService, toaster, $state) {
         $rootScope.active = 'vendor_logistics';
         $scope.tab = 'deliverRule';
         $scope.title = '配送规则';
+        $scope.$$rule = {};
+
+        $scope.ruleTableParams = new ngTableParams({
+            page : 1,
+            count : 10,
+            sorting : {
+                num : 'asc'
+            }
+        },{
+            total : 0,
+            getData : function ($defer, params) {
+                var param = BaseService.parseParams(params.url());
+                DistributionRule.findAllRule(param, function (page){
+                    $scope.$$rule.totalElements = page.totalElements;
+                    if(Number(page.totalElements) > 0) {
+                        $scope.$$rule.start = Number(page.size) * (Number(page.number) - 1) + 1;
+                    }else {
+                        $scope.$$rule.start = 0;
+                    }
+                    $scope.$$rule.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
+                    params.total(page.totalElements);
+                    $defer.resolve(page.content);
+                },function () {
+                    toaster.pop('error', '获取配送规则失败');
+                } )
+            }
+        });
+
+        $scope.editRule = function (data) {
+            if (data){
+                $state.go('vendor_deliveryRule_add', {rule : angular.toJson(data)});
+            }else {
+                $state.go('vendor_deliveryRule_add');
+            }
+
+        };
+
+        $scope.changeActive = function (rule, isAdd, active) {
+            DistributionRule.saveRule({isAdd:isAdd,isActive:active}, rule, function (data) {
+                if (data){
+                    $scope.ruleTableParams.reload();
+                }
+            })
+        };
+
+        $scope.showDeleteFrame = function (data) {
+            $scope.deleteFrame = true;
+            $scope.deleteObject = data;
+        };
+
+        //删除地址
+        $scope.deleteRule = function (id) {
+            DistributionRule.deleteOne({id:id}, {}, function () {
+                $scope.deleteFrame = false;
+                toaster.pop('info', '删除自提点地址成功');
+                $scope.loadDeliveryRule();
+            }, function () {
+                toaster.pop('error', '删除自提点地址失败');
+            });
+        };
+
+        /**
+         * 刷新配送规则
+         */
+        $scope.loadDeliveryRule = function () {
+            $scope.ruleTableParams.page(1);
+            $scope.ruleTableParams.reload();
+            $scope.getTakeSelfName();
+        };
+
+        $scope.getTakeSelfName = function () {
+            DistributionRule.findAllRuleName({}, {}, function (data) {
+                if (data){
+                    $scope.nameArray = data;
+                }
+            },function (error) {
+                toaster.pop('error', "获取配送规则名称失败")
+            })
+        };
+
+        //取消删除
+        $scope.cancelDelete = function () {
+            $scope.deleteFrame = false;
+        };
+
     }]);
 });

+ 553 - 0
src/main/webapp/resources/view/vendor/forstore/vendor_delivery_add_rule.html

@@ -0,0 +1,553 @@
+<style>
+	.count .count01 {
+		display: block;
+	}
+	/*新增规则*/
+	.addRule-menu{
+		width: 100%;
+		height: 20px;
+		line-height: 20px;
+		position: absolute;
+		top: 40px;
+	}
+	.addRule-menu span{
+		display: inline-block;
+		text-align: center;
+		width: 112px;
+		height: 20px;
+		background: #eee;
+		border-top-left-radius: 3px;
+		border-top-right-radius: 3px;
+		margin-left: 518px;
+		line-height: 19px;
+		position: relative;
+		bottom: 20px;
+	}
+	.addRule-menu span a{
+		font-size: 12px;
+		color: #999;
+		display: inline-block;
+		height: 20px;
+		width: 75px;
+	}
+	.addRule-menu span.active{
+		background: #fff;
+		border: #82d2fa 1px solid;
+		border-bottom: #fff 1px solid;
+	}
+	.addRule-menu span.active a{
+		color: #666;
+	}
+	.addRule-menu span i{
+		font-size: 14px;
+		color: #999;
+	}
+	.addRule-menu span i:hover,.addRule-menu span a:hover{
+		color: #5078cb;
+	}
+	.com_tab.rule-act ul {
+		border-bottom: #82d2fa 1px solid;
+	}
+	.com_tab.rule-act{
+		margin-bottom: 0;
+	}
+
+	/*内容开始*/
+	.rule-main{
+		width: 100%;
+		margin: 0 auto;
+		background: #fff;
+		padding-bottom: 20px;
+	}
+	.rule-main .rule-title{
+		width: 100%;
+		margin: 0 auto;
+		height: 40px;
+		line-height: 50px;
+		font-size: 14px;
+		color: #5078cb;
+		padding-left: 35px;
+		font-weight: bold;
+	}
+	.rule-main .rule-content{
+		width: 97%;
+		margin: 0 auto;
+		background: #f5f8fe;
+		padding: 10px 20px;
+	}
+	.rule-main .rule-content .row{
+		margin: 0;
+		font-size: 14px;
+		color: #666;
+		line-height: 26px;
+		margin-bottom: 10px;
+	}
+	.rule-main .rule-content .row span{
+		font-size: 14px;
+		line-height: 26px;
+		margin-right: 15px;
+	}
+	.rule-main .rule-content .row span,.rule-main .rule-content .row select,.rule-main .rule-content .row input,.rule-main .rule-content .row label{
+		float: left;
+	}
+	.rule-main .rule-content .row input{
+		text-align: center;
+	}
+	.rule-main .rule-content .row strong{
+		color: #f00;
+		margin-right: 3px;
+	}
+	.rule-main .rule-content .row .form-control{
+		border-radius: 0;
+		height: 26px;
+		padding: 0 10px;
+		line-height: 26px;
+		border: #d4d4d4 1px solid;
+		margin-right: 40px;
+		font-size: 12px;
+	}
+	.rule-main .rule-content .row label{
+		font-weight: inherit;
+		margin-right: 40px;
+	}
+	.rule-main .rule-content .row label input{
+		margin: 7px 8px 0;
+	}
+	.rule-main .rule-content .row select.delivery{
+		width: 130px;
+	}
+	.rule-main .rule-content .row input.sort{
+		width: 100px;
+	}
+	.rule-main .rule-content .row input.rule{
+		width: 350px;
+		margin-right: 0;
+	}
+	.rule-main .rule-content .row select.for-people{
+		width: 220px;
+	}
+	.rule-main .rule-content .row button{
+		width: 70px;
+		height: 22px;
+		line-height: 22px;
+		text-align: center;
+		color: #fff;
+		background: #ff8522;
+		border: none;
+	}
+	.rule-main .rule-content .row .check-act input{
+		display: none;
+	}
+	.rule-main .rule-content .check-act label{
+		width: 12px;
+		height: 12px;
+		margin-right: 5px;
+		display: inline-block;
+		background: url(static/img/icon/check-rule.png) no-repeat;
+		position: relative;
+		top: 7px;
+	}
+	.rule-main .rule-content .radio-1 .check-act label{
+		background-position: 0 0;
+	}
+	.rule-main .rule-content .check-1 .check-act label{
+		background-position: -48px 0;
+	}
+	.rule-main .rule-content .radio-1 input:checked + label{
+		background-position: -15px 0;
+	}
+	.rule-main .rule-content .check-1 input:checked + label{
+		background-position: -31px 0;
+	}
+	.rule-main .rule-content i.notes{
+		font-size: 12px;
+		color: #999;
+	}
+	.rule-main .rule-content .common-style{
+		width: 900px;
+		margin-right: 0 auto;
+	}
+	.rule-main .rule-content .common-style .row{
+		padding: 8px;
+		background: #e8e7e7;
+		min-height: 40px;
+		font-size: 12px;
+	}
+	.rule-main .rule-content .common-style .row span{
+		font-size: 12px;
+	}
+	.rule-main .rule-content .common-style .price-input{
+		min-width: 90px;
+		float: left;
+		position: relative;
+		z-index: 10;
+	}
+	.rule-main .rule-content .common-style .price-input em{
+		float: left;
+		margin: 0 5px;
+	}
+	.rule-main .rule-content .common-style .price-input em i{
+		margin-right: 20px;
+	}
+	.rule-main .rule-content .common-style .price-input i.currency{
+		width: 20px;
+		height: 26px;
+		text-align: center;
+		display: inline-block;
+		background: #b0b0b0;
+		color: #fff;
+		float: left;
+		border-bottom-left-radius: 3px;
+		border-top-left-radius: 3px;
+	}
+	.rule-main .rule-content .common-style .price-input input{
+		max-width: 80px;
+		padding: 0;
+		margin-right: 3px !important;
+		position: relative;
+		/*left: -1px;*/
+		font-size: 12px;
+	}
+	.rule-main .rule-content .common-style .row textarea{
+		width: 600px;
+		height: 84px;
+		font-size: 12px;
+		float: left;
+		margin-right: 0 !important;
+	}
+	.rule-main .rule-content .common-style .row .prompt{
+		float: left;
+		width: 110px;
+		margin-left: 30px;
+		line-height: 20px;
+		color: #999;
+	}
+	.rule-main .rule-content .common-style .row .no-edit{
+		width: 824px;
+		min-height: 40px;
+		background: #e8e7e7;
+		float: right;
+		margin-right: 0 !important;
+		padding-left: 10px;
+		line-height: 40px;
+	}
+	.rule-main .rule-content .common-style .row .edit{
+		width: 824px;
+		margin: 0 auto;
+		float: right;
+	}
+	/*操作取消保存*/
+	.deal-btn{
+		width: 100%;
+		margin: 0 auto;
+		text-align: center;
+		margin-top: 15px;
+	}
+	.deal-btn a{
+		width: 70px;
+		height: 30px;
+		display: inline-block;
+		text-align: center;
+		line-height: 30px;
+		font-size: 14px;
+	}
+	.deal-btn a.off{
+		background: #cdcccc;
+		color: #666;
+		margin-right: 8px;
+	}
+	.deal-btn a.save-other{
+		width: 100px;
+		background: #ff8522;
+		color: #fff;
+		margin-right: 8px;
+	}
+	.deal-btn a.ok{
+		background: #5078cb;
+		color: #fff;
+	}
+	.deal-btn a:hover{
+		background: #337ab7;
+		color: #fff;
+	}
+	/*适用地区*/
+	.rule-main .rule-content .area-content{
+		width: 715px;
+		min-height: 30px;
+		padding: 5px 5px 2px 5px;
+		background: #fff;
+		float: left;
+		margin-right: 30px;
+	}
+	.rule-main .rule-content .area-content a{
+		font-size: 12px;
+		color: #666;
+		display: inline-block;
+		padding: 0 3px;
+		border-radius: 2px;
+		float: left;
+		margin: 1px 1px 6px 1px;
+		margin-right: 3px;
+		height: 22px;
+		background: #e6eefe;
+	}
+	.rule-main .rule-content .area-content a em{
+		display: inline-block;
+		max-width: 150px;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+		line-height: 22px;
+		float: left;
+	}
+	.rule-main .rule-content .area-content a i{
+		color: #cddcfb;
+		margin-left: 3px;
+		font-size: 16px;
+		background: #fff;
+		height: 10px;
+		position: relative;
+		border-radius: 100%;
+	}
+	.rule-main .rule-content .area-content a i:before{
+		position: relative;
+		top: -1px;
+	}
+	.rule-main .rule-content .area-content a:hover{
+		background: #8eb0f5;
+	}
+	.rule-main .rule-content .area-content a:hover em{
+		color: #fff;
+	}
+	.rule-main .rule-content .area-content a:hover i{
+		color: #ef4646;
+	}
+	.rule-main .rule-content .common-style.style-price .row{
+		margin-bottom: 0 !important;
+	}
+	.rule-main .rule-content .common-style.style-price .row .no-edit{
+		padding: 8px 10px;
+	}
+	.rule-main .rule-content .common-style.style-price .row .no-edit p{
+		line-height: 25px;
+	}
+	.rule-main .rule-content .common-style .row{
+		position: relative;
+	}
+	.rule-main .rule-content .common-style .row.dot:before{
+		content: "";
+		width: 15px;
+		height: 15px;
+		display: inline-block;
+		background: #e8e7e7;
+		transform: rotate(-45deg);
+		position: absolute;
+		top: -5px;
+		left: 129px;
+		z-index: 1;
+	}
+	.rule-main .rule-content .common-style.style-price .row.dot:before{
+		left: 260px;
+	}
+</style>
+<!--右侧主体部分-->
+<div class="count user_right fr">
+	<div class="count_center">
+		<div class="com_tab rule-act" style="position: relative">
+			<ul class="fl">
+				<li ng-class="{'active': tab=='deliverRule'}"><a ui-sref="vendor_deliveryRule">配送规则</a></li>
+				<li ng-class="{'active': tab=='distributor'}"><a ui-sref="vendor_distributor">配送商</a></li>
+				<li ng-class="{'active': tab=='takeSelf'}"><a ui-sref="vendor_takeSelf">自提点</a></li>
+				<li ng-class="{'active': tab=='logistic'}"><a ui-sref="vendor_logistics">发货地址</a></li>
+			</ul>
+			<!--匹配结果导航-->
+			<div class="addRule-menu">
+                <span class="active">
+                    <a ng-click="" ng-if="!isModify">新增配送规则</a>
+					<a ng-click="" ng-if="isModify">修改配送规则</a>
+                    <i class="fa fa-remove" ng-click="close()"></i>
+                </span>
+			</div>
+		</div>
+		<!--配送规则-->
+		<div class="rule-main">
+			<div class="rule-title">基本信息</div>
+			<div class="rule-content">
+				<div class="row">
+					<span><strong>*</strong>配送方式</span>
+					<select class="select-adder form-control delivery" ng-model="rule.shippingMethod">
+						<option value="">请选择配送方式</option>
+						<option value="1301">第三方配送</option>
+						<option value="1302">卖家配送</option>
+						<option value="1303">上门自提</option>
+					</select>
+					<span>优先级排序</span>
+					<input type="text" class="form-control sort" ng-model="rule.num">
+					<span><strong>*</strong>规则名称</span>
+					<input type="text" class="form-control rule" style="text-align: left;" ng-model="rule.ruleName">
+				</div>
+				<div class="row radio-1">
+					<span>是否生效</span>
+					<label class="check-act">
+						<input type="radio" id="effect" name="radio" value="true" ng-click="isActive=true" ng-checked="isActive">
+						<label for="effect"></label>
+						生效
+					</label>
+					<label class="check-act">
+						<input type="radio" id="no-effect" name="radio" value="false" ng-click="isActive=false" ng-checked="!isActive">
+						<label for="no-effect"></label>
+						暂不生效
+					</label>
+				</div>
+			</div>
+			<!--适用范围-->
+			<div class="rule-title">适用范围</div>
+			<div class="rule-content">
+				<div class="row check-1">
+					<span><strong>*</strong>适用类型</span>
+					<label class="check-act">
+						<input type="checkbox" id="1" ng-model="orderType.normal"/>
+						<label for="1"></label>
+						普通订单
+					</label>
+					<label class="check-act">
+						<input type="checkbox" id="2" ng-model="orderType.preSale"/>
+						<label for="2"></label>
+						预售订单
+					</label>
+					<label class="check-act">
+						<input type="checkbox" id="3" ng-modle="orderType.bill"/>
+						<label for="3"></label>
+						发票
+					</label>
+					<span>适用用户</span>
+					<select class="select-adder form-control for-people" ng-model="rule.userType">
+						<option value="1301">所有用户</option>
+						<!--<option value="2">所有用户</option>-->
+						<!--<option value="3">所有用户</option>-->
+					</select>
+				</div>
+				<div class="row">
+					<span>适用地区</span>
+					<div class="area-content">
+						<a href="#"><em>广东省 / 东莞市</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>广东省 / 深圳市 / 南山区</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>四川省 / 成都市</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>广东省 / 东莞市</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>广东省 / 深圳市 / 南山区</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>广东省 / 东莞市</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>广东省 / 东莞市</em><i class="fa fa-minus-circle"></i></a>
+						<a href="#"><em>广东省 / 东莞市</em><i class="fa fa-minus-circle"></i></a>
+					</div>
+					<button>选择地区</button>
+					<!--<i class="notes">默认对全部地区生效</i>-->
+				</div>
+			</div>
+			<!--计费方式-->
+			<div class="rule-title">计费方式</div>
+			<div class="rule-content">
+				<div class="row radio-1">
+					<span>计费方式</span>
+					<label class="check-act" ng-click="checkTab(1)">
+						<input type="radio" id="style01" name="radio2" ng-checked="rule.fareType==1"/>
+						<label for="style01"></label>
+						统一规定运费
+					</label>
+					<label class="check-act" ng-click="checkTab(2)">
+						<input type="radio" id="style02" name="radio2" ng-checked="rule.fareType==2"/>
+						<label for="style02"></label>
+						按总金额计算
+					</label>
+				</div>
+				<!--统一规定运费-->
+				<div class="style-regulations common-style" ng-if="rule.fareType==1">
+					<div class="row dot">
+						<span>统一运费</span>
+						<div class="price-input">
+							<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+							<i class="currency" ng-if="rule.currencyName=='USD'">$</i>
+							<input type="text" class="form-control" placeholder="请输入金额" ng-model="rule.uniformPrice" />
+						</div>
+					</div>
+					<div class="row" style="background: none; padding: 0;">
+						<span class="f14">计算说明</span>
+						<!--可编辑-->
+						<!--<div class="edit">-->
+						<!--<textarea class="form-control" placeholder="全国统一运费 $20"></textarea>-->
+						<!--<div class="prompt"><strong>*</strong>公式说明内容将会在购物车中显示,可自行修改</div>-->
+						<!--</div>-->
+						<!--不可以编辑的状态-->
+						<div class="no-edit">全国统一运费
+							<em ng-if="rule.currencyName=='RMB'">¥</em>
+							<em ng-if="rule.currencyName=='USD'">$</em>
+							{{rule.uniformPrice}}
+						</div>
+					</div>
+				</div>
+				<!--按总金额计算-->
+				<div class="style-price common-style" ng-if="rule.fareType==2">
+					<!--<div class="row dot">-->
+						<!--<span>总金额在</span>-->
+						<!--<div class="price-input">-->
+							<!--<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>-->
+							<!--<i class="currency" ng-if="rule.currencyName=='USD'">$</i>-->
+							<!--<input type="text" class="form-control" placeholder="0" />-->
+							<!--<em>以下,</em>-->
+						<!--</div>-->
+						<!--<div class="price-input">-->
+							<!--<em>运费为</em>-->
+							<!--<i class="currency">$</i>-->
+							<!--<input type="text" class="form-control" placeholder="0" />-->
+						<!--</div>-->
+					<!--</div>-->
+					<div class="row" ng-repeat="(data, index) in fareArray" ng-class="{'dot' : index==0}">
+						<span>总金额在</span>
+						<div class="price-input">
+							<em>
+								<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+								<i class="currency" ng-if="rule.currencyName=='USD'">$</i>
+								<i>{{data.start}}</i>以上,
+							</em>
+							<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+							<i class="currency" ng-if="rule.currencyName=='USD'">$</i>
+							<input type="text" class="form-control" placeholder="100" />
+							<em>以下,</em>
+						</div>
+						<div class="price-input">
+							<em>运费为</em>
+							<i class="currency">$</i>
+							<input type="text" class="form-control" placeholder="2000" />
+						</div>
+					</div>
+					<!--<div class="row">-->
+						<!--<span>总金额在</span>-->
+						<!--<div class="price-input">-->
+							<!--<em><i>$1000</i>以上,</em>-->
+						<!--</div>-->
+						<!--<div class="price-input">-->
+							<!--<em>运费为</em>-->
+							<!--<i class="currency">$</i>-->
+							<!--<input type="text" class="form-control" placeholder="2000" />-->
+						<!--</div>-->
+						<!--<button style="margin-left: 20px;">增加范围</button>-->
+					<!--</div>-->
+					<!--计算说明-->
+					<div class="row" style="background: none; padding: 0; margin-top: 10px !important;">
+						<span class="f14">计算说明</span>
+						<div class="no-edit">
+							<p>总金额在 $1000 以下,运费为 $500</p>
+							<p>总金额在 $1000  (含$1000) 以上,运费为 $20</p>
+							<p>总金额在 $2000  (含$2000) 以上,运费为 $0</p>
+						</div>
+					</div>
+				</div>
+			</div>
+			<!--操作取消保存-->
+			<div class="deal-btn">
+				<a ng-click="saveDistributionRule(false)" ng-if="isModify" class="save-other">另存为新规则</a>
+				<a ng-click="" class="off">取消</a>
+				<a ng-click="saveDistributionRule(true)" class="ok">保存</a>
+			</div>
+		</div>
+	</div>
+</div>

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

@@ -1,22 +1,283 @@
 <style>
-	.count .count01 {
+	.delivery-list{
+		width: 1026px;
+		background: #fff;
+	}
+	.delivery-list .content-header{
+		padding-top: 30px;
+		overflow: hidden;
+	}
+	.delivery-list .content-header span{
+		padding-left: 23px;
+		font-size: 14px;
+		color: #333;
+	}
+	.delivery-list .content-header a{
+		float: right;
+		margin-right: 16px;
+		color: #333;
+		font-size: 14px;
+	}
+	.delivery-list .content-header i{
+		color: #32b500;
+		font-size: 16px;
+	}
+	.delivery-list .content-body {
+		width: 1000px;
+		margin: 0 auto;
+		text-align: center;
+	}
+	.delivery-list .content-body table{
+		box-sizing: border-box;
+		margin-top: 15px;
+	}
+	.delivery-list .content-body thead{
+		height: 40px;
+		width: 100%;
+		background: #89aefa;
+	}
+	.delivery-list .content-body thead th{
+		color: #fff;
+		font-weight: normal;
+		font-size: 14px;
+		text-align: center;
+	}
+	.delivery-list .content-body tbody td{
+		font-size: 14px;
+		color: #666;
+		border: 1px solid #dae5fd;
+		height: 45px;
+		vertical-align: middle;
+	}
+	.delivery-list .content-body tbody td a{
+		text-decoration: none;
+		color: #5078cb;
+		font-size: 12px;
+		cursor: pointer;
+	}
+	.delivery-list .content-body tbody td.address {
+		text-align: left;
+	}
+	.delivery-list .content-body tbody td p.switch{
+		margin: 5px 0;
+		padding-left: 10px;
+	}
+	.delivery-list .content-body tbody td p.switch .checkbox {
+		width: 54px;
+		margin: 0 auto;
+		text-align: center;
+		position: relative;
 		display: block;
 	}
+	.delivery-list .content-body tbody td p.switch .checkbox span {
+		width: 46px;
+		height: 12px;
+		display: inline-block;
+		border-radius: 18px;
+		border: #e4e4e4 1px solid;
+		cursor: pointer;
+		position: relative;
+		box-shadow: 1px 1px 5px #eee;
+		background: -webkit-gradient(linear,0% 0%, 0% 100%, from(#E0E0E0), to(#E8E8E8), color-stop(0.5,#F2F2F2));
+		transition: background-color .1s ease-out;
+	}
+	.delivery-list .content-body tbody tr:hover{
+		background: #f1f5ff;
+	}
+	.delivery-list .content-body tbody td p.switch .checkbox.active span{
+		background: #b9cffa;
+	}
+	.delivery-list .content-body tbody td p.switch .checkbox.active span em{
+		left: 34px;
+	}
+	.checkbox span em{
+		position: absolute;
+		width: 16px;
+		top: -4px;
+		left: 0;
+		height: 16px;
+		line-height: 16px;
+		background-color: #fff;
+		border: #eee 1px solid;
+		border-radius: 50%;
+		box-shadow: -1px 2px 1px #999;
+		transition: background-color .1s ease-out;
+		color: #666;
+		font-size: 12px;
+	}
+	.checkbox span em:after{
+		content: '';
+		width: 6px;
+		height: 6px;
+		display: inline-block;
+		background: #dedcdc;
+		border-radius: 100%;
+		position: absolute;
+		top: 4px;
+		left: 4px;
+	}
+	.delivery-list .content-body .count-tip{
+		float: right;
+		font-size: 12px;
+		color: #333;
+	}
+	.table>thead>tr>th{
+		border-bottom: none;
+	}
+	/*防误删*/
+	.com-del-box{
+		position: fixed;
+		z-index: 22;
+		height: 152px;
+		opacity: 1;
+		background-color: white;
+		width: 310px;
+		-webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);
+		box-shadow: 0 5px 15px rgba(0,0,0,.5);
+		margin: -155px 0 0 -75px;
+		top: 55%;
+		left: 50%;
+	}
+	.com-del-box .title{
+		height: 30px;
+		background-color: #5078cb;
+		text-align: right;
+		padding-right: 15px;
+		line-height: 30px;
+	}
+	.com-del-box .title a{
+		color: white;
+		font-size: 16px;
+	}
+	.com-del-box .content{
+		width: 100%;
+		text-align: center;
+		margin: 0 auto;
+	}
+	.com-del-box .content p{
+		line-height: 50px;
+		font-size: 14px;
+		padding-top: 10px;
+	}
+	.com-del-box .content p i{
+		color: #5078cb;
+		font-size: 16px;
+		margin-right: 10px;
+	}
+	.com-del-box .content div{
+		width: 100%;
+		text-align: center;
+		margin: 0 auto;
+	}
+	.com-del-box .content div a{
+		width: 55px;
+		height: 26px;
+		line-height: 26px;
+		display: inline-block;
+		text-align: center;
+		font-size: 14px;
+	}
+	.com-del-box .content div a:first-child{
+		background: #b4b5b9;
+		color: #333;
+		margin-right: 10px;
+	}
+	.com-del-box .content div a:last-child{
+		background: #5078cb;
+		color: #fff;
+	}
+	.com-del-box .content div a:hover{
+		background: #3f7ae3;
+		color: #fff;
+	}
+	.table>tbody>tr.record-num td{
+		padding: 0;
+		border: none;
+	}
+	.table>tbody>tr.record-num:hover{
+		background: none;
+	}
+	.table>tbody+tbody{
+		border-top: 0;
+	}
+	.table>tbody+tbody.no-record-list tr td{
+		border: none;
+	}
 </style>
 <!--右侧主体部分-->
 <div class="count user_right fr">
 	<div class="count_center">
-		<div class="com_tab">
+		<div class="com_tab" style="position: relative">
 			<ul class="fl">
+				<!--<li ng-class="{'active': tab=='deliverRule'}"><a ui-sref="vendor_deliveryRule">配送规则</a></li>-->
 				<li ng-class="{'active': tab=='deliverRule'}"><a ui-sref="vendor_deliveryRule">配送规则</a></li>
 				<li ng-class="{'active': tab=='distributor'}"><a ui-sref="vendor_distributor">配送商</a></li>
 				<li ng-class="{'active': tab=='takeSelf'}"><a ui-sref="vendor_takeSelf">自提点</a></li>
 				<li ng-class="{'active': tab=='logistic'}"><a ui-sref="vendor_logistics">发货地址</a></li>
 			</ul>
+
 		</div>
-		<!--配送规则-->
-		<div>
-			<h1>配送规则界面{{title}}</h1>
+		<!--配送规则列表-->
+		<div class="delivery-list">
+			<div class="content-header">
+				<a ng-click="editRule()"><i class="fa fa-plus-circle"></i>&nbsp;新增配送规则</a>
+				<span>已设置的配送规则</span>
+			</div>
+			<div class="content-body">
+				<table class="table" ng-table="ruleTableParams">
+					<thead>
+					<tr>
+						<th width="80">优先级</th>
+						<th width="120">配送方式</th>
+						<th width="340">规则名称</th>
+						<th width="120">是否生效</th>
+						<th width="120">操作</th>
+					</tr>
+					</thead>
+					<tbody>
+					<tr ng-repeat="rule in $data">
+						<td ng-bind="rule.num">22</td>
+						<td ng-bind="rule.shippingMethod">第三方配送</td>
+						<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><em></em></span>
+								</span>
+								<span class="checkbox active" ng-click="changeActive(rule, true, false)" ng-if="rule.active == 1">
+										<span><em></em></span>
+								</span>
+							</p>
+						</td>
+						<td>
+							<!--ui-sref="vendor_deliveryRule_add({ruleModify:{{turnToJson(rule)}}})"-->
+							<a ng-click="editRule(rule)">修改</a> | <a ng-click="deleteRule(rule)">删除</a>
+						</td>
+					</tr>
+
+					<tr class="record-num" ng-if="rules.length >0">
+						<td colspan="5">
+							<span class="count-tip">显示1-10条,共<em ng-bind="rules.length" style="color: #5078cb">2506</em>条</span>
+						</td>
+					</tr>
+					</tbody>
+					<tbody class="no-record-list" ng-if="rules.length == 0">
+					<tr class="height200">
+						<td colspan="10"><img src="static/img/all/empty-cart.png"><span>暂无配送规则信息!</span></td>
+					</tr>
+					</tbody>
+				</table>
+			</div>
 		</div>
 	</div>
 </div>
+<!--防误删-->
+<div class="com-del-box" ng-if="deleteFrame">
+	<div class="title">
+		<a ng-click="cancelDelete()"><i class="fa fa-close fa-lg"></i></a>
+	</div>
+	<div class="content">
+		<p><i class="fa fa-exclamation-circle"></i>是否要删除此规则?</p>
+		<div><a ng-click="cancelDelete()">取消</a><a ng-click="deleteRule(deleteObject.id)">确认</a></div>
+	</div>
+</div>