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

Merge branch 'function_vendor_modify' into bug

# Conflicts:
#	src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js
#	src/main/webapp/resources/view/usercenter/forstore/buyer_order.html
#	src/main/webapp/resources/view/usercenter/forstore/order_detail.html
#	src/main/webapp/resources/view/usercenter/forstore/order_pay.html
#	src/main/webapp/resources/view/vendor/forstore/purchase_detail.html
#	src/main/webapp/resources/view/vendor/forstore/vendor_order.html
hulh 9 лет назад
Родитель
Сommit
c2e85977ee
73 измененных файлов с 7960 добавлено и 631 удалено
  1. 8 4
      src/main/java/com/uas/platform/b2c/core/constant/Type.java
  2. 4 2
      src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java
  3. 65 0
      src/main/java/com/uas/platform/b2c/logistics/constant/LogisticsType.java
  4. 12 0
      src/main/java/com/uas/platform/b2c/logistics/controller/AddressTakeSelfController.java
  5. 137 0
      src/main/java/com/uas/platform/b2c/logistics/controller/DistributionRuleController.java
  6. 19 0
      src/main/java/com/uas/platform/b2c/logistics/controller/LogisticsOldController.java
  7. 85 0
      src/main/java/com/uas/platform/b2c/logistics/dao/DistributionRuleDao.java
  8. 10 1
      src/main/java/com/uas/platform/b2c/logistics/dao/DistributorSellerDao.java
  9. 279 0
      src/main/java/com/uas/platform/b2c/logistics/model/DistributionRule.java
  10. 14 0
      src/main/java/com/uas/platform/b2c/logistics/model/DistributorSeller.java
  11. 69 0
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrder.java
  12. 60 0
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrderDetail.java
  13. 74 2
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchase.java
  14. 60 0
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchaseDetail.java
  15. 56 0
      src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyArea.java
  16. 49 0
      src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyFare.java
  17. 104 0
      src/main/java/com/uas/platform/b2c/logistics/model/UsableRuleInfo.java
  18. 8 0
      src/main/java/com/uas/platform/b2c/logistics/service/AddressTakeSelfService.java
  19. 99 0
      src/main/java/com/uas/platform/b2c/logistics/service/DistributionRuleService.java
  20. 17 0
      src/main/java/com/uas/platform/b2c/logistics/service/LogisticsOldService.java
  21. 13 17
      src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressServiceImpl.java
  22. 25 0
      src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressTakeSelfServiceImpl.java
  23. 491 0
      src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java
  24. 14 14
      src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributorSellerServiceImpl.java
  25. 15 1
      src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFOrderServiceImpl.java
  26. 60 30
      src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFPurchaseServiceImpl.java
  27. 92 0
      src/main/java/com/uas/platform/b2c/logistics/service/impl/LogisticsOldServiceImpl.java
  28. 2 0
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java
  29. 14 0
      src/main/java/com/uas/platform/b2c/trade/order/controller/PurchaseController.java
  30. 171 101
      src/main/java/com/uas/platform/b2c/trade/order/model/Order.java
  31. 14 0
      src/main/java/com/uas/platform/b2c/trade/order/model/OrderDetail.java
  32. 57 1
      src/main/java/com/uas/platform/b2c/trade/order/model/Purchase.java
  33. 15 0
      src/main/java/com/uas/platform/b2c/trade/order/model/PurchaseDetail.java
  34. 2 0
      src/main/java/com/uas/platform/b2c/trade/order/service/PurchaseService.java
  35. 48 3
      src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java
  36. 24 5
      src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseServiceImpl.java
  37. 24 1
      src/main/webapp/resources/css/common.css
  38. 1 1
      src/main/webapp/resources/css/vendor/sell.css
  39. 9 1
      src/main/webapp/resources/js/common/query/logistics.js
  40. 49 0
      src/main/webapp/resources/js/common/query/logisticsPort.js
  41. 4 0
      src/main/webapp/resources/js/common/query/vendor.js
  42. 3 2
      src/main/webapp/resources/js/common/services.js
  43. 4 4
      src/main/webapp/resources/js/prod/data/city.json
  44. 2 2
      src/main/webapp/resources/js/usercenter/app.js
  45. 3 3
      src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js
  46. 21 0
      src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js
  47. 199 18
      src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js
  48. 1 1
      src/main/webapp/resources/js/usercenter/controllers/forstore/shipping_address_edit_ctrl.js
  49. 8 1
      src/main/webapp/resources/js/vendor/app.js
  50. 20 1
      src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js
  51. 551 0
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_add_ctrl.js
  52. 918 1
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_ctrl.js
  53. 485 98
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_delivery_ctrl.js
  54. 83 47
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_distributor_ctrl.js
  55. 3 3
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_logistics_ctrl.js
  56. 160 2
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_order_ctrl.js
  57. 5 0
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_productOn_ctrl.js
  58. 2 3
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_takeSelf_ctrl.js
  59. 2 1
      src/main/webapp/resources/view/common/modal/edit_address_modal.html
  60. 3 2
      src/main/webapp/resources/view/prod/order_ensure.html
  61. 131 70
      src/main/webapp/resources/view/usercenter/forstore/order_detail.html
  62. 208 27
      src/main/webapp/resources/view/usercenter/forstore/order_pay.html
  63. 1 1
      src/main/webapp/resources/view/usercenter/modal/cancelOrder_modal.html
  64. 85 31
      src/main/webapp/resources/view/vendor/forstore/purchase_detail.html
  65. 619 73
      src/main/webapp/resources/view/vendor/forstore/vendor_delivery.html
  66. 767 0
      src/main/webapp/resources/view/vendor/forstore/vendor_delivery_add_rule.html
  67. 1072 6
      src/main/webapp/resources/view/vendor/forstore/vendor_delivery_rule.html
  68. 20 18
      src/main/webapp/resources/view/vendor/forstore/vendor_distributor.html
  69. 14 5
      src/main/webapp/resources/view/vendor/forstore/vendor_logistics.html
  70. 147 3
      src/main/webapp/resources/view/vendor/forstore/vendor_order.html
  71. 5 3
      src/main/webapp/resources/view/vendor/forstore/vendor_take_self.html
  72. 3 3
      src/main/webapp/resources/view/vendor/left_nav.html
  73. 42 18
      src/main/webapp/resources/view/vendor/modal/vendor_distributor_manage.html

+ 8 - 4
src/main/java/com/uas/platform/b2c/core/constant/Type.java

@@ -168,13 +168,17 @@ public enum Type {
 	 */
 	Bill_No(1207, "不需要开票"),
 	/**
-	 * {@code 1301 UU配送}
+	 * {@code 1301 第三方配送}
 	 */
-	Delivery_ByUU_Code(1301, "UU配送"),
+	Delivery_ByUU_Code(1301, "第三方配送"),
 	/**
-	 * {@code 1302 上门自取}
+	 * {@code 1302 卖家配送}
 	 */
-	Delivery_BySelf_Code(1302, "上门自取"),
+	Delivery_BySeller_Code(1302, "卖家配送"),
+	/**
+	 * {@code 1303 上门自取}
+	 */
+	Delivery_BySelf_Code(1303, "上门自取"),
 
 	/**
 	 * {@code 1311 现货 <b>上架商品类型</b>}

+ 4 - 2
src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java

@@ -173,8 +173,10 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
 				}
 			}
 		}
-		if (needPermission != null)
-			throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
+		if (needPermission != null){
+			return;
+//			throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
+		}
 	}
 
 	@Override

+ 65 - 0
src/main/java/com/uas/platform/b2c/logistics/constant/LogisticsType.java

@@ -0,0 +1,65 @@
+package com.uas.platform.b2c.logistics.constant;
+
+/**
+ * Created by hulh on 2017/9/20.
+ * 物流方面的状态码
+ */
+public enum LogisticsType {
+	/**
+	 * {@code 1201 适用于普通订单}
+	 */
+	Rule_Order_Normal(1201, "普通订单"),
+	/**
+	 * {@code 1202 适用于预售订单}
+	 */
+	Rule_Order_PreSale(1202, "预售订单"),
+	/**
+	 * {@code 1203 适用于发票}
+	 */
+	Rule_Invoice(1203, "发票"),
+	/**
+	 * {@code 1301 适用于所有用户}
+	 */
+	Rule_User_All(1301, "所有用户");
+
+
+	private LogisticsType(int value, String phrase) {
+		this.value = value;
+		this.phrase = phrase;
+	}
+	private final int value;
+
+	private final String phrase;
+
+	public int getValue() {
+		return this.value;
+	}
+
+	public String getPhrase() {
+		return this.phrase;
+	}
+
+	/**
+	 * @param statusCode 状态的编码
+	 * @return 状态
+	 * @throws IllegalArgumentException
+	 *             如果statusCode不存在的话
+	 */
+	public static LogisticsType valueOf(int statusCode) {
+		for (LogisticsType status : values()) {
+			if (status.value == statusCode) {
+				return status;
+			}
+		}
+		throw new IllegalArgumentException("没有与编号 [" + statusCode + "]匹配的状态");
+	}
+
+	/**
+	 * 返回状态码的编号
+	 * @return
+	 */
+	@Override
+	public String toString() {
+		return Integer.toString(value);
+	}
+}

+ 12 - 0
src/main/java/com/uas/platform/b2c/logistics/controller/AddressTakeSelfController.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.logistics.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.logistics.model.AddressTakeSelf;
 import com.uas.platform.b2c.logistics.service.AddressTakeSelfService;
@@ -9,6 +10,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by hulh on 2017/8/11.
@@ -76,4 +78,14 @@ public class AddressTakeSelfController {
 	public List<String> findAllTakeSelfName(){
 		return addressTakeSelfService.findAllTakeSelfName();
 	}
+
+	/**
+	 * 根据店铺list获取自提点信息
+	 * @param info
+	 * @return
+	 */
+	@RequestMapping(value = "/store/takeSelf", method = RequestMethod.POST)
+	public Map<String, List<AddressTakeSelf>> findStoreTakeSelf(@RequestBody List<JSONObject> info){
+		return addressTakeSelfService.findTakeSelfByStore(info);
+	}
 }

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

@@ -0,0 +1,137 @@
+package com.uas.platform.b2c.logistics.controller;
+
+import com.alibaba.fastjson.JSONObject;
+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.model.UsableRuleInfo;
+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;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则controller
+ */
+@RestController
+@RequestMapping(value = "trade/distributionRule")
+public class DistributionRuleController {
+
+	@Autowired
+	private DistributionRuleService distributionRuleService;
+
+	private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+	/**
+	 * 分页获取配送规则
+	 * @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 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
+	 */
+	@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();
+	}
+
+	/**
+	 * 查找配送规则名是否存在
+	 * @param id
+	 * @param ruleName
+	 * @param newSave 是否为另存为
+	 * @return
+	 */
+	@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){
+		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);
+	}
+
+	/**
+	 * 获取已设置生效配送规则的配送方式列表
+	 * @return
+	 */
+	@RequestMapping(value = "/usable/rule", method = RequestMethod.POST)
+	public Map<String, List<UsableRuleInfo>> findUsableRule(String area, @RequestBody List<JSONObject> info){
+		assert logger != null;
+		logger.log("匹配配送规则", "收货地址地区信息为"  + area);
+		return distributionRuleService.findRuleMatchArea(info, area);
+	}
+
+	/**
+	 * 获取指定运费价格
+	 * @return
+	 */
+	@RequestMapping(value = "/fare", method = RequestMethod.POST)
+	public List<UsableRuleInfo> findFareRule(Double price, @RequestBody List<UsableRuleInfo> ruleList){
+		return distributionRuleService.findFareOfRule(ruleList, price);
+	}
+}

+ 19 - 0
src/main/java/com/uas/platform/b2c/logistics/controller/LogisticsOldController.java

@@ -132,4 +132,23 @@ public class LogisticsOldController {
 		logger.log("快递信息管理", "快递公司排序", "更新物流信息 id为" + id + " 的物流信息");
 		return logisticsOldService.updateLogistics(id, logistics, invoiceFuid);
 	}
+
+	/**
+	 * 保存物流信息,以免卖家发货界面没有填写快递信息,可以添加物流信息
+	 * @return
+	 */
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public ResultMap addLogistics(String inid, @RequestBody Logistics logistics){
+		return logisticsOldService.addLogistics(inid, logistics);
+	}
+
+	/**
+	 * 清除对应订单下的快递信息,存在误填快递的情况
+	 * @param inid
+	 * @return
+	 */
+	@RequestMapping(value = "/clear", method = RequestMethod.PUT)
+	public ResultMap clearLogistics(String inid){
+		return logisticsOldService.clearLogistics(inid);
+	}
 }

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

@@ -0,0 +1,85 @@
+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
+	 * @param active
+	 * @return
+	 */
+	List<DistributionRule> findByEnuuAndActiveOrderByNumAsc(Long enuu, Short active);
+
+	/**
+	 * 根据enuu获取所有的配送规则名称
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select d.ruleName from DistributionRule d where d.enuu = :enuu")
+	List<String> findAllRuleNameByEnuu(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据enuu和ruleName查找记录数
+	 * @param enuu
+	 * @param ruleName
+	 * @return
+	 */
+	@Query(value = "select count(1) from DistributionRule d where d.enuu = :enuu and d.ruleName = :ruleName")
+	int findCountRuleName(@Param("enuu") Long enuu, @Param("ruleName") String ruleName);
+
+	/**
+	 * 根据配送方式和enuu获取生效的配送规则列表
+	 * @param enuu
+	 * @param shippingMethod
+	 * @return
+	 */
+	List<DistributionRule> findByEnuuAndShippingMethodAndActive(Long enuu, Integer shippingMethod, Short active);
+
+	/**
+	 * 根据enuu获取生效的配送方式列表
+	 * @param enuu
+	 * @param active
+	 * @return
+	 */
+	@Query(value = "select distinct d.shippingMethod from DistributionRule d where d.enuu = :enuu and d.active = :active")
+	List<Integer> findShippingMethodByEnuuAndActive(Long enuu, Short active);
+}

+ 10 - 1
src/main/java/com/uas/platform/b2c/logistics/dao/DistributorSellerDao.java

@@ -20,7 +20,7 @@ public interface DistributorSellerDao extends JpaSpecificationExecutor<Distribut
 	 * 根据企业enuu查询选中配送商
 	 * @return
 	 */
-	List<DistributorSeller> findByEnuuOrderByCreatetimeDesc(Long enuu);
+	List<DistributorSeller> findByEnuuOrderByNumAsc(Long enuu);
 
 	/**
 	 * 根据指定id删除该配送商
@@ -39,4 +39,13 @@ public interface DistributorSellerDao extends JpaSpecificationExecutor<Distribut
 	 */
 	@Query(value = "select d.companyName from DistributorSeller d where d.enuu=:enuu")
 	List<String> findAllChooseName(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据Enuu删除配送商列表
+	 * @param enuu
+	 */
+	@Transactional
+	@Modifying
+	@Query(value = "delete from DistributorSeller d where d.enuu=:enuu")
+	void deleteDistributorByEnuu(@Param("enuu") Long enuu);
 }

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

@@ -0,0 +1,279 @@
+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;
+
+	/**
+	 * 适用店铺 0-自营,1-寄售
+	 */
+	@Column(name = "rule_store_type")
+	private Short 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 Short getStoreType() {
+		return storeType;
+	}
+
+	public void setStoreType(Short 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;
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	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;
+	}
+}

+ 14 - 0
src/main/java/com/uas/platform/b2c/logistics/model/DistributorSeller.java

@@ -53,6 +53,12 @@ public class DistributorSeller {
 	@Column(name = "seller_createtime")
 	private Date createtime;
 
+	/**
+	 * 配送商排序
+	 */
+	@Column(name = "seller_num")
+	private Integer num;
+
 	public Long getId() {
 		return id;
 	}
@@ -108,4 +114,12 @@ public class DistributorSeller {
 	public void setCreatetime(Date createtime) {
 		this.createtime = createtime;
 	}
+
+	public Integer getNum() {
+		return num;
+	}
+
+	public void setNum(Integer num) {
+		this.num = num;
+	}
 }

+ 69 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrder.java

@@ -93,6 +93,36 @@ public class InvoiceFOrder extends Document implements Serializable {
 	@Column(name = "in_sp_addr", length = 2000)
 	private String jsonSpAddress;
 
+	/**
+	 * 配送类型
+	 */
+	@Column(name = "in_delivery_type")
+	private Integer deliveryType;
+
+	/**
+	 * 适用配送规则
+	 */
+	@Column(name = "in_rule", length = 2000)
+	private String jsonRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "in_take_self", length = 2000)
+	private String jsonTakeSelf;
+
+	/**
+	 * 运费
+	 */
+	@Column(name = "in_fare")
+	private Double fare;
+
+	/**
+	 * 订单备注
+	 */
+	@Column(name = "in_remark", length = 4000)
+	private String inforRemark;
+
 	/**
 	 * 发货地址 这里使用json字符串的形式将收货地址整个存起来
 	 */
@@ -229,6 +259,14 @@ public class InvoiceFOrder extends Document implements Serializable {
 		this.buyeruu = buyeruu;
 	}
 
+	public String getInforRemark() {
+		return inforRemark;
+	}
+
+	public void setInforRemark(String inforRemark) {
+		this.inforRemark = inforRemark;
+	}
+
 	public Long getUasPurcid() {
 		return uasPurcid;
 	}
@@ -261,6 +299,14 @@ public class InvoiceFOrder extends Document implements Serializable {
 		this.orid = orid;
 	}
 
+	public Integer getDeliveryType() {
+		return deliveryType;
+	}
+
+	public void setDeliveryType(Integer deliveryType) {
+		this.deliveryType = deliveryType;
+	}
+
 	public String getJsonSpAddress() {
 		return jsonSpAddress;
 	}
@@ -415,4 +461,27 @@ public class InvoiceFOrder extends Document implements Serializable {
 		this.sendstatus = sendstatus;
 	}
 
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
 }

+ 60 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrderDetail.java

@@ -68,6 +68,18 @@ public class InvoiceFOrderDetail {
 	@Column(name = "go_batch")
 	private String batchCode;
 
+	/**
+	 * 明细的评论
+	 */
+	@Column(name = "detail_remark", length = 4000)
+	private String remark;
+
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/**
 	 * 对应的器件uuid
 	 */
@@ -190,6 +202,18 @@ public class InvoiceFOrderDetail {
 	@Column(name = "detail_currency")
 	private String currency;
 
+	/**
+	 * 商城最长交期
+	 */
+	@Column(name = "go_b2cmaxdelivery")
+	private Short b2cMaxDelivery;
+
+	/**
+	 * 商城最短交期
+	 */
+	@Column(name = "go_b2cmindelivery")
+	private Short b2cMinDelivery;
+
 	public InvoiceFOrderDetail() {
 	}
 
@@ -229,6 +253,10 @@ public class InvoiceFOrderDetail {
 		this.ensurePrice = detail.getEnsurePrice();
 		this.ordetailid = detail.getId();
 		this.status = Status.TOBESHIPPED.value();
+		this.goodsnumber = detail.getGoodsnumber();
+		this.b2cMinDelivery = detail.getB2cMinDelivery();
+		this.b2cMaxDelivery = detail.getB2cMaxDelivery();
+		this.remark = detail.getRemark();
 	}
 
 	public Long getId() {
@@ -263,6 +291,38 @@ public class InvoiceFOrderDetail {
 		this.tax = tax;
 	}
 
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
+	public Short getB2cMaxDelivery() {
+		return b2cMaxDelivery;
+	}
+
+	public void setB2cMaxDelivery(Short b2cMaxDelivery) {
+		this.b2cMaxDelivery = b2cMaxDelivery;
+	}
+
+	public Short getB2cMinDelivery() {
+		return b2cMinDelivery;
+	}
+
+	public void setB2cMinDelivery(Short b2cMinDelivery) {
+		this.b2cMinDelivery = b2cMinDelivery;
+	}
+
 	public Double getTaxes() {
 		return taxes;
 	}

+ 74 - 2
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchase.java

@@ -100,6 +100,12 @@ public class InvoiceFPurchase extends Document implements Serializable {
 	 */
 	@Column(name = "in_sourceid")
 	private String sourceid;
+
+	/**
+	 * 订单备注
+	 */
+	@Column(name = "in_remark", length = 4000)
+	private String infpuRemark;
 	
 	/**
 	 * 是否是UAS的来源
@@ -156,13 +162,31 @@ public class InvoiceFPurchase extends Document implements Serializable {
 	private String currencyName;
 
 	/**
-	 * 价税合计
+	 * 运费
+	 */
+	@Column(name = "in_fare")
+	private Double fare;
+
+	/**
+	 * 适用的配送规则
+	 */
+	@Column(name = "in_rule")
+	private String jsonRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "in_take_self")
+	private String jsonTakeSelf;
+
+	/**
+	 * 价税合计 (商品合计)
 	 */
 	@Column(name = "in_price")
 	private Double price;
 
 	/**
-	 * 确认金额(考虑商城打折的情况)
+	 * 确认金额(考虑商城打折的情况)(包括运费)
 	 */
 	@Column(name = "ensure_price")
 	private Double ensurePrice;
@@ -191,6 +215,12 @@ public class InvoiceFPurchase extends Document implements Serializable {
 	 */
 	@Column(name = "in_proofingid")
 	private Long proofingid;
+
+	/**
+	 * 配送方式
+	 */
+	@Column(name = "in_send_type")
+	private Integer sendType;
 	
 	/**
 	 * 自己送货还是第三方物流送货
@@ -277,6 +307,14 @@ public class InvoiceFPurchase extends Document implements Serializable {
 		this.deliveryType = deliveryType;
 	}
 
+	public Integer getSendType() {
+		return sendType;
+	}
+
+	public void setSendType(Integer sendType) {
+		this.sendType = sendType;
+	}
+
 	public String getSelfDeliveryName() {
 		return selfDeliveryName;
 	}
@@ -515,6 +553,38 @@ public class InvoiceFPurchase extends Document implements Serializable {
 		return this;
 	}
 
+	public String getInfpuRemark() {
+		return infpuRemark;
+	}
+
+	public void setInfpuRemark(String infpuRemark) {
+		this.infpuRemark = infpuRemark;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
 	/**
 	 * @Tip 对象初始化时必须给历史记录赋值
 	 */
@@ -542,5 +612,7 @@ public class InvoiceFPurchase extends Document implements Serializable {
 		this.sourceid = purchase.getPurchaseid();
 		this.storeid = purchase.getStoreid();
 		this.orid = purchase.getOrderid();
+		this.infpuRemark = purchase.getPurchaseRemark();
+		this.fare = purchase.getFare();
 	}
 }

+ 60 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchaseDetail.java

@@ -205,12 +205,36 @@ public class InvoiceFPurchaseDetail {
 	@StatusColumn
 	private Integer status;
 
+	/**
+	 * 明细的评论
+	 */
+	@Column(name = "detail_remark", length = 4000)
+	private String remark;
+
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/**
 	 * 店铺的storeid
 	 */
 	@Column(name = "detail_storid")
 	private String storeid;
 
+	/**
+	 * 商城最长交期
+	 */
+	@Column(name = "go_b2cmaxdelivery")
+	private Short b2cMaxDelivery;
+
+	/**
+	 * 商城最短交期
+	 */
+	@Column(name = "go_b2cmindelivery")
+	private Short b2cMinDelivery;
+
 	public InvoiceFPurchaseDetail() {
 	}
 
@@ -247,6 +271,10 @@ public class InvoiceFPurchaseDetail {
 		this.returnInWeek = puDetail.getReturnInWeek();
 		this.returnQty = puDetail.getReturnQty();
 		this.changeQty = puDetail.getChangeQty();
+		this.b2cMinDelivery = puDetail.getB2cMinDelivery();
+		this.b2cMaxDelivery = puDetail.getB2cMaxDelivery();
+		this.remark = puDetail.getRemark();
+		this.goodsnumber = puDetail.getGoodsnumber();
 	}
 
 	public Long getId() {
@@ -297,6 +325,38 @@ public class InvoiceFPurchaseDetail {
 		this.uuid = uuid;
 	}
 
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
+	public Short getB2cMaxDelivery() {
+		return b2cMaxDelivery;
+	}
+
+	public void setB2cMaxDelivery(Short b2cMaxDelivery) {
+		this.b2cMaxDelivery = b2cMaxDelivery;
+	}
+
+	public Short getB2cMinDelivery() {
+		return b2cMinDelivery;
+	}
+
+	public void setB2cMinDelivery(Short b2cMinDelivery) {
+		this.b2cMinDelivery = b2cMinDelivery;
+	}
+
 	public String getCmpCode() {
 		return cmpCode;
 	}

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

@@ -0,0 +1,56 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 分段地区
+ */
+public class RuleQtyArea {
+	/**
+	 * 地区:中国大陆--港澳台
+	 */
+	private String mainland;
+	/**
+	 * 地区:省
+	 */
+	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;
+	}
+
+	public String getMainland() {
+		return mainland;
+	}
+
+	public void setMainland(String mainland) {
+		this.mainland = mainland;
+	}
+}

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

@@ -0,0 +1,49 @@
+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;
+
+
+	public Double getStart() {
+		return start;
+	}
+
+	public void setStart(Double start) {
+		this.start = start;
+	}
+
+	public Double getEnd() {
+		return end;
+	}
+
+	public void setEnd(Double end) {
+		this.end = end;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+}

+ 104 - 0
src/main/java/com/uas/platform/b2c/logistics/model/UsableRuleInfo.java

@@ -0,0 +1,104 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/9/13.
+ * 适用的配送规则简要信息
+ */
+public class UsableRuleInfo {
+	/**
+	 * 配送id
+	 */
+	private Long id;
+	/**
+	 * 配送规则名称
+	 */
+	private String ruleName;
+	/**
+	 * 实际所需价格
+	 */
+	private Double fare;
+	/**
+	 * 配送方式
+	 */
+	private Integer method;
+	/**
+	 * 卖家enuu
+	 */
+	private Long enuu;
+	/**
+	 * 卖家店铺uuid
+	 */
+	private String uuid;
+	/**
+	 * 配送规则币别
+	 */
+	private String currencyName;
+
+	public UsableRuleInfo(){
+
+	}
+
+	public UsableRuleInfo(DistributionRule rule){
+		this.id = rule.getId();
+		this.ruleName = rule.getRuleName();
+		this.method = rule.getShippingMethod();
+		this.currencyName = rule.getCurrencyName();
+		this.enuu = rule.getEnuu();
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getRuleName() {
+		return ruleName;
+	}
+
+	public void setRuleName(String ruleName) {
+		this.ruleName = ruleName;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
+	public Integer getMethod() {
+		return method;
+	}
+
+	public void setMethod(Integer method) {
+		this.method = method;
+	}
+
+	public Long getEnuu() {
+		return enuu;
+	}
+
+	public void setEnuu(Long enuu) {
+		this.enuu = enuu;
+	}
+
+	public String getCurrencyName() {
+		return currencyName;
+	}
+
+	public void setCurrencyName(String currencyName) {
+		this.currencyName = currencyName;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+}

+ 8 - 0
src/main/java/com/uas/platform/b2c/logistics/service/AddressTakeSelfService.java

@@ -1,10 +1,12 @@
 package com.uas.platform.b2c.logistics.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.logistics.model.AddressTakeSelf;
 import com.uas.platform.core.model.PageParams;
 import org.springframework.data.domain.Page;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by hulh on 2017/8/11.
@@ -48,4 +50,10 @@ public interface AddressTakeSelfService {
 	 * @return
 	 */
 	List<String> findAllTakeSelfName();
+
+	/**
+	 * 根据企业列表获取自提点信息
+	 * @return
+	 */
+	Map<String, List<AddressTakeSelf>> findTakeSelfByStore(List<JSONObject> info);
 }

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

@@ -0,0 +1,99 @@
+package com.uas.platform.b2c.logistics.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import com.uas.platform.b2c.logistics.model.UsableRuleInfo;
+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;
+import java.util.Map;
+
+/**
+ * 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
+	 */
+	ResultMap saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule);
+
+	/**
+	 * 根据id修改配送规则的生效状态
+	 * @param id
+	 * @param isActive
+	 * @return
+	 */
+	ResultMap changeRuleActive(Long id, Boolean isActive);
+
+	/**
+	 * 根据id删除指定配送规则
+	 * @param id
+	 */
+	void deleteOne(Long id);
+
+	/**
+	 * 返回所有的配送规则名称
+	 * @return
+	 */
+	List<String> findAllRuleName();
+
+	/**
+	 * 返回当前enuu下配送规则总数
+	 * @return
+	 */
+	ResultMap findCountRule();
+
+	/**
+	 * 查找是否已存在该名称
+	 * @param id
+	 * @param ruleName
+	 * @param newSave
+	 * @return
+	 */
+	ResultMap containsName(Long id, String ruleName, Boolean newSave);
+
+	/**
+	 * 根据配送方式和地区匹配适用的配送规则
+	 * @param method
+	 * @param area
+	 * @return
+	 */
+	List<DistributionRule> ruleMatchArea(Integer method, String area, String uuid);
+
+	/**
+	 * 获取已设置生效配送规则的配送方式列表
+	 * @return
+	 */
+	List<Integer> findUsableShippingMethod();
+
+	/**
+	 * 根据店铺id集合和地区获取配送规则
+	 * @param uuidArray
+	 * @param area
+	 * @return
+	 */
+	Map<String, List<UsableRuleInfo>> findRuleMatchArea(List<JSONObject> uuidArray, String area);
+
+	/**
+	 * 更新指定运费
+	 * @param ruleList
+	 * @param price
+	 * @return
+	 */
+	List<UsableRuleInfo> findFareOfRule(List<UsableRuleInfo> ruleList, Double price);
+}

+ 17 - 0
src/main/java/com/uas/platform/b2c/logistics/service/LogisticsOldService.java

@@ -60,6 +60,23 @@ public interface LogisticsOldService {
 	 */
 	ResultMap updateLogistics(Long id, Logistics logistics, String invoicFuid);
 
+	/**
+	 * 新增快递信息
+	 *
+	 * @param inid
+	 * @param logistics
+	 * @return
+	 */
+	ResultMap addLogistics(String inid, Logistics logistics);
+
+	/**
+	 * 清除对应订单下的快递信息
+	 *
+	 * @param inid
+	 * @return
+	 */
+	ResultMap clearLogistics(String inid);
+
 	/**
 	 * 传入物流公司和物流单号 生成Logistics
 	 *

+ 13 - 17
src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressServiceImpl.java

@@ -37,7 +37,6 @@ public class AddressServiceImpl implements AddressService {
 	public void delete(Long addid) {
 		if (addressDao.exists(addid)) {
 			Address address = addressDao.findOne(addid);
-			int modifyNum = address.getNum();
 			List<Address> addresses = null;
 			addressDao.delete(addid);
 			int type = address.getType();
@@ -48,12 +47,14 @@ public class AddressServiceImpl implements AddressService {
 				addresses = addressDao.findByEnuuAndTypeAndUsetypeOrderByNumAsc(address.getEnuu(), type, (short)2);
 			}
 			if (!CollectionUtils.isEmpty(addresses) && addresses.size() > 0) {
-				int num = 0;
-				if (modifyNum == 1) {
-					num = 1;
-				}
-				for (Address add : addresses){
-					add.setNum(++num);
+				if (addresses.size() == 1){
+					Address add = addresses.get(0);
+					add.setNum(1);
+				}else {
+					int num = addresses.get(0).getNum();
+					for (Address add : addresses){
+						add.setNum(num++);
+					}
 				}
 			}
 			addressDao.save(addresses);
@@ -71,7 +72,6 @@ public class AddressServiceImpl implements AddressService {
 	@Override
 	public void setTop(Long addid, boolean setTop) {
 		Address address = addressDao.findOne(addid); //查询操作的Address
-//		System.out.println("setTop=" + setTop);
 		Long useruu = address.getUseruu();
 		int type = address.getType();
 		List<Address> addresses = null;
@@ -84,7 +84,6 @@ public class AddressServiceImpl implements AddressService {
 		long modifyId = address.getId().longValue();
 		int modifyNum = address.getNum().intValue();
 		if (setTop){
-//			System.out.println("设为默认地址情况");
 			for (Address add : addresses) {
 				if (add.getId().longValue() == modifyId) {
 					add.setNum(1);
@@ -95,14 +94,12 @@ public class AddressServiceImpl implements AddressService {
 			}
 		}else {
 			if (modifyNum == 1){ //取消默认地址
-//				System.out.println("取消默认地址情况");
 				for (Address add : addresses) { //空出默认地址位置
 					add.setNum(++num);
 				}
 			}else {
 				int firstNum = addresses.get(0).getNum();
 				if (firstNum == 1){ //有默认地址情况
-//					System.out.println("有默认地址新增地址情况");
 					num++; //空出默认地址位置
 					for (Address add : addresses) {
 						if (add.getNum() != 1){
@@ -115,7 +112,6 @@ public class AddressServiceImpl implements AddressService {
 						}
 					}
 				}else { //没有默认地址情况
-//					System.out.println("没有默认地址新增地址情况");
 					num++; //空出默认地址位置
 					for (Address add : addresses) {
 						if (add.getId().longValue() != modifyId){
@@ -156,17 +152,17 @@ public class AddressServiceImpl implements AddressService {
 				address.setUsetype((short)2);
 				num = addressDao.getCountByEnuuAndTypeAndUsetype(user.getEnterprise().getUu(), address.getType(), address.getUsetype());
 			}
-			address.setNum(num == null ? 1 : ++num);
+			address.setNum(num == 0 ? 1 : ++num);
 		}
 		Long modifyId = address.getId();
 		Address add = save(address);
-		System.out.println(address.getId());
+		if (modifyId == null && add.getNum().intValue() == 1){
+			isSetTop = true;
+		}
 		if(modifyId == null || isSetTop) { //只有新增加的地址 或者需要被置顶的地址 才需要重新排序。
-//			System.out.println("新增地址或设为默认地址");
 			setTop(add.getId(), isSetTop);
 		}
-		if (address.getNum() == 1 && !isSetTop) { //取消默认地址的时候需要重新排序
-//			System.out.println("取消默认地址");
+		if (address.getNum().intValue() == 1 && !isSetTop) { //取消默认地址的时候需要重新排序
 			setTop(add.getId(), isSetTop);
 		}
 		return add;

+ 25 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressTakeSelfServiceImpl.java

@@ -1,9 +1,13 @@
 package com.uas.platform.b2c.logistics.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.logistics.dao.AddressTakeSelfDao;
 import com.uas.platform.b2c.logistics.model.AddressTakeSelf;
 import com.uas.platform.b2c.logistics.service.AddressTakeSelfService;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +21,9 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by hulh on 2017/8/11.
@@ -25,9 +31,13 @@ import java.util.List;
 @Service
 @Transactional
 public class AddressTakeSelfServiceImpl implements AddressTakeSelfService {
+
 	@Autowired
 	private AddressTakeSelfDao addressTakeSelfDao;
 
+	@Autowired
+	private StoreInDao storeInDao;
+
 	@Override
 	public AddressTakeSelf saveTakeSelf(AddressTakeSelf addressTakeSelf, Boolean isActive) {
 		if (addressTakeSelf.getId() == null){
@@ -81,4 +91,19 @@ public class AddressTakeSelfServiceImpl implements AddressTakeSelfService {
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
 		return addressTakeSelfDao.findTakenameByEnuu(enuu);
 	}
+
+	@Override
+	public Map<String, List<AddressTakeSelf>> findTakeSelfByStore(List<JSONObject> info) {
+		Map<String, List<AddressTakeSelf>> map = new HashMap<>();
+		for (JSONObject object : info){
+			StoreIn store = storeInDao.findByUuid(object.getString("uuid"));
+			if (store == null){
+				throw new IllegalOperatorException("店铺信息丢失,请刷新后重试");
+			}
+			Long enuu = store.getEnUU();
+			List<AddressTakeSelf> list = addressTakeSelfDao.findByEnuuOrderByCreatetimeDesc(enuu);
+			map.put(object.getString("uuid"), list);
+		}
+		return map;
+	}
 }

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

@@ -0,0 +1,491 @@
+package com.uas.platform.b2c.logistics.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+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.model.RuleQtyFare;
+import com.uas.platform.b2c.logistics.model.UsableRuleInfo;
+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;
+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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则实现类
+ */
+@Service
+@Transactional
+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);
+		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);
+	}
+
+	/**
+	 * 保存或修改配送规则
+	 * @param isAdd true-保存,false-另存
+	 * @param isActive
+	 * @param rule
+	 * @return
+	 */
+	@Override
+	public ResultMap saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule) {
+		if (rule.getShippingMethod() == null){
+			return new ResultMap(CodeType.NO_INFO, "请选择配送方式");
+		}
+		if (rule.getRuleName() == null || rule.getRuleName().isEmpty()){
+			return new ResultMap(CodeType.NO_INFO, "请填写规则名称");
+		}
+		if (CollectionUtils.isEmpty(rule.getAreas())){
+			return new ResultMap(CodeType.NO_INFO, "您还没有选择任何地区");
+		}
+		if (rule.getFareType() == 2 && CollectionUtils.isEmpty(rule.getFares())){
+			return new ResultMap(CodeType.NO_INFO, "请完善计费方式");
+		}
+		if (rule.getId() == null){ //新增配送规则,初始化数据
+			Long uu = SystemSession.getUser().getUserUU();
+			Long enuu = SystemSession.getUser().getEnterprise().getUu();
+			rule.setUseruu(uu);
+			rule.setEnuu(enuu);
+
+			if (enuu.longValue() == sysConf.getEnUU().longValue()){
+				rule.setStoreType(ShortConstant.YES_SHORT);
+			}else {
+				rule.setStoreType(ShortConstant.NO_SHORT);
+			}
+		}
+		if (isActive){
+			rule.setActive(ShortConstant.YES_SHORT);
+		}else {
+			rule.setActive(ShortConstant.NO_SHORT);
+		}
+		if (!isAdd){ //若为另存为,则将主键id设为空
+			if (rule.getId() != null){
+				rule.setId(null);
+			}
+		}
+		int count = distributionRuleDao.findCountByEnuu(rule.getEnuu());
+		int num = count == 0 ? 1 : ++count;
+		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() == null){
+				rule.setNum(oldRule.getNum());
+			}else {
+				if (rule.getNum() < num-1){
+					sortRule(rule.getId(), rule.getNum());
+				}else {
+					sortRule(rule.getId(), num-1);
+					rule.setNum(num-1);
+				}
+			}
+		}
+		distributionRuleDao.save(rule);
+		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);
+	}
+
+	/**
+	 * 修改,排序已有配送规则列表,本配送规则不参与排序,空出num位置
+	 * @param id
+	 * @param num
+	 */
+	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);
+	}
+
+	/**
+	 * 新增,排序已有配送规则列表,空出num位置
+	 * @param num
+	 */
+	public void sortRule(int num){
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int start = 1;
+		for (DistributionRule rule : ruleList){
+			if (start == num){
+				start++;
+			}
+			rule.setNum(start++);
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	@Transactional
+	@Override
+	public void deleteOne(Long id) {
+		distributionRuleDao.deleteOneById(id);
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int num = 1;
+		for (DistributionRule rule : ruleList){
+			rule.setNum(num++);
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	@Override
+	public List<String> findAllRuleName() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		return distributionRuleDao.findAllRuleNameByEnuu(enuu);
+	}
+
+	/**
+	 * 查询已设置配送规则的数量
+	 * @return
+	 */
+	@Override
+	public ResultMap findCountRule() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		int count = distributionRuleDao.findCountByEnuu(enuu);
+		return ResultMap.success(count);
+	}
+
+	/**
+	 * 根据配送规则名称查询是否已存在
+	 * @param id
+	 * @param ruleName 配送规则名称
+	 * @param newSave 是否为另存,true-另存 false-保存
+	 * @return
+	 */
+	@Override
+	public ResultMap containsName(Long id, String ruleName, Boolean newSave) {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		Boolean repeat = null;
+		if (id != null){
+			//修改配送规则情况,分保存和另存为两种
+			if (newSave){ //另存为
+				int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
+				if (count != 0){
+					repeat = true;
+				}else {
+					repeat = false;
+				}
+			}else { //保存
+				DistributionRule rule = distributionRuleDao.findOne(id);
+				if (ruleName.equals(rule.getRuleName())){
+					repeat = false;
+				}else {
+					int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
+					if (count != 0){
+						repeat = true;
+					}else {
+						repeat = false;
+					}
+				}
+			}
+		}else { //新增配送规则情况
+			int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
+			if (count != 0){
+				repeat = true;
+			}else {
+				repeat = false;
+			}
+		}
+		return ResultMap.success(repeat);
+	}
+
+	@Override
+	public List<Integer> findUsableShippingMethod() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		return distributionRuleDao.findShippingMethodByEnuuAndActive(enuu, ShortConstant.YES_SHORT);
+	}
+
+	/**
+	 * 更新配送规则的运费
+	 * @param ruleList
+	 * @param price
+	 * @return
+	 */
+	@Override
+	public List<UsableRuleInfo> findFareOfRule(List<UsableRuleInfo> ruleList, Double price) {
+		if (CollectionUtils.isEmpty(ruleList)){
+			throw new IllegalOperatorException("配送规则信息丢失,请刷新后重试");
+		}
+		for (UsableRuleInfo info : ruleList){
+			DistributionRule rule = distributionRuleDao.findOne(info.getId());
+			if (rule == null){
+				throw new IllegalOperatorException("配送规则信息丢失,请刷新后重试");
+			}
+			Double fare = getFareOfRule(rule, price);
+			info.setFare(fare);
+		}
+		return ruleList;
+	}
+
+	/**
+	 * 返回所有店铺适用的配送规则
+	 * @param uuidArray
+	 * @param area
+	 * @return
+	 */
+	@Override
+	public Map<String, List<UsableRuleInfo>> findRuleMatchArea(List<JSONObject> uuidArray, String area){
+		if (area == null){
+			throw new IllegalOperatorException("地址信息缺失,请重新确认收货地址");
+		}
+		Map<String, List<UsableRuleInfo>> resultMap = new HashMap<>();
+		for (JSONObject object : uuidArray){
+			Double price = Double.parseDouble(object.getString("fare"));
+			List<UsableRuleInfo> list = findRuleInStore(object.getString("uuid"), area, price);
+			resultMap.put(object.getString("uuid"), list);
+		}
+		return resultMap;
+	}
+
+	/**
+	 * 返回该店铺适用的配送规则
+	 * @param uuid
+	 * @param area
+	 * @return
+	 */
+	public List<UsableRuleInfo> findRuleInStore(String uuid, String area, Double price){
+		StoreIn store = storeInDao.findByUuid(uuid);
+		if (store == null){
+			throw new IllegalOperatorException("店铺信息缺失,请刷新后重试");
+		}
+		List<DistributionRule> allRuleList = distributionRuleDao.findByEnuuAndActiveOrderByNumAsc(store.getEnUU(), ShortConstant.YES_SHORT);
+		List<UsableRuleInfo> ruleInfoList = new ArrayList<>();
+		List<Integer> methodList = new ArrayList<>();
+		for (DistributionRule rule : allRuleList){
+			if (!methodList.contains(rule.getShippingMethod())){
+				List<RuleQtyArea> qtyArea = rule.getAreas();
+				//转化分段地区信息
+				Map<String, Map<String, List<String>>> resultMap = convertArea(qtyArea);
+				//是否包含改地区信息
+				boolean isContains = containsArea(resultMap, area);
+				if (isContains){
+					methodList.add(rule.getShippingMethod());
+					UsableRuleInfo info = new UsableRuleInfo(rule);
+					Double fare = getFareOfRule(rule, price);
+					info.setFare(fare);
+					info.setUuid(uuid);
+					ruleInfoList.add(info);
+				}
+			}
+			if (methodList.size() == 3){
+				break;
+			}
+		}
+		return ruleInfoList;
+	}
+
+	/**
+	 * 根据配送方式获取匹配地区的配送规则列表
+	 * @param method
+	 * @param area
+	 * @param uuid
+	 * @return
+	 */
+	@Override
+	public List<DistributionRule> ruleMatchArea(Integer method, String area, String uuid) {
+		StoreIn store = storeInDao.findByUuid(uuid);
+
+		List<DistributionRule> resultList = new ArrayList<>();
+		// 根据配送方式找出所有生效的配送规则
+		List<DistributionRule> methodList = distributionRuleDao.findByEnuuAndShippingMethodAndActive(store.getEnUU(), method, ShortConstant.YES_SHORT);
+
+		for (DistributionRule rule : methodList){
+			List<RuleQtyArea> qtyArea = rule.getAreas();
+			Map<String, Map<String, List<String>>> resultMap = convertArea(qtyArea);
+			boolean isContains = containsArea(resultMap, area);
+			if (isContains){
+				resultList.add(rule);
+			}
+		}
+		return resultList;
+	}
+
+	/**
+	 * 获取运费最小的配送规则
+	 * @param price
+	 * @return
+	 */
+	public DistributionRule getRuleOInMinFare(Double price){
+		//获取匹配地区的配送规则列表
+		List<DistributionRule> matchList = null;
+		DistributionRule minRule = null; //最少运费的配送规则
+		Double minFare = getFareOfRule(matchList.get(0), price);
+		for (int i = 1; i<matchList.size(); i++){
+			Double fare = getFareOfRule(matchList.get(i), price);
+			if (fare < minFare){
+				minRule = matchList.get(i);
+				minFare = fare;
+			}
+		}
+		return minRule;
+	}
+
+	/**
+	 * 获取指定配送规则的运费
+	 * @param rule
+	 * @return
+	 */
+	public Double getFareOfRule(DistributionRule rule, Double price){
+		Double needFare = null;
+		if (rule.getFareType() == 1){
+			needFare = rule.getUniformPrice();
+		}else {
+			for (RuleQtyFare fare : rule.getFares()){
+				if (fare.getStart() <= price){
+					if (fare.getEnd() != null){
+						if (fare.getEnd() > price){
+							needFare = fare.getFare();
+						}
+					}else {
+						needFare = fare.getFare();
+					}
+				}
+			}
+		}
+		return needFare;
+	}
+
+	/**
+	 * 根据分段地区集合转化为可用的Map集合
+	 *
+	 * @param qtyArea 分段地区集合
+	 * @return
+	 */
+	public Map<String, Map<String, List<String>>> convertArea(List<RuleQtyArea> qtyArea){
+		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是否包含省字段
+				Map<String, List<String>> cityMap = null;
+				if (!areaMap.containsKey(a.getProvince())){
+					cityMap = new HashMap<>();
+					areaMap.put(a.getProvince(), cityMap);
+				}
+				cityMap = areaMap.get(a.getProvince());
+				if (a.getCity() != null && a.getCity().length() != 0){
+					//判断该RuleQtyArea是否包含市字段
+					List<String> areaList = null;
+					if (!cityMap.containsKey(a.getCity())){
+						areaList = new ArrayList<>();
+						cityMap.put(a.getCity(), areaList);
+					}
+					areaList = cityMap.get(a.getCity());
+					if (a.getArea() != null && a.getArea().length() != 0){
+						if (!areaList.contains(a.getArea())){
+							areaList.add(a.getArea());
+						}
+					}
+				}
+			}
+		}
+		return areaMap;
+	}
+
+	/**
+	 * 是否匹配该地区
+	 *
+	 * @param resultMap 转化的地区map集合
+	 * @param area 要匹配的地区
+	 * @return
+	 */
+	public boolean containsArea(Map<String, Map<String, List<String>>> resultMap, String area){
+		String[] areaArray = area.split(SplitChar.COMMA); //拆分地区数据,获取省,市,区的数组
+		if (resultMap.containsKey(areaArray[0])){ //是否包含该省
+			Map<String, List<String>> cityMap = resultMap.get(areaArray[0]);
+			if (cityMap.isEmpty()){ //没有市数据
+				return true;
+			}else {
+				if (cityMap.containsKey(areaArray[1])){ //是否包含该市
+					List<String> areaList = cityMap.get(areaArray[1]);
+					if (areaList.isEmpty()){ //没有区数据
+						return true;
+					}else {
+						if (areaList.contains(areaArray[2])){
+							return true;
+						}else {
+							return false;
+						}
+					}
+				}else {
+					return false;
+				}
+			}
+		}else {
+			return false;
+		}
+	}
+}

+ 14 - 14
src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributorSellerServiceImpl.java

@@ -27,7 +27,7 @@ public class DistributorSellerServiceImpl implements DistributorSellerService {
 	@Override
 	public List<DistributorSeller> findAllChooseDistributor() {
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
-		return distributorSellerDao.findByEnuuOrderByCreatetimeDesc(enuu);
+		return distributorSellerDao.findByEnuuOrderByNumAsc(enuu);
 	}
 
 	@Override
@@ -35,22 +35,22 @@ public class DistributorSellerServiceImpl implements DistributorSellerService {
 		List<DistributorSeller> savaList = new ArrayList<>();
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
 		Long useruu = SystemSession.getUser().getUserUU();
-		List<String> chooseList = distributorSellerDao.findAllChooseName(enuu);
+		distributorSellerDao.deleteDistributorByEnuu(enuu);//保存前先清空表
+		int num = 1;
 		for (JSONObject object : objects){
-			if (!chooseList.contains(object.getString("companyName"))){
-				DistributorSeller distributor = new DistributorSeller();
-				if (object.getString("code") != null){
-					distributor.setIsKdn((short)1);
-				}else {
-					distributor.setIsKdn((short)0);
-				}
+			DistributorSeller distributor = new DistributorSeller();
+			if (object.getString("code") != null){
+				distributor.setIsKdn((short)1);
 				distributor.setCode(object.getString("code"));
-				distributor.setCompanyName(object.getString("companyName"));
-				distributor.setUseruu(useruu);
-				distributor.setEnuu(enuu);
-				distributor.setCreatetime(new Date());
-				savaList.add(distributor);
+			}else {
+				distributor.setIsKdn((short)0);
 			}
+			distributor.setCompanyName(object.getString("companyName"));
+			distributor.setUseruu(useruu);
+			distributor.setEnuu(enuu);
+			distributor.setCreatetime(new Date());
+			distributor.setNum(num++);
+			savaList.add(distributor);
 		}
 		return distributorSellerDao.save(savaList);
 	}

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

@@ -170,7 +170,7 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
 			order.setLgtId(inF.getLogistics().getId());
 			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 			order.setDeliverTime(sdf.format(new Date()));
-			order.setDeliverytype(Type.Delivery_ByUU_Code.value());
+//			order.setDeliverytype(Type.Delivery_ByUU_Code.value());
 			order.setJsonSdAddress(addr);
 			Set<OrderDetail> orderDetails = order.getOrderDetails();
 			for (OrderDetail orderDetail : orderDetails) {
@@ -351,12 +351,26 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
 		if(detno == 1) {
 			throw new IllegalOperatorException("当前订单的明细状态没有已出货的状态,不能转出货单");
 		}
+		invoice.setFare(order.getFare());
+		//设置配送规则和自提点信息
+		if (order.getJsonRule() != null){
+			invoice.setJsonRule(order.getJsonRule());
+		}
+		if (order.getJsonTakeSelf() != null){
+			invoice.setJsonTakeSelf(order.getJsonTakeSelf());
+		}
 		invoice.setTaxes(taxes);
 		invoice.setPrice(prices);
 		invoice.setNumber(number);
+		/**
+		 * 加入运费
+		 */
+		ensurePrice = DoubleArith.add(ensurePrice, invoice.getFare());
 		invoice.setEnsurePrice(ensurePrice);
 		invoice.setTobeshipped(userUU);
 		invoice.setInvoiceFOrderDetails(iDetails);
+		invoice.setInforRemark(order.getOrderRemark());
+		invoice.setDeliveryType(order.getDeliverytype());
 
 		if (invoice.getUasPurcid() != null) {
 			// 手动将平台状态改成202(要考虑一点,UAS和平台做的单据是否都可以这样做)

+ 60 - 30
src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFPurchaseServiceImpl.java

@@ -42,6 +42,7 @@ 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 org.springframework.util.NumberUtils;
 import org.springframework.util.StringUtils;
 
 import javax.management.OperationsException;
@@ -118,6 +119,14 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 		Long uu = SystemSession.getUser().getUserUU();
 		Date date = new Date();
 		InvoiceFPurchase inFpu = new InvoiceFPurchase(purchase);
+
+		//保存适用配送规则和自提点信息
+		if (purchase.getJsonRule() != null){
+			inFpu.setJsonRule(purchase.getJsonRule());
+		}
+		if (purchase.getJsonTakeSelf() != null){
+			inFpu.setJsonTakeSelf(purchase.getJsonTakeSelf());
+		}
 		// 生成出货单号
 		String invoiceid = createNumberService.generateVoucherId(EncodingRulesConstant.INVOICE_FROMPURCHASE,
 				"trade$invoice_fmpu", 8);
@@ -166,10 +175,14 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 		inFpu.setTaxes(taxes);
 		price = NumberUtil.pricesScaleTwo(price);
 		inFpu.setPrice(price);
+		//添加运费
+		ensurePrice = NumberUtil.add(ensurePrice, inFpu.getFare());
 		ensurePrice = NumberUtil.pricesScaleTwo(ensurePrice);
 		inFpu.setEnsurePrice(ensurePrice);
 		inFpu.setNumber(number);
 		inFpu.setStatusToBeShipped(uu);
+		inFpu.setInfpuRemark(purchase.getPurchaseRemark());
+		inFpu.setSendType(purchase.getSendType());
 		inFpu.setInvoiceFPurchaseDetails(IpDetails);
 
 		inFpu = inFpuDao.save(inFpu);
@@ -247,9 +260,13 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 		Long userUU = SystemSession.getUser().getUserUU();
 		InvoiceFPurchase invoiceFPurchase = inFpuDao.getOne(id);
 		Purchase purchase = purchaseDao.findOne(invoiceFPurchase.getPuid());
-		String deliveryType = sendInfo.getString("deliveryType");
-		
-		if(StringUtils.isEmpty(deliveryType)) {
+//		String deliveryType = sendInfo.getString("deliveryType");
+		Integer sendType = Integer.parseInt(sendInfo.getString("sendType"));
+
+//		if(StringUtils.isEmpty(deliveryType)) {
+//			return new ResultMap(CodeType.NO_INFO, "配送方式的信息为空,请重新操作");
+//		}
+		if (sendType == null){
 			return new ResultMap(CodeType.NO_INFO, "配送方式的信息为空,请重新操作");
 		}
 		
@@ -262,31 +279,37 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 				&&purchase.getLaunchPuExApplyStatus().equals(AfterSaleStatus.FINISHED)) {
 			return new ResultMap(CodeType.NOT_PERMIT, "您的异常申请流程还不是已完成或已取消状态,不能做发货的动作!");
 		}
-		
-		if("logistics".equals(deliveryType)) {
-			JSONObject  logisjson= sendInfo.getJSONObject("logisticsInfo");
-			Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisjson.getString("companyName"), logisjson.getString("number"));
+		JSONObject  logisticsJson = sendInfo.getJSONObject("logisticsInfo");
+		if (logisticsJson != null){
+			Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisticsJson.getString("companyName"), logisticsJson.getString("number"));
 			invoiceFPurchase.setLogistics(logistics);
-
-		}else if("selfDelivery".equals(deliveryType)){
-			JSONObject  logisticsJson= sendInfo.getJSONObject("selfDeliveryPerson");
-			String name = logisticsJson.getString("name");
-			if(StringUtils.isEmpty(name)) {
-				return new ResultMap(CodeType.NO_INFO, "送货人信息为空,请重新操作");
-			}
-			String phone = logisticsJson.getString("phone");
-			if(StringUtils.isEmpty(phone)) {
-				return new ResultMap(CodeType.NO_INFO, "送货人电话信息为空,请重新操作");
-			}
-			invoiceFPurchase.setSelfDeliveryName(name);
-			invoiceFPurchase.setSelfDeliveryPhone(phone);
 		}
+//		if("logistics".equals(deliveryType)) {
+//			JSONObject  logisjson= sendInfo.getJSONObject("logisticsInfo");
+//			Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisjson.getString("companyName"), logisjson.getString("number"));
+//			invoiceFPurchase.setLogistics(logistics);
+//
+//		}else if("selfDelivery".equals(deliveryType)){
+//			JSONObject  logisticsJson= sendInfo.getJSONObject("selfDeliveryPerson");
+//			String name = logisticsJson.getString("name");
+//			if(StringUtils.isEmpty(name)) {
+//				return new ResultMap(CodeType.NO_INFO, "送货人信息为空,请重新操作");
+//			}
+//			String phone = logisticsJson.getString("phone");
+//			if(StringUtils.isEmpty(phone)) {
+//				return new ResultMap(CodeType.NO_INFO, "送货人电话信息为空,请重新操作");
+//			}
+//			invoiceFPurchase.setSelfDeliveryName(name);
+//			invoiceFPurchase.setSelfDeliveryPhone(phone);
+//		}
+
 		String jsonSdAddress = sendInfo.getString("jsonSdAddress");
 		if(StringUtils.isEmpty(jsonSdAddress)) {
 			return new ResultMap(CodeType.NO_INFO, "发货人的地址信息为空,请重新操作");
 		}
 		invoiceFPurchase.setJsonSdAddress(jsonSdAddress);
-		invoiceFPurchase.setDeliveryType(deliveryType);
+//		invoiceFPurchase.setDeliveryType(deliveryType);
+		invoiceFPurchase.setSendType(sendType);
 		
 		invoiceFPurchase.setStatusInBound(userUU);
 		Set<InvoiceFPurchaseDetail> invoiceFPurchaseDetails = invoiceFPurchase.getInvoiceFPurchaseDetails();
@@ -306,13 +329,17 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 			}
 		}
 		purchase.setStatusInBound(userUU);
-		if("logistics".equals(inFpu.getDeliveryType())) {
+		if (inFpu.getLogistics() != null){
 			purchase.setLgtId(inFpu.getLogistics().getId());
-		}else {
-			purchase.setSelfDeliveryName(inFpu.getSelfDeliveryName());
-			purchase.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
 		}
-		purchase.setDeliveryType(inFpu.getDeliveryType());
+//		if("logistics".equals(inFpu.getDeliveryType())) {
+//			purchase.setLgtId(inFpu.getLogistics().getId());
+//		}else {
+//			purchase.setSelfDeliveryName(inFpu.getSelfDeliveryName());
+//			purchase.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
+//		}
+//		purchase.setDeliveryType(inFpu.getDeliveryType());
+
 		purchase.setJsonSdAddress(inFpu.getJsonSdAddress());
 		purchase.setSendName(SystemSession.getUser().getUserName());
 		purchase.setSenduu(SystemSession.getUser().getUserUU());
@@ -325,12 +352,15 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 			if(order == null) {
 				return new ResultMap(CodeType.NOT_PERMIT, "您订单的信息有误,请重新提交");
 			}
-			if("logistics".equals(inFpu.getDeliveryType())) {
+			if (inFpu.getLogistics() != null){
 				order.setLgtId(inFpu.getLogistics().getId());
-			}else {
-				order.setSelfDeliveryName(inFpu.getSelfDeliveryName());
-				order.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
 			}
+//			if("logistics".equals(inFpu.getDeliveryType())) {
+//				order.setLgtId(inFpu.getLogistics().getId());
+//			}else {
+//				order.setSelfDeliveryName(inFpu.getSelfDeliveryName());
+//				order.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
+//			}
 			order.setJsonSdAddress(inFpu.getJsonSdAddress());
 			order.setStatusInBound(userUU);
 			for (OrderDetail detail : order.getOrderDetails()) {

+ 92 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/LogisticsOldServiceImpl.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.logistics.service.impl;
 
+import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.logistics.model.Logistics;
 import com.uas.platform.b2c.logistics.model.LogisticsCompanyCode;
 import com.uas.platform.b2c.core.support.SystemSession;
@@ -11,6 +12,10 @@ import com.uas.platform.b2c.trade.deprecated.model.ConstantTrade;
 import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
 import com.uas.platform.b2c.trade.deprecated.model.ResponseLogistics;
 import com.uas.platform.b2c.logistics.service.LogisticsOldService;
+import com.uas.platform.b2c.trade.order.dao.OrderDao;
+import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
+import com.uas.platform.b2c.trade.order.model.Order;
+import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.exception.IllegalOperatorException;
@@ -32,6 +37,15 @@ public class LogisticsOldServiceImpl implements LogisticsOldService {
 	@Autowired
 	private InvoiceFPurchaseDao invoiceFPurchaseDao;
 
+	@Autowired
+	private PurchaseDao purchaseDao;
+
+	@Autowired
+	private OrderDao orderDao;
+
+	@Autowired
+	private SysConf sysConf;
+
 	/*
 	 * @Override public List<LogisticsCompanyCode> getAllCodes() { return
 	 * logisticsCompanyCodeDao.findAll(); } public List<String> getAllName(){
@@ -88,6 +102,84 @@ public class LogisticsOldServiceImpl implements LogisticsOldService {
 		return logisticsDao.findOne(id);
 	}
 
+	/**
+	 * 新增物流信息
+	 * @param inid
+	 * @param logistics
+	 * @return
+	 */
+	@Override
+	public ResultMap addLogistics(String inid, Logistics logistics) {
+		if(StringUtils.isEmpty(inid)) {
+			return new ResultMap(CodeType.NO_INFO, "您需要更新的出货单号为空,请重新操作");
+		}
+		InvoiceFPurchase fPurchase = invoiceFPurchaseDao.findByInvoiceid(inid);
+		if(fPurchase == null) {
+			return new ResultMap(CodeType.NOT_EXiST, "找不到对应的出货单号为空,请重新操作");
+		}
+		if(SystemSession.getUser().getEnterprise().getUu().longValue() != fPurchase.getSellerenuu().longValue()) {
+			return new ResultMap(CodeType.NOT_PERMIT, "当前登录的公司不能操作此订单");
+		}
+		if(StringUtils.isEmpty(logistics.getCompanyName())) {
+			return new ResultMap(CodeType.NO_INFO, "物流公司信息为空,请重新操作");
+		}
+		if(StringUtils.isEmpty(logistics.getNumber())) {
+			return new ResultMap(CodeType.NO_INFO, "物流单号信息为空,请重新操作");
+		}
+		if (logistics != null){
+			LogisticsCompanyCode logisticsCompanyCode = logisticsCompanyCodeDao.findByName(logistics.getCompanyName());
+			if (logisticsCompanyCode != null) {
+				logistics.setCompanyId(logisticsCompanyCode.getId());
+				logistics.setCompanyCode(logisticsCompanyCode.getCode());
+			}
+			Logistics logistics1 = logisticsDao.save(logistics);
+			fPurchase.setLogistics(logistics1);
+		}
+		Purchase purchase = purchaseDao.findOne(fPurchase.getPuid());
+		if (fPurchase.getLogistics() != null){
+			purchase.setLgtId(fPurchase.getLogistics().getId());
+			purchaseDao.save(purchase);
+		}
+		if(!purchase.getStoreid().equals(sysConf.getStoreid())) {
+			Order order = orderDao.findByOrderid(purchase.getOrderid());
+			if (order == null) {
+				return new ResultMap(CodeType.NOT_PERMIT, "您订单的信息有误,请重新提交");
+			}
+			if (fPurchase.getLogistics() != null) {
+				order.setLgtId(fPurchase.getLogistics().getId());
+			}
+			orderDao.save(order);
+		}
+		invoiceFPurchaseDao.save(fPurchase);
+		return ResultMap.success(null);
+	}
+
+	@Override
+	public ResultMap clearLogistics(String inid) {
+		if(StringUtils.isEmpty(inid)) {
+			return new ResultMap(CodeType.NO_INFO, "您需要更新的出货单号为空,请重新操作");
+		}
+		InvoiceFPurchase fPurchase = invoiceFPurchaseDao.findByInvoiceid(inid);
+		if (fPurchase.getLogistics() == null){
+			return new ResultMap(CodeType.NO_INFO, "您需要更新的快递信息为空,请重新操作");
+		}
+		fPurchase.setLogistics(null);
+		Purchase purchase = purchaseDao.findOne(fPurchase.getPuid());
+		if (purchase.getLgtId() != null){
+			purchase.setLgtId(null);
+			purchaseDao.save(purchase);
+		}
+		//如果是自营的,也需要将订单的快递为空
+		if(!purchase.getStoreid().equals(sysConf.getStoreid())) {
+			Order order = orderDao.findByOrderid(purchase.getOrderid());
+			if (order.getLgtId() != null){
+				order.setLgtId(null);
+			}
+			orderDao.save(order);
+		}
+		invoiceFPurchaseDao.save(fPurchase);
+		return ResultMap.success(null);
+	}
 
 	/**
 	 * 更新物流信息

+ 2 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java

@@ -31,6 +31,8 @@ import java.util.Map;
  *
  * @author wangyc on 2017/5/26.
  * @version 2017年8月3日11:34:58 yuj 增加注释
+ * @version 2017年8月21日14:40:15 产品管理开发第三版
+ * @version 2017年8月21日15:12:50 test
  */
 @RestController
 @RequestMapping("/trade/products")

+ 14 - 0
src/main/java/com/uas/platform/b2c/trade/order/controller/PurchaseController.java

@@ -9,12 +9,14 @@ import com.uas.platform.b2c.core.support.view.JxlsExcelView;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.core.utils.StringUtilB2C;
 import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
+import com.uas.platform.b2c.logistics.model.Logistics;
 import com.uas.platform.b2c.prod.store.service.StoreInService;
 import com.uas.platform.b2c.trade.order.model.Order;
 import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.b2c.trade.order.model.PurchaseModifyingHistory;
 import com.uas.platform.b2c.trade.order.service.PurchaseDetailService;
 import com.uas.platform.b2c.trade.order.service.PurchaseService;
+import com.uas.platform.b2c.trade.presale.model.ValidTime;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
@@ -597,4 +599,16 @@ public class PurchaseController {
 	public String findOrderIdByPuId(@PathVariable("purchaseId") String purchaseId){
 		return purchaseService.findOrderIdByPuId(purchaseId);
 	}
+
+//	@RequestMapping(value = "/logistics")
+//	public Logistics findOneLogistics(){
+//		return null;
+//	}
+//
+//	@RequestMapping(value = "/modifyLogistics", method = RequestMethod.PUT)
+//	public Logistics updateLogistics(Long id){
+//		System.out.println("id=" + id);
+//		return null;
+//	}
+
 }

+ 171 - 101
src/main/java/com/uas/platform/b2c/trade/order/model/Order.java

@@ -141,6 +141,36 @@ public class Order extends Document implements Serializable {
 	@Column(name = "or_deliverytype")
 	private Integer deliverytype;
 
+	/**
+	 * 运费
+	 */
+	@Column(name = "or_fare")
+	private Double fare = 0d;
+
+	/**
+	 * 使用的配送规则
+	 */
+	@Column(name = "or_rule", length = 2000)
+	private String jsonRule;
+
+	/**
+	 * 拆单之前的配送规则列表
+	 */
+	@Column(name = "or_rules", length = 4000)
+	private String jsonMoreRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "or_take_self", length = 2000)
+	private String jsonTakeSelf;
+
+	/**
+	 * 拆单之前的自提点信息
+	 */
+	@Column(name = "or_take_selfs", length = 4000)
+	private String jsonMoreTake;
+
 	/**
 	 * 收货地址 这里使用json字符串的形式将收货地址整个存起来
 	 */
@@ -259,7 +289,7 @@ public class Order extends Document implements Serializable {
 
 	/**
 	 * 订单状态(1->2->3->4->5->6->7->8->9)
-	 * 
+	 *
 	 * @Tip 必须严格按照顺序流转 1、TOBECONFIRMED(501, "待确认"), 2、TOBEPAID(503, "待付款"),
 	 *      3、PAID(505, "已付款"), 4、TOBESHIPPED(406, "待出货"), 5、SHIPPINGIN(403,
 	 *      "出货中"), 6、SHIPPED(407, "已出货"), 7、SENDING(408, "发货中"), 8、INBOUND(404,
@@ -274,7 +304,7 @@ public class Order extends Document implements Serializable {
 	 */
 	@Column(name = "or_paytime")
 	private Date paytime;
-	
+
 	/**
 	 * 失效时间
 	 */
@@ -295,7 +325,7 @@ public class Order extends Document implements Serializable {
 
 	/**
 	 * 银行转账信息id
-	 * 
+	 *
 	 * @Tip 目前只有银行转账信息,
 	 */
 	@Column(name = "or_banktf")
@@ -330,13 +360,13 @@ public class Order extends Document implements Serializable {
 	 */
 	@Column(name = "or_import_extra_charges")
 	private Double importExtraCharges;
-	
+
 	/**
-	 * 金额合计
+	 * 金额合计,店铺商品明细金额总计
 	 */
 	@Column(name = "or_price")
 	private Double price;
-	
+
 	/**
 	 * 币别
 	 */
@@ -356,13 +386,13 @@ public class Order extends Document implements Serializable {
 	private String inid;
 
 	/**
-	 * 确认金额(考虑商城打折的情况)
+	 * 确认金额(考虑商城打折的情况)包括运费
 	 */
 	@Column(name = "ensure_price")
 	private Double ensurePrice;
 
 	/**
-	 * 实际成交金额(考虑退货)
+	 * 实际成交金额(考虑退货)包括运费
 	 */
 	@Column(name = "transation_price")
 	private Double transationPrice;
@@ -384,31 +414,31 @@ public class Order extends Document implements Serializable {
 	 */
 	@Column(name = "or_qty")
 	private Double qty;
-	
+
 	/**
 	 * 批次数量
 	 */
 	@Column(name = "or_batch_qty")
 	private Integer batchQty;
-	
+
 	/**
 	 * 型号数量
 	 */
 	@Column(name = "or_cmp_qty")
 	private Integer cmpQty;
-	
+
 	/**
 	 * 客户收到货的时间
 	 */
 	@Column(name = "or_recipttime")
 	private Date reciptTime;
-	
+
 	/**
 	 * 二次收货时间
 	 */
 	@Column(name = "or_secondretime")
 	private Date secondReTime;
-	
+
 	/**
 	 * 发货时间,如果有两次 时间戳,时间戳
 	 */
@@ -446,7 +476,7 @@ public class Order extends Document implements Serializable {
 	@OneToMany(mappedBy = "order", cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
 	@OrderBy("detno")
 	private Set<OrderDetail> orderDetails;
-	
+
 	/**
 	 * 记录订单的客服、退款、退货、退换货服务状态
 	 * @tip 第一个数字位,代表客服状态,1:申请客服,2:客服确认中,3:客服有反馈
@@ -458,84 +488,84 @@ public class Order extends Document implements Serializable {
 	private String serviceStatus = "1111";
 
 	/**********************异常处理 start**********************/
-    /**
-     * 发起的售后申请状态
-     */
-    @Enumerated(EnumType.STRING)
-    @Column(name = "launch_or_ex_apply_status")
-    private AfterSaleStatus launchOrExApplyStatus;
+	/**
+	 * 发起的售后申请状态
+	 */
+	@Enumerated(EnumType.STRING)
+	@Column(name = "launch_or_ex_apply_status")
+	private AfterSaleStatus launchOrExApplyStatus;
 
-    /**
-     * 发起的申请单申请号
-     */
-    @Column(name = "launch_or_ex_apply_id")
-    private String launchOrExApplyId;
+	/**
+	 * 发起的申请单申请号
+	 */
+	@Column(name = "launch_or_ex_apply_id")
+	private String launchOrExApplyId;
 
-    /**
-     * 接收的供应商的多张申请单信息
-     * 格式: [{puExApplyId : "PAP2016111100000002", status : "SUP_TO_MALL"}, {puExApplyId : "PAP2016111100000003", status : "FINISHED"}]
-     */
-    @Column(name = "or_json_pu_ex_info")
-    private String puExInfoJson;
+	/**
+	 * 接收的供应商的多张申请单信息
+	 * 格式: [{puExApplyId : "PAP2016111100000002", status : "SUP_TO_MALL"}, {puExApplyId : "PAP2016111100000003", status : "FINISHED"}]
+	 */
+	@Column(name = "or_json_pu_ex_info")
+	private String puExInfoJson;
 
-    /**
-     * jsonPuExInfo的map形式,便于在程序中操作
+	/**
+	 * jsonPuExInfo的map形式,便于在程序中操作
 	 * key:采购异常申请单号
 	 * value:异常申请状态
-     */
-    @Transient
-    private Map<String, AfterSaleStatus> puExInfoMap;
-    
-    /**
-     * 退货单单号
-     */
-    @Column(name = "or_returnid")
-    private String returnId;
-    
-    /**
-     * 退货单的状态
-     */
-    @Column(name = "or_returnstatus")
-    private Integer returnStatus;
+	 */
+	@Transient
+	private Map<String, AfterSaleStatus> puExInfoMap;
 
-    /**
-     * 换货单号
-     */
-    @Column(name = "or_changeid")
-    private String changeId;
-    
-    /**
-     * 换货单的状态
-     */
-    @Column(name = "or_changestatus")
-    private Integer changeStatus;
+	/**
+	 * 退货单单号
+	 */
+	@Column(name = "or_returnid")
+	private String returnId;
 
-    /**
-     * 退款单的状态
-     */
-    @Column(name = "or_refundtatus")
-    private Integer refundStatus;
-    
-    /**
-     * 退款单号
-     */
-    @Column(name = "or_refund_id")
-    private String refundId;
+	/**
+	 * 退货单的状态
+	 */
+	@Column(name = "or_returnstatus")
+	private Integer returnStatus;
+
+	/**
+	 * 换货单号
+	 */
+	@Column(name = "or_changeid")
+	private String changeId;
 
-    /************ 异常处理 end ************/
+	/**
+	 * 换货单的状态
+	 */
+	@Column(name = "or_changestatus")
+	private Integer changeStatus;
 
-    /**
+	/**
+	 * 退款单的状态
+	 */
+	@Column(name = "or_refundtatus")
+	private Integer refundStatus;
+
+	/**
+	 * 退款单号
+	 */
+	@Column(name = "or_refund_id")
+	private String refundId;
+
+	/************ 异常处理 end ************/
+
+	/**
 	 * 开发票的快递公司
 	 */
 	@Column(name = "or_bill_logistic_company")
 	private String drawBillLogisComp;
-	
+
 	/**
 	 * 开发票的快递单号
 	 */
 	@Column(name = "or_bill_logistic_num")
 	private String drawBillLogisNum;
-	
+
 	/**
 	 * 开发票的时间
 	 */
@@ -737,8 +767,8 @@ public class Order extends Document implements Serializable {
 	 * @return the refund id
 	 */
 	public String getRefundId() {
-        return refundId;
-    }
+		return refundId;
+	}
 
 	/**
 	 * Sets refund id.
@@ -746,8 +776,8 @@ public class Order extends Document implements Serializable {
 	 * @param refundId the refund id
 	 */
 	public void setRefundId(String refundId) {
-        this.refundId = refundId;
-    }
+		this.refundId = refundId;
+	}
 
 	/**
 	 * Gets buyername.
@@ -973,8 +1003,8 @@ public class Order extends Document implements Serializable {
 	 * @return the boolean
 	 */
 	public boolean isBuyNow() {
-        return buyNow;
-    }
+		return buyNow;
+	}
 
 	/**
 	 * Sets buy now.
@@ -982,8 +1012,8 @@ public class Order extends Document implements Serializable {
 	 * @param buyNow the buy now
 	 */
 	public void setBuyNow(boolean buyNow) {
-        this.buyNow = buyNow;
-    }
+		this.buyNow = buyNow;
+	}
 
 	/**
 	 * Gets invoicetype.
@@ -1732,6 +1762,14 @@ public class Order extends Document implements Serializable {
 		this.vatBillStatus = vatBillStatus;
 	}
 
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
 	/**
 	 * Gets audit pay fail reason.
 	 *
@@ -2304,7 +2342,7 @@ public class Order extends Document implements Serializable {
 			b2cOrDetail.setNumber(details.getNumber());
 			b2cOrDetail.setBatchCode(details.getBatchCode());
 			b2cOrDetail.setPrice(details.getPrice());
-			b2cOrDetail.setTax(details.getTax()); 
+			b2cOrDetail.setTax(details.getTax());
 			b2cOrDetail.setTaxes(details.getTaxes());
 			b2cOrDetail.setUnitprice(details.getTaxUnitprice());
 			b2cOrDetails.add(b2cOrDetail);
@@ -2365,7 +2403,7 @@ public class Order extends Document implements Serializable {
 		this.buyername = user.getUserName();
 		this.buyerTel = user.getUserTel();
 		this.setStatusToBeConfirmed(user.getUserUU());
-        buyNow = false; // 默认不是立即购买,是则手动设置
+		buyNow = false; // 默认不是立即购买,是则手动设置
 	}
 
 	/**
@@ -2412,8 +2450,8 @@ public class Order extends Document implements Serializable {
 	 * @return the launch or ex apply status
 	 */
 	public AfterSaleStatus getLaunchOrExApplyStatus() {
-        return launchOrExApplyStatus;
-    }
+		return launchOrExApplyStatus;
+	}
 
 	/**
 	 * Sets launch or ex apply status.
@@ -2421,8 +2459,8 @@ public class Order extends Document implements Serializable {
 	 * @param launchOrExApplyStatus the launch or ex apply status
 	 */
 	public void setLaunchOrExApplyStatus(AfterSaleStatus launchOrExApplyStatus) {
-        this.launchOrExApplyStatus = launchOrExApplyStatus;
-    }
+		this.launchOrExApplyStatus = launchOrExApplyStatus;
+	}
 
 	/**
 	 * Gets orderids.
@@ -2510,8 +2548,8 @@ public class Order extends Document implements Serializable {
 	 * @return the launch or ex apply id
 	 */
 	public String getLaunchOrExApplyId() {
-        return launchOrExApplyId;
-    }
+		return launchOrExApplyId;
+	}
 
 	/**
 	 * Sets launch or ex apply id.
@@ -2519,8 +2557,8 @@ public class Order extends Document implements Serializable {
 	 * @param launchOrExApplyId the launch or ex apply id
 	 */
 	public void setLaunchOrExApplyId(String launchOrExApplyId) {
-        this.launchOrExApplyId = launchOrExApplyId;
-    }
+		this.launchOrExApplyId = launchOrExApplyId;
+	}
 
 	/**
 	 * Gets pu ex info json.
@@ -2528,8 +2566,8 @@ public class Order extends Document implements Serializable {
 	 * @return the pu ex info json
 	 */
 	public String getPuExInfoJson() {
-        return puExInfoJson;
-    }
+		return puExInfoJson;
+	}
 
 	/**
 	 * Sets pu ex info json.
@@ -2537,8 +2575,8 @@ public class Order extends Document implements Serializable {
 	 * @param puExInfoJson the pu ex info json
 	 */
 	public void setPuExInfoJson(String puExInfoJson) {
-        this.puExInfoJson = puExInfoJson;
-    }
+		this.puExInfoJson = puExInfoJson;
+	}
 
 	/**
 	 * Gets used.
@@ -2564,11 +2602,11 @@ public class Order extends Document implements Serializable {
 	 * @return pu ex info map
 	 */
 	@JSONField(serialize = false)
-    @JsonIgnore
-    public Map<String, AfterSaleStatus> getPuExInfoMap() {
-        if(CollectionUtils.isEmpty(puExInfoMap) && StringUtils.hasText( puExInfoJson)) {
-            puExInfoMap = ExceptionUtil.puExInfoJsonToMap(puExInfoJson);
-        }
+	@JsonIgnore
+	public Map<String, AfterSaleStatus> getPuExInfoMap() {
+		if(CollectionUtils.isEmpty(puExInfoMap) && StringUtils.hasText( puExInfoJson)) {
+			puExInfoMap = ExceptionUtil.puExInfoJsonToMap(puExInfoJson);
+		}
 		return puExInfoMap;
 	}
 
@@ -2718,4 +2756,36 @@ public class Order extends Document implements Serializable {
 	public void setDissociative(Integer dissociative) {
 		this.dissociative = dissociative;
 	}
+
+	public String getJsonMoreRule() {
+		return jsonMoreRule;
+	}
+
+	public void setJsonMoreRule(String jsonMoreRule) {
+		this.jsonMoreRule = jsonMoreRule;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
+	public String getJsonMoreTake() {
+		return jsonMoreTake;
+	}
+
+	public void setJsonMoreTake(String jsonMoreTake) {
+		this.jsonMoreTake = jsonMoreTake;
+	}
 }

+ 14 - 0
src/main/java/com/uas/platform/b2c/trade/order/model/OrderDetail.java

@@ -443,6 +443,12 @@ public class OrderDetail extends Document implements Serializable{
 	@Column(name = "detail_remark", length = 4000)
 	private String remark;
 
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/*******************************
 	 * 交货周期
 	 *******************************/
@@ -1380,6 +1386,14 @@ public class OrderDetail extends Document implements Serializable{
 		return this;
 	}
 
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
 	/****************************************************
 	 * others
 	 * @param uu the uu

+ 57 - 1
src/main/java/com/uas/platform/b2c/trade/order/model/Purchase.java

@@ -453,14 +453,38 @@ public class Purchase extends Document implements Serializable {
 	/**
 	 * 交易备注
 	 */
-	@Column(name = "pu_remark")
+	@Column(name = "pu_remark", length = 4000)
 	private String purchaseRemark;
 
+	/**
+	 * 配送类型 --第三方配送 1301,卖家配送 1302,上门自提1303
+	 */
+	@Column(name = "pu_send_type")
+	private Integer sendType;
+
 	/**
 	 * 自己送货还是第三方物流送货
 	 */
 	@Column(name = "pu_deliverytype")
 	private String deliveryType;
+
+	/**
+	 * 使用的配送规则
+	 */
+	@Column(name = "pu_rule", length = 2000)
+	private String jsonRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "pu_take_self", length = 2000)
+	private String jsonTakeSelf;
+
+	/**
+	 * 运费
+	 */
+	@Column(name = "pu_fare")
+	private Double fare;
 	
 	/*
 	 * 自己送货的送货人
@@ -574,6 +598,14 @@ public class Purchase extends Document implements Serializable {
 		this.statushistory = addStatusHistory(statushistory, uu, this.status);
 	}
 
+	public Integer getSendType() {
+		return sendType;
+	}
+
+	public void setSendType(Integer sendType) {
+		this.sendType = sendType;
+	}
+
 	/**
 	 * Sets status to be shipped.
 	 *
@@ -1513,6 +1545,14 @@ public class Purchase extends Document implements Serializable {
 		this.ensurePrice = ensurePrice;
 	}
 
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
 	/**
 	 * Gets transation price.
 	 *
@@ -1715,6 +1755,14 @@ public class Purchase extends Document implements Serializable {
 		return this;
 	}
 
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
 	/**
 	 * @Tip 对象初始化时必须给历史记录赋值,为showTip属性设置默认值
 	 */
@@ -2050,6 +2098,14 @@ public class Purchase extends Document implements Serializable {
 		this.exchangeStatus = exchangeStatus;
 	}
 
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
 	/**
 	 * Gets storeid.
 	 *

+ 15 - 0
src/main/java/com/uas/platform/b2c/trade/order/model/PurchaseDetail.java

@@ -309,6 +309,12 @@ public class PurchaseDetail extends Document {
 	@Column(name = "detail_remark", length = 4000)
 	private String remark;
 
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/**
 	 * 商城最长交期
 	 */
@@ -1068,6 +1074,14 @@ public class PurchaseDetail extends Document {
 		this.changeQty = changeQty;
 	}
 
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
 	/**
 	 * Instantiates a new Purchase detail.
 	 *
@@ -1105,6 +1119,7 @@ public class PurchaseDetail extends Document {
 		this.b2cMaxDelivery = oDetail.getB2cMaxDelivery();
 		this.b2cMinDelivery = oDetail.getB2cMinDelivery();
 		this.remark = oDetail.getRemark();
+		this.goodsnumber = oDetail.getGoodsnumber();
 	}
 
 	/**

+ 2 - 0
src/main/java/com/uas/platform/b2c/trade/order/service/PurchaseService.java

@@ -398,4 +398,6 @@ public interface PurchaseService {
 	 * @return Logistics
 	 */
 	Logistics findByLgtId(Long lgtId);
+
+	Logistics modifyPurchaseLogistics(Long id);
 }

+ 48 - 3
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -644,6 +644,11 @@ public class OrderServiceImpl implements OrderService {
     @Transactional
     private ResultMap updateOrder(String orderid, JSONObject[] ordersInfos) {
         ResultMap resultMap1 = convertInfoToOrder(ordersInfos);
+        JSONObject orderInfo  = ordersInfos[0];
+
+        JSONObject splitObject = orderInfo.getJSONObject("splitInfo");
+        System.out.println(splitObject);
+
         if(resultMap1.getCode() != ResultMapType.OK.getCode()) {
             return resultMap1;
         }
@@ -669,7 +674,7 @@ public class OrderServiceImpl implements OrderService {
         }
 
         List<Order> orderList = null;
-        ResultMap resultMap = splitOrder(order);
+        ResultMap resultMap = splitOrder(order, splitObject);
         if(resultMap.getCode() == CodeType.OK.code()) {
             orderList = (List<Order>) resultMap.getData();
         }else {
@@ -682,6 +687,12 @@ public class OrderServiceImpl implements OrderService {
         }
         str1 = StringUtils.isEmpty(str1) ? str1 : str1.substring(0, str1.length() - 1);
         order.setOrderids(str1);
+        //保存配送规则Map
+        String ruleJson = splitObject.getString("ruleList");
+        order.setJsonMoreRule(ruleJson);
+        String takeJson = splitObject.getString("takeList");
+        order.setJsonMoreTake(takeJson);
+        order.setEnsurePrice(orderInfo.getDouble("totalprice"));
         orderDao.save(order);
 
         // 记录确认订单操作日志
@@ -702,11 +713,19 @@ public class OrderServiceImpl implements OrderService {
      * 针对[501]待确认付款的订单拆单
      */
     @Transactional
-    private ResultMap splitOrder(Order order) {
+    private ResultMap splitOrder(Order order, JSONObject object) {
         //确认付款这里将不同的店铺的商品拆单
         Map<String, List<OrderDetail>> listMap = new HashMap<>();
         //获得订单备注Map
         JSONObject remarkMap = FastjsonUtils.fromJson(order.getOrderRemark(), JSONObject.class);
+
+        //获取适用配送规则列表
+        String jsonRule = object.getString("ruleList");
+        JSONObject ruleObject = FastjsonUtils.fromJson(jsonRule, JSONObject.class);
+        //获取自提点信息
+        String jsonTake = object.getString("takeList");
+        JSONObject takeObject = FastjsonUtils.fromJson(jsonTake, JSONObject.class);
+
         for (OrderDetail detail : order.getOrderDetails()) {
             List<OrderDetail> orderDetails = listMap.get(detail.getStoreid());
             if (orderDetails == null) {
@@ -747,6 +766,22 @@ public class OrderServiceImpl implements OrderService {
 
                 newOrderDetails.add(orderDetail1);
             }
+            /**
+             *  加入运费
+             */
+            JSONObject rule = ruleObject.getJSONObject(storeid);
+            JSONObject take = takeObject.getJSONObject(storeid);
+            System.out.println(rule);
+            or.setJsonRule(FastjsonUtils.toJson(rule));
+            if(take != null){
+                or.setJsonTakeSelf(FastjsonUtils.toJson(take));
+            }
+
+            or.setDeliverytype(Integer.parseInt(rule.getString("method")));
+            or.setFare(Double.parseDouble(rule.getString("fare")));
+            ensurePrices += or.getFare();
+            transationPrice += or.getFare();
+
             or.setBatchQty(newOrderDetails.size());
             or.setEnsurePrice(NumberUtil.fractionNumCeil(ensurePrices, 2));
             or.setPrice(NumberUtil.fractionNumCeil(prices, 2));
@@ -758,6 +793,7 @@ public class OrderServiceImpl implements OrderService {
             map.put(storeid, remarkMap.getString(storeid));
             String orRemark = FastjsonUtils.toJson(map);
             or.setOrderRemark(orRemark);
+//            or.setDeliverytype(Integer.parseInt(methodMap.getString(storeid)));
 
             StoreIn storeIn = storeInDao.findByUuid(storeid);
             if (storeIn == null) {
@@ -800,13 +836,21 @@ public class OrderServiceImpl implements OrderService {
     private ResultMap convertInfoToOrder(JSONObject[] ordersInfo) {
         JSONObject orderInfo  = ordersInfo[0];
         Order order = orderDao.findOne(orderInfo.getLong("id"));
-        order.setDeliverytype(orderInfo.getInteger("deliverytype"));
+        /**
+         * 这里的deliverytype为key,value的map形式
+         */
+//        order.setDeliverytypes(orderInfo.getString("deliverytypes"));
+//        order.setFares(orderInfo.getString("fares"));
 
         // TODO huxz 暂时设置为1301
         if (order.getDeliverytype() == null) {
             order.setDeliverytype(Type.Delivery_ByUU_Code.value());
         }
+
         Long add_id = orderInfo.getLong("add_id");
+        /**
+         * TODO hulh 这里需要转化地址。暂时设为1301
+         */
         String jsonAddress = getAddressFormateToString(order.getDeliverytype(), add_id);
         order.setJsonAddress(jsonAddress);
         order.setInvoicetype(orderInfo.getInteger("invoicetype"));
@@ -836,6 +880,7 @@ public class OrderServiceImpl implements OrderService {
                     detail.setNumber(detailInfo.getDouble("number"));
                     detail.setTaxUnitprice(detailInfo.getDouble("taxUnitprice"));
                     detail.setRemark(detailInfo.getString("remark"));
+                    detail.setGoodsnumber(detailInfo.getString("goodsnumber"));
                     String storeid = detailInfo.getString("storeid");
                     Goods goods = goodsDao.findByBatchCode(detail.getBatchCode());
                     if(!goods.getStoreid().equals(storeid)) {

+ 24 - 5
src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseServiceImpl.java

@@ -10,6 +10,7 @@ import com.uas.platform.b2c.common.account.model.TradeLog;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.constant.SplitChar;
+import com.uas.platform.b2c.core.constant.Type;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.TradeBufferedLogger;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
@@ -55,7 +56,6 @@ import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.EncodingRulesConstant;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.Status;
-import com.uas.platform.core.model.Type;
 import com.uas.platform.core.persistence.criteria.CriterionExpression;
 import com.uas.platform.core.persistence.criteria.LogicalExpression;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
@@ -352,6 +352,8 @@ public class PurchaseServiceImpl implements PurchaseService {
 		price = NumberUtil.pricesScaleTwo(price);
 		purchase.setPrice(price);
 		// TODO 这里需要考虑确认总价的问题 (默认和总价相等,打折或优惠券逻辑待考虑)
+		// 加入运费
+		ensurePrices += purchase.getFare();
 		ensurePrices = NumberUtil.pricesScaleTwo(ensurePrices);
 		purchase.setEnsurePrice(ensurePrices);
 	}
@@ -409,6 +411,8 @@ public class PurchaseServiceImpl implements PurchaseService {
 			purchase.setInvoicetype(Type.Bill_Deduct.value());
 			purchase.setInvoiceAddress(FastjsonUtils.toJson(billOne.get(0)));
 			purchase.setInvoicetitle(billOne.get(0).getHead());
+			purchase.setFare(0d);//默认为0
+			purchase.setSendType(Type.Delivery_ByUU_Code.value());//寄售类型统一为第三方配送
 		}else {
 			if(orderFromCust.getBuyerentername() == null) {
 				Enterprise enterprise = enterpriseDao.findByUu(orderFromCust.getBuyerenuu());
@@ -426,6 +430,13 @@ public class PurchaseServiceImpl implements PurchaseService {
 			purchase.setInvoicetype(orderFromCust.getInvoicetype());
 			purchase.setInvoiceAddress(orderFromCust.getInvoiceAddress());
 			purchase.setInvoicetitle(orderFromCust.getInvoicetitle());
+			//如果是自营的,则保存配送规则和运费信息,自提点信息和配送方式
+			purchase.setFare(orderFromCust.getFare());
+			purchase.setJsonRule(orderFromCust.getJsonRule());
+			purchase.setSendType(orderFromCust.getDeliverytype());
+			if (orderFromCust.getJsonTakeSelf() != null){
+				purchase.setJsonTakeSelf(orderFromCust.getJsonTakeSelf());
+			}
 		}
 		List<User> users = userDao.findUserByUserUU(purchase.getBuyeruu());
 		User user = null;
@@ -1365,9 +1376,11 @@ public class PurchaseServiceImpl implements PurchaseService {
 			countPurchaseTaxes += NumberUtil.mul(CountPurchaseDetailPrice, 0.17);
 			countPurchasePrice += CountPurchaseDetailPrice;
 			double countFractionPurchasePrice = NumberUtil.fractionNumCeil(countPurchasePrice,2);
-			purchase.setEnsurePrice(countFractionPurchasePrice);
+			//加入运费
+			double priceAddFara = NumberUtil.add(countFractionPurchasePrice, purchase.getFare());
+			purchase.setEnsurePrice(priceAddFara);
 			purchase.setPrice(countFractionPurchasePrice);
-			purchase.setTransationPrice(countFractionPurchasePrice);
+			purchase.setTransationPrice(priceAddFara);
 			purchase.setTaxes(countPurchaseTaxes);
 			purchaseDao.save(purchase);
 			// 修改订单明细单价,不含税单价,价税合计(三个字段),税金
@@ -1398,10 +1411,11 @@ public class PurchaseServiceImpl implements PurchaseService {
 			}
 			countOrderPrice += CountPurchaseDetailPrice;
 			double countFractionOrderPrice = NumberUtil.fractionNumCeil(countOrderPrice,2);
+			double orderPriceAddFare = NumberUtil.add(countFractionOrderPrice, order.getFare());
 			countOrderTaxes += NumberUtil.mul(CountPurchaseDetailPrice, 0.17);
-			order.setEnsurePrice(countFractionOrderPrice);
+			order.setEnsurePrice(orderPriceAddFare);
 			order.setPrice(countFractionOrderPrice);
-			order.setTransationPrice(countFractionOrderPrice);
+			order.setTransationPrice(orderPriceAddFare);
 			order.setTaxes(countOrderTaxes);
 			orderDao.save(order);
 			// 保存卖家采购单修改单价的记录
@@ -1435,4 +1449,9 @@ public class PurchaseServiceImpl implements PurchaseService {
 	public Logistics findByLgtId(Long lgtId) {
 		return logisticsDao.findOne(lgtId);
 	}
+
+	@Override
+	public Logistics modifyPurchaseLogistics(Long id) {
+		return null;
+	}
 }

+ 24 - 1
src/main/webapp/resources/css/common.css

@@ -782,4 +782,27 @@ div.ng-table-pager a.page-a{
 #left-nav-fragment .user_left ul li a:focus,#left-nav-fragment .user_left p:hover{
 	color: #fff !important;
 }
-input:required:invalid, input:focus:invalid, textarea:required:invalid, textarea:focus:invalid{box-shadow: none;}
+input:required:invalid, input:focus:invalid, textarea:required:invalid, textarea:focus:invalid{box-shadow: none;}
+
+.color333{
+	color: #333 !important;
+}
+.color666{
+	color: #666 !important;
+}
+.color999{
+	color: #999 !important;
+}
+
+::-webkit-input-placeholder { /* WebKit, Blink, Edge */
+	color:    #999;
+}
+:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
+	color:    #999;
+}
+::-moz-placeholder { /* Mozilla Firefox 19+ */
+	color:    #999;
+}
+:-ms-input-placeholder { /* Internet Explorer 10-11 */
+	color:    #999;
+}

+ 1 - 1
src/main/webapp/resources/css/vendor/sell.css

@@ -1806,7 +1806,7 @@ body {
     width:100%;
     margin:0 auto;
     background: #fff;
-    padding-top: 10px;
+    padding: 10px 0;
 }
 .logistics_list01 .oder_xq p {
     line-height:30px;

+ 9 - 1
src/main/webapp/resources/js/common/query/logistics.js

@@ -46,7 +46,15 @@ define([ 'ngResource' ], function() {
 			 updateLogistics : {
 				 url : 'trade/logistics/:id',
 				 method : 'POST'
-			 }
+			 },
+			addLogistics : {
+				url : 'trade/logistics/add',
+				method : 'POST'
+			},
+			clearLogistics : {
+				url : 'trade/logistics/clear',
+				method : 'PUT'
+			}
 		});
 	}]);
 });

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

@@ -77,5 +77,54 @@ 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
+			},
+			changeActive : {
+				url: 'trade/distributionRule/status',
+				method: 'POST'
+			},
+			findCountOfRule : {
+				url: 'trade/distributionRule/count',
+				method: 'GET'
+			},
+			checkRuleName : {
+				url: 'trade/distributionRule/checkName',
+				method: 'GET'
+			},
+			findMatchRule : {
+				url: 'trade/distributionRule/rule/matchArea',
+				method: 'GET',
+				isArray : true
+			},
+			findFareOfRule : {
+				url: 'trade/distributionRule/fare',
+				method: 'POST',
+				isArray : true
+			},
+			findUsableRule : {
+				url: 'trade/distributionRule/usable/rule',
+				method: 'POST'
+			}
+		})
 	}]);
 });

+ 4 - 0
src/main/webapp/resources/js/common/query/vendor.js

@@ -52,6 +52,10 @@ define(['ngResource'], function() {
 				url : 'trade/takeSelf/takeName',
 				method : 'GET',
 				isArray : true
+			},
+			findTakeSelfByStore : {
+				url : 'trade/takeSelf/store/takeSelf',
+				method : 'POST'
 			}
 		});
 	}]);

+ 3 - 2
src/main/webapp/resources/js/common/services.js

@@ -581,8 +581,9 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 			"1202":"17%增值税不可抵扣,累计开票,8%税点",
 			"1203":"17%增值税可抵扣,随元器件一起发货,10%税点",
 			"1204":"17%增值税不可抵扣,,随元器件一起发货,10%税点",
-			"1301":"UU配送",
-			"1302":"上门自取"
+			"1301":"第三方配送",
+            "1302":"卖家配送",
+			"1303":"上门自取"
 			};
 		return function(data) {
 			return statusConfig[data];

+ 4 - 4
src/main/webapp/resources/js/prod/data/city.json

@@ -1,5 +1,5 @@
 {
-    "北京市": {
+    "北京": {
         "北京市": [
             "东城区",
 		    "西城区",
@@ -19,7 +19,7 @@
 		    "延庆县"         
         ]
     },
-    "上海市": {
+    "上海": {
         "上海市": [
 			"黄浦区",
 		    "徐汇区",
@@ -41,7 +41,7 @@
 		    "崇明县"
         ]
     },
-    "天津市": {
+    "天津": {
         "天津市": [
 		  	"和平区",
 		    "河东区",
@@ -64,7 +64,7 @@
 		    "蓟县"
         ]
     },
-    "重庆市": {
+    "重庆": {
         "重庆市": [
 		  	"万州区",
 		    "涪陵区",

+ 2 - 2
src/main/webapp/resources/js/usercenter/app.js

@@ -1,7 +1,7 @@
 
-define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter'], function(angularAMD) {
+define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter', 'common/query/vendor'], function(angularAMD) {
 	'use strict';
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter', 'vendorServices']);
 	app.init = function() {
 		angularAMD.bootstrap(app);
 	};

+ 3 - 3
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -308,7 +308,7 @@ define(['app/app'], function(app) {
 				var size;
 				if(num == 1) {
 					if ($scope.address.name){
-						size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
+						size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
 						if (size > 20) {
 							console.log(size);
 							$scope.userError = true;
@@ -318,7 +318,7 @@ define(['app/app'], function(app) {
 					}
 				} else if(num == 2) {
 					if ($scope.address.tel){
-						size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
+						size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
 						if (size < 8 || size > 11) {
 							$scope.telError = true;
 							return;
@@ -333,7 +333,7 @@ define(['app/app'], function(app) {
 					}
 				} else if(num == 3) {
 					if ($scope.address.detailAddress){
-						size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
+						size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
 						if (size > 60) {
 							$scope.addrError = true;
 							return;

+ 21 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js

@@ -27,6 +27,13 @@ define(['app/app'], function(app) {
 			603: true
 		};
 
+		//配送方式列表
+		$scope.deliveryMethod = {
+			1301 : '第三方配送',
+			1302 : '卖家配送',
+			1303 : '上门自提'
+		};
+
 		// TODO 暂时假设运费固定为0
 		$scope.freight = 0;
 
@@ -184,6 +191,17 @@ define(['app/app'], function(app) {
 				}
 				$scope.order = data;
 				$scope.order.orderHistory = angular.fromJson($scope.order.statushistory);
+				if ($scope.order.orderRemark){
+					$scope.remarkList = angular.fromJson($scope.order.orderRemark);
+				}
+				if ($scope.order.jsonRule){
+					$scope.rule = angular.fromJson($scope.order.jsonRule);
+				}
+				//自提点信息
+				if ($scope.order.jsonTakeSelf){
+					$scope.takeSelf = angular.fromJson($scope.order.jsonTakeSelf);
+					$scope.takeSelf.area = $scope.takeSelf.area.replace(/,/g,' ');
+				}
 				// 设置状态样式
 				$scope.stepStyle($scope.order.status);
 				// 获取物流信息
@@ -201,6 +219,9 @@ define(['app/app'], function(app) {
 				//发票信息
 				$scope.order.invoiceInfo = angular.fromJson($scope.order.invoiceAddress);
 
+				// 取消原因
+				$scope.order.unavailableReason = angular.fromJson($scope.order.unavailableReason);
+
 				//收货地址
 				$scope.order.deliveryAddress = angular.fromJson($scope.order.jsonAddress);
 

+ 199 - 18
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', 'TakeSelf', function($scope, $rootScope, $stateParams, $modal, $state, Bill, toaster, Order, $filter, ShippingAddress, Ysepay, $q, NumberService, Cart, $timeout, DistributionRule, TakeSelf) {
 
 		$rootScope.active = 'buyer_cart';
 
@@ -74,15 +74,21 @@ define(['app/app'], function(app) {
         $scope.togglePrice = function (detail) {
             detail.display = detail.display == 'block' ? 'none' : 'block';
         };
+
 		//获取订单的信息
 		var getOrderData = function() {
 			return Order.findStatusByOrderid({enOrderid : $stateParams.orderid}, function (response) {
 
+				$scope.storeArray = [];
+				$scope.ruleMap = {};
 				if (response.status == 501){
 					Order.orderContainGoods({enOrderid : $stateParams.orderid}, function(data) {
 						$scope.order = data;
 						$scope.$$orderDetailsMap = {};
-						$scope.remarkList = {};
+						$scope.remarkList = {};//订单备注列表
+						$scope.deliveryList = {};//配送方式列表
+						$scope.takeSelfList = {};
+						$scope.fareList = {};//运费列表
 						if($scope.order.orderDetails.length == 0) {
 							toaster.pop('warning', '您购买的商品已全部失效,请您前往购物车重新勾选');
 							$timeout(function () {
@@ -98,6 +104,9 @@ define(['app/app'], function(app) {
 							}else {
 								$scope.$$orderDetailsMap[detail.storeName] = [];
 								$scope.remarkList[detail.storeid] = "";
+								$scope.deliveryList[detail.storeid] = '';
+								$scope.takeSelfList[detail.storeid] = null;
+								$scope.fareList[detail.storeid] = 0;
 								$scope.$$orderDetailsMap[detail.storeName].push(detail);
 							}
 							$scope.disabledAddAndSub(detail);
@@ -105,7 +114,15 @@ define(['app/app'], function(app) {
 						if($scope.order.status == 501) { //如果不是待确认状态,则不需要计算
 							//计算总价格
 							$scope.calculateTotal();
+							getTakeSelf();
 						}
+						angular.forEach($scope.$$orderDetailsMap, function (value, key) {
+							var object = {
+								uuid : value[0].storeid,
+								fare : $scope.storePrice[key]
+							};
+							$scope.storeArray.push(object);
+						});
 						initOrder();
 					}, function(response) {
 						toaster.pop('error', "获取订单的类型失败。" + response.data);
@@ -116,6 +133,12 @@ define(['app/app'], function(app) {
 					if ($scope.order.orderRemark){
 						$scope.remarkList = angular.fromJson($scope.order.orderRemark);
 					}
+					if ($scope.order.jsonRule){
+						$scope.rule = angular.fromJson($scope.order.jsonRule);
+					}
+					if ($scope.order.jsonTakeSelf){
+						$scope.takeSelf = angular.fromJson($scope.order.jsonTakeSelf);
+					}
 					if($scope.order.orderDetails.length == 0) {
 						$state.go('buyer_order');
 					}
@@ -123,10 +146,20 @@ define(['app/app'], function(app) {
 						if($scope.$$orderDetailsMap[detail.storeName]) {
 							$scope.$$orderDetailsMap[detail.storeName].push(detail);
 						}else {
+							$scope.storeArray.push(detail.storeid);
 							$scope.$$orderDetailsMap[detail.storeName] = [];
 							$scope.$$orderDetailsMap[detail.storeName].push(detail);
 						}
 					});
+					if ($scope.order.jsonMoreRule){
+						$scope.deliveryList = angular.fromJson($scope.order.jsonMoreRule);
+					}
+					if ($scope.order.jsonMoreTake){
+						$scope.takeList = angular.fromJson($scope.order.jsonMoreTake);
+					}
+					if ($scope.storeArray.length != 1){
+						$scope.calculateTotal();
+					}
 					initOrder();
 				}
 			});
@@ -147,6 +180,35 @@ define(['app/app'], function(app) {
 			$scope.contactBNox = false;
 		};
 
+		var getTakeSelf = function () {
+			if ($scope.order.status == 501){
+				TakeSelf.findTakeSelfByStore({}, $scope.storeArray, function (data) {
+					if(data){
+						$scope.takeSelfMap = data;
+					}
+				})
+			}
+		};
+
+		$scope.changeFare = function (details) {
+			var storeid = details[0].storeid;
+			var rule = $scope.deliveryList[storeid];
+			$scope.fareList[storeid] = rule.fare;
+			$scope.calculateFare();
+		};
+
+		/**
+		 * 计算运费和店铺费用合计
+		 */
+		$scope.calculateFare = function () {
+			var fare = 0;
+			angular.forEach($scope.fareList, function (v) {
+				fare = NumberService.add(v, fare);
+			});
+			$scope.order.ensurePrice = NumberService.add($scope.order.totalprice, fare);
+		};
+
+
 		/**
 		 * 获取买家收货地址信息
 		 */
@@ -182,6 +244,31 @@ define(['app/app'], function(app) {
 		$scope.selectAdd = function(address) {
 			$scope.payment.address = address;
             $scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
+			if ($scope.order.status == 501){
+				DistributionRule.findUsableRule({area:$scope.payment.address.area}, $scope.storeArray, function (data) {
+					if (data){
+						//更换地址后先清空数据
+						$scope.deliveryList = {};
+						$scope.fareList = {};
+						angular.forEach($scope.storeArray, function (item) {
+							$scope.ruleMap[item.uuid] = [];
+							var arr = data[item.uuid];
+							$scope.ruleMap[item.uuid] = arr;
+							if (arr.length != 0){
+								$scope.deliveryList[item.uuid] = arr[0];
+								$scope.fareList[item.uuid] = arr[0].fare;
+							}
+						});
+						$scope.calculateFare();
+					}
+				},function (error) {
+					toaster.pop('info', '提示', error.data);
+				})
+			}
+		};
+
+		$scope.updateTakeSelf = function (uuid, item) {
+			$scope.takeSelfList[uuid] = item;
 		};
 
 		// 添加按钮,每次加1
@@ -197,6 +284,21 @@ define(['app/app'], function(app) {
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
+			updateStoreArray(detail);
+			$q.all([updateFare($scope.ruleMap[detail.storeid], $scope.storePrice[detail.storeName]).$promise]).then(function (data) {
+				if (data){
+					var id = $scope.deliveryList[detail.storeid].id;
+					var arr = data[0];
+					$scope.ruleMap[detail.storeid] = arr;
+					angular.forEach(arr, function (item) {
+						if (item.id == id){
+							$scope.deliveryList[detail.storeid] = item;
+							$scope.fareList[detail.storeid] = item.fare;
+						}
+					});
+					$scope.calculateFare();
+				}
+			});
 		};
 
 		// 减少按钮,每次减minPackQty
@@ -212,6 +314,49 @@ define(['app/app'], function(app) {
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
+			updateStoreArray(detail);
+			$q.all([updateFare($scope.ruleMap[detail.storeid], $scope.storePrice[detail.storeName]).$promise]).then(function (data) {
+				if (data){
+					var id = $scope.deliveryList[detail.storeid].id;
+					var arr = data[0];
+					$scope.ruleMap[detail.storeid] = arr;
+					angular.forEach(arr, function (item) {
+						if (item.id == id){
+							$scope.deliveryList[detail.storeid] = item;
+							$scope.fareList[detail.storeid] = item.fare;
+						}
+					});
+					$scope.calculateFare();
+				}
+			});
+
+		};
+
+		/**
+		 * 更新配送规则请求参数
+		 */
+		var updateStoreArray = function (detail) {
+			angular.forEach($scope.storeArray, function (item) {
+				if (item.uuid == detail.storeid){
+					item.fare = $scope.storePrice[detail.storeName];
+				}
+			})
+		};
+
+		/**
+		 * 更新运费列表
+		 * @param ruleList
+		 * @param price
+		 * @returns {*|{url, method, isArray}}
+		 */
+		var updateFare = function (ruleList, price) {
+			return DistributionRule.findFareOfRule({price:price}, ruleList, function (data) {
+				if (data){
+
+				}
+			}, function (error) {
+				// toaster.pop("error", error.data);
+			})
 		};
 
 		// 输入购买量限制
@@ -234,6 +379,27 @@ define(['app/app'], function(app) {
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
+			updateStoreArray(detail);
+			$q.all([updateFare($scope.ruleMap[detail.storeid], $scope.storePrice[detail.storeName]).$promise]).then(function (data) {
+				if (data){
+					var id = $scope.deliveryList[detail.storeid].id;
+					var arr = data[0];
+					$scope.ruleMap[detail.storeid] = arr;
+					angular.forEach(arr, function (item) {
+						if (item.id == id){
+							$scope.deliveryList[detail.storeid] = item;
+							$scope.fareList[detail.storeid] = item.fare;
+						}
+					});
+					$scope.calculateFare();
+				}
+			});
+		};
+
+		$scope.deliveryMethod = {
+			1301 : '第三方配送',
+			1302 : '卖家配送',
+			1303 : '上门自提'
 		};
 
 		/**
@@ -270,6 +436,16 @@ define(['app/app'], function(app) {
 				}
 				return ;
 			}
+			var validRule = checkRule();
+			if (!validRule){
+				toaster.pop("info", "当前地址部分卖家无法配送,请重新选择地址或与卖家协商处理");
+				return ;
+			}
+			var validTakeSelf = checkTakeSelf();
+			if (!validTakeSelf){
+				toaster.pop("info", "请选择一个自提点");
+				return ;
+			}
 			var orderInfos = [], orderInfo;
 			orderInfo = generateOrderInfo();
 			if(orderInfo == null) {
@@ -353,7 +529,7 @@ define(['app/app'], function(app) {
 
 			orderInfo.id = $scope.order.id;
 			orderInfo.orderid = $scope.order.orderid;
-			orderInfo.deliverytype = $scope.order.deliverytype; // 配送方式
+			// orderInfo.deliverytype = $scope.order.deliverytype; // 配送方式
 
 			if($scope.order.currency == 'USD' && $scope.order.paytype == '1102') {
 				toaster.pop('info', '美元请线下付款');
@@ -365,7 +541,8 @@ define(['app/app'], function(app) {
 			}
 
 			// 收货地址,上门自提暂不提供
-			if($scope.order.deliverytype == '1301'){
+			if($scope.deliveryList){
+				console.log("进来了");
 				/*var address = angular.fromJson($scope.selectAddress);
 				 delete address.isSelect;
 				 orderInfo.jsonAddress = angular.toJson(address);*/
@@ -385,9 +562,10 @@ define(['app/app'], function(app) {
 					}
 				}
 				orderInfo.add_id = $scope.payment.address.id;
-			}else if($scope.order.deliverytype == '1302'){
-				orderInfo.add_id = $scope.pickAddress.id;
 			}
+			// else if($scope.order.deliverytype == '1302'){
+			// 	orderInfo.add_id = $scope.pickAddress.id;
+			// }
 			orderInfo.invoicetype = $scope.order.invoicetype; // 发票类型
 			if($scope.order.invoicetype != '1207') {
 				if(!$scope.bill.id) {
@@ -397,11 +575,14 @@ define(['app/app'], function(app) {
 				orderInfo.invoiceid = $scope.bill.id; // 发票主键
 			}
 
-			orderInfo.totalprice = $scope.order.ensurePrice; // 应付总额
+			orderInfo.totalprice = $scope.order.totalprice; // 应付总额,不含运费
 			orderInfo.currency = $scope.order.currency; // 币别
-			orderInfo.orderRemark = angular.toJson($scope.remarkList);
-			// console.log(orderInfo.orderRemark);
-			// orderInfo.orderRemark = $scope.order.orderRemark; // 交易备注
+			orderInfo.orderRemark = angular.toJson($scope.remarkList);//订单备注
+			orderInfo.splitInfo = {
+				ruleList : angular.toJson($scope.deliveryList),
+				takeList : angular.toJson($scope.takeSelfList)
+			};
+
 			orderInfo.paytype =  $scope.order.paytype;
 			orderInfo.orderDetails = convertOrderDetails(); // 订单明细信息:id、number
 
@@ -417,6 +598,7 @@ define(['app/app'], function(app) {
 					number: v.number,
 					taxUnitprice: v.taxUnitprice,
 					remark : v.remark,
+					goodsnumber : v.goodsnumber,
 					storeid : v.storeid
 				});
 			});
@@ -445,7 +627,7 @@ define(['app/app'], function(app) {
 			    $scope.order.invoicetype = 1205;
 				$scope.order.paytype = '1102';
 			}
-			// 默认选择UU配送  --1301UU配送  --1302上门自提
+			// 默认选择第三方配送  --1301第三方配送 --卖家配送  --1303上门自提
 			$scope.order.deliverytype = 1301;
 
 			//获取地址的信息
@@ -490,8 +672,7 @@ define(['app/app'], function(app) {
 						$scope.sendAddress.push(address);
 					}
 				}
-				$scope.payment.address = address;
-				$scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
+				$scope.selectAdd(address);
 			}, function(){
 				toaster.pop('info', '提示 ' + '您已取消收货地址的编辑');
 			});
@@ -545,7 +726,7 @@ define(['app/app'], function(app) {
 		 * 计算总金额
 		 */
 		$scope.calculateTotal = function () {
-			$scope.order.ensurePrice = 0;
+			$scope.order.totalprice = 0;
 			$scope.storePrice = {};
 			angular.forEach($scope.order.orderDetails, function(detail) {
 				detail.ensurePrice = Number(NumberService.mul(detail.taxUnitprice, detail.number));
@@ -556,7 +737,7 @@ define(['app/app'], function(app) {
 			});
 			angular.forEach($scope.$$orderDetailsMap, function (value, key) {
 				$scope.storePrice[key] = Number(NumberService.toCeil($scope.storePrice[key], 2));
-				$scope.order.ensurePrice = NumberService.add($scope.storePrice[key], $scope.order.ensurePrice)
+				$scope.order.totalprice = NumberService.add($scope.storePrice[key], $scope.order.totalprice)
 			});
 		};
 
@@ -624,7 +805,7 @@ define(['app/app'], function(app) {
 			var size;
 			if(num == 1) {
 				if ($scope.address.name){
-					size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
 					if (size > 20) {
 						$scope.userError = true;
 						return;
@@ -633,7 +814,7 @@ define(['app/app'], function(app) {
 				}
 			} else if(num == 2) {
 				if ($scope.address.tel){
-					size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
 					if (size < 8 || size > 11) {
 						$scope.telError = true;
 						return;
@@ -648,7 +829,7 @@ define(['app/app'], function(app) {
 				}
 			} else if(num == 3) {
 				if ($scope.address.detailAddress){
-					size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
 					if (size > 60) {
 						$scope.addrError = true;
 						return;

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

@@ -146,7 +146,7 @@ define(['app/app'], function(app) {
 			// }else {
 			//     if(!$scope.order.invoicetype) $scope.order.invoicetype = 1205;
 			// }
-			// 默认选择UU配送  --1301UU配送  --1302上门自提
+			// 默认选择UU配送  --1301第三方配送  --1302卖家配送 --1303上门自提
 			if(!$scope.order.deliverytype) $scope.order.deliverytype = 1301;
 		};
 

+ 8 - 1
src/main/webapp/resources/js/vendor/app.js

@@ -467,7 +467,8 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 			// templateUrl : 'static/view/vendor/forstore/vendor_upload.html',
 			// controllerUrl : "app/controllers/forstore/vendor_upload_ctrl",
 			// controller : 'vendorUploadCtrl'
-			templateUrl : 'static/view/vendor/forstore/vendor_productOn.html',
+			// templateUrl : 'static/view/vendor/forstore/vendor_productOn.html',
+			templateUrl : 'static/view/vendor/forstore/product_file.html',
 			controllerUrl : "app/controllers/forstore/vendor_productOn_ctrl",
 			controller : 'vendorProductOnCtrl'
 		})).state('product_repository', angularAMD.route({
@@ -538,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',

+ 20 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js

@@ -155,6 +155,12 @@ define(['app/app'], function(app) {
 			603: true
 		};
 
+		//配送方式列表
+		$scope.deliveryMethod = {
+			1301 : '第三方配送',
+			1302 : '卖家配送',
+			1303 : '上门自提'
+		};
 
 
 
@@ -174,6 +180,16 @@ define(['app/app'], function(app) {
 				$scope.purchase = result.data;
 				$scope.purchase.purchaseHistory = angular.fromJson($scope.purchase.statushistory);
 				$scope.purchase.currentTotal = $scope.purchase.price;
+				if ($scope.purchase.jsonRule){
+					$scope.rule = angular.fromJson($scope.purchase.jsonRule);
+				}
+				//自提点信息
+				if ($scope.purchase.jsonTakeSelf){
+					$scope.takeSelf = angular.fromJson($scope.purchase.jsonTakeSelf);
+					$scope.takeSelf.area = $scope.takeSelf.area.replace(/,/g,' ');
+				}
+				// 取消原因
+				$scope.purchase.unavailableReason = angular.fromJson($scope.purchase.unavailableReason)
 				// 设置状态样式
 				$scope.stepStyle($scope.purchase.status);
 				// 获取物流信息
@@ -198,7 +214,7 @@ define(['app/app'], function(app) {
 				toaster.pop('warning', '提示', '输入的价格必须是数字');
 				return ;
 			}
-			if (Number(data.currentTaxUnitPrice) <= 0){
+			if (Number(data.currentTaxUnitPrice) < 0){
 				data.currentTaxUnitPrice = 0.000001;
 			}
 			if (Number(data.currentTaxUnitPrice) > 100000){
@@ -209,6 +225,8 @@ define(['app/app'], function(app) {
 			angular.forEach($scope.purchase.purchaseDetails, function (detail) {
 				$scope.purchase.currentTotal += detail.currentTaxUnitPrice * detail.number;
 			});
+			//加上运费
+			$scope.purchase.currentTotal = NumberService.add($scope.purchase.currentTotal, $scope.purchase.fare);
 			$scope.purchase.currentTotal = Number(NumberService.toCeil($scope.purchase.currentTotal, 2));
 		};
 
@@ -219,6 +237,7 @@ define(['app/app'], function(app) {
 			angular.forEach($scope.purchase.purchaseDetails, function (detail) {
 				detail.currentTaxUnitPrice = detail.taxUnitPrice;
 			});
+			$scope.purchase.currentTotal = $scope.purchase.ensurePrice;
         };
 
         // 取消

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

@@ -0,0 +1,551 @@
+define([ 'app/app' ], function(app) {
+    'use strict';
+    app.register.controller('vendorDeliveryRuleAddCtrl', ['$scope', '$rootScope', '$stateParams', 'Enterprise', 'toaster', 'DistributionRule', '$state', '$http', 'TreeData', function ($scope, $rootScope, $stateParams, Enterprise, toaster, DistributionRule, $state, $http, TreeData) {
+        $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;
+                $scope.fareArray = angular.fromJson($scope.rule.fares);
+                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;
+                        }
+                    })
+                }
+                //TODO 获取地区的JSON字符串,需要转换成有用的数据--需要改善
+                if ($scope.rule.areas){
+                    var data = angular.fromJson($scope.rule.areas);
+                    $scope.mapArray = data;
+                    $scope.qtyAreaArray = [];
+                    angular.forEach(data, function (item) {
+                        if (item.province){
+                            $scope.qtyAreaArray.push(item.province);
+                        }
+                        if (item.city){
+                            $scope.qtyAreaArray.push(item.city);
+                        }
+                        if (item.area){
+                            $scope.qtyAreaArray.push(item.area);
+                        }
+                    });
+                }
+            }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,
+                    end : 0,
+                    fare : 0
+                };
+                var secondFare = {
+                    start : 0,
+                    end : 0,
+                    fare : 0
+                };
+                $scope.fareArray.push(firstFare);
+                $scope.fareArray.push(secondFare);
+            }
+        };
+        initData();
+
+        $scope.loadCityData = function () {
+            $http.get('static/js/prod/data/city.json').success(function (data) {
+                $scope.cityJson = data;
+                $scope.cityData = convert($scope.cityJson);
+                // $scope.tree = new TreeData($scope.cityData);
+            }).error(function (res) {
+                console.log(res);
+            });
+
+            DistributionRule.findAllRuleName({},{},function (data) {
+                $scope.nameArray = data;
+            })
+        };
+        $scope.loadCityData();
+
+        $scope.repeatError = false;
+        $scope.checkRuleName = function () {
+            var k = 1;
+            angular.forEach($scope.nameArray, function (item) {
+                if (item == $scope.rule.ruleName){
+                    k = 0;
+                    return;
+                }
+            });
+            if (k == 1){
+                $scope.repeatError = false;
+            }else {
+                $scope.repeatError = true;
+            }
+
+        };
+
+        $scope.addQtyFare = function (data) {
+            var fare = {
+                start : data.end,
+                end : 0,
+                fare : 0
+            };
+            $scope.fareArray.push(fare);
+        };
+
+        $scope.deleteQtyFare = function (index) {
+            $scope.fareArray[index+1].start = $scope.fareArray[index-1].end;
+            $scope.fareArray.splice(index, 1);
+        };
+
+        $scope.inputFare = function (data) {
+            if(!data.fare) {
+                data.fare = 0;
+                return false;
+            }
+            if(isNaN(data.fare)){
+                data.fare = 0;
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return false;
+            }
+            if(Number(data.fare) < 0 || Number(data.fare) % 1 != 0) {
+                data.fare = 0;
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return false;
+            }
+            if(Number(data.fare) > 100000){
+                data.fare = 100000;
+            }
+            data.fare = Number(data.fare);
+        };
+
+        $scope.inputUniform = function () {
+            if(!$scope.rule.uniformPrice) {
+                $scope.rule.uniformPrice = 0;
+                return false;
+            }
+            if(isNaN($scope.rule.uniformPrice)){
+                $scope.rule.uniformPrice = 0;
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return false;
+            }
+            if(Number($scope.rule.uniformPrice) < 0 || Number($scope.rule.uniformPrice) % 1 != 0) {
+                data.fare = 0;
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return false;
+            }
+            if(Number($scope.rule.uniformPrice) > 100000){
+                $scope.rule.uniformPrice = 100000;
+            }
+            data.fare = Number($scope.rule.uniformPrice);
+        };
+
+        $scope.inputQtyFare = function (data, index) {
+            if(!data.start && !data.end) {
+                data.start = 0;
+                data.end = 0;
+                return false;
+            }
+            if(isNaN(data.start) || isNaN(data.end)) {
+                data.end = data.start + 1;
+                $scope.fareArray[index+1].start = Number(data.end);
+                toaster.pop('warning', '提示', '金额必须是数字');
+                return false;
+            }
+            if(Number(data.start) < 0) {
+                data.start = 0;
+                toaster.pop('warning', '提示', '金额必须大于0');
+                return false;
+            }
+            if(Number(data.end) < 0){
+                data.end = data.start + 1;
+                $scope.fareArray[index+1].start = Number(data.end);
+                toaster.pop('warning', '提示', '金额必须大于0');
+                return false;
+            }
+            if(Number(data.end) <= Number(data.start)){
+                data.end = data.start + 1;
+            }
+            if(Number(data.start) > 100000){
+                data.start = 100000;
+            }
+            if(Number(data.end) > 100000){
+                data.end = 100000;
+            }
+            data.start = Number(data.start);
+            data.end = Number(data.end);
+            $scope.fareArray[index+1].start = Number(data.end);
+        };
+
+        $scope.saveDistributionRule = function (isAdd) {
+            console.log(angular.toJson($scope.fareArray));
+            console.log(angular.toJson($scope.mapArray));
+            $scope.checkRuleName();
+            if (!$scope.rule.shippingMethod){
+                toaster.pop('error', "请选择配送方式");
+                return;
+            }
+            if(!$scope.rule.ruleName){
+                toaster.pop('error', "请填写规则名称");
+                return;
+            }
+            if($scope.repeatError){
+                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;
+            }
+
+            //拼接适用类型
+            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("-");
+            $scope.rule.qtyFare = angular.toJson($scope.fareArray);
+            $scope.rule.qtyArea = angular.toJson($scope.mapArray);
+            DistributionRule.saveRule({isAdd:isAdd, isActive:$scope.isActive}, $scope.rule , function (data) {
+                if (data){
+                    // $scope.loadDeliveryRule();
+                    if (isAdd){
+                        toaster.pop('info', "保存成功");
+                    }else{
+                        toaster.pop('info', "新增规则成功");
+                    }
+                }
+            },function (error) {
+                toaster.pop('error', "保存配送规则失败");
+            })
+        };
+
+        $scope.close = function () {
+            $state.go('vendor_deliveryRule');
+        };
+
+        // 切换tab
+        $scope.checkTab = function (t) {
+            $scope.rule.fareType = t;
+        };
+
+        $scope.chooseBox = false;
+        $scope.cancel = function () {
+            $scope.resetData($scope.tree.$data);
+            $scope.tree.initData($scope.mapArray);
+            $scope.chooseBox = false;
+        };
+
+        $scope.resetData = function (items) {
+            angular.forEach(items, function (item) {
+                item.checked = false;
+                item.selectedNum = 0;
+                if (item.items){
+                    $scope.resetData(item.items);
+                }
+            });
+        };
+
+        $scope.showSelectedData = function () {
+            $scope.mapArray = [];
+            $scope.mapArray = $scope.tree.getChecked();
+            if ($scope.mapArray.length == 0){
+                toaster.pop("info", "您还没有选择任何地区");
+                return;
+            }
+            $scope.tree.initData($scope.mapArray);
+            $scope.chooseBox = false;
+        };
+
+        $scope.deleteMapItem = function (index) {
+            $scope.mapArray.splice(index, 1);
+        };
+
+        /**
+         * 将本地地址数据转化为可用的结构
+         * @param item
+         * @returns {Array}
+         */
+        function convert(item) {
+            var arr = [];
+            if(angular.isArray(item)) {
+                angular.forEach(item, function (v) {
+                    arr.push({
+                        label: v
+                    })
+                })
+            } else {
+                angular.forEach(item, function (v, k) {
+                    arr.push({
+                        label: k,
+                        items: convert(v),
+                        selectedNum : 0,
+                        folded: true
+                    })
+                })
+            }
+            return arr;
+        }
+        // 选择地区
+        $scope.chooseAddress = function () {
+            $scope.chooseBox = true;
+            $scope.tree = new TreeData($scope.cityData);
+            $scope.tree.initData($scope.mapArray);
+        }
+    }]);
+    // 地区选择
+    app.register.factory('TreeData', function(){
+        return function (tree) {
+            var me = this;
+            me.$data = tree;
+
+            me.initData = function (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.province) {
+                                p = value; break;
+                            }
+                        }
+                        p.checked = true;
+                        if(v.city) {
+                            var c = {};
+                            for(var i in p.items) {
+                                var value = p.items[i];
+                                if(value.label == v.city) {
+                                    c = value; break;
+                                }
+                            }
+                            c.checked = true;
+                            if(v.area) {
+                                for(var i in c.items) {
+                                    var value = c.items[i];
+                                    if(value.label == v.area) {
+                                        value.checked = true; break;
+                                    }
+                                }
+                            } else {
+                                angular.forEach(c.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);
+                }
+            };
+
+
+            /**
+             * 折叠或展开文件夹
+             * @param item
+             * @param folded
+             */
+            me.toggleFold = function (item, folded) {
+                item.folded = angular.isUndefined(folded) ? !item.folded : folded;
+            }
+
+            /**
+             * 折叠文件夹
+             * @param item
+             */
+            me.fold = function (item) {
+                item.folded = true;
+            }
+
+            /**
+             * 展开文件夹
+             * @param item
+             */
+            me.unFold = function (item) {
+                item.folded = false;
+            }
+
+            /**
+             * 选中单个
+             * @param item
+             */
+            me.check = function (item) {
+                me._updateChildrenCheck(item);
+                me._updateParentsCheck(me.$data);
+                // me.getChecked();
+            }
+
+            /**
+             * 更新子树的选中状态
+             * @param item
+             * @private
+             */
+            me._updateChildrenCheck = function (item) {
+                if(item.items) {
+                    item.selectedNum = item.checked ? item.items.length : 0;
+                    angular.forEach(item.items, function (v) {
+                        v.checked = item.checked;
+                        me._updateChildrenCheck(v);
+                    })
+                }
+            }
+
+            /**
+             * 根据子树状态更新父节点选中状态
+             * @param items
+             * @private
+             */
+            me._updateParentsCheck = function (items) {
+                angular.forEach(items, function (d) {
+                    if(d.items) {
+                        me._updateParentsCheck(d.items);
+                        d.checked = me._hasCheckedChildren(d);
+                        d.semiChecked = me._hasUncheckedChildren(d);
+                    }
+                })
+            }
+
+
+            /**
+             * 判断是否有选中的子树
+             * @param item
+             * @returns {boolean}
+             * @private
+             */
+            me._hasCheckedChildren = function (item) {
+                var result = false;
+                var count = 0;
+                angular.forEach(item.items, function (v) {
+                    result = result || v.checked;
+                    if (v.checked){
+                        count++;
+                    }
+                    if(v.items && !result) {
+                        result = result || me._hasCheckedChildren(v);
+                    }
+                })
+                item.selectedNum = count;
+                return result;
+            }
+
+            /**
+             * 判断是否有没有选中的子树
+             * @param item
+             * @returns {boolean}
+             * @private
+             */
+            me._hasUncheckedChildren = function (item) {
+                var result = false;
+                angular.forEach(item.items, function (v) {
+                    result = result || !v.checked;
+                    if(v.items && !result) {
+                        result = result || me._hasUncheckedChildren(v);
+                    }
+                })
+                return result;
+            }
+
+            /**
+             * 是否半选中
+             * @param item
+             * @returns {boolean|*}
+             */
+            me.isSemiChecked = function (item) {
+                return item.checked && item.semiChecked;
+            }
+
+            /**
+             * 获取所有选中的数据
+             */
+            me.getChecked = function () {
+                var addressArray = [];
+                angular.forEach(me.$data, function (v) {
+                    if(v.checked) {
+                        if(!v.semiChecked) {
+                            var first = {
+                                province : v.label
+                            };
+                            addressArray.push(first);
+                        } else {
+                            angular.forEach(v.items, function (data) {
+                                if (data.checked){
+                                    if(!data.semiChecked) {
+                                        var second = {
+                                            province : v.label,
+                                            city : data.label
+                                        };
+                                        addressArray.push(second);
+                                    }else {
+                                        angular.forEach(data.items, function (item) {
+                                            if (item.checked){
+                                                var third = {
+                                                    province : v.label,
+                                                    city : data.label,
+                                                    area : item.label
+                                                };
+                                                addressArray.push(third);
+                                            }
+                                        })
+                                    }
+                                }
+                            });
+                        }
+                    }
+                });
+                return addressArray;
+            }
+        }
+    })
+});

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

@@ -1,8 +1,925 @@
 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', '$http', 'Enterprise', 'TreeData','$q','NumberService', function ($scope, $rootScope, ngTableParams, DistributionRule, BaseService, toaster, $state, $http, Enterprise, TreeData,$q,NumberService) {
         $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.toggleTab = function (tab) {
+            $scope.tab = tab;
+        };
+
+        /**
+         * 编辑或新增配送规则,初始化
+         * @param data
+         */
+        $scope.editRule = function (data) {
+            $scope.editFrame = true;
+            $scope.tab = 'editRule';
+            if ($scope.tree){
+                $scope.resetData($scope.tree.$data);
+            }
+            if (data){
+                $scope.modifyRule = data;
+                $scope.isModify = true;
+                $scope.isActive = $scope.modifyRule.active == 1;
+                if ($scope.modifyRule.fareType == 2){
+                    $scope.fareArray = angular.fromJson($scope.modifyRule.fares);
+                }
+                $scope.currencySymbol = $scope.modifyRule.currencyName == "RMB" ? "¥" : "$";
+                if (!$scope.fareArray){
+                    $scope.fareArray = [];
+                    var firstFare = {
+                        start : "0",
+                        end : "",
+                        fare : ""
+                    };
+                    var secondFare = {
+                        start : "",
+                        fare : ""
+                    };
+                    $scope.fareArray.push(firstFare);
+                    $scope.fareArray.push(secondFare);
+                }
+                if ($scope.modifyRule.orderType){
+                    var orderTypeArray = $scope.modifyRule.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;
+                        }
+                    })
+                }
+                $scope.mapArray = [];
+                if ($scope.modifyRule.areas){
+                    var data = angular.fromJson($scope.modifyRule.areas);
+                    $scope.tree = $scope.tree ? $scope.tree : new TreeData($scope.cityData);
+                    $scope.tree.newInitData(data);
+                    $scope.mapArray = $scope.tree.getChecked();
+                }
+            }else {
+                $scope.isModify = false;
+                $scope.modifyRule = {};
+                $scope.isActive = true;
+                $scope.modifyRule.fareType = 1;
+                $scope.modifyRule.userType = 1301;
+                $scope.orderType = {
+                    normal : true,
+                    preSale : true,
+                    bill : false
+                };
+                Enterprise.getCurrencyByRegisterAddress({}, {} ,function (data) {
+                    if (data){
+                        /**
+                         * 目前存在没有注册地址的公司,暂时设为RMB
+                         */
+                        $scope.modifyRule.currencyName = data.data ? data.data : 'RMB';
+                        $scope.currencySymbol = $scope.modifyRule.currencyName == "RMB" ? "¥" : "$";
+                    }
+                }, function (error) {
+                    toaster.pop('error', "获取企业币别信息失败");
+                });
+
+                DistributionRule.findCountOfRule({}, {}, function (data) {
+                    if (data){
+                        var num = data.data;
+                        $scope.modifyRule.num = num + 1;
+                    }
+                });
+
+                $scope.mapArray = [];
+
+                $scope.fareArray = [];
+                var firstFare = {
+                    start : "0",
+                    end : "",
+                    fare : ""
+                };
+                var secondFare = {
+                    start : "",
+                    fare : ""
+                };
+                $scope.fareArray.push(firstFare);
+                $scope.fareArray.push(secondFare);
+            }
+        };
+
+        //配送方式类型
+        $scope.deliveryMethod = {
+            1301: '第三方配送',
+            1302: '卖家配送',
+            1303: '上门自提'
+        };
+
+        $scope.inputNum = function (data) {
+            if(isNaN(data.num)){
+                data.num = null;
+                toaster.pop('warning', '提示', '请输入大于0的整数');
+                return false;
+            }
+            if(Number(data.num) < 1 || Number(data.num) % 1 != 0) {
+                data.num = null;
+                toaster.pop('warning', '提示', '请输入大于0的整数');
+                return false;
+            }
+            if(Number(data.num) > 100000){
+                data.num = 100000;
+                return false;
+            }
+        };
+
+        $scope.loadCityData = function () {
+            $http.get('static/js/prod/data/city.json').success(function (data) {
+                $scope.cityJson = data;
+                $scope.cityData = convert($scope.cityJson, null);
+            }).error(function (res) {
+                console.log(res);
+            });
+
+            DistributionRule.findAllRuleName({},{},function (data) {
+                $scope.nameArray = data;
+            })
+        };
+        $scope.loadCityData();
+
+        $scope.repeatError = false;
+        $scope.checkRuleNameSize = function () {
+            if ($scope.modifyRule.ruleName){
+                var size = $scope.modifyRule.ruleName.replace(/[^\x00-\xff]/g,'**').length;
+                if (size > 50) {
+                    $scope.nameError = true;
+                }else {
+                    $scope.nameError = false;
+                }
+            }
+            if ($scope.nameError){
+                toaster.pop("error", "规则名称,最多可输入25个文字");
+                return;
+            }
+        };
+
+        /**
+         * 添加一个分段费用
+         * @param data
+         */
+        $scope.addQtyFare = function (data) {
+            if (Number(data.start) == 1000000){
+                toaster.pop('warning', '提示', '已达到最大值1,000,000,请修改后再新增');
+                return;
+            }
+            var index = $scope.fareArray.length-1;
+            $scope.fareArray[index].end = "";
+            var fare = {
+                start : data.end,
+                fare : ""
+            };
+            $scope.fareArray.push(fare);
+        };
+
+        /**
+         * 删除一个分段费用
+         * @param index
+         */
+        $scope.deleteQtyFare = function (index) {
+            $scope.fareArray[index+1].start = $scope.fareArray[index-1].end;
+            $scope.fareArray.splice(index, 1);
+        };
+
+        $scope.inputFare = function (data) {
+            if(isNaN(data.fare)){
+                data.fare = "";
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return;
+            }
+            if(Number(data.fare) < 0 || Number(data.fare) % 1 != 0) {
+                data.fare = "";
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return;
+            }
+            if(Number(data.fare) > 100000){
+                data.fare = 100000;
+                toaster.pop('warning', '提示', '请勿超过100,100');
+            }
+            if(data.fare.length > 0){
+                data.fare = Number(data.fare);
+            }
+        };
+
+        $scope.inputUniform = function () {
+            if(isNaN($scope.modifyRule.uniformPrice)){
+                $scope.modifyRule.uniformPrice = "";
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return false;
+            }
+            if(Number($scope.modifyRule.uniformPrice) < 0 || Number($scope.modifyRule.uniformPrice) % 1 != 0) {
+                $scope.modifyRule.uniformPrice = "";
+                toaster.pop('warning', '提示', '运费必须是整数');
+                return false;
+            }
+            if(Number($scope.modifyRule.uniformPrice) > 100000){
+                $scope.modifyRule.uniformPrice = 100000;
+            }
+            if ($scope.modifyRule.uniformPrice.length != 0){
+                $scope.modifyRule.uniformPrice = Number($scope.modifyRule.uniformPrice);
+            }
+        };
+
+        $scope.exchangeActive = function (data) {
+            $scope.isActive = data;
+        };
+
+        $scope.inputQtyFare = function (data, index) {
+            if(isNaN(data.end)) {
+                data.end = "";
+                toaster.pop('warning', '提示', '仅可输入数值');
+                return;
+            }
+            if(Number(data.end) > 1000000){
+                data.end = "";
+                toaster.pop('warning', '提示', '请勿超过1,000,000');
+                return;
+            }
+            if(Number(data.end) <= Number(data.start)) {
+                data.end = "";
+                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', '提示', '输入值应小于下一行结束金额');
+                        return;
+                    }
+                }
+            }
+            if (data.end.length != 0){
+                data.end = Number(NumberService.toCeil(data.end, 2)) + "";
+                $scope.fareArray[index+1].start = data.end;
+            }
+        };
+
+        $scope.formatMoney = function (data) {
+            if (Number(data) > 100000){
+                data = 100000;
+            }
+            return Number(data);
+        };
+
+        /**
+         * 后台检查规则名是否重复
+         * @param newSave
+         * @returns {*|{url, method}}
+         */
+        var checkRepeatName = function (newSave) {
+            return DistributionRule.checkRuleName({id:$scope.modifyRule.id,ruleName:$scope.modifyRule.ruleName,newSave:newSave}, {}, function (data) {
+
+            })
+        };
+
+        /**
+         * 检查配送规则字段
+         * @returns {boolean}
+         */
+        var checkRuleError = function () {
+            if (!$scope.modifyRule.shippingMethod){
+                toaster.pop('error', "请选择配送方式");
+                return false;
+            }
+            if(!$scope.modifyRule.ruleName){
+                toaster.pop('error', "请填写规则名称");
+                return false;
+            }
+            if($scope.nameError){
+                toaster.pop('error', "规则名称,最多可输入25个文字");
+                return false;
+            }
+            if($scope.repeatError){
+                toaster.pop('error', "该规则名称已存在,请修改");
+                return false;
+            }
+            /**
+             * TODO 暂时注释,以后在放出来
+             */
+            // if(!$scope.orderType.normal && !$scope.orderType.preSale && !$scope.orderType.bill){
+            //     toaster.pop('error', "请选择适用类型");
+            //     return false;
+            // }
+            // if(!$scope.modifyRule.userType){
+            //     toaster.pop('error', "请选择适用类型");
+            //     return false;
+            // }
+            if (!$scope.mapArray){
+                toaster.pop('error', "您还没有选择任何地区");
+                return false;
+            }
+            if ($scope.mapArray.length > 0){
+                var resultArray = convertArray($scope.mapArray);
+                $scope.modifyRule.qtyArea = angular.toJson(resultArray);
+            }else {
+                toaster.pop('error', "您还没有选择任何地区");
+                return false;
+            }
+            if (!$scope.modifyRule.qtyArea){
+                toaster.pop('error', "您还没有选择任何地区");
+                return false;
+            }
+            if ($scope.modifyRule.fareType == 1){
+                if (typeof($scope.modifyRule.uniformPrice) == 'undefined' ||
+                    typeof($scope.modifyRule.uniformPrice) == 'string'){
+                    toaster.pop('error', "请输入统一规定运费");
+                    return false;
+                }
+            }
+            if ($scope.modifyRule.fareType == 2){
+                var lackData = false;
+                angular.forEach($scope.fareArray, function (item) {
+                    if (item.start.length == 0 || item.fare.length == 0){
+                        lackData = true
+                    }
+                    if (item.end){
+                        if (item.end.length == 0){
+                            lackData = true
+                        }
+                    }
+                });
+                if (lackData){
+                    toaster.pop('error', "请完善计费方式");
+                    return false;
+                }
+                $scope.modifyRule.qtyFare = angular.toJson($scope.fareArray);
+            }
+            return true;
+        };
+
+        /**
+         * isAdd false-另存为
+         * @param isAdd
+         */
+        $scope.saveDistributionRule = function (isAdd) {
+            if ($scope.modifyRule.ruleName){
+                $q.all([checkRepeatName(!isAdd).$promise]).then(function(data) {
+                    if (data){
+                        $scope.repeatError = data[0].data;
+                    }
+                    var valid = checkRuleError();
+                    if (!valid){
+                        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.modifyRule.orderType = typeArray.join("-");
+
+                    if (!$scope.modifyRule.qtyArea){
+                        toaster.pop('error', "您还没有选择任何地区");
+                        return;
+                    }
+
+                    if (valid){
+                        DistributionRule.saveRule({isAdd:isAdd, isActive:$scope.isActive}, $scope.modifyRule , function (data) {
+                            if (data.success){
+                                $scope.editFrame = false;
+                                $scope.tab = 'deliverRule';
+                                if (isAdd){
+                                    toaster.pop('info', "保存成功");
+                                }else{
+                                    toaster.pop('info', "新增规则成功");
+                                }
+                            }else {
+                                toaster.pop('error', data.message);
+                                return;
+                            }
+                        },function (error) {
+                            toaster.pop('error', "保存配送规则失败");
+                        })
+                    }
+                });
+            }else {
+                toaster.pop('error', "请填写规则名称");
+                return;
+            }
+
+        };
+
+        // 切换计费类型
+        $scope.checkTab = function (t) {
+            $scope.modifyRule.fareType = t;
+        };
+
+        var convertArray = function (array) {
+            var resultArray = angular.copy(array);
+            var indexArray = [];
+            angular.forEach(array, function (item, index) {
+                if (item.mainland && !item.province){
+                    indexArray.push(index);
+                    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 count = 0;
+            angular.forEach(indexArray, function (index) {
+                resultArray.splice(index - count, 1);
+                count++;
+            });
+            return resultArray;
+        };
+
+        $scope.chooseBox = false;
+        $scope.cancel = function () {
+            $scope.resetData($scope.tree.$data);
+            if ($scope.mapArray.length > 0){
+                var resultArray = convertArray($scope.mapArray);
+                $scope.tree.newInitData(resultArray);
+            }
+            $scope.chooseBox = false;
+        };
+
+        $scope.cancelEdit = function () {
+            $scope.editFrame = false;
+            $scope.tab = 'deliverRule';
+        };
+
+        $scope.resetData = function (items) {
+            angular.forEach(items, function (item) {
+                item.checked = false;
+                if (item.parent == null){
+                    item.folded = false;
+                }else {
+                    item.folded = true;
+                }
+                item.selectedNum = 0;
+                if (item.items){
+                    $scope.resetData(item.items);
+                }
+            });
+        };
+
+        $scope.showSelectedData = function () {
+            $scope.mapArray = [];
+            $scope.mapArray = $scope.tree.getChecked();
+            if ($scope.mapArray.length == 0){
+                toaster.pop("info", "您还没有选择任何地区");
+                return;
+            }
+            $scope.tree.newInitData($scope.mapArray);
+            $scope.chooseBox = false;
+        };
+
+        $scope.deleteMapItem = function (index) {
+            $scope.mapArray.splice(index, 1);
+            $scope.resetData($scope.tree.$data);
+            if ($scope.mapArray.length > 0){
+                var resultArray = convertArray($scope.mapArray);
+                $scope.tree.newInitData(resultArray);
+            }
+        };
+
+        /**
+         * 将本地地址数据转化为可用的结构
+         * @param item
+         * @returns {Array}
+         */
+        function convert(item, parent) {
+            var arr = [];
+            if(angular.isArray(item)) {
+                angular.forEach(item, function (v) {
+                    arr.push({
+                        label: v,
+                        checked: false,
+                        parent:parent
+                    })
+                })
+            } else {
+                if (parent == null){
+                    var china = {
+                        label:'中国大陆',
+                        checked: false,
+                        parent:null,
+                        items:null,
+                        selectedNum: 0,
+                        folded: false
+                    };
+                    $scope.hmt = {
+                        label:'港澳台',
+                        checked: false,
+                        parent:null,
+                        items:null,
+                        selectedNum:0,
+                        folded: false
+                    };
+                    china.items = convert(item, china);
+                    arr.push(china);
+                    arr.push($scope.hmt);
+                }else {
+                    angular.forEach(item, function (v, k) {
+                        if (k != '香港特别行政区'){
+                            var object = {
+                                label: k,
+                                checked: false,
+                                parent:parent,
+                                items: null,
+                                selectedNum : 0,
+                                folded: true
+                            };
+                            object.items = convert(v, object);
+                            arr.push(object);
+                        }else {
+                            $scope.hmtChild = {
+                                label: k,
+                                checked: false,
+                                parent:$scope.hmt,
+                                items: null,
+                                selectedNum : 0,
+                                folded: true
+                            }
+                            $scope.hmtChild.items = convert(v, $scope.hmtChild);
+                            var hmtArr = [];
+                            hmtArr.push($scope.hmtChild);
+                            $scope.hmt.items = hmtArr;
+                            // arr.push($scope.hmtChild);
+                        }
+                    })
+                }
+            }
+            return arr;
+        }
+        // 选择地区
+        $scope.chooseAddress = function () {
+            $scope.chooseBox = true;
+            $scope.tree = $scope.tree ? $scope.tree : new TreeData($scope.cityData);
+            $scope.tree.newInitData($scope.mapArray);
+        }
+
+        /**
+         * 切换生效状态
+         * @param rule
+         * @param isAdd
+         * @param active
+         */
+        $scope.changeActive = function (ruleId, active) {
+            DistributionRule.changeActive({id:ruleId, isActive:active}, {}, function (data) {
+                if (data){
+                    $scope.ruleTableParams.reload();
+                }
+            })
+        };
+
+        $scope.showDeleteFrame = function (data) {
+            $scope.deleteFrame = true;
+            $scope.deleteObject = data;
+        };
+
+        /**
+         * 根据id删除指定配送规则
+         * @param id
+         */
+        $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.cancelDelete = function () {
+            $scope.deleteFrame = false;
+        };
+
     }]);
+
+    // 地区选择
+    app.register.factory('TreeData', function(){
+        return function (tree) {
+            var me = this;
+            me.$data = tree;
+
+            /**
+             * 根据已选地区映射到树对象中
+             * @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 data) {
+                            var value = data[i];//获取单个省
+                            if(value.label == v.province) {
+                                p = value; break;
+                            }
+                        }
+                        p.checked = true;
+                        if(v.city) {
+                            var c = {};
+                            for(var i in p.items) {
+                                var value = p.items[i];//获取单个市
+                                if(value.label == v.city) {
+                                    c = value; break;
+                                }
+                            }
+                            c.checked = true;
+                            if(v.area) {
+                                for(var i in c.items) {
+                                    var a = c.items[i];//获取单个区
+                                    if(a.label == v.area) {
+                                        a.checked = true; break;
+                                    }
+                                }
+                            }else {
+                                angular.forEach(c.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;
+                                })
+                            })
+                        }
+                    })
+                }
+            };
+
+            /**
+             * 折叠或展开文件夹
+             * @param item
+             * @param folded
+             */
+            me.toggleFold = function (item, folded) {
+                var f = item.folded;
+                if (item.items){
+                    me._resetFold(me.$data);
+                    if (item.parent != null){
+                        me._unFoldThisItem(item.parent);
+                    }
+                }
+                item.folded = angular.isUndefined(folded) ? !f : folded;
+            }
+
+            /**
+             * 折叠文件夹
+             * @param item
+             */
+            me.fold = function (item) {
+                item.folded = true;
+            }
+
+            /**
+             * 展开文件夹
+             * @param item
+             */
+            me.unFold = function (item) {
+                item.folded = false;
+            }
+
+            /**
+             * 选中单个
+             * @param item
+             */
+            me.check = function (item) {
+                if (item.items){
+                    me._resetFold(me.$data);
+                    me._unFoldThisItem(item);
+                }
+                me._updateChildrenCheck(item);
+                me._updateParentsCheck(me.$data);
+
+            }
+
+            /**
+             * 展开当前列表和父列表
+             * @param item
+             * @private
+             */
+            me._unFoldThisItem = function (item) {
+                me.unFold(item);
+                if (item.parent != null){
+                    me._unFoldThisItem(item.parent);
+                }
+            }
+
+            /**
+             * 折叠全部
+             * @param items
+             * @private
+             */
+            me._resetFold = function (items) {
+                angular.forEach(items, function (v) {
+                    v.folded = true;
+                    if (v.items){
+                        me._resetFold(v.items);
+                    }
+                });
+            }
+
+            /**
+             * 更新子树的选中状态
+             * @param item
+             * @private
+             */
+            me._updateChildrenCheck = function (item) {
+                if(item.items) {
+                    item.selectedNum = item.checked ? item.items.length : 0;
+                    angular.forEach(item.items, function (v) {
+                        v.checked = item.checked;
+                        me._updateChildrenCheck(v);
+                    })
+                }
+            }
+
+            /**
+             * 根据子树状态更新父节点选中状态
+             * @param items
+             * @private
+             */
+            me._updateParentsCheck = function (items) {
+                angular.forEach(items, function (d) {
+                    if(d.items) {
+                        me._updateParentsCheck(d.items);
+                        d.checked = me._hasCheckedChildren(d);
+                        d.semiChecked = me._hasUncheckedChildren(d);
+                    }
+                })
+            }
+
+
+            /**
+             * 判断是否有选中的子树
+             * @param item
+             * @returns {boolean}
+             * @private
+             */
+            me._hasCheckedChildren = function (item) {
+                var result = false;
+                var count = 0;
+                angular.forEach(item.items, function (v) {
+                    result = result || v.checked;
+                    if (v.checked){
+                        count++;
+                    }
+                    if(v.items && !result) {
+                        result = result || me._hasCheckedChildren(v);
+                    }
+                })
+                item.selectedNum = count;
+                return result;
+            }
+
+            /**
+             * 判断是否有没有选中的子树
+             * @param item
+             * @returns {boolean}
+             * @private
+             */
+            me._hasUncheckedChildren = function (item) {
+                var result = false;
+                angular.forEach(item.items, function (v) {
+                    result = result || !v.checked;
+                    if(v.items && !result) {
+                        result = result || me._hasUncheckedChildren(v);
+                    }
+                })
+                return result;
+            }
+
+            /**
+             * 是否半选中
+             * @param item
+             * @returns {boolean|*}
+             */
+            me.isSemiChecked = function (item) {
+                return item.checked && item.semiChecked;
+            }
+
+            /**
+             * 获取所有选中的数据
+             */
+            me.getChecked = function () {
+                var addressArray = [];
+                angular.forEach(me.$data, function (v) {
+                    if(v.checked) {
+                        if(!v.semiChecked) {
+                            var first = {
+                                mainland : v.label
+                            };
+                            addressArray.push(first);
+                        } else {
+                            angular.forEach(v.items, function (data) {
+                                if (data.checked){
+                                    if(!data.semiChecked) {
+                                        var second = {
+                                            // mainland : v.label,
+                                            province : data.label
+                                        };
+                                        addressArray.push(second);
+                                    }else {
+                                        angular.forEach(data.items, function (item) {
+                                            if(!item.semiChecked) {
+                                                var third = {
+                                                    // mainland : v.label,
+                                                    province : data.label,
+                                                    city : item.label
+                                                };
+                                                addressArray.push(third);
+                                            }else {
+                                                angular.forEach(item.items, function (m) {
+                                                    if (m.checked){
+                                                        var forth = {
+                                                            // mainland : v.label,
+                                                            province : data.label,
+                                                            city : item.label,
+                                                            area : m.label
+                                                        };
+                                                        addressArray.push(forth);
+                                                    }
+                                                })
+                                            }
+                                        })
+                                    }
+                                }
+                            });
+                        }
+                    }
+                });
+                return addressArray;
+            }
+        }
+    })
 });

+ 485 - 98
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_delivery_ctrl.js

@@ -4,12 +4,11 @@
  */
 define(['app/app'], function(app) {
     "use strict";
-    app.register.controller('vendorDeliveryCtrl', ['$scope', '$rootScope', 'InvoiceFPurchase', 'ChineseToPinYin', 'Order' , 'Purchase', '$modal', '$stateParams', 'ComponentActive','$window','$state', 'BaseService', 'ShippingAddress', 'Logistics', '$filter', 'toaster', 'KdnLogistics', '$q', '$timeout', function($scope, $rootScope, InvoiceFPurchase, ChineseToPinYin, Order , Purchase, $modal, $stateParams, ComponentActive, $window, $state, BaseService, ShippingAddress, Logistics, $filter, toaster, KdnLogistics, $q, $timeout) {
+    app.register.controller('vendorDeliveryCtrl', ['$scope', '$rootScope', 'InvoiceFPurchase', 'ChineseToPinYin', 'Order' , 'Purchase', '$modal', '$stateParams', 'ComponentActive','$window','$state', 'BaseService', 'ShippingAddress', 'Logistics', '$filter', 'toaster', 'KdnLogistics', '$q', '$timeout','Distributor', 'SessionService', function($scope, $rootScope, InvoiceFPurchase, ChineseToPinYin, Order , Purchase, $modal, $stateParams, ComponentActive, $window, $state, BaseService, ShippingAddress, Logistics, $filter, toaster, KdnLogistics, $q, $timeout, Distributor, SessionService) {
 
         $scope.logistics = {};
         $scope.jsonSdAddress = {};
         $scope.selfDeliveryPerson = {};
-        
 		// 获取快递鸟快递公司列表
         $scope.selectedName = ""; // 选中的物流公司名称
         var getKdnLogistics = function () {
@@ -21,24 +20,56 @@ define(['app/app'], function(app) {
             }, function () {
                 toaster.pop("error", "错误", "获取快递公司列表失败");
             });
-        }
+        };
+
+        $scope.initData = function () {
+            Distributor.findAllSelected({},function (data) {
+                if (data){
+                    $scope.data_list = data;
+                }
+                angular.forEach($scope.data_list, function (data) {
+                    data.isOpen = false;
+                })
+            })
+        };
+        $scope.initData();
+
+        /**
+         * 初始化所有的快递鸟列表
+         */
+        $scope.findAllKdnList = function () {
+            KdnLogistics.getCompanyName({}, function (data) {
+                if (data){
+                    $scope.allKdnList = data;
+                }
+                angular.forEach($scope.allKdnList, function (data) {
+                    data.isChoosed = false;
+                });
+            }, function (error) {
+
+            })
+        };
+        $scope.findAllKdnList();
 
         $scope.showText = function (data) {
-            document.getElementById("addr").value = data;
-            $scope.logistics.companyName = data;
-            $scope.containsAttr(data);
+            $scope.logistics.companyName = data.companyName;
+            $scope.companyObject = data;
             $scope.showCompanyName = false;
-            // console.log($scope.logistics.companyName);
         };
 
-        $scope.showCompanyName = false;
+        //显示默认的选项
+        $scope.showDefaultText = function () {
+            $scope.logistics.companyName = '请选择物流公司';
+            $scope.companyObject = {};
+        };
+
+        // $scope.showCompanyName = false;
 
         $scope.changeShowLogistics = function () {
             // matchArray();
-            $scope.matchData = true;
-            $scope.resultList = $scope.companyNameList;
+            // $scope.matchData = true;
+            // $scope.resultList = $scope.companyNameList;
             $scope.showCompanyName = !$scope.showCompanyName;
-            // document.getElementById("addr").value = "";
         };
 
         /**
@@ -59,17 +90,17 @@ define(['app/app'], function(app) {
             }
         };
 
-        $scope.textChange = function () {
-            // console.log( $scope.logistics.companyName);
-            initIndex();
-            var dom = document.getElementById("addr");
-            matchArray();
-            if (dom.value) {
-                var content = dom.value;
-                $scope.containsAttr(content);
-            }
-            $scope.showCompanyName = true;
-        };
+        // $scope.textChange = function () {
+        //     // console.log( $scope.logistics.companyName);
+        //     initIndex();
+        //     var dom = document.getElementById("addr");
+        //     matchArray();
+        //     if (dom.value) {
+        //         var content = dom.value;
+        //         $scope.containsAttr(content);
+        //     }
+        //     $scope.showCompanyName = true;
+        // };
 
         /**
          * 判断快递鸟是否包含输入的快递
@@ -92,6 +123,11 @@ define(['app/app'], function(app) {
             }
         };
 
+        $scope.backToDelivery = function () {
+            SessionService.setCookie('status', 'comfirmed');
+            $state.go('vendor_order');
+        };
+
         var getInvoiceFPurchase = function () {
             return InvoiceFPurchase.tobeshippedByInvoiceid({ids: $stateParams.ids}, function(data) {
                 $scope.checkinvoice = data[0];
@@ -99,7 +135,15 @@ define(['app/app'], function(app) {
                 //     $scope.checkinvoice.orderId = result.data;
                 // });
                 $scope.checkinvoice.jsonSpAddress = angular.fromJson($scope.checkinvoice.jsonSpAddress);
+                $scope.checkinvoice.jsonSpAddress.area = $scope.checkinvoice.jsonSpAddress.area.replace(/,/g,' ');
                 $scope.checkinvoice.show = false;
+                if ($scope.checkinvoice.jsonRule){
+                    $scope.rule = angular.fromJson($scope.checkinvoice.jsonRule);
+                }
+                if ($scope.checkinvoice.jsonTakeSelf){
+                    $scope.takeSelf = angular.fromJson($scope.checkinvoice.jsonTakeSelf);
+                    $scope.takeSelf.area = $scope.takeSelf.area.replace(/,/g,' ');
+                }
                 //现在默认物公司
                 $scope.checkinvoice.deliveryType = 'logistics';
             }, function (response) {
@@ -138,6 +182,12 @@ define(['app/app'], function(app) {
             }
         };
 
+        //配送方式类型
+        $scope.deliveryMethod = {
+            1301: '第三方配送',
+            1302: '卖家配送',
+            1303: '上门自提'
+        };
 
         $scope.setAddrShow = function(invoice) {
             invoice.deliveryShow = "hide";
@@ -193,12 +243,14 @@ define(['app/app'], function(app) {
                 }else if(!addr){//新增地址
                     $scope.addresss.push(address);
                     $scope.jsonSdAddress = address;
+                    $scope.jsonSdAddress.area = $scope.jsonSdAddress.area.replace(/,/g,' ');
                 }else {//只是修改了地址的信息,则做替换的动作就可以了
                     $scope.addresss[address.num-1] = address;
                     $scope.jsonSdAddress = address;
+                    $scope.jsonSdAddress.area = $scope.jsonSdAddress.area.replace(/,/g,' ');
                 }
             }, function(){
-                toaster.pop('info', '提示 ' + '您已取消收货地址的编辑');
+                toaster.pop('info', '提示 ' + '您已取消发货地址的编辑');
             });
         };
 
@@ -210,6 +262,7 @@ define(['app/app'], function(app) {
                 $scope.jsonSdAddress = {};
                 if($scope.addresss.length > 0) {
                     $scope.jsonSdAddress = $scope.addresss[0];
+                    $scope.jsonSdAddress.area = $scope.jsonSdAddress.area.replace(/,/g,' ');
                 }
             }, function(res) {
                 toaster.pop('error', '错误', res.data);
@@ -246,39 +299,42 @@ define(['app/app'], function(app) {
         };
 
         // 搜索框获得焦点,显示联想框
-        $scope.getFocus = function() {
-            // $scope.showCompanyName = true;
+        $scope.getItemFocus = function() {
+            $scope.showCompanyName = true;
             initIndex();
-            // if(!$scope.logistics.companyName)
-            //     $scope.logistics.companyName = '';
         };
 
-        $scope.onBlur = function () {
-            setTimeout(function () {
-                $scope.showCompanyName = false;
-            }, 120);
+        $scope.onItemBlur = function () {
+            if ($scope.time){
+                clearTimeout($scope.time);
+            }
+            $scope.time = setTimeout(function () {
+                $scope.$apply(function () {
+                    $scope.showCompanyName = false;
+                });
+            }, 200);
         };
 
         //$scope.downNumber = 0;
         $scope.onKeyup = function () {
             var dom = document.getElementById("ulContent");
             // console.log(dom.scrollTop);
-            if ($scope.showCompanyName && $scope.matchData){
+            if ($scope.showCompanyName){
                 if(event.keyCode == 40) { //监听到按下键
                     $scope.selectIndex ++;
-                    if ($scope.downIndex == 10){
+                    if ($scope.downIndex == 5){
                         dom.scrollTop += 23;
                     }
-                    if ($scope.downIndex <= 9){
+                    if ($scope.downIndex <= 4){
                         $scope.downIndex++;
                     }
-                    if($scope.selectIndex >= $scope.resultList.length){
+                    if($scope.selectIndex >= $scope.data_list.length){
                         $scope.selectIndex = 0;
                         dom.scrollTop = 0;
                         $scope.downIndex = 1;
                     }
-                    $scope.logistics.companyName = $scope.resultList[$scope.selectIndex];
-                    $scope.containsAttr($scope.logistics.companyName);
+                    $scope.logistics.companyName = $scope.data_list[$scope.selectIndex].companyName;
+                    // $scope.containsAttr($scope.logistics.companyName);
                 } else if(event.keyCode == 38) { //监听到按上键
                     $scope.selectIndex --;
                     if ($scope.downIndex == 1){
@@ -288,12 +344,12 @@ define(['app/app'], function(app) {
                         $scope.downIndex--;
                     }
                     if($scope.selectIndex < 0){
-                        $scope.selectIndex = $scope.resultList.length - 1;
+                        $scope.selectIndex = $scope.data_list.length - 1;
                         dom.scrollTop = 2400;
-                        $scope.downIndex = 10;
+                        $scope.downIndex = 5;
                     }
-                    $scope.logistics.companyName = $scope.resultList[$scope.selectIndex];
-                    $scope.containsAttr($scope.logistics.companyName);
+                    $scope.logistics.companyName = $scope.data_list[$scope.selectIndex].companyName;
+                    // $scope.containsAttr($scope.logistics.companyName);
                 } else if(event.keyCode == 13) { //确定键
                     $scope.showCompanyName = false;
                 }
@@ -312,19 +368,19 @@ define(['app/app'], function(app) {
             }
 
             // 调用快递鸟预约取件接口
-            var params = {};
-            params.orderid = $scope.checkinvoice.invoiceid;
-            params.companyName = $scope.logistics.companyName;
-            params.receiverJson = $scope.checkinvoice.jsonSpAddress;
-            params.senderJson =	 $scope.jsonSdAddress;
-            KdnLogistics.kdnBooking(params, {}, function(response){
-            	var result = response;
-            	if("fail" == result){
-            		toaster.pop("info", "提示", "调用快递鸟预约取件失败")
-            	}
-            }, function(){
-            	/*toaster.pop("error", "错误", "快递鸟预约取件接口后台出现错误");*/
-            });
+            // var params = {};
+            // params.orderid = $scope.checkinvoice.invoiceid;
+            // params.companyName = $scope.logistics.companyName;
+            // params.receiverJson = $scope.checkinvoice.jsonSpAddress;
+            // params.senderJson =	 $scope.jsonSdAddress;
+            // KdnLogistics.kdnBooking(params, {}, function(response){
+            // 	var result = response;
+            // 	if("fail" == result){
+            // 		toaster.pop("info", "提示", "调用快递鸟预约取件失败")
+            // 	}
+            // }, function(){
+            // 	/*toaster.pop("error", "错误", "快递鸟预约取件接口后台出现错误");*/
+            // });
               
             //现在商城没有发货地址。
             // var toSendInvoice = angular.copy($scope.checkinvoice);
@@ -335,32 +391,39 @@ define(['app/app'], function(app) {
             //     delete $stateParams.ids;
             // });
 
-            var isValid = validDeliveryInfo($scope.checkinvoice.deliveryType);
+            // var isValid = validDeliveryInfo($scope.checkinvoice.deliveryType);
+            var isValid = validLogisticsInfo($scope.checkinvoice.sendType);
             if(!isValid) {
                 return ;
             }
-            if ($scope.showTip){
-                //验证通过后保存卖家输入额外的快递公司名称
-                KdnLogistics.saveSellerLogistics({companyName :$scope.logistics.companyName}, {}, function (data) {
-                    console.log(data);
-                });
-            }
+            // if ($scope.showTip){
+            //     //验证通过后保存卖家输入额外的快递公司名称
+            //     KdnLogistics.saveSellerLogistics({companyName :$scope.logistics.companyName}, {}, function (data) {
+            //         console.log(data);
+            //     });
+            // }
             var sendInfo = {};
-            if($scope.checkinvoice.deliveryType == 'logistics') {
-                sendInfo.deliveryType = 'logistics';
+            sendInfo.sendType = $scope.checkinvoice.sendType;
+            if ($scope.logistics.companyName && $scope.logistics.number){
                 sendInfo.logisticsInfo = {};
                 sendInfo.logisticsInfo.companyName = $scope.logistics.companyName;
                 sendInfo.logisticsInfo.number = $scope.logistics.number;
-            }else if($scope.checkinvoice.deliveryType == 'selfDelivery'){
-                sendInfo.deliveryType = 'selfDelivery';
-                sendInfo.selfDeliveryPerson = $scope.selfDeliveryPerson;
-            }else {
-                toaster.pop('info', '提示', '配送方式有误');
-                return ;
             }
+            // if($scope.checkinvoice.deliveryType == 'logistics') {
+            //     sendInfo.deliveryType = 'logistics';
+            //     sendInfo.logisticsInfo = {};
+            //     sendInfo.logisticsInfo.companyName = $scope.logistics.companyName;
+            //     sendInfo.logisticsInfo.number = $scope.logistics.number;
+            // }else if($scope.checkinvoice.deliveryType == 'selfDelivery'){
+            //     sendInfo.deliveryType = 'selfDelivery';
+            //     sendInfo.selfDeliveryPerson = $scope.selfDeliveryPerson;
+            // }else {
+            //     toaster.pop('info', '提示', '配送方式有误');
+            //     return ;
+            // }
             sendInfo.jsonSdAddress = angular.toJson($scope.jsonSdAddress);
             InvoiceFPurchase.saveInvoiceFPurchase({id : $scope.checkinvoice.id}, sendInfo, function(data) {
-                toaster.pop("success", "信息", "保存成功,返回出订单管理界面");
+                toaster.pop("success", "信息", "发货成功");
                 // TODO 这边要停5秒钟之后,在跳转到出货单管理界面
                 /*var fromPage = window.sessionStorage.getItem("orderAdmin");
                  if(fromPage == "invoiceProofing") {
@@ -418,6 +481,47 @@ define(['app/app'], function(app) {
             invoice.show = false;
             invoice.deliveryType = inputType;
         };
+        
+        var validLogisticsInfo = function (sendType) {
+            if (sendType == 1301){
+                if (!$scope.logistics.companyName){
+                    toaster.pop('error', '注意', '请选择物流公司');
+                    return false;
+                }
+                if ($scope.logistics.companyName == '请选择物流公司'){
+                    toaster.pop('error', '注意', '请选择物流公司');
+                    return false;
+                }
+                if (!$scope.logistics.number){
+                    toaster.pop('error', '注意', '请填写物流单号');
+                    return false;
+                }
+                var patt = new RegExp("^[A-Za-z0-9]+$");
+                if (!patt.test($scope.logistics.number)){
+                    toaster.pop("error", "注意", '请输入正确的物流单号');
+                    return false;
+                }
+            }else {
+                if ($scope.logistics.companyName && $scope.logistics.companyName != '请选择物流公司'){
+                    if (!$scope.logistics.number){
+                        toaster.pop("error", "注意", '请完善快递信息');
+                        return false;
+                    }
+                }
+                if ($scope.logistics.number){
+                    var patt = new RegExp("^[A-Za-z0-9]+$");
+                    if (!patt.test($scope.logistics.number)){
+                        toaster.pop("error", "注意", '请输入正确的物流单号');
+                        return false;
+                    }
+                    if (!$scope.logistics.companyName || $scope.logistics.companyName == '请选择物流公司'){
+                        toaster.pop("error", "注意", '请完善快递信息');
+                        return false;
+                    }
+                }
+            }
+            return true;
+        };
 
         var validDeliveryInfo = function(inputType) {
             if(angular.equals(inputType, 'logistics')) {
@@ -456,29 +560,29 @@ define(['app/app'], function(app) {
         };
 
 
-        document.onclick = function (event) {
-            var element = event.srcElement;
-            var elementName =  element.getAttribute("name");
-            $scope.$apply(function () {
-                    var isThisTag = false;
-                    if(elementName && "companyName" == elementName) {
-                        isThisTag = true;
-                    }
-                    if(!isThisTag) {
-                        var parentElement = element.parentElement;
-                        while (parentElement && parentElement.tagName && parentElement.tagName != 'BODY') {
-                            var parentElementName =  parentElement.getAttribute("name");
-                            if(parentElementName && "companyName" == parentElementName) {
-                                isThisTag = true;
-                            }
-                            parentElement = parentElement.parentElement;
-                        }
-                    }
-                    if(!isThisTag) {
-                        $scope.showCompanyName = false;
-                    }
-            });
-        };
+        // document.onclick = function (event) {
+        //     var element = event.srcElement;
+        //     var elementName =  element.getAttribute("name");
+        //     $scope.$apply(function () {
+        //             var isThisTag = false;
+        //             if(elementName && "companyName" == elementName) {
+        //                 isThisTag = true;
+        //             }
+        //             if(!isThisTag) {
+        //                 var parentElement = element.parentElement;
+        //                 while (parentElement && parentElement.tagName && parentElement.tagName != 'BODY') {
+        //                     var parentElementName =  parentElement.getAttribute("name");
+        //                     if(parentElementName && "companyName" == parentElementName) {
+        //                         isThisTag = true;
+        //                     }
+        //                     parentElement = parentElement.parentElement;
+        //                 }
+        //             }
+        //             if(!isThisTag) {
+        //                 $scope.showCompanyName = false;
+        //             }
+        //     });
+        // };
 
         $scope.cancle = function(invoice) {
             invoice.deliveryShow = 'hide';
@@ -577,7 +681,28 @@ define(['app/app'], function(app) {
             $scope.logistics.companyId = company.id;
             $scope.isCompany = false;
         };
-
+        // 新增配送商
+        $scope.addDistributor = function () {
+            $modal.open({
+                templateUrl : $rootScope.rootPath + '/static/view/vendor/modal/vendor_distributor_manage.html',
+                controller : 'vendorDistributorModalCtrl',
+                size : 'lg',
+                resolve : {
+                    allKdnList : function () {
+                        return $scope.allKdnList;
+                    },
+                    selectedList : function () {
+                        return $scope.data_list;
+                    }
+                }
+            }).result.then(function(data){
+                if (data) {
+                    $scope.initData();
+                }
+            }, function(){
+                // toaster.pop('info', '提示 ' + '您已取消配送商的编辑');
+            });
+        }
     }]);
 
     //地址编辑模态框
@@ -599,7 +724,7 @@ define(['app/app'], function(app) {
             if(addr){
                 $scope.address = addr;
                 //拼装下拉选择框
-                var arr = addr.area.split(',');
+                var arr = addr.area.split(' ');
                 addr.province = arr[0];
                 addr.city = arr[1];
                 addr.district = arr[2];
@@ -614,7 +739,7 @@ define(['app/app'], function(app) {
             var size;
             if(num == 1) {
                 if ($scope.address.name){
-                    size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
+                    size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
                     if (size > 20) {
                         $scope.userError = true;
                         return;
@@ -623,7 +748,7 @@ define(['app/app'], function(app) {
                 }
             } else if(num == 2) {
                 if ($scope.address.tel){
-                    size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
+                    size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
                     if (size < 8 || size > 11) {
                         $scope.telError = true;
                         return;
@@ -638,7 +763,7 @@ define(['app/app'], function(app) {
                 }
             } else if(num == 3) {
                 if ($scope.address.detailAddress){
-                    size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
+                    size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
                     if (size > 60) {
                         $scope.addrError = true;
                         return;
@@ -693,6 +818,268 @@ define(['app/app'], function(app) {
         };
     }]);
 
+    app.register.controller('vendorDistributorModalCtrl', ['$scope','$rootScope','$modal','toaster','KdnLogistics','Distributor','BaseService','ngTableParams','$modalInstance','$q','selectedList','allKdnList', function ($scope, $rootScope, $modal, toaster, KdnLogistics, Distributor, BaseService, ngTableParams, $modalInstance, $q, selectedList, allKdnList) {
+        //获取快递鸟信息
+        $scope.$$kdnData = {};
+        $scope.selectedList = selectedList;
+        $scope.allKdnList = allKdnList;
+        $scope.chooseList = [];
+        $scope.selectFlag = [];
+
+        $scope.initArrayData = function () {
+            angular.forEach(allKdnList, function (data) {
+                $scope.selectFlag[data.code] = {};
+                $scope.selectFlag[data.code].isChoosed = false;
+            });
+            angular.forEach(selectedList, function (data, index) {
+                $scope.chooseList[index] = {};
+                if (data.code){
+                    $scope.chooseList[index].code = data.code;
+                    $scope.selectFlag[data.code].isChoosed = true;
+                }
+                $scope.chooseList[index].companyName = data.companyName;
+            });
+        };
+        $scope.initArrayData();
+
+        $scope.distributorTableParams = new ngTableParams({
+            page : 1,
+            count : 30
+        },{
+            total : 0,
+            getData : function ($defer, params) {
+                var param = BaseService.parseParams(params.url());
+                KdnLogistics.findKdnPage(param, function (page) {
+                    $scope.$$kdnData.totalElements = page.totalElements;
+                    if(Number(page.totalElements) > 0) {
+                        $scope.$$kdnData.start = Number(page.size) * (Number(page.number) - 1) + 1;
+                    }else {
+                        $scope.$$kdnData.start = 0;
+                    }
+                    $scope.$$kdnData.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
+                    $scope.pageList = page.content;
+                    params.total(page.totalElements);
+                    $defer.resolve(page.content);
+                    //划分数据
+                    var row = Math.ceil(page.numberOfElements/6.0);
+                    $scope.showList = [];
+                    var count = 0;
+                    for (var i = 0; i<row; i++){
+                        $scope.showList[i] = [];
+                        for (var j = 0; j<6; j++){
+                            // var code = $scope.pageList[count].code;
+                            // $scope.pageList[count].isChoosed = $scope.selectFlag[code].isChoosed;
+                            $scope.showList[i].push($scope.pageList[count]);
+                            count++;
+                            if (count == page.numberOfElements){
+                                return;
+                            }
+                        }
+                    }
+                }, function () {
+                    toaster.pop('error', '获取快递鸟信息失败');
+                });
+            }
+        });
+
+        var countLength = function (string) {
+            return string.replace(/[^x00-xFF]/g,'**').length;
+        };
+
+        $scope.inputContent = function () {
+            for (var i=0; i<$scope.keyword.length;i++){
+                if (countLength($scope.keyword.substr(0, i)) >= 26){
+                    $scope.keyword = $scope.keyword.substr(0, i);
+                    break;
+                }
+            }
+            var addrPatt = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
+            if (!addrPatt.test($scope.keyword) && $scope.keyword.length > 0){
+                $scope.companyError = true;
+            }else {
+                $scope.companyError = false;
+            }
+            initIndex();
+            $scope.showDownFrame = true;
+            matchArray();
+            $scope.containsAttr($scope.keyword);
+        };
+
+        var initIndex = function () {
+            $scope.selectIndex = -1;
+            $scope.downIndex = 0;
+        };
+
+        $scope.getFocus = function() {
+            initIndex();
+        };
+
+        /**
+         * 根据输入内容获取匹配数据的长度
+         */
+        var matchArray = function () {
+            $scope.resultList = $scope.allKdnList.filter(function (data) {
+                if (data.companyName.indexOf($scope.keyword) >= 0){
+                    return data;
+                }
+            });
+            if ($scope.resultList.length > 0){
+                $scope.matchData = true;
+            }else{
+                $scope.matchData = false;
+            }
+        };
+
+        $scope.onBlur = function () {
+            setTimeout(function () {
+                $scope.showDownFrame = false;
+            }, 120);
+        };
+
+        $scope.onKeyDown = function () {
+            var dom = document.getElementById("ulContent");
+            // console.log(dom.scrollTop);
+            if ($scope.showDownFrame && $scope.matchData){
+                if(event.keyCode == 40) { //监听到按下键
+                    $scope.selectIndex ++;
+                    if ($scope.downIndex == 5){
+                        dom.scrollTop += 23;
+                    }
+                    if ($scope.downIndex <= 4){
+                        $scope.downIndex++;
+                    }
+                    if($scope.selectIndex >= $scope.resultList.length){
+                        $scope.selectIndex = 0;
+                        dom.scrollTop = 0;
+                        $scope.downIndex = 1;
+                    }
+                    $scope.inputObject = $scope.resultList[$scope.selectIndex];
+                    $scope.keyword = $scope.inputObject.companyName;
+                    $scope.containsAttr($scope.keyword);
+                } else if(event.keyCode == 38) { //监听到按上键
+                    $scope.selectIndex --;
+                    if ($scope.downIndex == 1){
+                        dom.scrollTop -= 22.67 ;
+                    }
+                    if ($scope.downIndex >= 2){
+                        $scope.downIndex--;
+                    }
+                    if($scope.selectIndex < 0){
+                        $scope.selectIndex = $scope.resultList.length - 1;
+                        dom.scrollTop = 2400;
+                        $scope.downIndex = 5;
+                    }
+                    $scope.inputObject = $scope.resultList[$scope.selectIndex];
+                    $scope.keyword = $scope.inputObject.companyName;
+                    $scope.containsAttr($scope.keyword);
+                } else if(event.keyCode == 13) { //确定键
+                    $scope.showDownFrame = false;
+                }
+            }
+        };
+
+        $scope.clickItem = function (data) {
+            // $scope.inputObject = data;
+            $scope.keyword = data.companyName;
+            $scope.containsAttr($scope.keyword);
+            $scope.showDownFrame = false;
+        };
+
+        /**
+         * 判断快递鸟是否包含输入的快递
+         * @param value
+         */
+        $scope.containsAttr = function (value) {
+            var key = 1;
+            if (value){
+                angular.forEach($scope.allKdnList, function (data) {
+                    if (data.companyName == value){
+                        key = 0;
+                        return;
+                    }
+                });
+                if (key == 1){
+                    $scope.containsItem = false;
+                }else {
+                    $scope.containsItem = true;
+                }
+            }
+        };
+
+        $scope.addItemInSelected = function () {
+            if ($scope.containsItem){
+                angular.forEach($scope.allKdnList, function (data) {
+                    if (data.companyName == $scope.keyword){
+                        if ($scope.selectFlag[data.code].isChoosed){
+                            var indexItem = null;
+                            if ($scope.chooseList){
+                                angular.forEach($scope.chooseList, function (item, index) {
+                                    if (item.code == data.code){
+                                        indexItem = index;
+                                    }
+                                });
+                            }
+                            $scope.chooseList.splice(indexItem, 1);
+                            $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
+                        }
+                        $scope.ChooseDistributor(data);
+                    }
+                });
+            }else {
+                var indexItem = null;
+                angular.forEach($scope.chooseList, function (item, index) {
+                    if (item.companyName == $scope.keyword){
+                        indexItem = index;
+                    }
+                });
+                if (indexItem){
+                    $scope.chooseList.splice(indexItem, 1);
+                }
+                var item = {};
+                item.companyName = $scope.keyword;
+                $scope.chooseList.push(item);
+            }
+            $scope.keyword = "";
+        };
+
+        $scope.removeDistributor = function (data, index) {
+            $scope.chooseList.splice(index, 1);
+            if (data.code){
+                $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
+            }
+        };
+
+        $scope.ChooseDistributor = function (data) {
+            if ($scope.selectFlag[data.code].isChoosed){
+                if ($scope.chooseList){
+                    angular.forEach($scope.chooseList, function (item, index) {
+                        if (item.code == data.code){
+                            $scope.index = index;
+                        }
+                    });
+                }
+                $scope.chooseList.splice($scope.index, 1);
+            }else {
+                $scope.chooseList.push(data);
+            }
+            $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
+        };
+
+        $scope.saveChooseList = function () {
+            Distributor.saveDistributor({}, $scope.chooseList ,function (data) {
+                if(data){
+                    toaster.pop('success', '成功', '保存配送商成功');
+                }
+                $modalInstance.close(data);
+            },function (error) {
+                toaster.pop('error', '成功', '保存配送商失败');
+            });
+        };
+
+        $scope.cancel = function() {
+            $modalInstance.dismiss();
+        };
+    }]);
     app.register.controller('chooseAddrCtrl', ['$scope', 'selectedAddr', 'address', '$modalInstance', function ($scope, selectedAddr, address, $modalInstance) {
 
         $scope.address = address;

+ 83 - 47
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_distributor_ctrl.js

@@ -4,16 +4,7 @@ define([ 'app/app' ], function(app) {
         $scope.tab = 'distributor';
         $rootScope.active = 'vendor_logistics';
         $scope.title = '配送商';
-        // $scope.data_list = [
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'},
-        //     {name: '顺丰快递'}
-        // ];
+
         $scope.initData = function () {
             Distributor.findAllSelected({},function (data) {
                 if (data){
@@ -76,6 +67,9 @@ define([ 'app/app' ], function(app) {
                 resolve : {
                     allKdnList : function () {
                         return $scope.allKdnList;
+                    },
+                    selectedList : function () {
+                        return $scope.data_list;
                     }
                 }
             }).result.then(function(data){
@@ -88,11 +82,28 @@ define([ 'app/app' ], function(app) {
         }
     }]);
 
-    app.register.controller('vendorDistributorManageCtrl', ['$scope','$rootScope','$modal','toaster','KdnLogistics','Distributor','BaseService','ngTableParams','allKdnList','$modalInstance', function ($scope, $rootScope, $modal, toaster, KdnLogistics, Distributor, BaseService, ngTableParams, allKdnList, $modalInstance) {
+    app.register.controller('vendorDistributorManageCtrl', ['$scope','$rootScope','$modal','toaster','KdnLogistics','Distributor','BaseService','ngTableParams','allKdnList','selectedList','$modalInstance', function ($scope, $rootScope, $modal, toaster, KdnLogistics, Distributor, BaseService, ngTableParams, allKdnList, selectedList, $modalInstance) {
         //获取快递鸟信息
         $scope.$$kdnData = {};
         $scope.allKdnList = allKdnList;
         $scope.chooseList = [];
+        $scope.selectFlag = [];
+
+        $scope.initArrayData = function () {
+            angular.forEach(allKdnList, function (data) {
+                $scope.selectFlag[data.code] = {};
+                $scope.selectFlag[data.code].isChoosed = false;
+            });
+            angular.forEach(selectedList, function (data, index) {
+                $scope.chooseList[index] = {};
+                if (data.code){
+                    $scope.chooseList[index].code = data.code;
+                    $scope.selectFlag[data.code].isChoosed = true;
+                }
+                $scope.chooseList[index].companyName = data.companyName;
+            });
+        };
+        $scope.initArrayData();
 
         $scope.distributorTableParams = new ngTableParams({
             page : 1,
@@ -109,6 +120,7 @@ define([ 'app/app' ], function(app) {
                         $scope.$$kdnData.start = 0;
                     }
                     $scope.$$kdnData.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
+                    $scope.pageList = page.content;
                     params.total(page.totalElements);
                     $defer.resolve(page.content);
                     //划分数据
@@ -118,7 +130,9 @@ define([ 'app/app' ], function(app) {
                     for (var i = 0; i<row; i++){
                         $scope.showList[i] = [];
                         for (var j = 0; j<6; j++){
-                            $scope.showList[i].push($scope.allKdnList[count+$scope.$$kdnData.start-1]);
+                            // var code = $scope.pageList[count].code;
+                            // $scope.pageList[count].isChoosed = $scope.selectFlag[code].isChoosed;
+                            $scope.showList[i].push($scope.pageList[count]);
                             count++;
                             if (count == page.numberOfElements){
                                 return;
@@ -132,22 +146,22 @@ define([ 'app/app' ], function(app) {
         });
 
         var countLength = function (string) {
-            return string.replace(/[^x00-xFF]/g,'**').length;
+            return string.replace(/[^\x00-\xff]/g,'**').length;
         };
 
         $scope.inputContent = function () {
-            for (var i=0; i<$scope.keyword.length;i++){
-                if (countLength($scope.keyword.substr(0, i)) >= 26){
-                    $scope.keyword = $scope.keyword.substr(0, i);
+            for (var i = 1; i<=$scope.keyword.length; i++){
+                if (countLength($scope.keyword.substr(0, i)) > 26){
+                    $scope.keyword = $scope.keyword.substr(0, i-1);
                     break;
                 }
             }
-            var addrPatt = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
-            if (!addrPatt.test($scope.keyword) && $scope.keyword.length > 0){
-                $scope.companyError = true;
-            }else {
-                $scope.companyError = false;
-            }
+            // var addrPatt = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
+            // if (!addrPatt.test($scope.keyword) && $scope.keyword.length > 0){
+            //     $scope.companyError = true;
+            // }else {
+            //     $scope.companyError = false;
+            // }
             initIndex();
             $scope.showDownFrame = true;
             matchArray();
@@ -218,7 +232,7 @@ define([ 'app/app' ], function(app) {
                         dom.scrollTop = 2400;
                         $scope.downIndex = 5;
                     }
-                    $scope.inputObject = $scope.allKdnList[$scope.selectIndex];
+                    $scope.inputObject = $scope.resultList[$scope.selectIndex];
                     $scope.keyword = $scope.inputObject.companyName;
                     $scope.containsAttr($scope.keyword);
                 } else if(event.keyCode == 13) { //确定键
@@ -228,7 +242,7 @@ define([ 'app/app' ], function(app) {
         };
 
         $scope.clickItem = function (data) {
-            $scope.inputObject = data;
+            // $scope.inputObject = data;
             $scope.keyword = data.companyName;
             $scope.containsAttr($scope.keyword);
             $scope.showDownFrame = false;
@@ -256,38 +270,62 @@ define([ 'app/app' ], function(app) {
         };
 
         $scope.addItemInSelected = function () {
-            if ($scope.inputObject){
-                $scope.ChooseDistributor($scope.inputObject);
+            if ($scope.containsItem){
+                angular.forEach($scope.allKdnList, function (data) {
+                    if (data.companyName == $scope.keyword){
+                        if ($scope.selectFlag[data.code].isChoosed){
+                            var indexItem = null;
+                            if ($scope.chooseList){
+                                angular.forEach($scope.chooseList, function (item, index) {
+                                    if (item.code == data.code){
+                                        indexItem = index;
+                                    }
+                                });
+                            }
+                            $scope.chooseList.splice(indexItem, 1);
+                            $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
+                        }
+                        $scope.ChooseDistributor(data);
+                    }
+                });
             }else {
+                var indexItem = null;
+                angular.forEach($scope.chooseList, function (item, index) {
+                    if (item.companyName == $scope.keyword){
+                        indexItem = index;
+                    }
+                });
+                if (indexItem){
+                    $scope.chooseList.splice(indexItem, 1);
+                }
                 var item = {};
-                console.log($scope.keyword);
                 item.companyName = $scope.keyword;
-                item.isChoosed = true;
                 $scope.chooseList.push(item);
             }
             $scope.keyword = "";
-            $scope.inputObject = null;
         };
 
-        $scope.ChooseDistributor = function (data) {
-            if ($scope.chooseList){
-                angular.forEach($scope.chooseList, function (item, index) {
-                    if (item.code == data.code){
-                        $scope.index = index;
-                    }
-                });
+        $scope.removeDistributor = function (data, index) {
+            $scope.chooseList.splice(index, 1);
+            if (data.code){
+                $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
             }
-            if (!data.isChoosed){
-                $scope.chooseList.push(data);
-            }else{
+        };
+
+        $scope.ChooseDistributor = function (data) {
+            if ($scope.selectFlag[data.code].isChoosed){
+                if ($scope.chooseList){
+                    angular.forEach($scope.chooseList, function (item, index) {
+                        if (item.code == data.code){
+                            $scope.index = index;
+                        }
+                    });
+                }
                 $scope.chooseList.splice($scope.index, 1);
+            }else {
+                $scope.chooseList.push(data);
             }
-            data.isChoosed = !data.isChoosed;
-            angular.forEach($scope.allKdnList, function (item) {
-                if (item.code == data.code){
-                    item.isChoosed = data.isChoosed;
-                }
-            });
+            $scope.selectFlag[data.code].isChoosed = !$scope.selectFlag[data.code].isChoosed;
         };
 
         $scope.saveChooseList = function () {
@@ -295,7 +333,6 @@ define([ 'app/app' ], function(app) {
                 if(data){
                     toaster.pop('success', '成功', '保存配送商成功');
                 }
-                $scope.chooseList = [];
                 $modalInstance.close(data);
             },function (error) {
                 toaster.pop('error', '成功', '保存配送商失败');
@@ -303,7 +340,6 @@ define([ 'app/app' ], function(app) {
         };
 
         $scope.cancel = function() {
-            $scope.chooseList = [];
             $modalInstance.dismiss();
         };
     }]);

+ 3 - 3
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_logistics_ctrl.js

@@ -362,7 +362,7 @@ define(['app/app', 'calendar'], function (app) {
 			var size;
 			if(num == 1) {
 				if ($scope.address.name){
-					size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
 					if (size > 20) {
 						$scope.userError = true;
 						return;
@@ -371,7 +371,7 @@ define(['app/app', 'calendar'], function (app) {
 				}
 			} else if(num == 2) {
 				if ($scope.address.tel){
-					size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
 					if (size < 8 || size > 11) {
 						$scope.telError = true;
 						return;
@@ -386,7 +386,7 @@ define(['app/app', 'calendar'], function (app) {
 				}
 			} else if(num == 3) {
 				if ($scope.address.detailAddress){
-					size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
 					if (size > 60) {
 						$scope.addrError = true;
 						return;

+ 160 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_order_ctrl.js

@@ -4,13 +4,18 @@
  */
 define(['app/app'], function (app) {
     "use strict";
-    app.register.controller('vendorOrderCtrl', ['$scope', '$rootScope', 'Purchase', 'ngTableParams', 'BaseService', 'toaster', '$state', '$filter', 'Return', 'Change', '$modal', 'PuExProcess', 'Recommendation', 'DateUtil', 'Loading', 'bankInfoService', function ($scope, $rootScope, Purchase, ngTableParams, BaseService, toaster, $state, $filter, Return, Change, $modal, PuExProcess, Recommendation, DateUtil, Loading, bankInfoService) {
+    app.register.controller('vendorOrderCtrl', ['$scope', '$rootScope', 'Purchase', 'ngTableParams', 'BaseService', 'toaster', '$state', '$filter', 'Return', 'Change', '$modal', 'PuExProcess', 'Recommendation', 'DateUtil', 'Loading', 'bankInfoService', 'Logistics', 'Distributor', 'SessionService', function ($scope, $rootScope, Purchase, ngTableParams, BaseService, toaster, $state, $filter, Return, Change, $modal, PuExProcess, Recommendation, DateUtil, Loading, bankInfoService, Logistics, Distributor, SessionService) {
         $rootScope.active = 'vendor_order';
 
         // 加密过滤器
         var enIdFilter = $filter('EncryptionFilter');
         // 默认状态为所有订单
-        $scope.status = 'all';
+        if (SessionService.getCookie('status')){
+            $scope.status = SessionService.get('status');
+            SessionService.removeCookie('status');
+        }else {
+            $scope.status = 'all';
+        }
         // 分页相关数据
         $scope.pageParams = {number: 1};
         // 下拉菜单状态
@@ -169,6 +174,159 @@ define(['app/app'], function (app) {
             state: 'orderBycreatetimeDesc'
         };
 
+        $scope.findSelectedDistributor = function () {
+            Distributor.findAllSelected({},{},function (data) {
+                if (data){
+                    $scope.companyList = data;
+                }
+            })
+        };
+        $scope.findSelectedDistributor();
+
+        //配送方式类型
+        $scope.deliveryMethod = {
+            1301: '第三方配送',
+            1302: '卖家配送',
+            1303: '上门自提'
+        };
+      // 获取已有物流配送商列表
+        $scope.initData = function () {
+            Distributor.findAllSelected({},function (data) {
+                if (data){
+                    $scope.data_list = data;
+                }
+            })
+        };
+        $scope.initData();
+        $scope.showNameUl = false;
+
+        $scope.showName = function () {
+            $scope.showNameUl = true;
+            console.log($scope.showNameUl)
+        };
+        $scope.onFocus = function () {
+            $scope.showNameUl = true;
+        };
+        $scope.onBlur = function () {
+            if ($scope.time){
+                clearTimeout($scope.time);
+            }
+            $scope.time = setTimeout(function () {
+                $scope.$apply(function () {
+                    $scope.showNameUl = false;
+                });
+            }, 200);
+        };
+        // 选中物流
+        $scope.showText = function (name) {
+            $scope.logistics.companyName = name;
+            $scope.showNameUl = false;
+        };
+        $scope.modifyLogistic = function (purchase) {
+            purchase.showLogistics = !purchase.showLogistics;
+            angular.forEach($scope.purchases, function (data) {
+                if (data.id != purchase.id){
+                    data.showLogistics = false;
+                }
+            });
+            if (purchase.showLogistics){
+                if (!purchase.lgtId){
+                    $scope.logistics = {};
+                }else {
+                    Logistics.findLogisticsById({lgtid:purchase.lgtId}, {}, function (data) {
+                        if (data){
+                            $scope.logistics = data;
+                        }
+                    })
+                }
+            }
+        };
+
+        $scope.cancelModify = function (purchase) {
+            purchase.showLogistics = false;
+        };
+
+        /**
+         * 确认修改物流信息
+         * @param purchase
+         */
+        $scope.ensureModifyLogistics = function (purchase) {
+            if (purchase.sendType == 1301){
+                if (!$scope.logistics.companyName) {
+                    toaster.pop("error", "请选择物流公司");
+                    return ;
+                }
+                if ($scope.logistics.companyName == '请选择物流公司'){
+                    toaster.pop('error', '注意', '请选择物流公司');
+                    return ;
+                }
+                if (!$scope.logistics.number) {
+                    toaster.pop("error", "请填写物流单号");
+                    return ;
+                }
+                var patt = new RegExp("^[A-Za-z0-9]+$");
+                if (!patt.test($scope.logistics.number)){
+                    toaster.pop("error", "注意", '请输入正确的物流单号');
+                    return ;
+                }
+            }else {
+                if ($scope.logistics.companyName && $scope.logistics.companyName != '请选择物流公司'){
+                    if (!$scope.logistics.number){
+                        toaster.pop("error", "注意", '请完善快递信息');
+                        return ;
+                    }
+                }
+                if ($scope.logistics.number){
+                    var patt = new RegExp("^[A-Za-z0-9]+$");
+                    if (!patt.test($scope.logistics.number)){
+                        toaster.pop("error", "注意", '请输入正确的物流单号');
+                        return ;
+                    }
+                    if (!$scope.logistics.companyName || $scope.logistics.companyName == '请选择物流公司'){
+                        toaster.pop("error", "注意", '请完善快递信息');
+                        return ;
+                    }
+                }
+            }
+            if (!purchase.lgtId){ //没有物流信息则添加物流信息
+                if ($scope.logistics.companyName && $scope.logistics.number){
+                    Logistics.addLogistics({inid : purchase.inid}, $scope.logistics, function (data) {
+                        if (data.success){
+                            $scope.orderTableParams.reload();
+                            toaster.pop("success", "保存物流信息成功");
+                            purchase.showLogistics = false;
+                        }
+                    })
+                }else {
+                    purchase.showLogistics = false;
+                }
+            }else { //更新物流信息
+                if ($scope.logistics.companyName && $scope.logistics.number){
+                    Logistics.updateLogistics({id : purchase.lgtId, invoiceFuid : purchase.inid}, $scope.logistics, function (data) {
+                        if (data){
+                            if(data.success){
+                                toaster.pop("success", "修改物流信息成功");
+                                purchase.showLogistics = false;
+                            }
+                        }
+                    })
+                } else {
+                    if (purchase.sendType != 1301){
+                        //没有则删除快递信息
+                        Logistics.clearLogistics({inid : purchase.inid}, {}, function (data) {
+                            if (data){
+                                if(data.success){
+                                    $scope.orderTableParams.reload();
+                                    toaster.pop("success", "修改物流信息成功");
+                                    purchase.showLogistics = false;
+                                }
+                            }
+                        })
+                    }
+                }
+            }
+        };
+
         $scope.changeOrderState = function (state) {
             if ($scope.sortingState.state === state) {
                 $scope.orderTableParams.sorting({createtime: 'DESC'});

+ 5 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_productOn_ctrl.js

@@ -8,6 +8,11 @@ define([ 'app/app' ], function(app) {
         $rootScope.$$productOn = {};
         $rootScope.active = 'vendor_productOn';
         $rootScope.$$productOn.leadIn = 'bathOn';
+        // 切换批量与单个建档
+        $scope.style = 'batch'
+        $scope.checkTab = function (type) {
+            $scope.style = type;
+        }
     }]);
 
     //产品导入的Ctrl

+ 2 - 3
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_takeSelf_ctrl.js

@@ -63,7 +63,7 @@ define([ 'app/app' ], function(app) {
         $scope.editTakeSelf = function (addressTakeSelf) {
             $modal.open({
                 templateUrl : 'static/view/vendor/modal/edit_address_takeSelf.html',
-                controller : 'editAddrCtrl',
+                controller : 'editTakeSelfCtrl',
                 size : 'lg',
                 resolve : {
                     addressTakeSelf : function () {
@@ -90,7 +90,7 @@ define([ 'app/app' ], function(app) {
         };
 
         //地址编辑模态框
-        app.register.controller('editAddrCtrl', ['$scope', '$rootScope', 'isModify', '$modalInstance', 'addressTakeSelf', 'nameList', '$http', function ($scope, $rootScope, isModify, $modalInstance, addressTakeSelf, nameList, $http) {
+        app.register.controller('editTakeSelfCtrl', ['$scope', '$rootScope', 'isModify', '$modalInstance', 'addressTakeSelf', 'nameList', '$http', function ($scope, $rootScope, isModify, $modalInstance, addressTakeSelf, nameList, $http) {
             $scope.isModify = isModify;
             $scope.nameList = nameList;
             if (!addressTakeSelf){
@@ -171,7 +171,6 @@ define([ 'app/app' ], function(app) {
 
             $scope.saveAddressTakeSelf = function () {
                 var address = $scope.takeSelf;
-                console.log(address);
                 if (!address){
                     toaster.pop('error', '请补充未填写的信息');
                     return ;

+ 2 - 1
src/main/webapp/resources/view/common/modal/edit_address_modal.html

@@ -162,7 +162,8 @@
 							<label class="check-active">
 								<input ng-model="isSetTop" type="checkbox" id="check-act">
 								<label for="check-act"></label>
-								<span>设置为默认收货地址</span>
+								<span ng-if="!isSendType">设置为默认收货地址</span>
+								<span ng-if="isSendType">设置为默认发货地址</span>
 							</label>
 						</div>
 					</div>

+ 3 - 2
src/main/webapp/resources/view/prod/order_ensure.html

@@ -775,8 +775,9 @@ table .before-blank, .table-bordered>tbody>tr>td.before-blank, .table-bordered>t
                             <td><div ng-bind="order.buyer"></div></td>
                             <td>
                                 <div ng-switch="order.deliverytype">
-                                    <div ng-switch-when="1301">UU配送</div>
-                                    <div ng-switch-when="1302">上门自提</div>
+                                    <div ng-switch-when="1301">第三方配送</div>
+                                    <div ng-switch-when="1302">卖家配送</div>
+									<div ng-switch-when="1303">上门自提</div>
                                 </div>
                             </td>
                             <td>/</td>

+ 131 - 70
src/main/webapp/resources/view/usercenter/forstore/order_detail.html

@@ -17,7 +17,7 @@
 		width: 14%;
 	}
 	#oder-detail .oder_xq_list dl span.wd01{
-		width: 16%;
+		width: 13%;
 	}
 	#oder-detail .oder_xq_list dl span.wd02{
 		width: 25%;
@@ -89,7 +89,7 @@
 		padding: 5px;
 		width: 120px;
 		height: 60px;
-		border: #ccc 1px solid;
+		border: #fff 1px solid;
 		margin-top: 10px;
 	}
 	.oder_xq_list dl span a{
@@ -112,7 +112,7 @@
 	.oder-remark span em {
 		float: left;
 		color: #333 !important;
-		margin-left: 20px;
+		margin-left: 40px;
 	}
 	.oder_xq_list dl span.total-price{
 		float: right;
@@ -165,6 +165,7 @@
 		text-decoration: none;
 		position: relative;
 		top: 0;
+		z-index: 200;
 	}
 	.open-more a i{
 		margin-right: 5px;
@@ -210,7 +211,8 @@
 		display: none;
 	}
 	.logistics_list01 .oder_xq{
-		width: 97%;
+		width: 98%;
+		padding: 10px 0;
 	}
 	.logistics ul li p:last-child{
 		font-size: 12px;
@@ -219,6 +221,41 @@
 		width: 60px;
 		height: 60px;
 	}
+	.logistics_list01.status{
+		margin-top: 0;
+	}
+	.color999{
+		color: #999 !important;
+	}
+	.log_menu span{
+		padding-left: 15px;
+		margin-left: 10px;
+	}
+	.text-area{
+		width: 120px;
+		height: 60px;
+		background: #fff;
+		margin-top: 15px;
+		overflow-y: auto;
+		text-align: left;
+		padding: 0 3px;
+		margin-left: 5px;
+	}
+	.text-area i{
+		text-align: left;
+		position: relative;
+		top: 4px;
+		font-size: 12px;
+		color: #666;
+		word-break: break-all;
+	}
+	.oder_xq_list dl span.user-address{
+		width: 100% !important;
+		line-height: 30px;
+		position: relative;
+		top: -23px;
+		background: #f1f6ff;
+	}
 	/*联系买家*/
 	.contact-box{
 		position: absolute;
@@ -278,7 +315,7 @@
 <div class="user_right fr">
 	<!--叮当详情-->
 	<div class="oder_detail" id="oder-detail">
-		<div class="logistics">
+		<div class="logistics" ng-if="order.status != 602 && order.status != 603 && order.status != 604 && order.status != 605 && order.status != 606 && order.status != 315" ng-cloak>
 			<ul>
 				<li ng-class="{ 'active' : (steps.step2 || steps.step3 || steps.step4 || steps.step5) }">
 					<p>拍下产品</p>
@@ -308,32 +345,42 @@
 			</ul>
 		</div>
 		<!--<div class="logistics_list01">-->
-			<!--<div class="log_menu">-->
-				<!--<span>收发货地址</span>-->
-			<!--</div>-->
-			<!--&lt;!&ndash;订单物流信息&ndash;&gt;-->
-			<!--<div class="com_log_list">-->
-				<!--<ul>-->
-					<!--<li class="log_line">收货人信息:</li>-->
-					<!--<li>-->
-						<!--<h4 ng-bind="::order.deliveryAddress.company">华商龙商务科技有限公司</h4>-->
-						<!--<p ng-if="order.deliveryAddress.area" ng-bind="::order.deliveryAddress.area + ',' + order.deliveryAddress.detailAddress" title="{{::order.deliveryAddress.area + ',' + order.deliveryAddress.detailAddress}}" class="text-more"></p>-->
-						<!--<p ng-if="!order.deliveryAddress.area">空</p>-->
-						<!--<span>{{order.deliveryAddress.tel || '空'}}&nbsp;&nbsp;{{order.deliveryAddress.name || '空'}}</span>-->
-					<!--</li>-->
-					<!--<li class="log_line" ng-if="order.sendAddress">发货人信息:</li>-->
-					<!--<li ng-if="order.sendAddress">-->
-						<!--<h4 ng-bind="order.sendAddress.company">华商龙商务科技有限公司</h4>-->
-						<!--<p ng-if="order.sendAddress.area" ng-bind="::order.sendAddress.area + ',' + order.sendAddress.detailAddress" title="{{::order.sendAddress.area + ',' + order.sendAddress.detailAddress}}" class="text-more"></p>-->
-						<!--<p ng-if="!order.sendAddress.area">空</p>-->
-						<!--<span>{{order.sendAddress.tel || '空'}}&nbsp;&nbsp;{{order.sendAddress.name || '空'}}</span>-->
-					<!--</li>-->
-				<!--</ul>-->
-			<!--</div>-->
+		<!--<div class="log_menu">-->
+		<!--<span>收发货地址</span>-->
+		<!--</div>-->
+		<!--&lt;!&ndash;订单物流信息&ndash;&gt;-->
+		<!--<div class="com_log_list">-->
+		<!--<ul>-->
+		<!--<li class="log_line">收货人信息:</li>-->
+		<!--<li>-->
+		<!--<h4 ng-bind="::order.deliveryAddress.company">华商龙商务科技有限公司</h4>-->
+		<!--<p ng-if="order.deliveryAddress.area" ng-bind="::order.deliveryAddress.area + ',' + order.deliveryAddress.detailAddress" title="{{::order.deliveryAddress.area + ',' + order.deliveryAddress.detailAddress}}" class="text-more"></p>-->
+		<!--<p ng-if="!order.deliveryAddress.area">空</p>-->
+		<!--<span>{{order.deliveryAddress.tel || '空'}}&nbsp;&nbsp;{{order.deliveryAddress.name || '空'}}</span>-->
+		<!--</li>-->
+		<!--<li class="log_line" ng-if="order.sendAddress">发货人信息:</li>-->
+		<!--<li ng-if="order.sendAddress">-->
+		<!--<h4 ng-bind="order.sendAddress.company">华商龙商务科技有限公司</h4>-->
+		<!--<p ng-if="order.sendAddress.area" ng-bind="::order.sendAddress.area + ',' + order.sendAddress.detailAddress" title="{{::order.sendAddress.area + ',' + order.sendAddress.detailAddress}}" class="text-more"></p>-->
+		<!--<p ng-if="!order.sendAddress.area">空</p>-->
+		<!--<span>{{order.sendAddress.tel || '空'}}&nbsp;&nbsp;{{order.sendAddress.name || '空'}}</span>-->
+		<!--</li>-->
+		<!--</ul>-->
+		<!--</div>-->
 		<!--</div>-->
 		<!--订单信息-->
-		<div class="logistics_list01">
-			<div class="log_menu"><span>订单信息<b>订单号:{{order.orderid}}<em><font style="color: #333">订单状态:</font>{{order.status | orderStatus}}</em></b></span></div>
+		<div class="logistics_list01" ng-class="{'status': order.status == 602 || order.status == 603 || order.status == 604 || order.status == 605 || order.status == 606 || order.status == 315}">
+			<div class="log_menu">
+				<span ng-if="order.status != 602 && order.status != 603 && order.status != 604 && order.status != 605 && order.status != 606 && order.status != 315">订单信息<b>订单号:{{order.orderid}}<em><font style="color: #333;">订单状态:</font>{{order.status | orderStatus}}</em></b></span>
+				<span ng-if="order.status == 602 || order.status == 603 || order.status == 604 || order.status == 605 || order.status == 606 || order.status == 315">
+					<i class="f14">订单号:{{order.orderid}}</i>
+					<b>
+						<em style="margin-right: 0;" ng-if="order.status != 603"><font class="color999">取消原因:</font>{{order.unavailableReason.reason}}</em>
+						<em style="margin-right: 0;" ng-if="order.status == 603"><font class="color999">取消原因:</font>超时未付款自动取消</em>
+						<em><font class="color999">订单状态:</font>{{order.status | orderStatus}}</em>
+					</b>
+				</span>
+			</div>
 			<div class="oder_xq clearfix" ng-if="address" style="background: #f8f8f8">
 				<p>
 					<b>收货人:</b>
@@ -356,6 +403,7 @@
 						<span class="wd01">单价</span>
 						<span style="width: 10%;">数量</span>
 						<span class="wd01">小计</span>
+						<span class="wd01">物料编码</span>
 						<span class="wd01">备注</span>
 					</dt>
 					<dd class="order-company">
@@ -382,7 +430,7 @@
 							</div>
 						</span>
 					</dd>
-					<div ng-class="{'limit-3': !open}">
+					<div ng-class="{'limit-3': !open}" style="width: 100%; margin: 0 auto; overflow: hidden;">
 						<dd class="oder_l" ng-repeat="detail in order.orderDetails">
                         <span class="wd02">
                             <a href="store/{{detail.storeid}}/{{::detail.batchCode}}" target="_blank">
@@ -398,22 +446,29 @@
 								<a ng-bind="detail.brName" href="product/brand/{{::detail.branduuid}}/" title="{{detail.brName}}" target="_blank"></a>
 							</p>
                         </span>
-						<span class="wd01">交期:
+							<span class="wd01">交期:
 							<i ng-if="detail.b2cMinDelivery != detail.b2cMaxDelivery" ng-bind="detail.b2cMinDelivery + '-' + detail.b2cMaxDelivery"></i>
 							<i ng-if="detail.b2cMinDelivery == detail.b2cMaxDelivery" ng-bind="detail.b2cMinDelivery"></i>
 						</span>
-						<span class="wd01" ng-bind="detail.taxUnitprice | formateNumber : 6 | currencySysmbol : detail.currencyName">$1.23</span>
-						<span style="width: 10%;" ng-bind="detail.number">100</span>
-						<span class="wd01 red" ng-bind="detail.ensurePrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
-						<span class="wd01" style="line-height: 20px;">
-							<!--<textarea placeholder="可填写产品备注!例如物料编号"></textarea>-->
-							<div style="width: 133px; height: 74px; background: #fff; margin-top: 7px; overflow-y: auto;" ng-if="detail.remark">
-								<i style="line-height: 20px; text-align: left; position: relative; top: 4px;" ng-bind="detail.remark">金石为开取数据五块钱叫稍微亲上加亲</i>
-							</div>
-						</span>
-					</dd>
+							<span class="wd01" ng-bind="detail.taxUnitprice | formateNumber : 6 | currencySysmbol : detail.currencyName">$1.23</span>
+							<span style="width: 10%;" ng-bind="detail.number">100</span>
+							<span class="wd01 red" ng-bind="detail.ensurePrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
+							<!--物料编码-->
+							<span class="wd01" style="line-height: 18px;">
+								<em ng-if="!detail.goodsnumber">&nbsp;</em>
+								<div class="text-area" ng-if="detail.goodsnumber">
+									<i ng-bind="detail.goodsnumber">金石为开取数据五块钱叫稍微亲上加亲</i>
+								</div>
+							</span>
+							<span class="wd01" style="line-height: 18px;">
+								<em ng-if="!detail.remark">&nbsp;</em>
+								<div class="text-area" ng-if="detail.remark">
+									<i ng-bind="detail.remark">金石为开取数据五块钱叫稍微亲上加亲</i>
+								</div>
+							</span>
+						</dd>
 					</div>
-					<div class="open-more row" ng-class="{'none': order.orderDetails.length < 3}">
+					<div class="open-more row" ng-class="{'none': order.orderDetails.length <= 3}">
 						<a href="javascript:void(0)" ng-click="open=!open" ng-class="{'active': open}">
 							<em ng-bind="open ? '收起' : '查看所有产品'"></em>
 							<i class="fa fa-angle-up" ng-if="open"></i>
@@ -428,11 +483,11 @@
 						</span>
 					</dd>
 					<dd class="line60">
-						<span class="wd02" style="width: 60%; text-align: left; margin-left: 20px; line-height: 30px;">配送方式:第三方配送
-							<!--<i style="color: #666;">(满1000元包邮,未满足的订单收取运费20元)</i>-->
+						<span class="wd02" style="width: 60%; text-align: left; margin-left: 40px; line-height: 30px;">配送方式:<i ng-bind="deliveryMethod[order.deliverytype]"></i>
+							<i style="color: #999;" ng-if="rule" ng-bind="'(' + rule.ruleName + ')'">(满1000元包邮,未满足的订单收取运费20元)</i>
 						</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>
+								<p><strong>运费:</strong><em ng-bind="order.fare | formateNumber : 2 | currencySysmbol : order.currency.substring(0,3)" style="font-weight: bold"></em></p>
 								<p><strong>店铺合计:</strong>
 									<em ng-bind="order.ensurePrice | formateNumber : 2 | currencySysmbol : order.currency" style="font-weight: bold"></em>
 								</p>
@@ -443,16 +498,22 @@
 						<!--<span><em ng-bind="freight | number : 2 | currencySysmbol : purchase.currency">¥20.00</em></span>-->
 						<!--物流的价格先隐藏-->
 					</dd>
+					<dd class="line60" ng-if="order.deliverytype == 1303 && takeSelf">
+						<span class="user-address" style="padding-left: 40px;">
+							<i class="fl"><strong style="font-weight: inherit; margin-right: 30px;" ng-bind="takeSelf.takename">自提点A</strong>营业时间:<i ng-bind="takeSelf.businesstime">周一至周五 8:30-18:00</i></i><br/>
+							<i class="fl">地址:<i ng-bind="takeSelf.area"></i>  <i ng-bind="takeSelf.detailAddress">科技园英唐大厦6楼 优软商城科技园英唐大厦6楼 优软商城</i></i>
+						</span>
+					</dd>
 					<!--<dd class="price">-->
-						<!--<span style="width: 100%;">总计:<i  ng-bind="order.price | formateNumber : 2 | currencySysmbol : order.currency">¥820.00</i></span>-->
+					<!--<span style="width: 100%;">总计:<i  ng-bind="order.price | formateNumber : 2 | currencySysmbol : order.currency">¥820.00</i></span>-->
 					<!--</dd>-->
 				</dl>
 			</div>
 		</div>
 		<!--物流信息-->
-		<div class="logistics_list01">
+		<div class="logistics_list01" ng-if="order.status != 602 && order.status != 603 && order.status != 604 && order.status != 605 && order.status != 606 && order.status != 315">
 			<div class="log_menu">
-				<span>物流信息<em style="color: #666;" ng-if="!logistics.companyName&& noLogisticInfoArray[order.status]">(暂无物流信息)</em>
+				<span>物流信息<em style="color: #666;" ng-if="!logistics.companyName&& noLogisticInfoArray[order.status]">(暂无物流信息)</em>
 					<b ng-if="logistics.companyName">物流公司:{{logistics.companyName.companyName || logistics.companyName || '空'}}&nbsp;&nbsp;&nbsp;物流单号:{{logistics.number || '空'}}</b>
 				</span>
 			</div>
@@ -469,28 +530,28 @@
 			</div>
 		</div>
 		<!--<div class="logistics_list01">-->
-			<!--<div class="log_menu">-->
-				<!--<span>收发货地址</span>-->
-			<!--</div>-->
-			<!--&lt;!&ndash;订单物流信息&ndash;&gt;-->
-			<!--<div class="com_log_list">-->
-				<!--<ul>-->
-					<!--<li class="log_line">收货人信息:</li>-->
-					<!--<li>-->
-						<!--<h4 ng-bind="::order.deliveryAddress.company">华商龙商务科技有限公司</h4>-->
-						<!--<p ng-if="order.deliveryAddress.area" ng-bind="::order.deliveryAddress.area + ',' + order.deliveryAddress.detailAddress"></p>-->
-						<!--<p ng-if="!order.deliveryAddress.area">空</p>-->
-						<!--<span>{{order.deliveryAddress.tel || '空'}}&nbsp;&nbsp;{{order.deliveryAddress.name || '空'}}</span>-->
-					<!--</li>-->
-					<!--<li class="log_line" ng-if="order.sendAddress">发货人信息:</li>-->
-					<!--<li ng-if="order.sendAddress">-->
-						<!--<h4 ng-bind="order.sendAddress.company">华商龙商务科技有限公司</h4>-->
-						<!--<p ng-if="order.sendAddress.area" ng-bind="::order.sendAddress.area + ',' + order.sendAddress.detailAddress"></p>-->
-						<!--<p ng-if="!order.sendAddress.area">空</p>-->
-						<!--<span>{{order.sendAddress.tel || '空'}}&nbsp;&nbsp;{{order.sendAddress.name || '空'}}</span>-->
-					<!--</li>-->
-				<!--</ul>-->
-			<!--</div>-->
+		<!--<div class="log_menu">-->
+		<!--<span>收发货地址</span>-->
+		<!--</div>-->
+		<!--&lt;!&ndash;订单物流信息&ndash;&gt;-->
+		<!--<div class="com_log_list">-->
+		<!--<ul>-->
+		<!--<li class="log_line">收货人信息:</li>-->
+		<!--<li>-->
+		<!--<h4 ng-bind="::order.deliveryAddress.company">华商龙商务科技有限公司</h4>-->
+		<!--<p ng-if="order.deliveryAddress.area" ng-bind="::order.deliveryAddress.area + ',' + order.deliveryAddress.detailAddress"></p>-->
+		<!--<p ng-if="!order.deliveryAddress.area">空</p>-->
+		<!--<span>{{order.deliveryAddress.tel || '空'}}&nbsp;&nbsp;{{order.deliveryAddress.name || '空'}}</span>-->
+		<!--</li>-->
+		<!--<li class="log_line" ng-if="order.sendAddress">发货人信息:</li>-->
+		<!--<li ng-if="order.sendAddress">-->
+		<!--<h4 ng-bind="order.sendAddress.company">华商龙商务科技有限公司</h4>-->
+		<!--<p ng-if="order.sendAddress.area" ng-bind="::order.sendAddress.area + ',' + order.sendAddress.detailAddress"></p>-->
+		<!--<p ng-if="!order.sendAddress.area">空</p>-->
+		<!--<span>{{order.sendAddress.tel || '空'}}&nbsp;&nbsp;{{order.sendAddress.name || '空'}}</span>-->
+		<!--</li>-->
+		<!--</ul>-->
+		<!--</div>-->
 		<!--</div>-->
 		<!--发票信息-->
 		<div class="logistics_list01">

+ 208 - 27
src/main/webapp/resources/view/usercenter/forstore/order_pay.html

@@ -22,7 +22,7 @@
 		width: 160px;
 	}
 	#pay-cart .oder_xq_list dl span.wd01{
-		width: 15%;
+		width: 14%;
 	}
 	#pay-cart .oder_xq_list dl span.wd02{
 		width: 22%;
@@ -30,7 +30,12 @@
 	.sure_oder .oder_xq_list dl span{
 		width: 13%;
 	}
-
+	.sure_oder .btn-wrap{
+		margin-left: 7px;
+	}
+	.sure_oder .oder_xq_list dl span textarea{
+		border: #fff 1px solid;
+	}
 	.payment .bill-radio {
 		font-size: 14px;
 		padding-top: 25px;
@@ -257,6 +262,9 @@
 	.oder-remark,.oder_xq_list dl .line60{
 		background: #f1f6ff;
 	}
+	.oder_xq_list dl .line60.none-border{
+		border-bottom: none;
+	}
 	.pay_price div{
 		margin-right: 0;
 	}
@@ -287,6 +295,9 @@
 		line-height: 20px;
 		margin-top: 36px;
 	}
+	.oder_xq_list dl span.price-step.none{
+		margin-top: 28px;
+	}
 	.oder_xq_list dl .price-step p{
 		text-align: center !important;
 		font-size: 12px;
@@ -301,7 +312,7 @@
 	.oder_xq_list dl .price-step .dropdown-menu{
 		min-width: 330px;
 		top: 0;
-		left: -280px;
+		left: -310px;
 		padding-top: 0;
 		padding-bottom: 0;
 		border-bottom: none;
@@ -331,6 +342,7 @@
 	}
 	.sure_oder .btn-wrap .number input{
 		height: 29px;
+		padding-bottom: 1px;
 		line-height: 29px;
 	}
 	.sure_oder .btn-wrap .number{
@@ -363,6 +375,103 @@
 	.oder_xq_list dl .price-step p a,.oder_xq_list dl .price-step p a:hover{
 		color: #5078cb;
 	}
+
+	/*自提点样式*/
+	.self-list{
+		width: 100%;
+		margin: 0 auto;
+		padding: 0 0 8px 0;
+		border-bottom: #5078CB 1px solid;
+		background: #f1f6ff;
+		position: relative;
+		top: -1px;
+	}
+	.check-act input{
+		display: none;
+	}
+	.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;
+	}
+	.check-act label{
+		background-position: 0 0;
+	}
+	.check-act input:checked + label{
+		background-position: -15px 0;
+	}
+	.oder_xq_list dl .self-advice{
+		width: 100%;
+		margin: 0 auto;
+		display: inline-block;
+	}
+	.oder_xq_list dl .self-advice li{
+		text-align: left;
+		float: left;
+		padding-left: 40px;
+		font-size: 14px;
+		line-height: 20px;
+		width: 100%;
+	}
+	.oder_xq_list dl .self-advice li strong{
+		font-weight: normal;
+		font-size: 14px;
+		margin-left: 40px;
+	}
+	.oder_xq_list dl .self-advice li strong i{
+		font-size: 14px;
+		margin-left: 0;
+	}
+	.payment .adress_list ul li p{
+		max-height: 40px;
+		overflow: hidden;
+		margin-bottom: 5px;
+		margin-top: 25px;
+		line-height: 20px;
+		margin-left: 20px;
+		width: 88%;
+	}
+	.payment .adress_list ul li span.adderss-name {
+		max-height: 40px;
+		overflow: hidden;
+		margin-top: 0;
+	}
+	.text-area{
+		width: 120px;
+		height: 60px;
+		background: #fff;
+		margin-top: 15px;
+		overflow-y: auto;
+		text-align: left;
+		padding: 0 3px;
+		margin-left: 5px;
+	}
+	.text-area i{
+		text-align: left;
+		position: relative;
+		top: 4px;
+		font-size: 12px;
+		color: #666;
+		word-break: break-all;
+	}
+	.oder_xq_list dl span.user-address{
+		width: 100% !important;
+		line-height: 30px;
+		position: relative;
+		top: -23px;
+		background: #f1f6ff;
+	}
+	.oder_xq_list dl span.user-address i{
+		margin-left: 0;
+		font-size: 14px;
+	}
+	.sure_oder .oder_xq_list dl .style01.line35{
+		line-height: 35px;
+	}
 	/*联系买家*/
 	.contact-box{
 		position: absolute;
@@ -436,8 +545,8 @@
 			<ul id="address" class="clearfix address" ng-if="sendAddress.length != 0" ng-class="{'inital' : !expand}">
 				<li class="clearfix" ng-repeat="address in sendAddress" ng-click="selectAdd(address)" ng-class="{'active' : payment.address.id == address.id}">
 					<!--<h4 ng-bind="address.company"></h4>-->
-					<p class="textmore" style="margin-top: 30px">{{address.area}}, {{address.detailAddress}}</p>
-					<span>{{address.tel}} &nbsp;&nbsp;{{address.name}}(收)<a ng-if="order.status == 501" href="javascript:void(0)" ng-click="addShippingAddress(address, $index)"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>&nbsp;编辑</a></span>
+					<p class="">{{address.area}}, {{address.detailAddress}}</p>
+					<span class="adderss-name">{{address.tel}} &nbsp;&nbsp;{{address.name}}(收)<a ng-if="order.status == 501" href="javascript:void(0)" ng-click="addShippingAddress(address, $index)"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>&nbsp;编辑</a></span>
 					<em ng-if="address.num ==1">默认地址</em>
 				</li>
 			</ul>
@@ -497,7 +606,8 @@
 						<span class="wd01">交期(天)</span>
 						<span class="wd01">单价</span>
 						<span class="wd01">数量</span>
-						<span style="width: 18%">小计</span>
+						<span style="width: 10%">小计</span>
+						<span>物料编码</span>
 						<span>备注</span>
 					</dt>
 					<div ng-repeat="(key, details) in $$orderDetailsMap">
@@ -558,7 +668,7 @@
 							<span ng-if="order.status != 501" ng-bind="detail.number" class="number" style="border: none;"></span>
                             </div>
                         </span>
-							<span class="price-step"  style="width: 18%">
+							<span class="price-step"  style="width: 10%" ng-class="{'none': detail.goodsHistory.prices.length > 1}">
 								<em ng-bind="detail.ensurePrice | formateNumber : 6 | currencySysmbol : detail.currencyName" class="red"></em>
 								<p>
 									<a name="{{detail.id}}" ng-click="togglePrice(detail)" ng-if="detail.goodsHistory.prices.length > 1" ng-blur="togglePriceBlur(detail)" style="font-size: 12px">价格梯度</a>
@@ -576,37 +686,108 @@
 									</table>
 								</p>
 							</span>
-							<span>
-                            	<textarea ng-if="order.status==501" placeholder="可填写产品备注!例如物料编号" ng-model="detail.remark" maxlength="200"></textarea>
-                        		<em ng-if="order.status!=501" ng-bind="detail.remark" style="color: #333; line-height: 20px; display: inline-block; padding-top: 10px;"></em>
+							<span style="line-height: 18px;">
+                            	<textarea ng-if="order.status==501" placeholder="可填写物料编码" maxlength="20" ng-model="detail.goodsnumber"></textarea>
+                        		<div class="text-area" ng-if="order.status!=501 && detail.goodsnumber">
+									<i ng-bind="detail.goodsnumber">金石为开取数据五块钱叫稍微亲上加亲</i>
+								</div>
+								<em ng-if="order.status!=501 && !detail.goodsnumber">&nbsp;</em>
+								<!--<em ng-if="order.status!=501" ng-bind="detail.goodsnumber" style="color: #333; line-height: 20px; display: inline-block; padding-top: 10px;"></em>-->
+							</span>
+							<span style="line-height: 18px;">
+                            	<textarea ng-if="order.status==501" placeholder="可填写产品备注" ng-model="detail.remark" maxlength="200"></textarea>
+								<div class="text-area" ng-if="order.status!=501 && detail.remark">
+									<i ng-bind="detail.remark">金石为开取数据五块钱叫稍微亲上加亲</i>
+								</div>
+								<em ng-if="order.status!=501 && !detail.remark">&nbsp;</em>
+                        		<!--<em ng-if="order.status!=501" ng-bind="detail.remark" style="color: #333; line-height: 20px; display: inline-block; padding-top: 10px;"></em>-->
 							</span>
 						</dd>
 						<dd class="oder-remark">
-							<span style="width: 100%">
-								<em>订单备注:</em>
+							<span style="width: 100%;">
+								<em style="margin-left: 40px;">订单备注:</em>
 								<input ng-if="order.status==501" type="text"  class="form-control" placeholder="请填写订单备注" ng-model="remarkList[details[0].storeid]" maxlength="200"/>
-								<em ng-if="order.status!=501" ng-bind="remarkList[order.storeid] || '无'" style="margin-left: 0;"></em>
+								<em ng-if="order.status!=501" ng-bind="remarkList[order.storeid] || '无'"></em>
 							</span>
 						</dd>
-						<dd class="line60">
-							<span class="style01" style="width: 60%; line-height: 40px;">配送方式:
-								<select ng-if="order.status == 501" class="select" ng-switch="order.deliverytype" style="opacity: 1;" >
-									<option ng-switch-when="1301">第三方配送</option>
-									<!--<option ng-switch-when="1301">卖家配送</option>-->
-									<!--<option ng-switch-when="1301">上门自提</option>-->
-									<!--<option ng-switch-when="1302">上门自提</option>-->
+						<dd class="line60" ng-class="{'none-border': deliveryList ? deliveryList[details[0].storeid].method==1303 : order.deliverytype=1303}">
+							<span class="style01" style="width: 60%; padding-left: 40px;" ng-class="{'line35': order.status!=501}">配送方式:
+								<select ng-if="order.status == 501" class="select" ng-model="deliveryList[details[0].storeid]" style="opacity: 1;"
+										ng-options="rule as deliveryMethod[rule.method] for rule in ruleMap[details[0].storeid]"
+										ng-change="changeFare(details)">
+									<!--ng-options="rule.method as deliveryMethod[rule.method] for rule in ruleMap[details[0].storeid]"-->
+									<!--<option ng-repeat="rule in ruleMap[details[0].storeid]" value="rule.method">{{deliveryMethod[rule.method]}}</option>-->
 								</select>
-								<em ng-if="order.status != 501" ng-bind="deliveryMethod[order.deliverytype]" style="color: #333;">物流配送</em>
-								<!--<i>满1000元包邮,未满足的订单收取运费20元</i>-->
+								<em ng-if="order.status != 501">
+									<em class="color333" ng-if="!deliveryList" ng-bind="deliveryMethod[order.deliverytype]"></em>
+									<em class="color333" ng-if="deliveryList" ng-bind="deliveryMethod[deliveryList[details[0].storeid].method]"></em>
+								</em>
+								<i ng-if="order.status == 501">
+									<i style="margin-left: 0px;" ng-if="deliveryList[details[0].storeid]" ng-bind="deliveryList[details[0].storeid].ruleName"></i>
+									<i style="margin-left: 0px;" ng-if="!payment.address">请选择收货地址</i>
+									<i style="margin-left: 0px;" ng-if="payment.address && ruleMap[details[0].storeid].length == 0">当前地址不支持配送,请与卖家协商处理</i>
+								</i>
+								<i ng-if="order.status != 501">
+									<i style="margin-left: 0px;" ng-if="deliveryList" ng-bind="deliveryList[details[0].storeid].ruleName"></i>
+									<i style="margin-left: 0px;" ng-if="!deliveryList" ng-bind="rule.ruleName"></i>
+								</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>
+							<span class="total-price">
+								<p><strong>运费:</strong>
+									<em ng-if="order.status==501" ng-bind="fareList[details[0].storeid] | formateNumber : 2 | currencySysmbol : order.currency.substring(0,3)" style="font-weight: bold"></em>
+									<em ng-if="order.status!=501" style="font-weight: bold">
+										<em ng-if="!deliveryList" ng-bind="order.fare | formateNumber : 2 | currencySysmbol : order.currency.substring(0,3)"></em>
+										<em ng-if="deliveryList" ng-bind="deliveryList[details[0].storeid].fare | formateNumber : 2 | currencySysmbol : order.currency.substring(0,3)"></em>
+									</em>
+								</p>
 								<p><strong>店铺合计:</strong>
-									<em ng-if="order.status==501" ng-bind="storePrice[key] | formateNumber :2 | currencySysmbol : order.currency.substring(0,3)" style="font-weight: bold"></em>
-									<em ng-if="order.status!=501" ng-bind="order.ensurePrice | formateNumber :2 | currencySysmbol : order.currency.substring(0,3)" style="font-weight: bold"></em>
+									<em ng-if="order.status==501" ng-bind="storePrice[key] + fareList[details[0].storeid] | formateNumber :2 | currencySysmbol : order.currency.substring(0,3)" style="font-weight: bold"></em>
+									<em ng-if="order.status!=501" style="font-weight: bold">
+										<em ng-if="storeArray.length == 1" ng-bind="order.ensurePrice | formateNumber :2 | currencySysmbol : order.currency.substring(0,3)"></em>
+										<em ng-if="storeArray.length != 1" ng-bind="storePrice[key] + deliveryList[details[0].storeid].fare | formateNumber :2 | currencySysmbol : order.currency.substring(0,3)"></em>
+									</em>
 								</p>
 							</span>
-							</dd>
+						</dd>
+						<div class="self-list" ng-if="order.status==501 && deliveryList[details[0].storeid].method == 1303">
+							<!--自提点列表-->
+								<ul class="self-advice" ng-if="order.status == 501">
+									<li ng-repeat="item in takeSelfMap[details[0].storeid]">
+										<label class="check-act">
+											<input type="radio" id="{{item.id}}" name="1" ng-click="updateTakeSelf(details[0].storeid, item)"/>
+											<label for="{{item.id}}"></label>
+										</label>
+										<strong style="margin-left: 0" ng-bind="item.takename"></strong>
+										<strong>地址:<i ng-bind="item.area"></i>&nbsp;&nbsp;<i ng-bind="item.detailAddress"></i></strong>
+										<strong>营业时间:<i ng-bind="item.businesstime">周一至周五 8:30-18:00</i></strong>
+									</li>
+								</ul>
+						</div>
+						<dd class="line60" ng-if="order.status!=501 && (takeList ? takeList[details[0].storeid] : takeSelf)">
+							<span class="user-address" style="padding-left: 40px;" ng-if="takeList && takeList[details[0].storeid]">
+								<i class="fl"><strong style="font-weight: inherit; margin-right: 30px;" ng-bind="takeList[details[0].storeid].takename">自提点A</strong>
+								{{takeList[details[0].storeid].businesstime}}</i><br/>
+								<i class="fl">地址:{{takeList[details[0].storeid].area}}  {{takeList[details[0].storeid].detailAddress}}</i>
+							</span>
+							<span class="user-address" style="padding-left: 40px;" ng-if="!takeList && takeSelf">
+								<i class="fl"><strong style="font-weight: inherit; margin-right: 30px;" ng-bind="takeSelf.takename">自提点A</strong>
+								{{takeSelf.businesstime}}</i><br/>
+								<i class="fl">地址:{{takeSelf.area}}  {{takeSelf.detailAddress}}</i>
+							</span>
+						</dd>
+						<!--<div class="self-list" ng-if="order.status!=501">-->
+							<!--<span ng-if="takeList">-->
+								<!--<strong style="margin-left: 0" ng-bind="takeList[details[0].storeid].takename"></strong>-->
+								<!--<strong>地址:<i ng-bind="takeList[details[0].storeid].area"></i>&nbsp;&nbsp;<i ng-bind="takeList[details[0].storeid].detailAddress"></i></strong>-->
+								<!--<strong>营业时间:<i ng-bind="takeList[details[0].storeid].businesstime">周一至周五 8:30-18:00</i></strong>-->
+							<!--</span>-->
+							<!--<span ng-if="!takeList && takeSelf">-->
+								<!--<strong style="margin-left: 0" ng-bind="takeSelf.takename"></strong>-->
+								<!--<strong>地址:<i ng-bind="takeSelf.area"></i>&nbsp;&nbsp;<i ng-bind="takeSelf.detailAddress"></i></strong>-->
+								<!--<strong>营业时间:<i ng-bind="takeSelf.businesstime">周一至周五 8:30-18:00</i></strong>-->
+							<!--</span>-->
+						<!--</div>-->
 					</div>
 					<dd class="pay_price">
 						<div>

+ 1 - 1
src/main/webapp/resources/view/usercenter/modal/cancelOrder_modal.html

@@ -76,7 +76,7 @@
 <div class="modal-header">
 	<a title="关闭" class="cancle-close" ng-click="cancel()">×</a>
 </div>
-<div class="modal-body" style="height: 240px">
+<div class="modal-body" style="height: 150px">
 	<div class="row" >
 		<div class="text-inverse attention"><img src="static/img/common/pay-attention.png" style="margin-right: 5px;"/>您确认需要取消该订单吗?取消订单后,不能恢复!</div>
 		<div id="reason" class="col-md-12 form-inline">

+ 85 - 31
src/main/webapp/resources/view/vendor/forstore/purchase_detail.html

@@ -17,7 +17,7 @@
 		width: 14%;
 	}
 	#oder-detail .oder_xq_list dl span.wd01{
-		width: 16%;
+		width: 13%;
 	}
 	#oder-detail .oder_xq_list dl span.wd02{
 		width: 25%;
@@ -41,7 +41,7 @@
 		line-height: 30px;
 		color: #fff;
 		font-size: 14px;
-		margin-right: 5px;
+		/*margin-right: 5px;*/
 		float: right;
 	}
 	#oder-detail .oder_xq_list dl .change-price span:hover{
@@ -58,7 +58,7 @@
 	.oder_xq_list dl .change .change-price{
 		width: 100% !important;
 		margin-top: 0;
-		padding-right: 30px;
+		/*padding-right: 30px;*/
 	}
 	#oder-detail .oder_xq_list dl .change-price span:hover{
 		background: #3f7ae3;
@@ -66,6 +66,7 @@
 	}
 	#oder-detail .oder_xq_list dl .change-price span.off{
 		background: #fa5a02;
+		margin-right: 10px;
 	}
 	.oder_xq_list dl .price span i {
 		margin-right: 35px;
@@ -135,7 +136,7 @@
 		background: #f1f6ff;
 	}
 	.oder_xq_list dl .line60{
-		height: 50px;
+		height: 60px;
 		border-bottom: #5078cb 1px solid;
 	}
 	.oder-remark .form-control {
@@ -149,7 +150,7 @@
 	.oder-remark span em {
 		float: left;
 		color: #333 !important;
-		margin-left: 20px;
+		margin-left: 40px;
 	}
 	.oder_xq_list dl span.total-price{
 		float: right;
@@ -215,6 +216,7 @@
 		text-decoration: none;
 		position: relative;
 		top: 0;
+		z-index: 200;
 	}
 	.open-more a i{
 		margin-right: 5px;
@@ -290,6 +292,33 @@
 		width: 60px;
 		height: 60px;
 	}
+	.color999{
+		color: #999 !important;
+	}
+	.log_menu span{
+		margin-left: 11px;
+	}
+	.text-area{
+		width: 120px;
+		height: 60px;
+		background: #fff;
+		margin-top: 15px;
+		overflow-y: auto;
+		text-align: left;
+		padding: 0 3px;
+		margin-left: 5px;
+	}
+	.text-area i{
+		text-align: left;
+		position: relative;
+		top: 4px;
+		font-size: 12px;
+		color: #666;
+		word-break: break-all;
+	}
+	#oder-detail .contact_btn:hover{
+		color: #fff !important;
+	}
 	/*联系买家*/
 	.contact-box{
 		position: absolute;
@@ -382,7 +411,18 @@
 		</div>-->
 		<!--订单信息-->
 		<div class="logistics_list01" style="margin-top: 0;">
-			<div class="log_menu"><span>订单信息<b>订单号:{{purchase.orderid}} <em><font style="color: #333; margin-left: 20px">订单状态:</font>{{purchase.status | purchaseStatus}}</em></b></span></div>
+			<div class="log_menu">
+				<!--<span>订单信息<b>订单号:{{purchase.orderid}} <em><font style="color: #333; margin-left: 20px">订单状态:</font>{{purchase.status | purchaseStatus}}</em></b></span>-->
+				<span ng-if="purchase.status != 602 && purchase.status != 603 && purchase.status != 604 && purchase.status != 605 && purchase.status != 606 && purchase.status != 315">订单信息<b>订单号:{{purchase.orderid}}<em style="margin-left: 25px;"><font style="color: #333;">订单状态:</font>{{purchase.status | purchaseStatus}}</em></b></span>
+				<span ng-if="purchase.status == 602 || purchase.status == 603 || purchase.status == 604 || purchase.status == 605 || purchase.status == 606 || purchase.status == 315">
+					<i class="f14">订单号:{{purchase.orderid}}</i>
+					<b>
+						<em style="margin-right: 25px;" ng-if="purchase.status != 603"><font class="color999">取消原因:</font>{{purchase.unavailableReason.reason}}</em>
+						<em style="margin-right: 25px;" ng-if="purchase.status == 603"><font class="color999">取消原因:</font>超时未付款自动取消</em>
+						<em><font class="color999">订单状态:</font>{{purchase.status | purchaseStatus}}</em>
+					</b>
+				</span>
+			</div>
 			<div class="oder_xq clearfix" style="background: #f8f8f8; width: 98%;">
 				<p>
 					<b>收货人:</b>
@@ -406,15 +446,19 @@
 						<span class="wd01">单价</span>
 						<span style="width: 10%;">数量</span>
 						<span class="wd01">小计</span>
+						<span class="wd01">物料编码</span>
 						<span class="wd01">备注</span>
 					</dt>
 					<!--<dd>-->
 					<!--<span style="width: 100%; text-align: left; padding-left: 20px;" class="ng-binding"><img src="static/img/user/images/shop_home01.png">{{purchase.buyentername}}</span>-->
 					<!--</dd>-->
 					<dd class="order-company">
-						<span style="white-space: nowrap; width: 100%; text-align: left; line-height: 50px; position: relative;">
+						<span style="white-space: nowrap; width: 100%; text-align: left; line-height: 50px;">
 							<i style="min-width: 315px; display: inline-block">
-								&nbsp;&nbsp;{{purchase.buyername}}<i ng-if="purchase.buyentername">&nbsp;&nbsp;|&nbsp;&nbsp;{{purchase.buyentername}}</i> <!--<a ng-if="purchase.pu_buyentername" name="{{purchase.id}}" ng-controller="ChatContactCtrl as chat" ng-click="chat.contactWithOther(purchase.buyPhone, purchase.buyerenuu, chat.UserType.ENTERPRISE)"></a>-->
+								<i ng-bind="purchase.buyername" style="color: #333; margin-left: 20px;"></i>
+                                <i style="color: #999; margin: 0 5px;" ng-if="purchase.buyentername">|</i>
+                                <i ng-bind="purchase.buyentername"></i>
+								<!--<a ng-if="purchase.pu_buyentername" name="{{purchase.id}}" ng-controller="ChatContactCtrl as chat" ng-click="chat.contactWithOther(purchase.buyPhone, purchase.buyerenuu, chat.UserType.ENTERPRISE)">|{{purchase.pu_buyentername}}</a>-->
 							</i>
 							<img src="static/img/common/songguo.png" style="margin-right:0; ">
 							<!--<a name="{{purchase.id}}" href="javascript:void(0)" class="contact_btn" ng-controller="ChatContactCtrl as chat" ng-click="chat.contactWithOther(purchase.buyPhone, purchase.buyerenuu, chat.UserType.ENTERPRISE)">联系买家</a>-->
@@ -434,7 +478,7 @@
 							</div>
 						</span>
 					</dd>
-					<div ng-class="{'limit-3': !open}">
+					<div ng-class="{'limit-3': !open}" style="width: 100%; margin: 0 auto; overflow: hidden;">
 						<dd class="oder_l" ng-repeat="detail in purchase.purchaseDetails">
 						<span class="wd02">
 							<a href="store/{{::detail.storeid}}/{{::detail.batchCode}}" target="_blank"><img ng-src="{{detail.img ? detail.img : 'static/img/store/common/default.png'}}"/></a>
@@ -459,18 +503,25 @@
 								<input ng-model="detail.currentTaxUnitPrice" type="number" ng-change="updateTotal(detail)"/>
 							</em>
 						</span>
-						<span style="width: 10%;" ng-bind="detail.number">100</span>
-						<span ng-show="!isChange" class="wd01 red" ng-bind="detail.taxUnitPrice * detail.number | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
-						<span ng-show="isChange" class="wd01 red" ng-bind="detail.currentTaxUnitPrice * detail.number | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
-						<span class="wd01" style="line-height: 20px;">
-							<!--<textarea placeholder="可填写产品备注!例如物料编号"></textarea>-->
-							<div style="width: 133px; height: 74px; background: #fff; margin-top: 7px; overflow-y: auto;" ng-if="detail.remark">
-								<i style="line-height: 20px; text-align: left; position: relative; top: 4px;" ng-bind="detail.remark">金石为开取数据五块钱叫稍微亲上加亲</i>
-							</div>
-						</span>
-					</dd>
+							<span style="width: 10%;" ng-bind="detail.number">100</span>
+							<span ng-show="!isChange" class="wd01 red" ng-bind="detail.taxUnitPrice * detail.number | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
+							<span ng-show="isChange" class="wd01 red" ng-bind="detail.currentTaxUnitPrice * detail.number | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
+							<!--物料编码-->
+							<span class="wd01" style="line-height: 18px;">
+								<em ng-if="!detail.goodsnumber">&nbsp;</em>
+								<div class="text-area" ng-if="detail.goodsnumber">
+									<i ng-bind="detail.goodsnumber">金石为开取数据五块钱叫稍微亲上加亲</i>
+								</div>
+							</span>
+							<span class="wd01" style="line-height: 18px;">
+								<em ng-if="!detail.remark">&nbsp;</em>
+								<div class="text-area" ng-if="detail.remark">
+									<i ng-bind="detail.remark">金石为开取数据五块钱叫稍微亲上加亲</i>
+								</div>
+							</span>
+						</dd>
 					</div>
-					<div class="open-more row" ng-class="{'none': purchase.purchaseDetails.length < 3}">
+					<div class="open-more row" ng-class="{'none': purchase.purchaseDetails.length <= 3}">
 						<a href="javascript:void(0)" ng-click="open=!open" ng-class="{'active': open}">
 							<em ng-bind="open ? '收起' : '查看所有产品'"></em>
 							<i class="fa fa-angle-up" ng-if="open"></i>
@@ -485,20 +536,17 @@
 						</span>
 					</dd>
 					<dd class="line60">
-						<span class="wd02" style="width: 60%; text-align: left; margin-left: 20px; line-height: 30px;">配送方式:第三方配送
-							<!--<i style="color: #666;">(满1000元包邮,未满足的订单收取运费20元)</i>-->
+						<span class="wd02" style="width: 60%; text-align: left; margin-left: 40px; line-height: 30px;">配送方式:<i ng-bind="deliveryMethod[purchase.sendType]"></i>
+							<i style="color: #999;" ng-if="rule" ng-bind="'(' + rule.ruleName + ')'">(满1000元包邮,未满足的订单收取运费20元)</i>
 						</span>
 						<span class="total-price">
-								<p><strong>运费:</strong><em ng-bind="0 | formateNumber : 2 | currencySysmbol : purchase.currency.substring(0,3)" style="font-weight: bold"></em></p>
+								<p><strong>运费:</strong><em ng-bind="purchase.fare | formateNumber : 2 | currencySysmbol : purchase.currency.substring(0,3)" style="font-weight: bold"></em></p>
 								<p><strong>店铺合计:</strong>
-									<em ng-if="!isChange" ng-bind="purchase.price | formateNumber : 2 | currencySysmbol : purchase.currency" style="font-weight: bold"></em>
+									<em ng-if="!isChange" ng-bind="purchase.ensurePrice | formateNumber : 2 | currencySysmbol : purchase.currency" style="font-weight: bold"></em>
 									<em ng-if="isChange" ng-bind="purchase.currentTotal | formateNumber : 2 | currencySysmbol : purchase.currency" style="font-weight: bold"></em>
 								</p>
 						</span>
-						<!--<span class="user-address">-->
-							<!--<i class="fl"><strong style="font-weight: inherit">自提点:</strong>营业时间:周一至周五 8:30-18:00</i><br/>-->
-							<!--<i class="fl">地址:广东省  深圳市  南山区  科技园英唐大厦6楼 优软商城科技园英唐大厦6楼 优软商城</i>-->
-							<!--&lt;!&ndash;<input type="text"  class="form-control" placeholder="请填写订单备注" ng-model="order.orderRemark"/>&ndash;&gt;-->
+						<!--&lt;!&ndash;<input type="text"  class="form-control" placeholder="请填写订单备注" ng-model="order.orderRemark"/>&ndash;&gt;-->
 						<!--</span>-->
 						<!--<span ng-if="!noLogisticInfoArray[purchase.status]" class="wd02">物流:{{logistics.companyName || '空'}}</span>-->
 						<!--<span ng-if="!noLogisticInfoArray[purchase.status]" class="wd01">物流单号:{{logistics.number || '空'}}</span>-->
@@ -506,6 +554,12 @@
 						<!--<span ng-show="!canShowInfo" class="wd01">系统无法提供</span>-->
 						<!--<span><em ng-bind="freight | number : 2 | currencySysmbol : purchase.currency">¥20.00</em></span>-->
 					</dd>
+					<dd class="line60" ng-if="purchase.sendType == 1303 && takeSelf">
+						<span class="user-address" style="padding-left: 40px;">
+							<i class="fl"><strong style="font-weight: inherit; margin-right: 30px;" ng-bind="takeSelf.takename">自提点A</strong>营业时间:<i ng-bind="takeSelf.businesstime">周一至周五 8:30-18:00</i></i><br/>
+							<i class="fl">地址:<i ng-bind="takeSelf.area"></i>  <i ng-bind="takeSelf.detailAddress"></i></i>
+						</span>
+					</dd>
 					<dd class="change price">
 						<!--<span style="width: 100%">店铺合计:<i ng-bind="purchase.price | formateNumber : 2 | currencySysmbol : purchase.currency"></i></span>-->
 						<span class="change-price" ng-show="purchase.status == 501">
@@ -518,9 +572,9 @@
 			</div>
 		</div>
 		<!--物流信息-->
-		<div class="logistics_list01">
+		<div class="logistics_list01" ng-if="purchase.status != 602 && purchase.status != 603 && purchase.status != 604 && purchase.status != 605 && purchase.status != 606 && purchase.status != 315">
 			<div class="log_menu">
-				<span>物流信息<em ng-hide="hasInfo" ng-if="purchase.status == 501 || purchase.status == 502 || purchase.status == 504 || purchase.status == 406 || purchase.status == 603">(暂无物流信息)</em>
+				<span>物流信息<em ng-hide="hasInfo" ng-if="purchase.status == 501 || purchase.status == 502 || purchase.status == 504 || purchase.status == 406 || purchase.status == 603" class="color666">(暂无物流信息)</em>
 					<b ng-if="logistics.companyName">物流公司:{{logistics.companyName || '空'}}&nbsp;&nbsp;&nbsp;物流单号:{{logistics.number || '空'}}</b>
 				</span>
 			</div>
@@ -537,7 +591,7 @@
 		</div>
 		<!--订单信息-->
 		<div class="logistics_list01">
-			<div class="log_menu"><span>发票信息<em ng-if="purchase.invoicetype==1207">(暂不开票)</em></span></div>
+			<div class="log_menu"><span>发票信息<em ng-if="purchase.invoicetype==1207" class="color666">(暂不开票)</em></span></div>
 			<div class="oder_xq clearfix" style="padding-bottom: 20px;" ng-if="purchase.invoicetype==1205 || purchase.invoicetype == 1206">
 				<p>
 					<b>发票类型:</b>

+ 619 - 73
src/main/webapp/resources/view/vendor/forstore/vendor_delivery.html

@@ -1,7 +1,7 @@
 <!--右侧主体部分-->
 <style type="text/css">
     em.title {
-        font-size: 16px;
+        font-size: 14px;
         font-weight: 600;
     }
 
@@ -11,8 +11,13 @@
 
     .taggle-address {
         vertical-align: baseline;
-        margin-left: 15px;
+        margin-left: 0;
         color: #5078cb;
+        font-size: 12px;
+    }
+    a.taggle-address:last-child{
+        color: #666;
+        margin-right: 10px;
     }
     .sell_oder .sure_oder .oder_xq_list dl span.wid01 p{
         text-overflow: ellipsis;
@@ -29,13 +34,26 @@
     }
     .pay_price div{
         border: none;
-        margin-top: -15px;
+        margin-top: -20px;
         height: 60px;
+        width: auto;
+        padding: 0;
+        margin-right: 0;
+        margin-bottom: 30px;
     }
     .pay_price a{
         width: 70px;
-        height: 32px;
+        height: 28px;
         font-size: 14px;
+        line-height: 28px;
+        margin-right: 10px;
+    }
+    .pay_price a:first-child{
+        margin-right: 0;
+    }
+    .pay_price a.add{
+        width: 90px;
+        background: #fc5902;
     }
     .pay_price a.cancel{
         background: #b4b5b9;
@@ -57,11 +75,11 @@
         border-radius: 3px;
     }
     .sell_oder .sure_oder .oder_xq_list dl span .dropdown-menu{
-        top: 49%;
+        top: 95%;
         line-height: 23px;
-        max-height: 240px;
+        max-height: 120px;
         overflow-y: auto;
-        width: 190px;
+        width: 170px;
         display: block;
         overflow-x: hidden;
         border-radius: 0;
@@ -97,32 +115,411 @@
         left: 3px;
         top: 5px;
     }
-    ::-webkit-scrollbar-track-piece {
+    .input-ul ::-webkit-scrollbar-track-piece {
         background: #d4d4d4;
     }
-    ::-webkit-scrollbar {
+    .input-ul ::-webkit-scrollbar {
         width: 20px;
         height: 5px;
     }
-    ::-webkit-scrollbar-thumb {
+    .input-ul ::-webkit-scrollbar-thumb {
         background: #b1abab;
         padding-left: 0;!important;
         -webkit-border-radius: 0;
     }
-    ::-webkit-scrollbar-thumb:hover{
+    .input-ul ::-webkit-scrollbar-thumb:hover{
         background: #9b9b9b;
         cursor: pointer;
     }
+    /*修改部分*/
+    .logistics_list_xq dl dd:last-child em{
+        background: #5078cb;
+    }
+    #oder-detail .oder_xq_list dl .oder_l p{
+        font-size: 14px;
+        text-align: left;
+        width: 100%;
+        position: relative;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+        word-break: normal;
+        overflow: hidden;
+    }
+    #oder-detail .oder_xq_list dl span{
+        width: 14%;
+    }
+    #oder-detail .oder_xq_list dl span.wd01{
+        width: 13%;
+    }
+    #oder-detail .oder_xq_list dl span.wd02{
+        width: 25%;
+    }
+    #oder-detail .oder_xq_list dl .oder_l p.style01{
+        width: 160px;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+        word-break: normal;
+        overflow: hidden;
+    }
+    #oder-detail .oder_xq_list dl .oder_l img{
+        margin-left: 20px;
+    }
+    #oder-detail .oder_xq_list dl .change-price span{
+        width: 74px;
+        height: 30px;
+        display: inline-block;
+        text-align: center;
+        background: #5078cb;
+        line-height: 30px;
+        color: #fff;
+        font-size: 14px;
+        margin-right: 5px;
+        float: right;
+    }
+    #oder-detail .oder_xq_list dl .change-price span:hover{
+        cursor: pointer;
+    }
+    .oder_xq_list dl .change{
+        height: 70px;
+    }
+    .oder_xq_list dl .change span{
+        height: 40px;
+        line-height: 40px;
+        margin-top: 10px;
+    }
+    .oder_xq_list dl .change .change-price{
+        width: 100% !important;
+        margin-top: 0;
+        padding-right: 30px;
+    }
+    #oder-detail .oder_xq_list dl .change-price span:hover{
+        background: #3f7ae3;
+        color: #fff !important;
+    }
+    #oder-detail .oder_xq_list dl .change-price span.off{
+        background: #fa5a02;
+    }
+    .oder_xq_list dl .price span i {
+        margin-right: 35px;
+        font-weight: bold;
+    }
+    .no-record{
+        height: 60px;
+        text-align: center;
+        line-height: 60px;
+        background: #fff;
+        font-size: 14px;
+    }
+    .logistics_list01 .oder_xq p{
+        display: inline-block;
+        margin-left: 10px;
+    }
+    .red{
+        color: #f00;
+    }
+    #oder-detail .oder_xq_list dl dd.line60 span{
+        width: 20%;
+    }
+    #oder-detail .oder_xq_list dl dd.line60 span.wd001{
+        width: 35%;
+        margin-left: 25px;
+    }
+    /*订单详情修改*/
+    .logistics_list01{
+        background: #fff;
+    }
+    .oder_xq_list dl dt{
+        border: #f1f6ff 1px solid;
+        height: 40px;
+        border-bottom: #769be9 2px solid !important;
+        background: #f6f9ff;
+        margin-top: 10px;
+    }
+    .oder_xq_list dl .oder_l {
+        background: #f6f9ff;
+        border-bottom: #fff 1px solid;
+    }
+    .oder_xq_list dl dd{
+        border-bottom: none;
+    }
+    .oder_xq_list dl dd.order-company{
+        height: 50px;
+        line-height: 50px;
+        border-bottom: #f1f6ff 1px solid;
+    }
+    .oder_xq_list dl .oder_l span.wd02{
+        margin-top: 0;
+    }
+    .oder_xq_list dl .oder_l span.wd02 a img{
+        margin-top: 15px;
+    }
+    .oder_xq_list dl .oder_l span textarea {
+        padding: 5px;
+        width: 120px;
+        height: 60px;
+        border: #ccc 1px solid;
+        margin-top: 10px;
+    }
+    .oder_xq_list dl span a{
+        color: #333;
+    }
+    .oder-remark,.oder_xq_list dl .line60{
+        background: #f1f6ff;
+    }
+    .oder_xq_list dl .line60{
+        /*height: 50px;*/
+        border-bottom: #5078cb 1px solid;
+    }
+    .oder-remark .form-control {
+        width: 546px;
+        height: 30px;
+        border-radius: 2px;
+        float: left;
+        margin-top: 5px;
+        margin-left: 4px;
+    }
+    .oder-remark span em {
+        float: left;
+        color: #333 !important;
+        margin-left: 20px;
+    }
+    .oder_xq_list dl span.total-price{
+        float: right;
+        width: auto !important;
+        position: relative;
+        bottom: 10px;
+        margin-right: 20px;
+    }
+    .oder_xq_list dl span.total-price p{
+        line-height: 25px;
+        font-size: 14px;
+        text-align: right;
+        font-weight: bold;
+        display: flex;
+    }
+    .oder_xq_list dl span.total-price p:first-child em{
+        color: #333;
+    }
+    .oder_xq_list dl span.total-price p:last-child{
+        color: #e64040;
+    }
+    .oder_xq_list dl span.total-price p em{
+        color: #e64040;
+    }
+    .oder_xq_list dl span.total-price strong {
+        width: 70px;
+        display: inline-block;
+        float: left;
+    }
+    .oder_xq_list dl span.user-address{
+        width: 100% !important;
+        line-height: 30px;
+        position: relative;
+        top: -23px;
+        background: #f1f6ff;
+    }
+    .oder_xq_list dl span.user-address i:nth-of-type(1){
+        margin-left: 20px;
+    }
+    .oder_xq_list dl span.user-address i:nth-of-type(2){
+        margin-left: 70px;
+    }
+    .open-more{
+        text-align: center;
+        background: #f6f9ff;
+        height: 2px;
+    }
+    .oder-remark.length3{
+        border-top: #a5d6f7 1px dashed
+    }
+    .open-more a{
+        font-size: 12px;
+        width: 200px;
+        height: 15px;
+        display: inline-block;
+        border: #5e9fcb 1px dashed;
+        border-top: 0;
+        font-weight: inherit;
+        background: #f6f9ff;
+        border-bottom-left-radius: 50px;
+        border-bottom-right-radius: 50px;
+        line-height: 15px;
+        text-decoration: none;
+        position: relative;
+        top: 0;
+        z-index: 200;
+    }
+    .open-more a i{
+        margin-right: 5px;
+        font-size: 20px;
+        vertical-align: middle;
+        position: relative;
+        top: -5px;
+        color: #ff8423;
+    }
+    .open-more a.active{
+        border-top-left-radius: 50px;
+        border-top-right-radius: 50px;
+        position: relative;
+        top: -12px;
+        border-bottom: none;
+        border-top: #5e9fcb 1px dashed;
+        border-bottom-left-radius: 0;
+        border-bottom-right-radius: 0;
+        background: #f1f6ff;
+    }
+    .open-more a.active em{
+        top: 3px;
+    }
+    .open-more a.active i{
+        top: 0;
+    }
+    .open-more a em{
+        position: relative;
+        top: -4px;
+        color: #ff8423;
+    }
+    .open-more a:hover em,.open-more a:hover i{
+        color: #5078cb;
+        text-decoration: none;
+    }
+    .limit-3{
+        width: 100%;
+        margin: 0 auto;
+        max-height: 270px;
+        overflow: hidden;
+    }
+    .open-more.none{
+        display: none;
+    }
+    .logistics_list01 .oder_xq p b{
+        color: #959595;
+    }
+    .logistics_list01 .oder_xq{
+        width: 97%;
+    }
+    .oder_xq_list dl .price-style em{
+        width: 18px;
+        height: 28px;
+        background: #5078cb;
+        text-align: center;
+        line-height: 28px;
+        border-top-left-radius: 3px;
+        border-bottom-left-radius: 3px;
+        color: #fff;
+        display: inline-block;
+    }
+    .oder_xq_list dl .price-style input{
+        width: 100px;
+        border: #5078cb 1px solid;
+        font-size: 14px;
+        position: relative;
+        height: 28px;
+        left: -6px;
+        top: -1px;
+        text-align: center;
+    }
+    .oder_xq_list dl .oder_l img{
+        width: 60px;
+        height: 60px;
+    }
+    .color999{
+        color: #999 !important;
+    }
+    .log_menu span{
+        margin-left: 11px;
+    }
+    .text-area{
+        width: 120px;
+        height: 60px;
+        background: #fff;
+        margin-top: 15px;
+        overflow-y: auto;
+        text-align: left;
+        padding: 0 3px;
+        margin-left: 5px;
+    }
+    .text-area i{
+        text-align: left;
+        position: relative;
+        top: 4px;
+        font-size: 12px;
+        color: #666;
+        word-break: break-all;
+    }
+
+    #oder-detail .line60.logistic-input{
+        position: relative;
+        top: -15px;
+        height: 80px;
+        margin-top: -10px;
+    }
+    #oder-detail .line60.logistic-input.h125{
+        height: 125px;
+    }
+    #oder-detail .line60.logistic-input span{
+        height: 30px;
+        line-height: 30px;
+        float: left;
+        margin-top: 5px;
+    }
+    #oder-detail .line60.logistic-input span .form-control{
+        border-radius: 2px;
+        border: #ccc 1px solid;
+    }
+    #oder-detail .line60.logistic-input span.input-ul{
+        width: 170px;
+        margin-right: 55px;
+        float: left
+    }
+    #oder-detail .line60.logistic-input span.input-ul input{
+        vertical-align: middle;
+        width:170px;
+        margin-top: -1px;
+        height: 32px;
+    }
+    #oder-detail .line60.logistic-input span.input-ul em{
+    }
+    #oder-detail .line60.logistic-input .logistic-input-01{
+        font-size: 14px;
+        margin-left: 40px;
+        line-height: 30px;
+    }
+    .com_log_list ul li p{
+        max-height: 40px;
+        overflow: hidden;
+        margin-bottom: 10px;
+        margin-top: 25px;
+        line-height: 20px;
+    }
+    .com_log_list{
+        height: 160px;
+    }
+    .com_log_list ul li span.adderss-name{
+        max-height: 40px;
+        overflow: hidden;
+    }
+    .com_log_list ul li{
+        width: 282px;
+        height: 124px;
+        background: url("static/img/user/images/adress_bg02.jpg") no-repeat;
+    }
+    .com_log_list ul li.active{
+        background-position: -283px 0;
+    }
+    .form-control[readonly]{
+        background-color: #ffffff;
+    }
 </style>
 <div class="user_right fr">
     <!--订单发货-->
-    <div class="sell_oder payment">
+    <div class="sell_oder payment" id="oder-detail">
         <!--确认订单信息-->
         <div class="sure_oder">
             <div class="log_menu">
                 <span><em class="title">订单信息</em>
-                    <b>订单号:<em ng-bind="::checkinvoice.orid" style="padding-right: 15px; width: 162px;"></em>
-                        <em><font class="gray">订单状态:</font>
+                    <b>订单号:<em ng-bind="::checkinvoice.orid" style="padding-right: 15px;" class="color333"></em>
+                        <em><font style="color: #333;">订单状态:</font>
                             <em ng-bind="checkinvoice.status | statusAndTypeFilter"></em>
                         </em>
                     </b>
@@ -132,19 +529,19 @@
                 <ul>
                     <li class="log_line">收货人信息:</li>
                     <li>
-                        <h4 ng-bind="checkinvoice.jsonSpAddress.company || '空'"></h4>
-                        <p class="textmore"><em ng-bind="::checkinvoice.jsonSpAddress.area"></em>,<em ng-bind="::checkinvoice.jsonSpAddress.detailAddress"></em></p>
-                        <span><em ng-bind="checkinvoice.jsonSpAddress.tel"></em>&nbsp;&nbsp;<em ng-bind="checkinvoice.buyerentername"></em></span>
+                        <!--<h4 ng-bind="checkinvoice.jsonSpAddress.company || '空'"></h4>-->
+                        <p class="" title=""><em ng-bind="::checkinvoice.jsonSpAddress.area"></em> <em ng-bind="::checkinvoice.jsonSpAddress.detailAddress"></em></p>
+                        <span class="adderss-name"><em ng-bind="checkinvoice.jsonSpAddress.tel"></em>&nbsp;&nbsp;<em ng-bind="checkinvoice.jsonSpAddress.name"></em></span>
                     </li>
                     <li class="log_line">发货人信息:</li>
                     <li ng-if="jsonSdAddress.area">
-                        <h4 ng-bind="jsonSdAddress.company"></h4>
-                        <p class="textmore">{{jsonSdAddress.area}},{{jsonSdAddress.detailAddress}}</p>
-                        <span><em ng-bind="jsonSdAddress.tel"></em>&nbsp;&nbsp;<em ng-bind="jsonSdAddress.name"></em>
-                            <div>
-                                <a ng-if="checkinvoice.status!=404" class="taggle-address edit-address" ng-click="editAddr(jsonSdAddress)"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>&nbsp;编辑</a>
-                                <a ng-if="checkinvoice.status!=404" class="taggle-address" ng-click="taggleAddress(jsonSdAddress)"><i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;切换</a>
-                                <a ng-if="checkinvoice.status!=404 && total < 20" class="taggle-address" ng-click="editAddr()"><i class="fa fa-plus-square" aria-hidden="true"></i>&nbsp;新建</a>
+                        <!--<h4 ng-bind="jsonSdAddress.company"></h4>-->
+                        <p class="">{{jsonSdAddress.area}} {{jsonSdAddress.detailAddress}}</p>
+                        <span class="adderss-name"><em ng-bind="jsonSdAddress.tel"></em>&nbsp;&nbsp;<em ng-bind="jsonSdAddress.name"></em>
+                            <div style="float: right; color: #ccc;">
+                                <a ng-if="checkinvoice.status!=404" class="taggle-address edit-address" ng-click="editAddr(jsonSdAddress)" style="color: #5078cb;">编辑</a>
+                                <!--<a ng-if="checkinvoice.status!=404" class="taggle-address" ng-click="taggleAddress(jsonSdAddress)"><i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;切换</a>-->
+                                <a ng-if="checkinvoice.status!=404 && total<20" class="taggle-address" ng-click="editAddr()" style="color: #5078cb;"> | 新增</a>
                             </div>
                         </span>
                     </li>
@@ -153,69 +550,218 @@
                     </li>
                 </ul>
             </div>
+            <!--订单列表-->
             <div class="oder_xq_list">
                 <dl class="clearfix">
                     <dt>
-                        <span class="wid01">产品型号</span>
-                        <span class="wid01">属性</span>
-                        <span>数量</span>
-                        <span>单价/币种</span>
-                        <span>小计</span>
-                        <span>备注</span>
+                        <span class="wd02">产品信息</span>
+                        <span class="wd01">交期(天)</span>
+                        <span class="wd01">单价</span>
+                        <span style="width: 10%;">数量</span>
+                        <span class="wd01">小计</span>
+                        <span class="wd01">物料编码</span>
+                        <span class="wd01">备注</span>
                     </dt>
-                    <dd>
-                        <span style="width: 100%; text-align: left;">买家:<em class="de_color" ng-bind="checkinvoice.buyerentername">HKJKLJKL</em></span>
+                    <!--<dd>-->
+                    <!--<span style="width: 100%; text-align: left; padding-left: 20px;" class="ng-binding"><img src="static/img/user/images/shop_home01.png">{{purchase.buyentername}}</span>-->
+                    <!--</dd>-->
+                    <dd class="order-company">
+						<span style="white-space: nowrap; width: 100%; text-align: left;">
+							<i style="min-width: 315px; display: inline-block">
+                                <i ng-bind="checkinvoice.buyername" style="color: #333; margin-left: 20px;"></i>
+                                <i style="color: #999; margin: 0 5px;" ng-if="checkinvoice.buyerentername">|</i>
+                                <i href="store/{{checkinvoice.storeid}}#/home" ng-bind="checkinvoice.buyerentername"></i>
+								<!--<a ng-if="purchase.pu_buyentername" name="{{purchase.id}}" ng-controller="ChatContactCtrl as chat" ng-click="chat.contactWithOther(purchase.buyPhone, purchase.buyerenuu, chat.UserType.ENTERPRISE)">|{{purchase.pu_buyentername}}</a>-->
+							</i>
+							<img src="static/img/common/songguo.png" style="margin-right:0; ">
+                            <!--<a name="{{purchase.id}}" href="javascript:void(0)" class="contact_btn" ng-controller="ChatContactCtrl as chat" ng-click="chat.contactWithOther(purchase.buyPhone, purchase.buyerenuu, chat.UserType.ENTERPRISE)">联系买家</a>-->
+							<a name="{{purchase.id}}" href="javascript:void(0)" class="contact_btn" >联系买家</a>
+						</span>
                     </dd>
-                    <dd class="oder_l" ng-repeat="detail in checkinvoice.invoiceFPurchaseDetails">
-                            <span class="wid01">
-                                <a href="store/{{::detail.storeid}}/{{::detail.batchCode}}"><img ng-src="{{detail.img || 'static/img/store/common/default.png'}}" width="42" height="42"/></a>
-                                <p><a href="store/{{detail.storeid}}/{{::detail.batchCode}}" ng-bind="detail.cmpCode" title="{{detail.cmpCode}}" class="text-more" style="width: 160px;margin-top: 3px;"></a></p>
-                            </span>
-                        <span  class="wid01" ng-bind="detail.kiName"></span>
-                        <span ng-bind="detail.number | number"></span>
-                        <span ng-bind="detail.taxUnitPrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
-                        <span><em ng-bind="detail.ensurePrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></em></span>
-                        <!--<span><font class="gray">无</font></span>-->
+                    <div ng-class="{'limit-3': !open}" style="width: 100%; margin: 0 auto; overflow: hidden;">
+                        <dd class="oder_l" ng-repeat="detail in checkinvoice.invoiceFPurchaseDetails">
+						<span class="wd02">
+							<a href="store/{{detail.storeid}}/{{::detail.batchCode}}" target="_blank"><img ng-src="{{detail.img ? detail.img : 'static/img/store/common/default.png'}}"/></a>
+							<p class="style01" style="margin-top: 10px;">类目:
+								<a ng-bind="detail.kiName" href="product/kind/{{::detail.kindUuid}}" title="{{detail.kiName}}" target="_blank"></a>
+							</p>
+							<p class="style01">型号:
+								<a ng-bind="detail.cmpCode" href="store/{{detail.storeid}}/{{::detail.batchCode}}" title="{{detail.cmpCode}}" target="_blank"></a>
+							</p>
+							<p class="style01">品牌:
+								<a ng-bind="detail.brName" href="product/brand/{{::detail.branduuid}}" title="{{detail.brName}}" target="_blank"></a>
+							</p>
+						</span>
+                            <span class="wd01">交期:
+							<i ng-if="detail.b2cMinDelivery != detail.b2cMaxDelivery" ng-bind="detail.b2cMinDelivery + '-' + detail.b2cMaxDelivery"></i>
+							<i ng-if="detail.b2cMinDelivery == detail.b2cMaxDelivery" ng-bind="detail.b2cMinDelivery"></i>
+						</span>
+                            <span class="wd01">
+							<em  ng-show="!isChange" ng-bind="detail.taxUnitPrice | formateNumber : 6 | currencySysmbol : detail.currencyName" style="color: #333;"></em>
+							<em ng-show="isChange" class="price-style">
+								<em  ng-bind="'' | currencySysmbol : detail.currencyName"></em>
+								<input ng-model="detail.currentTaxUnitPrice" type="number" ng-change="updateTotal()"/>
+							</em>
+						</span>
+                            <span style="width: 10%;" ng-bind="detail.number">100</span>
+                            <span ng-show="!isChange" class="wd01 red" ng-bind="detail.taxUnitPrice * detail.number | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
+                            <span ng-show="isChange" class="wd01 red" ng-bind="detail.currentTaxUnitPrice * detail.number | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>
+                            <!--物料编码-->
+                            <span class="wd01" style="line-height: 18px;">
+						<!--<textarea placeholder="可填写产品备注!例如物料编号"></textarea>-->
+                                <em ng-if="!detail.goodsnumber">&nbsp;</em>
+                                <div class="text-area" ng-if="detail.goodsnumber">
+                                    <i ng-bind="detail.goodsnumber">金石为开取数据五块钱叫稍微亲上加亲</i>
+                                </div>
+						    </span>
+                            <span class="wd01" style="line-height: 18px;">
+							<!--<textarea placeholder="可填写产品备注!例如物料编号"></textarea>-->
+                                <em ng-if="!detail.remark">&nbsp;</em>
+                                <div class="text-area" ng-if="detail.remark">
+                                    <i ng-bind="detail.remark">金石为开取数据五块钱叫稍微亲上加亲</i>
+                                </div>
+						</span>
+                        </dd>
+                    </div>
+                    <div class="open-more row" ng-class="{'none': checkinvoice.invoiceFPurchaseDetails.length <= 3}">
+                        <a href="javascript:void(0)" ng-click="open=!open" ng-class="{'active': open}">
+                            <em ng-bind="open ? '收起' : '查看所有产品'"></em>
+                            <i class="fa fa-angle-up" ng-if="open"></i>
+                            <i class="fa fa-angle-down" ng-if="!open"></i>
+                        </a>
+                    </div>
+                    <dd class="oder-remark" ng-class="{'length3': checkinvoice.invoiceFPurchaseDetails.length > 3}">
+						<span style="width: 100%; padding-left: 20px;">
+							<em>订单备注:</em>
+							<i class="fl" ng-bind="checkinvoice.infpuRemark || '无'">用便宜的物流最好!</i>
+                            <!--<input type="text"  class="form-control" placeholder="请填写订单备注" ng-model="order.orderRemark"/>-->
+						</span>
                     </dd>
-                    <dd class="line60">
-                        <span style="width: 165px; text-align: left;padding-left: 10px;">配送方式:<b>物流配送</b></span>
-                        <span style="width: 5%;"> 物流 :&nbsp;</span>
-                        <span style="width: 170px;top: 50%;margin-top: -15px; margin-right: 55px;">
-                             <!--<input type="text" style="vertical-align: middle;width:170px; margin-top: -2px;" class="form-control" ng-model="logistics.companyName" placeholder="请输入物流公司" autocomplete="off" typeahead="log.companyName as log.companyName for log in logisticsInfo | filter:$viewValue | limitTo : 10" typeahead-on-select="onAssociateKindClick($item)" typeahead-min-length="0" />-->
-                            <input id="addr" type="text" class="form-control" ng-change="textChange()" ng-blur="onBlur()" ng-focus="getFocus()" ng-keydown="onKeyup()" ng-model="logistics.companyName"  placeholder="请输入物流公司" autocomplete="off" style="vertical-align: middle;width:170px; margin-top: -2px;" maxlength="15">
-                            <em name="companyName" ng-click="changeShowLogistics()" class="btn-position"><i class="fa fa-caret-down" aria-hidden="true"></i></em>
-                            <ul id="ulContent" ng-if="showCompanyName && matchData" class="dropdown-menu">
-                                <li ng-click="showText(companyName)" ng-repeat="companyName in resultList" ng-class="{'active': $index==selectIndex}" ng-bind="companyName"></li>
-                            </ul>
-                        </span>
-
-                        <span style="margin-right: 20px; width: 160px;">
+                    <dd class="line60" style="border-bottom: none;">
+						<span class="wd02" style="width: 60%;text-align: left; margin-left: 40px;line-height: 30px; max-height: min-content;">
+                            配送方式:<em class="color333">{{deliveryMethod[checkinvoice.sendType]}}</em>
+                            <!--<em class="color333">上门自提</em>-->
+                            <i style="color: #666;" ng-if="rule" ng-bind="'(' + rule.ruleName + ')'">(满1000元包邮,未满足的订单收取运费20元)</i>
+						</span>
+                        <span class="total-price">
+								<p><strong>运费:</strong><em ng-bind="checkinvoice.fare | formateNumber : 2 | currencySysmbol : checkinvoice.currencyName.substring(0,3)" style="font-weight: bold"></em></p>
+								<p><strong>店铺合计:</strong>
+									<!--<em ng-if="!isChange" ng-bind="purchase.price | formateNumber : 2 | currencySysmbol : purchase.currency" style="font-weight: bold"></em>-->
+									<!--<em ng-if="isChange" ng-bind="purchase.currentTotal | formateNumber : 2 | currencySysmbol : purchase.currency" style="font-weight: bold"></em>-->
+                                    <em ng-bind="checkinvoice.ensurePrice  | formateNumber : 2 | currencySysmbol : checkinvoice.currencyName" style="font-weight: bold"></em>
+								</p>
+						</span>
+                        <!--<span class="user-address">-->
+                        <!--<i class="fl"><strong style="font-weight: inherit">自提点:</strong>营业时间:周一至周五 8:30-18:00</i><br/>-->
+                        <!--<i class="fl">地址:广东省  深圳市  南山区  科技园英唐大厦6楼 优软商城科技园英唐大厦6楼 优软商城</i>-->
+                        <!--&lt;!&ndash;<input type="text"  class="form-control" placeholder="请填写订单备注" ng-model="order.orderRemark"/>&ndash;&gt;-->
+                        <!--</span>-->
+                        <!--<span ng-if="!noLogisticInfoArray[purchase.status]" class="wd02">物流:{{logistics.companyName || '空'}}</span>-->
+                        <!--<span ng-if="!noLogisticInfoArray[purchase.status]" class="wd01">物流单号:{{logistics.number || '空'}}</span>-->
+                        <!--<span ng-show="!canShowInfo && !noLogisticInfoArray[purchase.status]" class="wd01 wd001"><em style="color: #b0b0b0; font-size: 12px;"><i class="fa fa-info-circle"></i>系统无法提供此物流信息,请根据物流单号到相应的官网查询。</em></span>-->
+                        <!--<span ng-show="!canShowInfo" class="wd01">系统无法提供</span>-->
+                        <!--<span><em ng-bind="freight | number : 2 | currencySysmbol : purchase.currency">¥20.00</em></span>-->
+                    </dd>
+                    <dd class="line60 logistic-input" ng-class="{'h125': checkinvoice.sendType==1303}">
+                        <div  class="logistic-input-01" ng-if="checkinvoice.sendType==1303">
+                            <i ng-bind="takeSelf.takename"></i> &nbsp;&nbsp;营业时间:<em ng-bind="takeSelf.businesstime">周一至周五 8:30-18:00</em><br/>
+                            地址:<em ng-bind="takeSelf.area">广东省  深圳市  南山区</em>&nbsp;&nbsp;<em ng-bind="takeSelf.detailAddress">科技园英唐大厦6楼 优软商城科技园英唐大厦6楼 优软商城</em>
+                        </div>
+                        <div style="width: 100%;margin: 0 auto;height: 45px;">
+                            <span style="width: 10%; margin-left: 22px;">物流公司 :&nbsp;</span>
+                            <span class="input-ul">
+                                <input id="addr" style="border: #5078cb 1px solid;" type="text" class="form-control select-adder" ng-focus="getItemFocus()" ng-blur="onItemBlur()" ng-keydown="onKeyup()" ng-model="logistics.companyName" placeholder="请选择物流公司" autocomplete="off" maxlength="15" readonly="readonly" >
+                                <!--<em name="companyName" ng-click="changeShowLogistics()" class="btn-position"><i class="fa fa-caret-down" aria-hidden="true"></i></em>-->
+                                <ul id="ulContent" ng-if="showCompanyName" class="dropdown-menu">
+                                    <li ng-click="showDefaultText()">请选择物流公司</li>
+                                    <li ng-click="showText(data)" ng-repeat="data in data_list" ng-class="{'active': $index==selectIndex}" ng-bind="data.companyName"></li>
+                                </ul>
+                            </span>
+                            <span  style="width: 10%;"> 物流单号 :&nbsp;</span>
+                            <span style="margin-right: 20px; width: 160px; float: left;">
                             <form name="myForm">
-                                <input name="number" type="text" class="form-control" ng-model="logistics.number" placeholder="请输入物流单号" style="margin-top: 13px;" ng-pattern="/^[A-Za-z0-9]+$/" maxlength="20"/>
-                                <!--<span ng-show="myForm.number.$invalid && myForm.number.$dirty">请输入正确的</span>-->
+                                <!--ng-pattern="/^[A-Za-z0-9]+$/"-->
+                            <input name="number" type="text" class="form-control" style="height: 32px" ng-model="logistics.number" placeholder="请输入物流单号" maxlength="20" autocomplete="off"/>
                             </form>
-                            <!--<input type="text" class="form-control" ng-model="logistics.number" placeholder="请输入物流单号" style="margin-top: 13px;" ng-pattern="/^[A-Za-z0-9]+$/"/>-->
                         </span>
-                        <em ng-if="showTip" style="color: #b0b0b0; font-size: 12px;"><i class="fa fa-info-circle"></i>系统无法提供此物流信息,请根据物流单号到相应的官网查询。</em>
-                        <!--<span style="width: 22%"><em>¥20.00</em></span>-->
-                    </dd>
-                    <dd class="price">
-                        <span style="width: 90%;">总计:<i ng-bind="checkinvoice.ensurePrice  | formateNumber : 2 | currencySysmbol : checkinvoice.currencyName"></i></span>
+                            <em ng-if="companyObject && companyObject.isKdn==0" style="color: #b0b0b0;
+                            font-size: 12px;
+                            float: left;
+                            line-height: 33px;"><i class="fa fa-info-circle"></i>系统无法提供此物流信息,请根据物流单号到相应的官网查询。</em>
+                        </div>
                     </dd>
                     <dd class="pay_price">
-                        <p>
-                            <div ng-if="checkinvoice.status==406">
-                                <a href="javascript:void(0)" ng-click="saveCheck()" class="confirm">确认</a>
-                                <a href="vendor#/order/center" class="cancel">取消</a>
-                            </div>
-                            <div ng-if="checkinvoice.status==404">
-                                <a href="javascript:void(0)" ng-click="upateLogistic(checkinvoice)" class="confirm">确认</a>
-                                <a href="vendor#/order/center" class="cancel">取消</a>
-                            </div>
-                        </p>
+                        <div ng-if="checkinvoice.status==406">
+                            <a href="javascript:void(0)" ng-click="saveCheck()" class="confirm">确认发货</a>
+                            <a ng-click="backToDelivery()" class="cancel">取消</a>
+                            <a ng-click="addDistributor()" class="add">新增配送商</a>
+                        </div>
                     </dd>
                 </dl>
             </div>
+            <!--<div class="oder_xq_list">-->
+                <!--<dl class="clearfix">-->
+                    <!--<dt>-->
+                        <!--<span class="wid01">产品型号</span>-->
+                        <!--<span class="wid01">属性</span>-->
+                        <!--<span>数量</span>-->
+                        <!--<span>单价/币种</span>-->
+                        <!--<span>小计</span>-->
+                        <!--<span>备注</span>-->
+                    <!--</dt>-->
+                    <!--<dd>-->
+                        <!--<span style="width: 100%; text-align: left;">买家:<em class="de_color" ng-bind="checkinvoice.buyerentername">HKJKLJKL</em></span>-->
+                    <!--</dd>-->
+                    <!--<dd class="oder_l" ng-repeat="detail in checkinvoice.invoiceFPurchaseDetails">-->
+                            <!--<span class="wid01">-->
+                                <!--<a href="store/{{::detail.storeid}}/{{::detail.batchCode}}"><img ng-src="{{detail.img || 'static/img/store/common/default.png'}}" width="42" height="42"/></a>-->
+                                <!--<p><a href="store/{{detail.storeid}}/{{::detail.batchCode}}" ng-bind="detail.cmpCode" title="{{detail.cmpCode}}" class="text-more" style="width: 160px;margin-top: 3px;"></a></p>-->
+                            <!--</span>-->
+                        <!--<span  class="wid01" ng-bind="detail.kiName"></span>-->
+                        <!--<span ng-bind="detail.number | number"></span>-->
+                        <!--<span ng-bind="detail.taxUnitPrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></span>-->
+                        <!--<span><em ng-bind="detail.ensurePrice | formateNumber : 6 | currencySysmbol : detail.currencyName"></em></span>-->
+                        <!--&lt;!&ndash;<span><font class="gray">无</font></span>&ndash;&gt;-->
+                    <!--</dd>-->
+                    <!--<dd class="line60">-->
+                        <!--<span style="width: 165px; text-align: left;padding-left: 10px;">配送方式:<b>物流配送</b></span>-->
+                        <!--<span style="width: 5%;"> 物流 :&nbsp;</span>-->
+                        <!--<span style="width: 170px;top: 50%;margin-top: -15px; margin-right: 55px;">-->
+                             <!--&lt;!&ndash;<input type="text" style="vertical-align: middle;width:170px; margin-top: -2px;" class="form-control" ng-model="logistics.companyName" placeholder="请输入物流公司" autocomplete="off" typeahead="log.companyName as log.companyName for log in logisticsInfo | filter:$viewValue | limitTo : 10" typeahead-on-select="onAssociateKindClick($item)" typeahead-min-length="0" />&ndash;&gt;-->
+                            <!--<input id="addr" type="text" class="form-control" ng-change="textChange()" ng-blur="onBlur()" ng-focus="getFocus()" ng-keydown="onKeyup()" ng-model="logistics.companyName"  placeholder="请输入物流公司" autocomplete="off" style="vertical-align: middle;width:170px; margin-top: -2px;" maxlength="15">-->
+                            <!--<em name="companyName" ng-click="changeShowLogistics()" class="btn-position"><i class="fa fa-caret-down" aria-hidden="true"></i></em>-->
+                            <!--<ul id="ulContent" ng-if="showCompanyName && matchData" class="dropdown-menu">-->
+                                <!--<li ng-click="showText(companyName)" ng-repeat="companyName in resultList" ng-class="{'active': $index==selectIndex}" ng-bind="companyName"></li>-->
+                            <!--</ul>-->
+                        <!--</span>-->
+
+                        <!--<span style="margin-right: 20px; width: 160px;">-->
+                            <!--<form name="myForm">-->
+                                <!--<input name="number" type="text" class="form-control" ng-model="logistics.number" placeholder="请输入物流单号" style="margin-top: 13px;" ng-pattern="/^[A-Za-z0-9]+$/" maxlength="20"/>-->
+                                <!--&lt;!&ndash;<span ng-show="myForm.number.$invalid && myForm.number.$dirty">请输入正确的</span>&ndash;&gt;-->
+                            <!--</form>-->
+                            <!--&lt;!&ndash;<input type="text" class="form-control" ng-model="logistics.number" placeholder="请输入物流单号" style="margin-top: 13px;" ng-pattern="/^[A-Za-z0-9]+$/"/>&ndash;&gt;-->
+                        <!--</span>-->
+                        <!--<em ng-if="showTip" style="color: #b0b0b0; font-size: 12px;"><i class="fa fa-info-circle"></i>系统无法提供此物流信息,请根据物流单号到相应的官网查询。</em>-->
+                        <!--&lt;!&ndash;<span style="width: 22%"><em>¥20.00</em></span>&ndash;&gt;-->
+                    <!--</dd>-->
+                    <!--<dd class="price">-->
+                        <!--<span style="width: 90%;">总计:<i ng-bind="checkinvoice.ensurePrice  | formateNumber : 2 | currencySysmbol : checkinvoice.currencyName"></i></span>-->
+                    <!--</dd>-->
+                    <!--<dd class="pay_price">-->
+                        <!--<p>-->
+                            <!--<div ng-if="checkinvoice.status==406">-->
+                                <!--<a href="javascript:void(0)" ng-click="saveCheck()" class="confirm">确认</a>-->
+                                <!--<a href="vendor#/order/center" class="cancel">取消</a>-->
+                            <!--</div>-->
+                            <!--<div ng-if="checkinvoice.status==404">-->
+                                <!--<a href="javascript:void(0)" ng-click="upateLogistic(checkinvoice)" class="confirm">确认</a>-->
+                                <!--<a href="vendor#/order/center" class="cancel">取消</a>-->
+                            <!--</div>-->
+                        <!--</p>-->
+                    <!--</dd>-->
+                <!--</dl>-->
+            <!--</div>-->
         </div>
     </div>
 </div>

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

@@ -0,0 +1,767 @@
+<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;
+		display: inline-block;
+		width: 63px;
+		text-align: right;
+	}
+	.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;
+	}
+	.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 span{
+		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;
+		width: auto;
+	}
+	.rule-main .rule-content .area-content span 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 span i{
+		color: #cddcfb;
+		margin-left: 3px;
+		font-size: 16px;
+		background: #fff;
+		height: 10px;
+		position: relative;
+		border-radius: 100%;
+	}
+	.rule-main .rule-content .area-content span i:before{
+		position: relative;
+		top: -1px;
+	}
+	.rule-main .rule-content .area-content span:hover{
+		background: #8eb0f5;
+		cursor: pointer;
+	}
+	.rule-main .rule-content .area-content span:hover em{
+		color: #fff;
+	}
+	.rule-main .rule-content .area-content span: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;
+	}
+	.add-box span{
+		margin: 0 1px;
+		position: relative;
+		top: 1px;
+		border: none;
+	}
+	.add-box span i{
+		font-size: 16px;
+	}
+	.add-box .reduce{
+		color: #ff8522;
+	}
+	.add-box span:hover{
+		cursor: pointer;
+	}
+	.add-box .add{
+		color: #32b500;
+	}
+
+	/*选择地区*/
+	.choose-box{
+		width: 320px;
+		height: 438px;
+		box-shadow: 2px 5px 8px #dee0e2;
+		position: absolute;
+		top: 120%;
+		left: 487px;
+		background: #fff;
+		z-index: 10000;
+		border: #e6eefe 1px solid;
+		border-radius: 5px;
+	}
+	.choose-box:after{
+		content: "";
+		width: 15px;
+		height: 15px;
+		display: inline-block;
+		background: #fff;
+		transform: rotate(-45deg);
+		position: absolute;
+		top: -8px;
+		left: 142px;
+		z-index: 1;
+		border: #e6eefe 1px solid;
+		border-bottom: none;
+		border-left: none;
+	}
+	.choose-box .tree{
+		width: 290px;
+		max-height: 364px;
+		overflow-y: auto;
+		margin: 0 auto;
+		border: #e8e9ea 1px solid;
+		padding-top: 15px;
+		margin-top: 16px;
+	}
+	.choose-box .tree li {
+		cursor: pointer;
+		padding-left: 1.3em;
+		width: 100%;
+		float: left;
+	}
+
+	.choose-box .tree ul {
+		list-style: none;
+		padding-left: 0;
+	}
+
+	.choose-box .intermediate {
+		opacity: 0.3;
+	}
+	.choose-box .tree ul i{
+		float: left;
+		font-size: 18px;
+		position: relative;
+		top: 3px;
+		right: 0;
+		color: #ff8522;
+	}
+	.choose-box .tree ul i.fa-fw{
+		width: 1em;
+	}
+
+	.choose-box .tree ul div.check-1{
+		float: right;
+	}
+	.choose-box .tree ul li span{
+		color: #666;
+		line-height: 24px !important;
+		margin-right: 3px !important;
+	}
+	.choose-box .tree ul li em{
+		color: #999;
+		font-size: 12px;
+		position: relative;
+		top: -2px;
+		left: 2px;
+	}
+	.rule-main .rule-content .row .choose-box .tree ul li span{
+		width: auto;
+	}
+	.choose-box .hidden {
+		display: none;
+	}
+	.choose-box .check-1 input{
+		/*display: none;*/
+	}
+	.rule-main .rule-content .row .choose-box label{
+		margin-right: 12px;
+	}
+</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 style="width: 70px;">优先级排序</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-blur="checkRuleName()" 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" style="position: relative;">
+					<span>适用地区</span>
+					<div class="area-content">
+						<!--<span ng-repeat="data in tree.getChecked()">{{data.province}}{{data.city}}{{data.area}}</span>-->
+						<!--<span ng-repeat="data in tree.addressArray">{{data.province}}{{data.city}}{{data.area}}</span>-->
+						<span ng-repeat="data in mapArray" ng-click="deleteMapItem($index)">
+							<em ng-if="data.province">{{data.province}}</em>
+							<em ng-if="data.city">/{{data.city}}</em>
+							<em ng-if="data.area">/{{data.area}}</em>
+							<i class="fa fa-minus-circle"></i>
+						</span>
+					</div>
+					<button ng-click="chooseAddress()">选择地区</button>
+					<!--选择地区 begin-->
+					<div class="choose-box" ng-show="chooseBox">
+						<div>
+							<div class="tree">
+								<ul>
+									<li ng-repeat="address in tree.$data">
+										<div>
+											<i class="fa fa-fw" ng-class="address.folded?'fa-caret-right':'fa-caret-down'" ng-click="tree.toggleFold(address)"></i>
+											<span ng-bind="::address.label" ng-click="tree.toggleFold(address)"></span><em ng-if="address.selectedNum!=0 && address.selectedNum!=address.items.length">({{address.selectedNum}})</em>
+											<div class="check-1">
+												<label class="check-act" ng-class="{'intermediate': tree.isSemiChecked(address)}">
+													<input type="checkbox" ng-model="address.checked" ng-change="tree.check(address)"  id="{{address.label}}">
+													<label for="{{address.label}}"></label>
+												</label>
+											</div>
+										</div>
+										<ul ng-hide="address.folded">
+											<li ng-repeat="city in address.items">
+												<div>
+													<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">({{city.selectedNum}})</em>
+													<div class="check-1">
+														<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>
+													</div>
+												</div>
+												<ul ng-hide="city.folded">
+													<li ng-repeat="area in city.items">
+															<label style="width: 100%;">
+																<span ng-bind="::area.label"></span>
+																	<div class="check-1">
+																	<label class="check-act">
+																		<input type="checkbox" ng-model="area.checked" ng-change="tree.check(area)" id="{{area.label}}">
+																		<label for="{{area.label}}"></label>
+																	</label>
+																</div>
+															</label>
+													</li>
+												</ul>
+											</li>
+										</ul>
+									</li>
+								</ul>
+							</div>
+							<div class="deal-btn">
+								<a ng-click="cancel()" class="off">取消</a>
+								<a ng-click="showSelectedData()" class="ok">确认</a>
+							</div>
+						</div>
+					</div>
+					<!--<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-blur="inputUniform()" 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 in fareArray" ng-class="{'dot' : $index==0}">
+						<span>总金额在</span>
+						<div class="price-input" ng-if="$index == 0">
+							<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+							<i class="currency" ng-if="rule.currencyName=='USD'">$</i>
+							<input type="text" class="form-control" ng-blur="inputQtyFare(data, $index)" placeholder="0" ng-model="data.end" />
+							以下,
+						</div>
+						<div class="price-input" ng-if="$index != 0 && $index != fareArray.length - 1">
+							<em>
+								<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+								<i class="currency" ng-if="rule.currencyName=='USD'">$</i>
+								<i ng-bind="fareArray[$index-1].end"></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" ng-blur="inputQtyFare(data, $index)" ng-model="data.end" placeholder="100" />
+							<em>以下,</em>
+						</div>
+						<div class="price-input" ng-if="$index == fareArray.length - 1">
+							<em>
+								<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+								<i class="currency" ng-if="rule.currencyName=='USD'">$</i>
+								<i ng-bind="fareArray[$index-1].end"></i>以上,
+							</em>
+						</div>
+						<div class="price-input">
+							<em>运费为</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" ng-blur="inputFare(data)" ng-model="data.fare" placeholder="0" />
+						</div>
+						<div class="add-box">
+							<span class="add" ng-if="$index == fareArray.length - 1 && fareArray.length < 5" ng-click="addQtyFare(data)"><i class="fa fa-plus-circle"></i></span>
+							<span class="reduce" ng-if="$index != 0 && $index != fareArray.length - 1" ng-click="deleteQtyFare($index)"><i class="fa fa-minus-circle"></i></span>
+						</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">
+							<div ng-repeat="data in fareArray">
+								<p ng-if="$index == 0">
+									总价在
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.end}}以下,
+									运费为
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.fare}}
+								</p>
+								<p ng-if="$index != 0 && $index != fareArray.length - 1">
+									总价在
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.start}}以上(含
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.start}}
+									),
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.end}}以下,
+									运费为
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.fare}}
+								</p>
+								<p ng-if="$index == fareArray.length-1">
+									总价在
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.start}}以上(含
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.start}}
+									),运费为
+									<i class="currency" ng-if="rule.currencyName=='RMB'">¥</i>
+									<i class="currency" ng-if="rule.currencyName=='USD'">$</i>{{data.fare}}
+								</p>
+							</div>
+						</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>

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

@@ -1,22 +1,1088 @@
 <style>
-	.count .count01 {
+	.delivery-list{
+		width: 1026px;
+		background: #fff;
+		display: inline-block;
+	}
+	.delivery-list .content-header{
+		padding-top: 25px;
+		overflow: hidden;
+	}
+	.delivery-list .content-header span{
+		padding-left: 23px;
+		font-size: 14px;
+		color: #333;
+	}
+	.delivery-list .content-header a{
+		float: right;
+		margin-right: 50px;
+		color: #333;
+		font-size: 14px;
+	}
+	.delivery-list .content-header i{
+		color: #32b500;
+		font-size: 16px;
+		position: relative;
+		top: 1px;
+	}
+	.delivery-list .content-body {
+		width: 1000px;
+		margin: 0 auto;
+		text-align: center;
+	}
+	.delivery-list .content-body table{
+		box-sizing: border-box;
+		margin-top: 15px;
+		margin-bottom: 0;
+	}
+	.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;
+	}
+	.ng-table-pager{
+		margin-right: 0 !important;
+	}
 </style>
 <!--右侧主体部分-->
 <div class="count user_right fr">
 	<div class="count_center">
-		<div class="com_tab">
+		<div class="com_tab" ng-class="{'rule-act': tab=='editRule'}" 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=='deliverRule'}"><a ng-click="toggleTab('deliverRule')" 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" ng-if="editFrame">
+                <span ng-class="{'active': tab=='editRule'}">
+                    <a ng-click="toggleTab('editRule')">
+						<em ng-if="!isModify">新增</em><em ng-if="isModify">修改</em>配送规则
+					</a>
+					<!--<a ng-if="isModify" ng-click="toggleTab('editRule')">修改配送规则</a>-->
+                    <i class="fa fa-remove" ng-click="cancelEdit()"></i>
+                </span>
+			</div>
+		</div>
+		<!--配送规则列表-->
+		<div class="delivery-list" ng-if="tab=='deliverRule'">
+			<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="deliveryMethod[rule.shippingMethod]">第三方配送</td>
+						<td ng-bind="rule.ruleName">深圳市内满100元包邮,不满1000元邮费20元不满1000元</td>
+						<td>
+							<p class="switch">
+								<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.id, 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="showDeleteFrame(rule)">删除</a>
+						</td>
+					</tr>
+
+					<tr class="record-num" ng-if="$data">
+						<td colspan="5">
+							<span class="count-tip">显示 1-10 条,共 <em ng-bind="$data.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>
-			<h1>配送规则界面{{title}}</h1>
+		<!--新增修改配送规则-->
+		<div class="rule-main" ng-if="tab=='editRule'">
+			<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="modifyRule.shippingMethod">
+						<option value="">请选择配送方式</option>
+						<option value="1301">第三方配送</option>
+						<option value="1302">卖家配送</option>
+						<option value="1303">上门自提</option>
+					</select>
+					<span style="width: 70px;">优先级排序</span>
+					<input type="text" class="form-control sort" ng-model="modifyRule.num" ng-blur="inputNum(modifyRule)">
+					<span><strong>*</strong>规则名称</span>
+					<input type="text" class="form-control rule" style="text-align: left;" ng-blur="checkRuleNameSize()" ng-model="modifyRule.ruleName" placeholder="会在购物车中显示">
+				</div>
+				<div class="row radio-1">
+					<span>是否生效</span>
+					<label class="check-act">
+						<input type="radio" id="effect" name="radio" ng-model="isActive" ng-click="exchangeActive(true)" ng-checked="isActive">
+						<label for="effect"></label>
+						生效
+					</label>
+					<label class="check-act">
+						<input type="radio" id="no-effect" name="radio" ng-model="isActive" ng-click="exchangeActive(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="modifyRule.userType">-->
+						<!--<option value="1301">所有用户</option>-->
+					<!--</select>-->
+				<!--</div>-->
+				<div class="row" style="position: relative;">
+					<span><strong>*</strong>适用地区</span>
+					<div class="area-content" ng-if="mapArray.length >0" style="max-height: 123px; overflow-y: auto;">
+						<span ng-repeat="data in mapArray">
+							<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>
+							<i class="fa fa-minus-circle" ng-click="deleteMapItem($index)"></i>
+						</span>
+					</div>
+					<button ng-click="chooseAddress()">选择地区</button>
+					<!--选择地区 begin-->
+					<div class="choose-box" ng-if="chooseBox">
+						<div>
+							<div class="tree">
+								<ul>
+									<li ng-repeat="mainland in tree.$data">
+										<div>
+											<i class="fa fa-fw" ng-class="mainland.folded?'fa-caret-right':'fa-caret-down'" ng-click="tree.toggleFold(mainland)"></i>
+											<span ng-bind="::mainland.label" ng-click="tree.toggleFold(mainland)"></span><em ng-if="mainland.selectedNum!=0 && mainland.selectedNum!=mainland.items.length">({{mainland.selectedNum}})</em>
+											<div class="check-1">
+												<label class="check-act" ng-class="{'intermediate': tree.isSemiChecked(mainland)}">
+													<input type="checkbox" ng-model="mainland.checked" ng-change="tree.check(mainland)"  id="{{mainland.label}}">
+													<label for="{{mainland.label}}"></label>
+												</label>
+											</div>
+										</div>
+										<ul ng-if="!mainland.folded">
+											<li ng-repeat="address in mainland.items">
+												<div>
+													<i ng-if="address.items" class="fa fa-fw" ng-class="address.folded?'fa-caret-right':'fa-caret-down'" ng-click="tree.toggleFold(address)"></i>
+													<span ng-bind="::address.label" ng-click="tree.toggleFold(address)"></span><em ng-if="address.selectedNum!=0 && address.selectedNum!=address.items.length">({{address.selectedNum}})</em>
+													<div class="check-1">
+														<label class="check-act" ng-class="{'intermediate': tree.isSemiChecked(address)}" >
+															<input type="checkbox" ng-model="address.checked" ng-change="tree.check(address)" id="{{address.label}}">
+															<label for="{{address.label}}"></label>
+														</label>
+													</div>
+												</div>
+												<ul ng-if="!address.folded">
+													<li ng-repeat="city in address.items">
+														<div style="width: 100%;">
+															<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" 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>
+															</div>
+														</div>
+														<ul ng-if="!city.folded">
+															<li ng-repeat="area in city.items">
+																<label style="width: 100%;">
+																	<span ng-bind="::area.label"></span>
+																	<div class="check-1">
+																		<label class="check-act">
+																			<input type="checkbox" ng-model="area.checked" ng-change="tree.check(area)" id="{{area.label}}">
+																			<label for="{{area.label}}"></label>
+																		</label>
+																	</div>
+																</label>
+															</li>
+														</ul>
+													</li>
+												</ul>
+											</li>
+										</ul>
+									</li>
+								</ul>
+							</div>
+							<div class="deal-btn">
+								<a ng-click="cancel()" class="off">取消</a>
+								<a ng-click="showSelectedData()" class="ok">确认</a>
+							</div>
+						</div>
+					</div>
+					<!--<i class="notes" ng-if="mapArray.length == 0">&nbsp;&nbsp;默认对全部地区生效</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="modifyRule.fareType==1"/>
+						<label for="style01"></label>
+						统一规定运费
+					</label>
+					<label class="check-act" ng-click="checkTab(2)">
+						<input type="radio" id="style02" name="radio2" ng-checked="modifyRule.fareType==2"/>
+						<label for="style02"></label>
+						按总金额计算
+					</label>
+				</div>
+				<!--统一规定运费-->
+				<div class="style-regulations common-style" ng-if="modifyRule.fareType==1">
+					<div class="row dot" style="padding-bottom: 10px;">
+						<span>统一运费</span>
+						<div class="price-input">
+							<i class="currency" ng-bind="currencySymbol"></i>
+							<input type="text" class="form-control" placeholder="请输入运费" ng-blur="inputUniform()" ng-model="modifyRule.uniformPrice" />
+						</div>
+					</div>
+					<div class="row" style="background: none; padding: 0;">
+						<span class="f14" style="margin-right: 10px;">计算说明</span>
+						<!--&lt;!&ndash;可编辑&ndash;&gt;-->
+						<!--<div class="edit" style="margin-top: 6px;">-->
+						<!--<textarea class="form-control" placeholder="全国统一运费 $20"></textarea>-->
+						<!--<div class="prompt"><strong>*</strong>公式说明内容将会在购物车中显示,可自行修改</div>-->
+						<!--</div>-->
+						<!--不可以编辑的状态-->
+						<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: 133px; white-space: nowrap;"></div>
+						</div>
+					</div>
+				</div>
+				<style>
+					.rule-main .rule-content .common-style .hr01{
+						float: left;
+						width: 14px;
+						text-align: center;
+						color: #666;
+					}
+					.rule-main .rule-content .common-style .price-input input.none{
+						background: #dad8d8;
+					}
+					.rule-main .rule-content .common-style .price-input input.none:hover{
+						cursor: not-allowed;
+					}
+					.add-box{
+						margin-right: 412px;
+						float: right;
+					}
+				</style>
+				<!--按总金额计算-->
+				<div class="style-price common-style" ng-if="modifyRule.fareType==2">
+					<div class="row" ng-repeat="data in fareArray" ng-class="{'dot' : $index==0,'active': $index == fareArray.length - 1}">
+						<span style="margin-right: 7px;">总金额在</span>
+						<div class="price-input" ng-if="$index == 0">
+							<i class="currency" ng-bind="currencySymbol"></i>
+							<span ng-bind="data.start"></span>
+							<!--<input type="text" class="form-control none" ng-model="data.start" disabled/>-->
+						</div>
+						<div class="price-input" ng-if="$index != 0 && $index != fareArray.length - 1">
+							<i class="currency" ng-bind="currencySymbol"></i>
+							<span ng-bind="fareArray[$index-1].end"></span>
+							<!--<input type="text" class="form-control none" ng-model="data.start" disabled/>-->
+						</div>
+						<div class="hr01" ng-if="$index != fareArray.length - 1">&#150;</div>
+						<div class="price-input" ng-if="$index != fareArray.length - 1">
+							<i class="currency" ng-bind="currencySymbol"></i>
+							<input type="text" class="form-control" placeholder="请输入金额" ng-blur="inputQtyFare(data, $index)" ng-model="data.end" />
+						</div>
+						<div class="price-input" ng-if="$index == fareArray.length - 1">
+							<i class="currency" ng-bind="currencySymbol"></i>
+							<span ng-bind="fareArray[$index-1].end"></span>
+							<!--<input type="text" class="form-control none" ng-model="fareArray[$index-1].end" disabled/>-->
+							&nbsp;&nbsp;&nbsp;以上
+						</div>
+						<div class="price-input">
+							<em>,运费为</em>
+							<i class="currency" ng-bind="currencySymbol"></i>
+							<input type="text" class="form-control" placeholder="请输入运费" ng-blur="inputFare(data)" ng-model="data.fare" />
+						</div>
+						<div class="add-box">
+							<span class="add" ng-if="$index == fareArray.length - 1 && fareArray.length < 5" ng-click="addQtyFare(data)"><i class="fa fa-plus-circle"></i></span>
+							<span class="reduce" ng-if="$index != 0 && $index != fareArray.length - 1" ng-click="deleteQtyFare($index)"><i class="fa fa-minus-circle"></i></span>
+						</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" style="margin-right: 10px;">计算说明</span>
+						<div class="no-edit" style="margin-top: 6px;">
+							<div ng-repeat="data in fareArray">
+								<p ng-if="$index == 0">
+									总金额在
+									<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>
+									<i class="input-text" ng-bind="data.fare"></i>
+								</p>
+								<p ng-if="$index != 0 && $index != fareArray.length - 1">
+									总金额在
+									<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>(含
+									<i class="currency" ng-bind="currencySymbol">¥</i>{{data.start}}),
+									运费为
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									<i class="input-text" ng-bind="data.fare"></i>
+								</p>
+								<p ng-if="$index == fareArray.length-1">
+									总金额在
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									<i class="input-text">{{data.start}}</i>(含
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									{{data.start}})以上,运费为
+									<i class="currency" ng-bind="currencySymbol">¥</i>
+									<i class="input-text" ng-bind="data.fare"></i>
+								</p>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+			<!--操作取消保存-->
+			<div class="deal-btn">
+				<a ng-click="saveDistributionRule(false)" ng-if="isModify" class="save-other">另存为新规则</a>
+				<a ng-click="cancelEdit()" class="off">取消</a>
+				<a ng-click="saveDistributionRule(true)" class="ok">保存</a>
+			</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>
+<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;
+		display: inline-block;
+		width: 63px;
+		text-align: right;
+	}
+	.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;
+	}
+	.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: 0 8px;
+		padding-top: 10px;
+		background: #e8e7e7;
+		/*min-height: 40px;*/
+		font-size: 12px;
+	}
+	.rule-main .rule-content .common-style .row.active{
+		padding-bottom: 10px;
+	}
+	.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 span{
+		border-radius: 0;
+		height: 26px;
+		line-height: 26px;
+		border: #d4d4d4 1px solid;
+		background: #dad8d8;
+		display: inline-block;
+		width: 80px;
+		text-align: center;
+		overflow: hidden;
+		margin-right: 0;
+	}
+	.rule-main .rule-content .common-style .price-input em{
+		float: left;
+		margin: 0 7px 0 0;
+	}
+	.rule-main .rule-content .common-style .price-input em i{
+		margin-right: 20px;
+		display: inline-block;
+		max-width: 60px;
+		float: left;
+		overflow: hidden;
+	}
+	.rule-main .rule-content .common-style.style-price .row .no-edit p i.input-text{
+		display: inline-block;
+		max-width: 60px;
+		height: 15px;
+		overflow: hidden;
+		position: relative;
+		top: 1px;
+		margin-right: 5px;
+	}
+	.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;
+		margin-right: -1px;
+		/*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: 0 !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 span{
+		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;
+		width: auto;
+	}
+	.rule-main .rule-content .area-content span 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 span i{
+		color: #cddcfb;
+		margin-left: 3px;
+		font-size: 16px;
+		background: #fff;
+		height: 10px;
+		position: relative;
+		border-radius: 100%;
+	}
+	.rule-main .rule-content .area-content span i:before{
+		position: relative;
+		top: -1px;
+	}
+	.rule-main .rule-content .area-content span:hover{
+		background: #8eb0f5;
+		cursor: pointer;
+	}
+	.rule-main .rule-content .area-content span:hover em{
+		color: #fff;
+	}
+	.rule-main .rule-content .area-content span: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: 20px;
+		height: 20px;
+	}
+	.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;
+	}
+	.add-box span{
+		margin: 0 1px;
+		position: relative;
+		top: 1px;
+		border: none;
+	}
+	.add-box span i{
+		font-size: 16px;
+	}
+	.add-box .reduce{
+		color: #ff8522;
+	}
+	.add-box span:hover{
+		cursor: pointer;
+	}
+	.add-box .add{
+		color: #32b500;
+	}
+
+	/*选择地区*/
+	.choose-box{
+		width: 320px;
+		height: 438px;
+		box-shadow: 2px 5px 8px #dee0e2;
+		position: absolute;
+		top: 115%;
+		left: 487px;
+		background: #fff;
+		z-index: 10000;
+		border: #e6eefe 1px solid;
+		border-radius: 5px;
+	}
+	.choose-box:after{
+		content: "";
+		width: 15px;
+		height: 15px;
+		display: inline-block;
+		background: #fff;
+		transform: rotate(-45deg);
+		position: absolute;
+		top: -8px;
+		left: 142px;
+		z-index: 1;
+		border: #e6eefe 1px solid;
+		border-bottom: none;
+		border-left: none;
+	}
+	.choose-box .tree{
+		width: 290px;
+		height: 364px;
+		overflow-y: auto;
+		margin: 0 auto;
+		border: #e8e9ea 1px solid;
+		padding-top: 15px;
+		margin-top: 16px;
+	}
+	.choose-box .tree li {
+		cursor: pointer;
+		padding-left: 1.3em;
+		width: 100%;
+		float: left;
+	}
+	.choose-box .tree li li li{
+		padding-left: 2.75em;
+	}
+	.choose-box .tree ul {
+		list-style: none;
+		padding-left: 0;
+	}
+
+	.choose-box .intermediate {
+		opacity: 0.3;
+	}
+	.choose-box .tree ul i{
+		float: left;
+		font-size: 18px;
+		position: relative;
+		top: 3px;
+		right: 0;
+		color: #ff8522;
+	}
+	.choose-box .tree ul i.fa-fw{
+		width: 1em;
+	}
+
+	.choose-box .tree ul div.check-1{
+		float: right;
+	}
+	.choose-box .tree ul li span{
+		color: #666;
+		line-height: 24px !important;
+		margin-right: 3px !important;
+	}
+	.choose-box .tree ul li em{
+		color: #999;
+		font-size: 12px;
+		position: relative;
+		top: -2px;
+		left: 2px;
+	}
+	.rule-main .rule-content .row .choose-box .tree ul li span{
+		width: auto;
+	}
+	.choose-box .hidden {
+		display: none;
+	}
+	.choose-box .check-1 input{
+		/*display: none;*/
+	}
+	.rule-main .rule-content .row .choose-box label{
+		margin-right: 12px;
+	}
+	.rule-main .rule-content .common-style .row .add-box span{
+		width: auto;
+	}
+</style>

+ 20 - 18
src/main/webapp/resources/view/vendor/forstore/vendor_distributor.html

@@ -71,52 +71,53 @@
 	.distributor-content {
 		width: 100%;
 		margin: 0 auto;
-		height: 489px;
+		min-height: 489px;
 		background: #fff;
 		padding-top: 25px;
 	}
 	.title-wrap{
-		height: 40px;
+		width: 100%;
+		margin: 0 auto;
+		margin-bottom: 15px;
 	}
 	.content-title{
-		width: 100px;
-		height: 40px;
 		text-align: center;
 		float: left;
-		margin-left: 25px;
+		margin-left: 23px;
 		font-size: 14px;
 	}
 	.add-btn{
 		width: 100px;
-		height: 40px;
 		text-align: center;
 		float: right;
-		margin-right: 25px;
-		font-size: 13px;
+		margin-right: 50px;
+		font-size: 14px;
 	}
 	.add-btn i{
-		background: white;
-		color: green;
-		margin-right: 5px;
+		color: #32b500;
+		font-size: 16px;
+		position: relative;
+		top: 1px;
 	}
 	.add-btn:hover{
 		cursor: pointer;
 	}
 	.send-list{
-		margin-left: 20px;
-		margin-right: 20px;
+		width: 1000px;
+		margin: 0 auto;
+		display: inline-block;
+		margin: 15px 0 0 13px;
+        padding-bottom: 20px;
 	}
 	.send-item{
 		display: inline-block;
-		width: 137px;
+		width: 14.28%;
 		height: 40px;
-		text-align: center;
 		vertical-align: middle;
 		font-size: 14px;
 		background: #f0f6ff;
 		margin-bottom: 2px;
 		padding-top: 10px;
-		float: left;
 	}
 	.send-item:hover {
 		cursor: pointer;
@@ -126,7 +127,8 @@
 		color: #fff;
 	}
 	.send-item span {
-		max-width: 100px;
+		width: 100px;
+		text-align: center;
 		text-overflow: ellipsis;
 		display: inline-block;
 		overflow: hidden;
@@ -160,7 +162,7 @@
 		<div class="distributor-content">
 			<div class="title-wrap">
 				<span class="content-title">我的配送商</span>
-				<span class="add-btn"  ng-click="addDistributor()"><i class="fa fa-plus-circle"></i>   新增配送商</span>
+				<span class="add-btn"  ng-click="addDistributor()"><i class="fa fa-plus-circle"></i>&nbsp;设置配送商</span>
 			</div>
 			<ul class="send-list">
 				<li ng-repeat="data in data_list track by $index" class="send-item" ng-mouseenter="hover_distributor($index)" ng-mouseleave="leave_distributor($index)">

+ 14 - 5
src/main/webapp/resources/view/vendor/forstore/vendor_logistics.html

@@ -2,22 +2,31 @@
 	.count .count01 {
 		display: block;
 	}
+	.logistic-content .menu-title{
+		font-size: 14px;
+	}
+	.logistic-content .add-log button i{
+		margin: 0;
+		font-size: 16px;
+		position: relative;
+		top: 1px;
+	}
 </style>
 <!--右侧主体部分-->
 <div class="count user_right fr">
 	<div class="count_center">
 		<div class="com_tab">
 			<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=='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 class="logistic-content" ng-if="tab=='logistic'">
 			<div class="menu-title row">现有发货地址<span>&nbsp;已保存<em>{{total}}</em>条,还能新增<em>{{canAddTotal-total}}</em>条地址</span></div>
-			<div class="add-log row" ng-if="total < canAddTotal"><button ng-click="editShippingAddress()"><i class="fa fa-plus-square"></i>新增发货地址</button></div>
+			<div class="add-log row" ng-if="total < canAddTotal"><button ng-click="editShippingAddress()"><i class="fa fa-plus-circle"></i>&nbsp;新增发货地址</button></div>
 			<div class="log-tab">
 				<table class="table">
 					<thead>
@@ -31,7 +40,7 @@
 					</thead>
 					<tbody>
 					<tr ng-repeat="address in addressList">
-						<td class="text-left">{{address.name}}</td>
+						<td class="text-left" title="{{address.name}}">{{address.name}}</td>
 						<td class="text-left">
 							<div>{{address.province}}&nbsp;{{address.city}}&nbsp;{{address.district}}</div>
 							<div>{{address.detailAddress}}</div>

+ 147 - 3
src/main/webapp/resources/view/vendor/forstore/vendor_order.html

@@ -168,6 +168,10 @@
 	}
 
 	.sellOder .oder_list .buyer-contact .contact-title a, .sellOder .oder_list .buyer-contact .contact-title a:hover {
+        color: white !important;
+    }
+
+	.oder .oder_list dl dd.line01 .buyer-contact .contact-title a i, .oder .oder_list dl dd.line01 .buyer-contact .contact-title a i:hover {
 		color: white !important;
 	}
 
@@ -611,6 +615,121 @@
 	.conuter-box .content p{
 		line-height: 20px;
 	}
+
+
+	.edit-logistic-box{
+		position: absolute;
+		width: 295px;
+		height: 184px;
+		box-shadow: 1px 1px 2px #ccc;
+		background: #fff;
+		right: 200px;
+		top: 30px;
+		border: #E8E8E8 1px solid;
+	}
+	.edit-logistic-box .title{
+		width: 100%;
+		height: 10px;
+		line-height: 25px;
+		position: relative;
+	}
+	.edit-logistic-box .title a{
+		position: absolute;
+		top: -3px;
+		right: 3px;
+		float: right;
+		color: #999 !important;
+		font-size: 16px !important;
+		text-decoration: none !important;
+	}
+	.edit-logistic-box .content{
+		width: 100%;
+		margin: 0 auto;
+		margin: 0 18px;
+	}
+	.edit-logistic-box .content .row{
+		line-height: 30px;
+		font-size: 14px;
+		text-align: left;
+		margin: 0;
+		margin-bottom: 14px;
+	}
+	.edit-logistic-box .content .row em{
+		display: inline-block;
+		width: 178px;
+		height: 30px;
+		position: absolute;
+		margin-left: 15px;
+	}
+	.edit-logistic-box .content .row em.btn-position{
+		position: absolute;
+		top: 1px;
+		right: 0px;
+		height: 30px;
+		width: 20px;
+		text-align: center;
+		display: inline-block;
+		font-size: 24px;
+		color: #fff;
+		background: #5078cb;
+		cursor: pointer;
+		border-bottom-right-radius: 3px;
+		border-top-right-radius: 3px;
+	}
+	.edit-logistic-box .content .row em input{
+		display: inline-block;
+		height: 30px;
+	}
+	.edit-logistic-box .edit-deal a{
+		width: 70px;
+		height: 30px;
+		display: inline-block;
+		text-align: center;
+		line-height: 30px;
+		font-size: 14px;
+		text-decoration: none !important;
+	}
+	.edit-logistic-box .edit-deal a.off{
+		background: #cdcccc;
+		color: #666;
+		margin-right: 8px;
+	}
+	.edit-logistic-box .edit-deal a.ok{
+		background: #5078cb;
+		color: #fff;
+	}
+	.edit-logistic-box .edit-deal a:hover{
+		background: #337ab7;
+		color: #fff !important;
+	}
+
+	/*选择物流*/
+	.edit-logistic-box .dropdown-menu{
+		top: 95%;
+		line-height: 23px;
+		max-height: 240px;
+		overflow-y: auto;
+		width: 190px;
+		overflow-x: hidden;
+		border-radius: 0;
+		width: 179px;
+		z-index: 10;
+	}
+	.edit-logistic-box .dropdown-menu.active{
+		display: inline-block;
+	}
+	.edit-logistic-box .dropdown-menu li{
+		font-size: 14px;
+		cursor: pointer;
+		padding-left: 13px;
+	}
+	.edit-logistic-box .dropdown-menu li:hover{
+		background: #5078cb;
+		color: #fff;
+	}
+	.form-control[readonly]{
+		background-color: #ffffff;
+	}
 </style>
 <div class="user_right fr">
 	<!--订单中心-->
@@ -725,7 +844,7 @@
 							<a ng-click="setChildStatus('','订单状态')">订单状态</a>
 							<a ng-if="status == 'tobeconfirmed' || status == 'all'" ng-click="setChildStatus('501','待买家付款')" title="">待买家付款</a>
 							<a ng-if="status == 'tobeconfirmed' || status == 'all'" ng-click="setChildStatus('504','付款确认中')" title="">付款确认中</a>
-							<a ng-if=" status == 'all'" ng-click="setChildStatus('502-406','待发货')" title="">待发货</a>
+							<a ng-if=" status == 'comfirmed' || status == 'all'" ng-click="setChildStatus('502-406','待发货')" title="">待发货</a>
 							<a ng-if="status == 'inbound' || status == 'all' || status == 'toBeReviewed'" ng-click="setChildStatus('404','待买家收货')" title="">待买家收货</a>
 							<a ng-if="status == 'tobepaid' || status == 'all' || status == 'toBeReviewed'" ng-click="setChildStatus('514','待商城付款')" title="">待商城付款</a>
 							<a ng-if="status == 'completed' || status == 'tobepaid' || status == 'all'" ng-click="setChildStatus('520','交易完成')" title="">交易完成</a>
@@ -811,11 +930,12 @@
                                 <a class="oder_d action-link" href="vendor#/logistics/query/{{purchase.purchaseid | EncryptionFilter}}" ng-if="purchase.status == 404 || purchase.status == 520 || purchase.status == 405 || purchase.status == 503 || purchase.status == 514" target="_blank">查看物流</a>
                             </div>
                         </span>
-						<span class="click_shop">
+						<span class="click_shop" style="position: relative">
                             <div ng-if="$index == 0">
                                 <a class="order-operation" href="javascript:void(0)" ng-if="(purchase.status == 502 || purchase.status == 406)&&(purchase.uasPurcid == null)" ng-click="toBeShiped(purchase)">点击发货</a>
 								<a ng-if="purchase.uasPurcid" style="text-decoration: none;color: #323232;">来源UAS</a>
-                                <a class="order-operation" href="javascript:void(0)" ng-if="purchase.status == 404 && purchase.lgtId&&!purchase.uasPurcid" ng-click="toBeShiped(purchase)" style="position: relative;">修改物流</a>
+                                <!--<a class="order-operation" href="javascript:void(0)" ng-if="purchase.status == 404 && purchase.lgtId&&!purchase.uasPurcid" ng-click="toBeShiped(purchase)" style="position: relative;">修改物流</a>-->
+								<a class="order-operation" href="javascript:void(0)" ng-if="purchase.status == 404&&!purchase.uasPurcid" ng-click="modifyLogistic(purchase)" style="position: relative;">修改物流</a>
                                 <div class="seller-ship-tip" ng-if="purchase.status == 404 && purchase.lgtId &&!purchase.uasPurcid" style="position: relative;">
                                     <img src="static/img/common/notice-tip.png" ng-mouseover="purchase.noticeTip = true" ng-mouseleave="purchase.noticeTip = false"/>
                                     <div class="ship-notify" ng-if="purchase.noticeTip">
@@ -823,6 +943,30 @@
                                       <div class="content">若物流信息填写有误,请重新填写</div>
                                     </div>
                                 </div>
+								<!--修改物流-->
+								<div class="edit-logistic-box" ng-if="purchase.showLogistics">
+									<div class="title"><a ng-click="cancelModify(purchase)">&times;</a></div>
+									<div class="content">
+										<div class="row">配送方式: <em>{{deliveryMethod[purchase.sendType]}}</em></div>
+										<div class="row">物流公司:
+											<em>
+												<input type="text" style="border: #5078cb 1px solid;" class="form-control select-adder" ng-model="logistics.companyName" ng-focus="onFocus()" ng-blur="onBlur()" placeholder="请选择物流公司" readonly="readonly"/>
+												<!--<em name="companyName" class="btn-position" ng-click="showName()"><i class="fa fa-caret-down"></i></em>-->
+												<ul class="dropdown-menu" ng-class="{'active': showNameUl}">
+													<li ng-click="showText('请选择物流公司')">请选择物流公司</li>
+                            						<li ng-click="showText(data.companyName)" ng-repeat="data in data_list" ng-bind="data.companyName"></li>
+                            					</ul>
+											</em>
+										</div>
+										<div class="row">物流单号: <em>
+											<input type="text" class="form-control" ng-model="logistics.number" maxlength="20" autocomplete="off"/>
+										</em></div>
+										<div class="edit-deal" style="margin-left: -18px;">
+											<a ng-click="cancelModify(purchase)" class="off">取消</a>
+											<a ng-click="ensureModifyLogistics(purchase)" class="ok">确认</a>
+										</div>
+									</div>
+								</div>
                             </div>
                         </span>
 					</dd>

+ 5 - 3
src/main/webapp/resources/view/vendor/forstore/vendor_take_self.html

@@ -8,11 +8,11 @@
 		background: #fff;
 	}
 	.takeSelf .content-header{
-		padding-top: 35px;
+		padding-top: 25px;
 		overflow: hidden;
 	}
 	.takeSelf .content-header span{
-		padding-left: 45px;
+		padding-left: 23px;
 		font-size: 14px;
 		color: #333;
 	}
@@ -25,6 +25,8 @@
 	.takeSelf .content-header i{
 		color: #32b500;
 		font-size: 16px;
+		position: relative;
+		top: 1px;
 	}
 	.takeSelf .content-body {
 		width: 1000px;
@@ -33,7 +35,7 @@
 	}
 	.takeSelf .content-body table{
 		box-sizing: border-box;
-		margin-top: 20px;
+		margin-top: 15px;
 	}
 	.takeSelf .content-body thead{
 		height: 40px;

+ 3 - 3
src/main/webapp/resources/view/vendor/left_nav.html

@@ -22,12 +22,12 @@
 	<a href="javascript:void(0)" ui-sref="vendor_index"><p ng-class="{'active' : active == 'index'}"><span>卖家中心</span></p></a>
 	<ul>
 		<li ng-class="{'active' : active == 'vendor_order'}"><a href="javascript:void(0)" ui-sref="vendor_order">订单中心</a></li>
-		<!--<li ng-class="{'active' : active == 'vendor_logistics'}"><a href="javascript:void(0)" ui-sref="vendor_deliveryRule">物流管理</a></li>-->
-		<li ng-class="{'active' : active == 'vendor_logistics'}"><a href="javascript:void(0)" ui-sref="vendor_logistics">物流管理</a></li>
+		<li ng-class="{'active' : active == 'vendor_logistics'}"><a href="javascript:void(0)" ui-sref="vendor_deliveryRule">物流管理</a></li>
+		<!--<li ng-class="{'active' : active == 'vendor_logistics'}"><a href="javascript:void(0)" ui-sref="vendor_logistics">物流管理</a></li>-->
 		<li ng-class="{'active' : active == 'pay_center'}"><a href="javascript:void(0)" ui-sref="pay_center">结算中心</a></li>
 		<li ng-class="{'active' : active == 'vendor_brand_apply'}"><a href="javascript:void(0)" ui-sref="vendor_brand_apply">品牌申请</a></li>
 		<li ng-class="{'active' : active == 'vendor_component_apply'}"><a href="javascript:void(0)" ui-sref="vendor_component_apply">器件申请</a></li>
-		<li ng-class="{'active' : active == 'vendor_productOn'}"><a href="javascript:void(0)" ui-sref="vendor_productOn">产品导入</a></li>
+		<li ng-class="{'active' : active == 'vendor_productOn'}"><a href="javascript:void(0)" ui-sref="vendor_productOn">产品建档</a></li>
 		<li ng-class="{'active' : active == 'vendor_repository'}"><a href="javascript:void(0)" ui-sref="vendor_repository">仓库管理</a></li>
 		<li ng-class="{'active' : active == 'vendor_goods'}"><a href="javascript:void(0)" ui-sref="vendor_standardPutOn">产品管理</a></li>
 		<!--<li ng-class="{'active' : active == 'vendor_after_sale'}" class="undo">-->

+ 42 - 18
src/main/webapp/resources/view/vendor/modal/vendor_distributor_manage.html

@@ -58,13 +58,16 @@
         padding: 10px;
         border-top: 1.5px solid #ccc;
         border-bottom: 1.5px solid #ccc;
+        position: relative;
     }
     .dis-manage-middle-input {
         width: 400px;
-        height: 34px;
-        line-height: 34px;
+        height: 38px;
+        line-height: 38px;
         display: inline-block;
         padding-left: 10px;
+        font-size: 14px;
+        float: left;
     }
     .dis-manage-middle-search {
         position: absolute;
@@ -114,12 +117,12 @@
         padding-right: 10px;
     }
     .dis-manage-middle .dropdown-menu {
-        top: 13%;
-        left: 1%;
+        top: 45px;
+        left: 10px;
         line-height: 23px;
         max-height: 120px;
         overflow-y: auto;
-        width: 402px;
+        width: 400px;
         display: block;
         overflow-x: hidden;
         border-radius: 0;
@@ -176,6 +179,7 @@
     }
     .dis-manage-middle button{
         border-radius: 0;
+        height: 38px;
     }
     .dis-manage-footer-cancel {
         background: #b4b5b9;
@@ -226,6 +230,13 @@
     .dis-manage-footer-table-tr-td .check-act input{
         display: none;
     }
+    .dis-manage-footer-table-tr-td >span {
+        float: left;
+        max-width: 68px;
+        text-overflow: ellipsis;
+        overflow: hidden;
+        white-space: nowrap;
+    }
     .dis-manage-footer-table-tr-td .check-act label{
         background-position: -48px 0;
     }
@@ -330,6 +341,22 @@
         float: right;
         margin-right: 10px;
     }
+    span.text-span{
+        float: left;
+        max-width: 82px;
+        text-overflow: ellipsis;
+        overflow: hidden;
+        white-space: nowrap;
+    }
+    .btn-success[disabled] {
+        background: #b4b5b9!important;
+        color: #333!important;
+        border-color: #b4b5b9!important;
+        /* border: none; */
+    }
+    .btn-success:hover {
+        border-color: #5078cb;
+    }
 </style>
 
 <div class="dis-content">
@@ -338,18 +365,18 @@
         <ul class="dis-manage-header-list">
             <li class="dis-manage-header-item" ng-repeat="data in chooseList">
                 <span>{{data.companyName}}</span>
-                <i class="fa fa-minus-circle" ng-click="ChooseDistributor(data)"></i>
+                <i class="fa fa-minus-circle" ng-click="removeDistributor(data, $index)"></i>
             </li>
         </ul>
     </div>
     <div class="dis-manage-middle">
         <input class="dis-manage-middle-input" type="text" placeholder="请输入配送商名称" ng-change="inputContent()" ng-model="keyword" ng-keydown="onKeyDown()" ng-blur="onBlur()" ng-focus="getFocus()">
-        <button ng-disabled="!keyword || keyword.length==0 || companyError" class="btn btn-success" ng-click="addItemInSelected()" type="button">新增</button>
-        <span class="dis-manage-middle-message" ng-if="!companyError && !containsItem"><i class="fa fa-info-circle"></i>系统无法提供此物流信息,请根据物流单号到相应的官网查询</span>
-        <span class="dis-manage-middle-message" ng-if="companyError && keyword.length > 0">请输入正确的物流公司</span>
-            <!--<ul id="ulContent">-->
-                <!--<li ng-repeat="data in resultList" ng-click="clickItem(data)" ng-class="{'active': $index==selectIndex}">{{data.companyName}}</li>-->
-            <!--</ul>-->
+        <button ng-disabled="!keyword || keyword.length==0" class="btn btn-success" ng-click="addItemInSelected()" type="button">新增</button>
+        <span class="dis-manage-middle-message" ng-if="!containsItem && keyword.length > 0"><i class="fa fa-info-circle"></i>系统无法提供此物流信息,请根据物流单号到相应的官网查询。</span>
+        <!--<span class="dis-manage-middle-message" ng-if="companyError && keyword.length > 0">请输入正确的物流公司</span>-->
+        <!--<ul id="ulContent">-->
+        <!--<li ng-repeat="data in resultList" ng-click="clickItem(data)" ng-class="{'active': $index==selectIndex}">{{data.companyName}}</li>-->
+        <!--</ul>-->
         <ul id="ulContent"  ng-if="showDownFrame && matchData" class="dropdown-menu">
             <li ng-click="clickItem(data)" ng-repeat="data in resultList" ng-class="{'active': $index==selectIndex}" ng-bind="data.companyName"></li>
         </ul>
@@ -359,19 +386,16 @@
         <table class="dis-manage-footer-table" ng-table="distributorTableParams">
             <tr class="dis-manage-footer-table-tr dis-manage-bgwhite" ng-repeat="value in showList">
                 <td class="dis-manage-footer-table-tr-td" ng-repeat="data in value" width="120">
-                    <span ng-bind="data.companyName" style="float: left;max-width: 120px;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    white-space: nowrap;"></span>
+                    <span ng-bind="data.companyName"></span>
                     <label class="check-act" style=" float: right;">
-                        <input type="checkbox" id="{{data.code}}" ng-click="ChooseDistributor(data)" ng-checked="data.isChoosed"/>
+                        <input type="checkbox" id="{{data.code}}" ng-click="ChooseDistributor(data)" ng-checked="selectFlag[data.code].isChoosed"/>
                         <label for="{{data.code}}"></label>
                     </label>
                 </td>
             </tr>
             <tr class="record-num">
                 <td colspan="6">
-                    <span class="count-tip">显示<span ng-bind="$$kdnData.start">23</span>-<span ng-bind="$$kdnData.end">10</span>,共:<span ng-bind="$$kdnData.totalElements" style="color: #5078cb;">23</span>个</span>
+                    <span class="count-tip">显示 <span ng-bind="$$kdnData.start">23</span>-<span ng-bind="$$kdnData.end">10</span> ,共:<span ng-bind="$$kdnData.totalElements" style="color: #5078cb;">23</span> 个</span>
                 </td>
             </tr>
         </table>