1
0
Quellcode durchsuchen

小程序前端、后端修改提交

hyq vor 6 Jahren
Ursprung
Commit
7d19a74128
48 geänderte Dateien mit 994 neuen und 196 gelöschten Zeilen
  1. 11 0
      kmall-admin/src/main/resources/conf/oms-merch.properties
  2. 1 0
      kmall-admin/src/main/resources/spring/spring-context.xml
  3. 1 0
      kmall-admin/src/main/resources/spring/spring-main.xml
  4. 23 0
      kmall-admin/src/main/resources/spring/spring-oms-merch.xml
  5. 2 1
      kmall-admin/src/main/webapp/WEB-INF/web.xml
  6. 45 6
      kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java
  7. 14 0
      kmall-api/src/main/java/com/kmall/api/api/ApiGoodsController.java
  8. 2 1
      kmall-api/src/main/java/com/kmall/api/api/ApiIndexController.java
  9. 32 0
      kmall-api/src/main/java/com/kmall/api/contants/Dict.java
  10. 2 0
      kmall-api/src/main/java/com/kmall/api/dao/ApiUserCouponMapper.java
  11. 19 0
      kmall-api/src/main/java/com/kmall/api/dao/FreightMapper.java
  12. 10 0
      kmall-api/src/main/java/com/kmall/api/entity/CartVo.java
  13. 21 0
      kmall-api/src/main/java/com/kmall/api/entity/CouponVo.java
  14. 114 0
      kmall-api/src/main/java/com/kmall/api/entity/FreightEntity.java
  15. 30 0
      kmall-api/src/main/java/com/kmall/api/entity/UserCouponVo.java
  16. 2 0
      kmall-api/src/main/java/com/kmall/api/service/ApiCouponService.java
  17. 146 74
      kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java
  18. 2 0
      kmall-api/src/main/java/com/kmall/api/service/ApiUserCouponService.java
  19. 62 0
      kmall-api/src/main/java/com/kmall/api/service/FreightService.java
  20. 43 0
      kmall-api/src/main/java/com/kmall/api/service/merch/OmsMerchProperties.java
  21. 40 0
      kmall-api/src/main/java/com/kmall/api/service/merch/OmsMerchPropertiesBuilder.java
  22. 27 0
      kmall-api/src/main/java/com/kmall/api/service/merch/OmsMerchPropertiesConfiguration.java
  23. 2 2
      kmall-api/src/main/java/com/kmall/api/util/CommonUtil.java
  24. 11 1
      kmall-api/src/main/resources/mybatis/mapper/ApiCartMapper.xml
  25. 2 0
      kmall-api/src/main/resources/mybatis/mapper/ApiCouponMapper.xml
  26. 16 2
      kmall-api/src/main/resources/mybatis/mapper/ApiUserCouponMapper.xml
  27. 101 0
      kmall-api/src/main/resources/mybatis/mapper/FreightMapper.xml
  28. 4 0
      kmall-common/src/main/java/com/kmall/common/utils/DateUtils.java
  29. 1 0
      kmall-framework/src/main/webapp/WEB-INF/web.xml
  30. 2 9
      wx-mall/pages/cart/cart.js
  31. 28 9
      wx-mall/pages/cart/cart.wxml
  32. 34 16
      wx-mall/pages/cart/cart.wxss
  33. 2 2
      wx-mall/pages/catalog/catalog.wxml
  34. 36 14
      wx-mall/pages/goods/goods.js
  35. 19 14
      wx-mall/pages/goods/goods.wxml
  36. 14 5
      wx-mall/pages/goods/goods.wxss
  37. 1 1
      wx-mall/pages/index/index.js
  38. 6 2
      wx-mall/pages/index/index.wxml
  39. 20 14
      wx-mall/pages/shopping/checkout/checkout.js
  40. 30 14
      wx-mall/pages/shopping/checkout/checkout.wxml
  41. 1 1
      wx-mall/pages/shopping/checkout/checkout.wxss
  42. 6 0
      wx-mall/pages/ucenter/coupon/coupon.js
  43. 4 3
      wx-mall/pages/ucenter/coupon/coupon.wxml
  44. 5 5
      wx-mall/pages/ucenter/order/order.wxml
  45. BIN
      wx-mall/static/images/icon_collect_checked.png
  46. BIN
      wx-mall/static/images/service-ehsjh.png
  47. BIN
      wx-mall/static/images/service-hsjh.png
  48. BIN
      wx-mall/static/images/service-smgw.png

+ 11 - 0
kmall-admin/src/main/resources/conf/oms-merch.properties

@@ -0,0 +1,11 @@
+########## oms商户配置 ##########
+
+#oms商户ID
+merch.merchSn=mhbs455771563389755392
+#oms商户名称
+merch.merchName=VVO
+#oms商户简称
+merch.merchShortName=VVO
+
+
+

+ 1 - 0
kmall-admin/src/main/resources/spring/spring-context.xml

@@ -27,6 +27,7 @@
                 <value>classpath:conf/redis.properties</value>
                 <value>classpath:conf/servlet.properties</value>
                 <value>classpath:conf/wx-mp.properties</value>
+                <value>classpath:conf/oms-merch.properties</value>
             </list>
         </property>
         <property name="fileEncoding" value="UTF-8"/>

+ 1 - 0
kmall-admin/src/main/resources/spring/spring-main.xml

@@ -19,5 +19,6 @@
     <import resource="spring-express-kdn.xml"/>
     <import resource="spring-wx-pay.xml"/>
     <import resource="spring-jdbc.xml"/>
+    <import resource="spring-oms-merch.xml"/>
 
 </beans>

+ 23 - 0
kmall-admin/src/main/resources/spring/spring-oms-merch.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xmlns:mvc="http://www.springframework.org/schema/mvc"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans 
+        http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
+        http://www.springframework.org/schema/context
+        http://www.springframework.org/schema/context/spring-context-4.2.xsd
+     	http://www.springframework.org/schema/aop
+     	http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
+		http://www.springframework.org/schema/mvc
+     	http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
+
+
+    <bean id="omsMerchProperties" class="com.kmall.api.service.merch.OmsMerchProperties">
+        <property name="merchSn" value="${merch.merchSn}"/>
+        <property name="merchName" value="${merch.merchName}"/>
+        <property name="merchShortName" value="${merch.merchShortName}"/>
+    </bean>
+</beans>

+ 2 - 1
kmall-admin/src/main/webapp/WEB-INF/web.xml

@@ -12,7 +12,8 @@
             classpath:spring/spring-express-kdn.xml,
             classpath:spring/spring-redis.xml,
             classpath:spring/spring-wx-pay.xml,
-            classpath:spring/spring-jdbc.xml,
+            classpath:spring/spring-jdbc.xml,,
+            classpath:spring/spring-oms-merch.xml,
             classpath*:kmall-*.xml
         </param-value>
     </context-param>

+ 45 - 6
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -46,6 +46,9 @@ public class ApiCartController extends ApiBaseAction {
     @Autowired
     private ApiUserService apiUserService;
 
+    @Autowired
+    private FreightService freightService;
+
     /**
      * 获取购物车中的数据
      */
@@ -263,10 +266,12 @@ public class ApiCartController extends ApiBaseAction {
             cartInfo.setGoods_specification_ids(productInfo.getGoods_specification_ids());
             cartInfo.setChecked(1);
             cartInfo.setGoodsBizType(goodsInfo.getGoodsBizType());//业务类型
+            cartInfo.setStockNum(productInfo.getStock_num());
             cartService.save(cartInfo);
         } else {
             cartInfo.setNumber(cartInfo.getNumber() + number);
             cartInfo.setGoodsBizType(goodsInfo.getGoodsBizType());//业务类型
+            cartInfo.setStockNum(productInfo.getStock_num());
             cartService.update(cartInfo);
         }
         return toResponsSuccess(getCart());
@@ -311,6 +316,10 @@ public class ApiCartController extends ApiBaseAction {
         }
         Long storeId = getStoreId();
         for (OrderGoodsVo goodsVo : orderGoodsVos) {
+            ProductVo productInfo = productService.queryObjectByStoreId(goodsVo.getProduct_id(), storeId);
+            if (null == productInfo) {
+                return this.toResponsObject(400, "商品已下架", "");
+            }
             CartVo cartInfo = new CartVo();
             cartInfo.setGoods_id(goodsVo.getGoods_id());
             cartInfo.setProduct_id(goodsVo.getProduct_id());
@@ -326,6 +335,7 @@ public class ApiCartController extends ApiBaseAction {
             cartInfo.setGoods_specification_ids(goodsVo.getGoods_specification_ids());
             cartInfo.setChecked(1);
             cartInfo.setGoodsBizType(goodsVo.getOrderBizType());
+            cartInfo.setStockNum(productInfo.getStock_num());
 
             Map map = new HashMap();
             map.put("user_id",loginUser.getId());
@@ -390,6 +400,7 @@ public class ApiCartController extends ApiBaseAction {
         Long productId = jsonParam.getLong("productId");
         Integer number = jsonParam.getInteger("number");
         Integer id = jsonParam.getInteger("id");
+        boolean isAdd = true;
         //取得规格的信息,判断规格库存
         ProductVo productInfo = productService.queryObjectByStoreId(productId, storeId);
         if (null == productInfo || productInfo.getStock_num() == 0) {
@@ -409,6 +420,7 @@ public class ApiCartController extends ApiBaseAction {
         //只是更新number
         if (cartInfo.getProduct_id().equals(productId)) {
             cartInfo.setNumber(number);
+            cartInfo.setStockNum(productInfo.getStock_num());
             cartService.update(cartInfo);
             return toResponsObject(0, msg, getCart());
         }
@@ -548,25 +560,51 @@ public class ApiCartController extends ApiBaseAction {
         }
         // 根据收货地址计算运费
 //        BigDecimal freightPrice = apiCouponService.matchShipping(loginUser.getId(), goodsTotalPrice);
-        BigDecimal freightPrice = new BigDecimal("00");
-        // 单独计算满减券
+        BigDecimal freightPrice00 = new BigDecimal("00");
+        BigDecimal freightPrice02 = new BigDecimal("00");
+        BigDecimal freightPrice10 = new BigDecimal("00");
+        BigDecimal freightPrice11 = new BigDecimal("00");
+        //查询运费模板
+        for (CartVo vo: checkedGoodsList) {
+            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())){
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(vo.getGoods_id());
+                freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;
+            }
+            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_02.getItem())){
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(vo.getGoods_id());
+                freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;
+            }
+            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_10.getItem())){
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(vo.getGoods_id());
+                freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;
+            }
+            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())){
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(vo.getGoods_id());
+                freightPrice11 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice11;
+            }
+
+        }
+        // 计算优惠券 todo 暂时不计算全场金额满减
         BigDecimal fullCutCouponDec = new BigDecimal(0);
         Long fullCutCouponId = 0L;
-        CouponVo fullSubCoupon = apiCouponService.matchFullSub(loginUser.getId(), goodsTotalPrice);
+        /*CouponVo fullSubCoupon = apiCouponService.matchFullSub(loginUser.getId(), goodsTotalPrice);
         if (null != fullSubCoupon && null != fullSubCoupon.getId()) {
             // 满减
             fullCutCouponDec = fullSubCoupon.getType_money();
             fullCutCouponId = fullSubCoupon.getId();
-        }
+        }*/
         resultObj.put("fullCutCouponDec", fullCutCouponDec);
         resultObj.put("fullCutCouponId", fullCutCouponId);
         //订单的总价
-        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice);
+        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice00).add(freightPrice02).add(freightPrice10).add(freightPrice11);
 
         //
         BigDecimal actualPrice = orderTotalPrice.subtract(fullCutCouponDec).subtract(couponPrice);  //减去其它支付的金额后,要实际支付的金额
 
-        resultObj.put("freightPrice", freightPrice);
+        resultObj.put("freightPrice00", freightPrice00);
+        resultObj.put("freightPrice02", freightPrice02);
+        resultObj.put("freightPrice10", freightPrice10);
+        resultObj.put("freightPrice11", freightPrice11);
         resultObj.put("checkedCoupon", checkedCoupon);
         resultObj.put("couponList", enableCouponList);
 
@@ -590,6 +628,7 @@ public class ApiCartController extends ApiBaseAction {
             resultObj.put("idNo", userVo.getIdNo());
             resultObj.put("userName", userVo.getUsername());
         }
+
         return toResponsSuccess(resultObj);
     }
 

+ 14 - 0
kmall-api/src/main/java/com/kmall/api/api/ApiGoodsController.java

@@ -68,6 +68,9 @@ public class ApiGoodsController extends ApiBaseAction {
     @Autowired
     private ApiBrandService apiBrandService;
 
+    @Autowired
+    private FreightService freightService;
+
     /**
      */
     @IgnoreAuth
@@ -193,6 +196,13 @@ public class ApiGoodsController extends ApiBaseAction {
             footprintEntity.setReferrer(0L);
         }
         footprintService.save(footprintEntity);
+
+        Map cartMap= new HashMap();
+        cartMap.put("user_id",userId);
+        cartMap.put("goods_id",info.getId());
+        List<CartVo> cartVoList = cartService.queryList(cartMap);
+
+        FreightEntity freightEntity = freightService.queryObjectByGoodsId(info.getId());
         //
         resultObj.put("info", info);
 
@@ -202,6 +212,10 @@ public class ApiGoodsController extends ApiBaseAction {
         resultObj.put("comment", comment);
         resultObj.put("specificationList", specificationList);
         resultObj.put("productList", productEntityList);
+        resultObj.put("stockNum", productEntityList.size()!=0? productEntityList.get(0).getStock_num():0);
+        resultObj.put("cartNumber", cartVoList.size()!=0? cartVoList.get(0).getNumber():0);
+        resultObj.put("defaultFreight", freightEntity != null? freightEntity.getDefaultFreight() :0);
+
         return toResponsSuccess(resultObj);
     }
 

+ 2 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiIndexController.java

@@ -52,7 +52,8 @@ public class ApiIndexController extends ApiBaseAction {
         Long storeId = getStoreId();
         //
         Map param = new HashMap();
-        param.put("ad_position_ids", new Integer[]{1, 2, 3});
+//        param.put("ad_position_ids", new Integer[]{1, 2, 3});
+        param.put("ad_position_ids", new Integer[]{1});//用户注册
         List<AdVo> adVos = apiAdService.queryList(param);
         //
         List<AdVo> banner = new ArrayList();

+ 32 - 0
kmall-api/src/main/java/com/kmall/api/contants/Dict.java

@@ -234,4 +234,36 @@ public class Dict {
             this.itemName = itemName;
         }
     }
+
+    /**
+     * 是否已使用
+     */
+    public enum isUsed {
+        item_0("0", "否"),
+        item_1("1", "是");
+
+        private String item;
+        private String itemName;
+
+        isUsed(String item, String itemName) {
+            this.item = item;
+            this.itemName = itemName;
+        }
+
+        public String getItem() {
+            return item;
+        }
+
+        public void setItem(String item) {
+            this.item = item;
+        }
+
+        public String getItemName() {
+            return itemName;
+        }
+
+        public void setItemName(String itemName) {
+            this.itemName = itemName;
+        }
+    }
 }

+ 2 - 0
kmall-api/src/main/java/com/kmall/api/dao/ApiUserCouponMapper.java

@@ -17,4 +17,6 @@ public interface ApiUserCouponMapper extends BaseDao<UserCouponVo> {
     UserCouponVo queryByOrderId(@Param("order_id") Long order_id);
 
     Integer cancelOrder(UserCouponVo couponVo);
+
+    UserCouponVo queryObjectByIdAndUsed(Integer id);
 }

+ 19 - 0
kmall-api/src/main/java/com/kmall/api/dao/FreightMapper.java

@@ -0,0 +1,19 @@
+package com.kmall.api.dao;
+
+import com.kmall.api.entity.FreightEntity;
+import com.kmall.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+/**
+ * Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-10-22 17:20:31
+ */
+@Component
+public interface FreightMapper extends BaseDao<FreightEntity> {
+    FreightEntity queryObjectByGoodsId(@Param("goodsId") Long goodsId);
+
+}

+ 10 - 0
kmall-api/src/main/java/com/kmall/api/entity/CartVo.java

@@ -64,6 +64,16 @@ public class CartVo implements Serializable {
 
     private Date tstm;
 
+    private Integer stockNum;
+
+    public Integer getStockNum() {
+        return stockNum;
+    }
+
+    public void setStockNum(Integer stockNum) {
+        this.stockNum = stockNum;
+    }
+
     public String getGoodsBizTypeName() {
         return goodsBizTypeName;
     }

+ 21 - 0
kmall-api/src/main/java/com/kmall/api/entity/CouponVo.java

@@ -61,6 +61,27 @@ public class CouponVo implements Serializable {
     private BigDecimal money; // 优惠金额
     private BigDecimal difDec; // 与结算价格差异
 
+    private String isAll;//是否适用与全场
+
+    private String couponUrl;
+
+    public String getCouponUrl() {
+        return couponUrl;
+    }
+
+    public void setCouponUrl(String couponUrl) {
+        this.couponUrl = couponUrl;
+    }
+
+
+    public String getIsAll() {
+        return isAll;
+    }
+
+    public void setIsAll(String isAll) {
+        this.isAll = isAll;
+    }
+
     public Long getId() {
         return id;
     }

+ 114 - 0
kmall-api/src/main/java/com/kmall/api/entity/FreightEntity.java

@@ -0,0 +1,114 @@
+package com.kmall.api.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 实体
+ * 表名 mall_freight
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-10-22 17:20:31
+ */
+public class FreightEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Integer id;
+    /**
+     * 模版名称
+     */
+    private String name;
+    /**
+     * 模版类型:0,买家承担运费;1,卖家包邮
+     */
+    private String templateType;
+    /**
+     * 计价方式:0,按件数;1,按重量;2,按体积
+     */
+    private String pricingManner;
+    /**
+     * 默认模版:0,否;1,是
+     */
+    private String isDefault;
+
+    private BigDecimal defaultFreight;//运费
+
+    public BigDecimal getDefaultFreight() {
+        return defaultFreight;
+    }
+
+    public void setDefaultFreight(BigDecimal defaultFreight) {
+        this.defaultFreight = defaultFreight;
+    }
+
+    /**
+     * 设置:主键
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:主键
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:模版名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 获取:模版名称
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * 设置:模版类型:0,买家承担运费;1,卖家包邮
+     */
+    public void setTemplateType(String templateType) {
+        this.templateType = templateType;
+    }
+
+    /**
+     * 获取:模版类型:0,买家承担运费;1,卖家包邮
+     */
+    public String getTemplateType() {
+        return templateType;
+    }
+    /**
+     * 设置:计价方式:0,按件数;1,按重量;2,按体积
+     */
+    public void setPricingManner(String pricingManner) {
+        this.pricingManner = pricingManner;
+    }
+
+    /**
+     * 获取:计价方式:0,按件数;1,按重量;2,按体积
+     */
+    public String getPricingManner() {
+        return pricingManner;
+    }
+    /**
+     * 设置:默认模版:0,否;1,是
+     */
+    public void setIsDefault(String isDefault) {
+        this.isDefault = isDefault;
+    }
+
+    /**
+     * 获取:默认模版:0,否;1,是
+     */
+    public String getIsDefault() {
+        return isDefault;
+    }
+}

+ 30 - 0
kmall-api/src/main/java/com/kmall/api/entity/UserCouponVo.java

@@ -50,6 +50,36 @@ public class UserCouponVo implements Serializable {
     //可用 1:可用 0:不可用
     private Integer enabled = 0;
 
+    private String isAll;
+
+    private String couponUrl;
+
+    private String isUsed;
+
+    public String getIsUsed() {
+        return isUsed;
+    }
+
+    public void setIsUsed(String isUsed) {
+        this.isUsed = isUsed;
+    }
+
+    public String getCouponUrl() {
+        return couponUrl;
+    }
+
+    public void setCouponUrl(String couponUrl) {
+        this.couponUrl = couponUrl;
+    }
+
+    public String getIsAll() {
+        return isAll;
+    }
+
+    public void setIsAll(String isAll) {
+        this.isAll = isAll;
+    }
+
     public Long getId() {
         return id;
     }

+ 2 - 0
kmall-api/src/main/java/com/kmall/api/service/ApiCouponService.java

@@ -1,5 +1,6 @@
 package com.kmall.api.service;
 
+import com.kmall.api.contants.Dict;
 import com.kmall.api.dao.ApiCouponMapper;
 import com.kmall.api.dao.ApiUserCouponMapper;
 import com.kmall.api.entity.CouponVo;
@@ -74,6 +75,7 @@ public class ApiCouponService {
         userCouponVo.setCoupon_name(couponVo.getName());
         userCouponVo.setMin_goods_amount(couponVo.getMin_goods_amount());
         userCouponVo.setEnd_time(couponVo.getUse_end_date());
+        userCouponVo.setIsUsed(Dict.isUsed.item_0.getItem());
         apiUserCouponMapper.save(userCouponVo);
         return userCouponVo;
     }

+ 146 - 74
kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.kmall.api.contants.Dict;
 import com.kmall.api.dao.*;
 import com.kmall.api.entity.*;
+import com.kmall.api.service.merch.OmsMerchPropertiesBuilder;
 import com.kmall.api.util.CommonUtil;
 import com.kmall.common.dao.TemplateConfDao;
 import com.kmall.common.entity.FormIdsEntity;
@@ -53,6 +54,8 @@ public class ApiOrderService {
     private FormIdsService formIdsService;
     @Autowired
     private ApiGoodsMapper apiGoodsMapper;
+    @Autowired
+    private FreightService freightService;
 
     public OrderVo queryObject(Long id) {
         return apiOrderMapper.queryObject(id);
@@ -163,58 +166,76 @@ public class ApiOrderService {
             productInfo.addSellVolume();
             productVos.add(productInfo);
         }
-        List<OrderVo> orderInfoList = new ArrayList();
-        OrderVo order00 = null;
-        OrderVo order02 = null;
-        OrderVo order10 = null;
-        OrderVo order11 = null;
-        String merchOrderSn = "EMATO"+new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
+
+        BigDecimal freightPrice00 = new BigDecimal(0.00);
+        BigDecimal freightPrice02 = new BigDecimal(0.00);
+        BigDecimal freightPrice10 = new BigDecimal(0.00);
+        BigDecimal freightPrice11 = new BigDecimal(0.00);
+        Boolean isBizType00 = false;
+        Boolean isBizType02 = false;
+        Boolean isBizType10 = false;
+        Boolean isBizType11 = false;
         //订单按业务类型进行分单
         for (CartVo goodsItem : checkedGoodsList) {
             //订单业务类型:00:保税备货, 02:保税展示补货,10:保税展示跨境,11:普通商品
             if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                order00 = setOrderVo(loginUser,jsonParam,storeId,checkedGoodsList,goodsItem.getGoodsBizType());
-                order00.setOrderBizType(goodsItem.getGoodsBizType());
-                order00.setMerchOrderSn(merchOrderSn);
-                if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript00)) {
-                    order00.setPostscript(postscript00);
-                }
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                freightPrice00 =freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;//查询商品运费信息
+                isBizType00 =true;
             }
             if(Dict.orderBizType.item_02.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                order02 = setOrderVo(loginUser,jsonParam,storeId,checkedGoodsList,goodsItem.getGoodsBizType());
-                order02.setOrderBizType(goodsItem.getGoodsBizType());
-                order02.setMerchOrderSn(merchOrderSn);
-                if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript02)) {
-                    order02.setPostscript(postscript02);
-                }
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                freightPrice02 =freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;//查询商品运费信息
+                isBizType02 =true;
             }
             if(Dict.orderBizType.item_10.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                order10 = setOrderVo(loginUser,jsonParam,storeId,checkedGoodsList,goodsItem.getGoodsBizType());
-                order10.setOrderBizType(goodsItem.getGoodsBizType());
-                order10.setMerchOrderSn(merchOrderSn);
-                if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript10)) {
-                    order10.setPostscript(postscript10);
-                }
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                freightPrice10 =freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;//查询商品运费信息
+                isBizType10 =true;
             }
             if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                order11 = setOrderVo(loginUser,jsonParam,storeId,checkedGoodsList,goodsItem.getGoodsBizType());
-                order11.setOrderBizType(goodsItem.getGoodsBizType());
-                order11.setMerchOrderSn(merchOrderSn);
-                if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript11)) {
-                    order11.setPostscript(postscript11);
-                }
+                FreightEntity freightEntity = freightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                freightPrice11 =freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice11;//查询商品运费信息
+                isBizType11 =true;
             }
         }
-        if(order00!=null){
+
+        List<OrderVo> orderInfoList = new ArrayList();
+        String merchOrderSn = "EMATO"+new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
+        if(isBizType00){
+            OrderVo order00 = setOrderVo(loginUser,jsonParam,storeId,freightPrice00,checkedGoodsList,Dict.orderBizType.item_00.getItem());
+            order00.setOrderBizType(Dict.orderBizType.item_00.getItem());
+            order00.setMerchOrderSn(merchOrderSn);
+            if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript00)) {
+                order00.setPostscript(postscript00);
+            }
             orderInfoList.add(order00);
         }
-        if(order02!=null){
+        if(isBizType02){
+            OrderVo order02 = setOrderVo(loginUser,jsonParam,storeId,freightPrice02,checkedGoodsList,Dict.orderBizType.item_02.getItem());
+            order02.setOrderBizType(Dict.orderBizType.item_02.getItem());
+            order02.setMerchOrderSn(merchOrderSn);
+            if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript02)) {
+                order02.setPostscript(postscript02);
+            }
             orderInfoList.add(order02);
         }
-        if(order10!=null){
+        if(isBizType10){
+            OrderVo order10 = setOrderVo(loginUser,jsonParam,storeId,freightPrice10,checkedGoodsList,Dict.orderBizType.item_10.getItem());
+            order10.setOrderBizType(Dict.orderBizType.item_10.getItem());
+            order10.setMerchOrderSn(merchOrderSn);
+            if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript10)) {
+                order10.setPostscript(postscript10);
+            }
             orderInfoList.add(order10);
         }
-        if(order11!=null){
+        if(isBizType11){
+            OrderVo order11 = setOrderVo(loginUser,jsonParam,storeId,freightPrice11,checkedGoodsList,Dict.orderBizType.item_11.getItem());
+            order11.setOrderBizType(Dict.orderBizType.item_11.getItem());
+            order11.setMerchOrderSn(merchOrderSn);
+            if(org.apache.commons.lang.StringUtils.isNotEmpty(postscript11)) {
+                order11.setPostscript(postscript11);
+            }
             orderInfoList.add(order11);
         }
 
@@ -261,16 +282,17 @@ public class ApiOrderService {
             resultObj.put("data", orderInfoMap);
 
             // 优惠券标记已用
-            for (OrderVo orderInfo : orderInfoList) {
+            /*for (OrderVo orderInfo : orderInfoList) {
                 if (null != userCouponId && 0 != userCouponId) {
                     UserCouponVo userCouponVo = apiUserCouponMapper.queryObject(userCouponId);
                     if (null != userCouponVo && (null == userCouponVo.getOrder_id() || 0 == userCouponVo.getOrder_id())) {
                         userCouponVo.setUsed_time(new Date());
                         userCouponVo.setOrder_id(orderInfo.getId());
+                        userCouponVo.setIsUsed(Dict.isUsed.item_1.getItem());
                         apiUserCouponMapper.update(userCouponVo);
                     }
                 }
-            }
+            }*/
         }
 
         return resultObj;
@@ -281,15 +303,15 @@ public class ApiOrderService {
      * @param loginUser
      * @param jsonParam
      * @param storeId
+     * @param freightPrice
      * @param checkedGoodsList
      * @return
      */
-    public OrderVo setOrderVo(UserVo loginUser,JSONObject jsonParam,Long storeId,List<CartVo> checkedGoodsList,String orderBizType){
+    public OrderVo setOrderVo(UserVo loginUser,JSONObject jsonParam,Long storeId,BigDecimal freightPrice,List<CartVo> checkedGoodsList,String bizType){
+        OrderVo orderInfo = new OrderVo();
         Integer userCouponId = jsonParam.getInteger("userCouponId");
         String postscript = jsonParam.getString("postscript");
-        Long fullCutCouponId = jsonParam.getLong("fullCutCouponId");
-//        BigDecimal freightPrice = new BigDecimal(10.00);
-        BigDecimal freightPrice = new BigDecimal(0.00);
+        Long fullCutCouponId = jsonParam.getLong("fullCutCouponId");//满减券
         AddressVo addressVo = jsonParam.getObject("checkedAddress", AddressVo.class);
         Date delivery_date = jsonParam.getDate("delivery_date");
         if (null == delivery_date) {
@@ -299,53 +321,60 @@ public class ApiOrderService {
         if (StringUtils.isNullOrEmpty(delivery_remark)) {
             delivery_remark = "尽快送达";
         }
-
-        //统计商品总价
+        BigDecimal fullCutCouponDec = new BigDecimal(0);
         BigDecimal goodsTotalPrice = new BigDecimal(0.00);
-        for (CartVo cartItem : checkedGoodsList) {
-            if(orderBizType.equalsIgnoreCase(cartItem.getGoodsBizType())){
-                goodsTotalPrice = goodsTotalPrice.add(cartItem.getRetail_price().multiply(new BigDecimal(cartItem.getNumber())));
+        for (CartVo goodsItem : checkedGoodsList) {
+            if(bizType.equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                goodsTotalPrice = goodsTotalPrice.add(goodsItem.getRetail_price().multiply(new BigDecimal(goodsItem.getNumber())));
             }
         }
 
-        //获取订单使用的优惠券
-        BigDecimal couponPrice = new BigDecimal(0.00);
+        //查询未使用的优惠券
         String couponName = "";
+        UserCouponVo couponVo = null;
+        BigDecimal couponPrice = new BigDecimal(0.00);
         if (null != userCouponId && 0 != userCouponId) {
-            UserCouponVo couponVo = apiUserCouponMapper.queryObject(userCouponId);
+            couponVo = apiUserCouponMapper.queryObjectByIdAndUsed(userCouponId);
             if (null != couponVo && null != couponVo.getType_money()) {
                 couponPrice = couponVo.getType_money();
                 couponName = couponVo.getCoupon_name();
             }
         }
-        // 获取优惠信息提示
-//        Map couponParam = new HashMap();
-//        couponParam.put("enabled", true);
-//        Integer[] send_types = new Integer[]{7};
-//        couponParam.put("send_types", send_types);
-//        List<CouponVo> couponVos = apiCouponMapper.queryList(couponParam);
-//        if (null != couponVos && couponVos.size() > 0) {
-//            for (CouponVo couponVo : couponVos) {
-//                // 是否免运费
-//                if (couponVo.getSend_type() == 7 && couponVo.getMin_goods_amount().compareTo(goodsTotalPrice) <= 0) {
-//                    freightPrice = couponVo.getType_money();
-//                }
-//            }
-//        }
-        // 获取优惠信息 满减
-        BigDecimal fullCutCouponDec = new BigDecimal(0);
+
+        /*// 获取优惠信息提示
+        Map couponParam = new HashMap();
+        couponParam.put("enabled", true);
+        Integer[] send_types = new Integer[]{7};
+        couponParam.put("send_types", send_types);
+        List<CouponVo> couponVos = apiCouponMapper.queryList(couponParam);
+        if (null != couponVos && couponVos.size() > 0) {
+            for (CouponVo couponVo : couponVos) {
+                // 是否免运费
+                if (couponVo.getSend_type() == 7 && couponVo.getMin_goods_amount().compareTo(goodsTotalPrice) <= 0) {
+                    freightPrice = couponVo.getType_money();
+                }
+            }
+        }
+        //todo 获取优惠信息 满减,暂时不用
         CouponVo fullCutCoupon = apiCouponMapper.queryObject(fullCutCouponId);
         if (null != fullCutCoupon) {
             fullCutCouponDec = fullCutCoupon.getType_money();
-        }
+        }*/
 
-        //订单价格计算
-        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice); //订单的总价+运费
+        //订单价格计算:订单的总价+运费
+        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice);
 
-        BigDecimal actualPrice = orderTotalPrice.subtract(fullCutCouponDec).subtract(couponPrice);  //减去其它支付的金额后,要实际支付的金额
+        //减去其它支付的金额后,要实际支付的金额   订单的总价+运费-优惠券金额
+        BigDecimal actualPrice = orderTotalPrice.subtract(couponPrice);
+//        BigDecimal actualPrice = orderTotalPrice.subtract(fullCutCouponDec).subtract(couponPrice);
+
+        //商户(拼音首字母)+业务类型+编号
+        String merchSn = OmsMerchPropertiesBuilder.instance().getMerchSn();
+        String merchShortName = OmsMerchPropertiesBuilder.instance().getMerchShortName();
+        String orderSn = merchShortName + bizType + CommonUtil.generateOrderNumber();
+        orderInfo.setOrder_sn(orderSn);
+        orderInfo.setMerchSn(merchSn);
 
-        OrderVo orderInfo = new OrderVo();
-        orderInfo.setOrder_sn(CommonUtil.generateOrderNumber());
         orderInfo.setUser_id(loginUser.getId());
         //收货地址和运费
         orderInfo.setConsignee(addressVo.getUserName());
@@ -361,12 +390,15 @@ public class ApiOrderService {
         orderInfo.setStore_id(storeId);
         //
         orderInfo.setFreight_price(freightPrice.intValue());
+
+        orderInfo.setCoupon_id(userCouponId);
+        orderInfo.setCoupon_price(couponPrice);
+        orderInfo.setCoupon_name(couponName);
+
         //留言
         orderInfo.setPostscript(postscript);
         //使用的优惠券
         orderInfo.setFull_cut_price(fullCutCouponDec);
-        orderInfo.setCoupon_id(userCouponId);
-        orderInfo.setCoupon_price(couponPrice);
         orderInfo.setAdd_time(new Date());
         orderInfo.setGoods_price(goodsTotalPrice);
         orderInfo.setOrder_price(orderTotalPrice);
@@ -379,13 +411,19 @@ public class ApiOrderService {
         orderInfo.setShipping_id(0L);
         orderInfo.setShipping_fee(new BigDecimal(0));
         orderInfo.setIntegral(0);
-        orderInfo.setCoupon_name(couponName);
         orderInfo.setIntegral_money(new BigDecimal(0));
         orderInfo.setCreateTime(new Date());
         orderInfo.setModTime(new Date());
         orderInfo.setPayMobile(loginUser.getMobile());
         orderInfo.setPayTransactionId("");
         orderInfo.setIsScan("0");//默认未扫描
+
+        //标记该订单已使用优惠券
+        if(couponVo != null){
+            couponVo.setUsed_time(new Date());
+            couponVo.setIsUsed(Dict.isUsed.item_1.getItem());
+            apiUserCouponMapper.update(couponVo);
+        }
         return orderInfo;
     }
 
@@ -408,7 +446,41 @@ public class ApiOrderService {
         orderGoodsVo.setModTime(new Date());
 
         orderGoodsVo.setGoodsRate(goodsVo.getGoodsRate());
-        orderGoodsVo.setSettlePrice(new BigDecimal("0"));//商品结算平摊价格=(零售价格*数量)/订单结算总金额
+
+        BigDecimal number = new BigDecimal(Long.valueOf(goodsItem.getNumber()));
+        BigDecimal goodsTotal = goodsItem.getRetail_price().multiply(number);//单商品总价
+        BigDecimal rate = goodsTotal.divide(orderInfo.getGoods_price(),2, BigDecimal.ROUND_HALF_UP);//单商品总价/订单总价(不含运费、不含优惠券)
+        BigDecimal freightPrice = BigDecimal.valueOf(orderInfo.getFreight_price());
+        BigDecimal settlePrice = new BigDecimal(0);
+        if(orderInfo.getFreight_price()!=0 && !"0".equalsIgnoreCase(orderInfo.getCoupon_price()+"")){
+            //运费-优惠券
+            BigDecimal rateTotal = freightPrice.subtract(orderInfo.getCoupon_price());
+
+            //商品结算平摊价格(含优惠券、运费金额) = 单商品总价 + 单商品总价/订单总价(不含运费、不含优惠券) * 运费与优惠券合计税率
+            settlePrice = goodsTotal.add(rate.multiply(rateTotal));
+        }else{
+            if(orderInfo.getFreight_price()!=0){
+                //运费税率 = 单商品总价/订单总价(不含运费)* 运费金额
+                BigDecimal freightRate = rate.multiply(freightPrice);
+
+                //商品结算平摊价格(含运费金额) = 单商品总价+运费税率
+                settlePrice = goodsTotal.add(freightRate);
+
+            }
+            if(!"0".equalsIgnoreCase(orderInfo.getCoupon_price()+"")){
+
+                //优惠券税率 = 单商品总价/订单总价(不含优惠券)* 优惠券金额
+                BigDecimal couponRate = rate.multiply(orderInfo.getCoupon_price());
+
+                //商品结算平摊价格(含优惠券金额) = 单商品总价-优惠券税率
+                settlePrice = goodsTotal.subtract(couponRate);
+            }
+        }
+        if(settlePrice.compareTo(BigDecimal.valueOf(0)) == 0){
+            orderGoodsVo.setSettlePrice(goodsTotal);//商品结算平摊价格
+        }else{
+            orderGoodsVo.setSettlePrice(settlePrice);//商品结算平摊价格
+        }
         return orderGoodsVo;
     }
     /**

+ 2 - 0
kmall-api/src/main/java/com/kmall/api/service/ApiUserCouponService.java

@@ -1,5 +1,6 @@
 package com.kmall.api.service;
 
+import com.kmall.api.contants.Dict;
 import com.kmall.api.dao.ApiUserCouponMapper;
 import com.kmall.api.entity.UserCouponVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -93,6 +94,7 @@ public class ApiUserCouponService {
         param.put("enabled", true);
         Integer[] send_types = new Integer[]{1, 2, 3, 4, 5, 6}; // 去除订单满减0,运费7
         param.put("send_types", send_types);
+        param.put("isUsed", Dict.isUsed.item_0.getItem());
 
         List<UserCouponVo> couponVos = userCouponDao.queryList(param);
         if (null != couponVos && couponVos.size() > 0) {

+ 62 - 0
kmall-api/src/main/java/com/kmall/api/service/FreightService.java

@@ -0,0 +1,62 @@
+package com.kmall.api.service;
+
+import com.kmall.api.dao.FreightMapper;
+import com.kmall.api.entity.FreightEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-10-22 17:20:31
+ */
+@Service
+public class FreightService{
+    @Autowired
+    private FreightMapper freightDao;
+
+    
+    public FreightEntity queryObject(Integer id) {
+        return freightDao.queryObject(id);
+    }
+
+    
+    public List<FreightEntity> queryList(Map<String, Object> map) {
+        return freightDao.queryList(map);
+    }
+
+    
+    public int queryTotal(Map<String, Object> map) {
+        return freightDao.queryTotal(map);
+    }
+
+    
+    public int save(FreightEntity freight) {
+        return freightDao.save(freight);
+    }
+
+    
+    public int update(FreightEntity freight) {
+        return freightDao.update(freight);
+    }
+
+    
+    public int delete(Integer id) {
+        return freightDao.delete(id);
+    }
+
+    
+    public int deleteBatch(Integer[]ids) {
+        return freightDao.deleteBatch(ids);
+    }
+
+
+    public FreightEntity queryObjectByGoodsId(Long id) {
+        return freightDao.queryObjectByGoodsId(id);
+    }
+}

+ 43 - 0
kmall-api/src/main/java/com/kmall/api/service/merch/OmsMerchProperties.java

@@ -0,0 +1,43 @@
+package com.kmall.api.service.merch;
+
+import java.io.Serializable;
+
+/**
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-10-24 11:40
+ */
+public class OmsMerchProperties implements Serializable {
+
+    private static final long serialVersionUID = -5150960165047052585L;
+
+    private String merchSn;
+
+    private String merchName;
+
+    private String merchShortName;
+
+    public String getMerchSn() {
+        return merchSn;
+    }
+
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    public String getMerchName() {
+        return merchName;
+    }
+
+    public void setMerchName(String merchName) {
+        this.merchName = merchName;
+    }
+
+    public String getMerchShortName() {
+        return merchShortName;
+    }
+
+    public void setMerchShortName(String merchShortName) {
+        this.merchShortName = merchShortName;
+    }
+}

+ 40 - 0
kmall-api/src/main/java/com/kmall/api/service/merch/OmsMerchPropertiesBuilder.java

@@ -0,0 +1,40 @@
+package com.kmall.api.service.merch;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * @author huangyaqin
+ * @since 1.0
+ * 2018-10-24
+ */
+@Component
+public class OmsMerchPropertiesBuilder {
+    private static final Logger logger = LoggerFactory.getLogger(OmsMerchPropertiesBuilder.class);
+
+    @Autowired
+    @Qualifier("omsMerchProperties")
+    private OmsMerchProperties omsMerchProperties;
+
+    private static OmsMerchProperties merchProp;
+
+    /**
+     * Bean 向静态变量赋值
+     */
+    @PostConstruct
+    private void init(){
+        logger.info("MerchProperties初始化开始......");
+        merchProp = omsMerchProperties;
+    }
+
+    public static OmsMerchProperties instance(){
+        logger.info("MerchProperties实例返回");
+        return merchProp;
+    }
+
+}

+ 27 - 0
kmall-api/src/main/java/com/kmall/api/service/merch/OmsMerchPropertiesConfiguration.java

@@ -0,0 +1,27 @@
+package com.kmall.api.service.merch;
+
+import com.kmall.api.service.pay.wxpay.WxPayDevProperties;
+import com.kmall.api.service.pay.wxpay.WxPayProdProperties;
+import com.kmall.api.service.pay.wxpay.WxPayProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Scott Chen
+ * @since 1.0
+ * 2018-09-27
+ */
+@Component
+public class OmsMerchPropertiesConfiguration {
+
+    @Autowired
+    private OmsMerchProperties omsMerchProperties;
+
+    @Bean
+    public OmsMerchProperties omsMerchProperties(){
+        return omsMerchProperties;
+    }
+
+}

+ 2 - 2
kmall-api/src/main/java/com/kmall/api/util/CommonUtil.java

@@ -91,8 +91,8 @@ public class CommonUtil {
     public static String generateOrderNumber() {
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
-        String timeStr = DateUtils.format(cal.getTime(), DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS_SSS);
-        return timeStr + CharUtil.getRandomNum(6);
+        String timeStr = DateUtils.format(cal.getTime(), DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS);
+        return timeStr + CharUtil.getRandomNum(4);
     }
 
     public static String getSha1(String str) {

+ 11 - 1
kmall-api/src/main/resources/mybatis/mapper/ApiCartMapper.xml

@@ -26,12 +26,13 @@
         <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
         <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
         <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
+        <result property="stockNum" column="stock_num"/>
     </resultMap>
 
     <sql id="Base_Column_List" >
         id, user_id, goods_id, sku, goods_sn, product_id, goods_name, market_price, retail_price,
         number, goods_specification_ids, checked, list_pic_url, store_id, goods_biz_type,
-        creater_sn, create_time, moder_sn, mod_time, tstm,goods_specification_name_value
+        creater_sn, create_time, moder_sn, mod_time, tstm,goods_specification_name_value,stock_num
     </sql>
     <select id="queryObject" resultMap="cartMap">
 		select
@@ -101,6 +102,9 @@
             <if test="user_id != null" >
                 user_id,
             </if>
+            <if test="stockNum != null" >
+                stock_num,
+            </if>
             <if test="goods_id != null" >
                 goods_id,
             </if>
@@ -163,6 +167,9 @@
             <if test="user_id != null" >
                 #{user_id},
             </if>
+            <if test="stockNum != null" >
+                #{stockNum},
+            </if>
             <if test="goods_id != null" >
                 #{goods_id,jdbcType=INTEGER},
             </if>
@@ -229,6 +236,9 @@
             <if test="user_id != null" >
                 user_id = #{user_id},
             </if>
+            <if test="stockNum != null" >
+                stock_num = #{stockNum},
+            </if>
             <if test="goods_id != null" >
                 goods_id = #{goods_id,jdbcType=INTEGER},
             </if>

+ 2 - 0
kmall-api/src/main/resources/mybatis/mapper/ApiCouponMapper.xml

@@ -22,6 +22,8 @@
         <result property="min_transmit_num" column="min_transmit_num"/>
         <result property="show_state" column="show_state"/>
         <result property="pic_url" column="pic_url"/>
+        <result property="isAll" column="is_all"/>
+        <result property="couponUrl" column="coupon_url"/>
     </resultMap>
 
     <select id="queryObject" resultMap="couponMap">

+ 16 - 2
kmall-api/src/main/resources/mybatis/mapper/ApiUserCouponMapper.xml

@@ -20,12 +20,20 @@
         <result property="type_money" column="type_money"/>
         <result property="send_type" column="send_type"/>
         <result property="min_goods_amount" column="min_goods_amount"/>
+        <result property="isAll" column="is_all"/>
+        <result property="couponUrl" column="coupon_url"/>
+        <result property="isUsed" column="is_used"/>
+
     </resultMap>
 
     <select id="queryObject" resultMap="userCouponMap">
 		select * from mall_user_coupon where id = #{value}
 	</select>
 
+    <select id="queryObjectByIdAndUsed" resultMap="userCouponMap">
+        select * from mall_user_coupon where id = #{value} and is_used = 0
+    </select>
+
     <select id="queryByCouponNumber" resultMap="userCouponMap">
         select * from mall_user_coupon where coupon_number = #{coupon_number}
     </select>
@@ -35,8 +43,8 @@
     </select>
 
     <select id="queryList" resultMap="userCouponMap">
-        select a.*
-        from mall_user_coupon a
+        select a.*,c.is_all,c.coupon_url
+        from mall_user_coupon a  inner join mall_coupon c on a.coupon_id = c.id
         where 1 = 1
         <if test="coupon_number != null">
             and a.coupon_number = #{coupon_number}
@@ -68,6 +76,9 @@
         <if test="enabled != null and enabled == true">
             and a.end_time > now()
         </if>
+        <if test="isUsed != null and isUsed != ''">
+            and a.is_used = 0
+        </if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
@@ -112,6 +123,7 @@
 		(
 			`coupon_id`,
 			`coupon_name`,
+            `is_used`,
 			`coupon_number`, 
 			`user_id`, 
 			`used_time`, 
@@ -129,6 +141,7 @@
 		(
             #{coupon_id},
             #{coupon_name},
+            #{isUsed},
 			#{coupon_number},
 			#{user_id},
 			#{used_time},
@@ -149,6 +162,7 @@
         <set>
             <if test="coupon_id != null">`coupon_id` = #{coupon_id},</if>
             <if test="coupon_name != null">`coupon_name` = #{coupon_name},</if>
+            <if test="isUsed != null">`is_used` = #{isUsed},</if>
             <if test="coupon_number != null">`coupon_number` = #{coupon_number},</if>
             <if test="user_id != null">`user_id` = #{user_id},</if>
             <if test="used_time != null">`used_time` = #{used_time},</if>

+ 101 - 0
kmall-api/src/main/resources/mybatis/mapper/FreightMapper.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.api.dao.FreightMapper">
+
+    <resultMap type="com.kmall.api.entity.FreightEntity" id="freightMap">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="templateType" column="template_type"/>
+        <result property="pricingManner" column="pricing_manner"/>
+        <result property="isDefault" column="is_default"/>
+		<result property="defaultFreight" column="default_freight"/>
+
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.api.entity.FreightEntity">
+		select
+		`id`,
+		`name`,
+		`template_type`,
+		`pricing_manner`,
+		`is_default`,default_freight
+		from mall_freight
+		where id = #{id}
+	</select>
+	<select id="queryObjectByGoodsId" resultType="com.kmall.api.entity.FreightEntity">
+		select f.* from mall_freight f  inner join mall_goods g on g.freight_id = f.id where g.id=#{goodsId}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.api.entity.FreightEntity">
+		select
+    		`id`,
+    		`name`,
+    		`template_type`,
+    		`pricing_manner`,
+    		`is_default`,default_freight
+		from mall_freight
+		WHERE 1=1
+		<if test="name != null and name.trim() != ''">
+			AND name LIKE concat('%',#{name},'%')
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mall_freight
+		WHERE 1=1
+        <if test="name != null and name.trim() != ''">
+            AND name LIKE concat('%',#{name},'%')
+        </if>
+	</select>
+	 
+	<insert id="save" parameterType="com.kmall.api.entity.FreightEntity" useGeneratedKeys="true" keyProperty="id">
+		insert into mall_freight(
+			`name`,
+			`template_type`,
+			`pricing_manner`,
+			`is_default`,
+		`default_freight`)
+		values(
+			#{name},
+			#{templateType},
+			#{pricingManner},
+			#{isDefault},
+		#{defaultFreight})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.api.entity.FreightEntity">
+		update mall_freight 
+		<set>
+			<if test="name != null">`name` = #{name}, </if>
+			<if test="templateType != null">`template_type` = #{templateType}, </if>
+			<if test="pricingManner != null">`pricing_manner` = #{pricingManner}, </if>
+			<if test="isDefault != null">`is_default` = #{isDefault}</if>
+			<if test="defaultFreight != null">`default_freight` = #{defaultFreight}</if>
+		</set>
+		where id = #{id}
+	</update>
+	
+	<delete id="delete">
+		delete from mall_freight where id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mall_freight where id in 
+		<foreach item="id" collection="array" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 4 - 0
kmall-common/src/main/java/com/kmall/common/utils/DateUtils.java

@@ -24,6 +24,10 @@ public class DateUtils {
      */
     public final static String DATE_PATTERN = "yyyy-MM-dd";
     /**
+     * 无分隔符日期格式 "yyyyMMddHHmmss"
+     */
+    public static String DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
+    /**
      * 无分隔符日期格式 "yyyyMMddHHmmssSSS"
      */
     public static String DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS_SSS = "yyyyMMddHHmmssSSS";

+ 1 - 0
kmall-framework/src/main/webapp/WEB-INF/web.xml

@@ -13,6 +13,7 @@
             classpath:spring/spring-redis.xml,
             classpath:spring/spring-wx-pay.xml,
             classpath:spring/spring-jdbc.xml,
+            classpath:spring/spring-oms-merch.xml,
             classpath*:kmall-*.xml
         </param-value>
     </context-param>

+ 2 - 9
wx-mall/pages/cart/cart.js

@@ -29,7 +29,8 @@ Page({
     openAttr: false,
     specificationList: {},
     checkedSpecText: '请选择规格数量',
-    number: 1
+    number: 1,
+    isAdd: true
   },
   onLoad: function (options) {
     // 页面初始化 options为页面跳转所带来的参数
@@ -248,14 +249,6 @@ Page({
     }, 'POST').then(function (res) {
       if (res.errno === 0) {
         console.log(res.data);
-        if (res.errmsg) {
-          wx.showModal({
-            title: '修改失败',
-            showCancel: false,
-            content: res.errmsg
-          })
-        }
-
         that.setCommonData(res);
       } else {
         // util.showErrorToast(res.errmsg);

+ 28 - 9
wx-mall/pages/cart/cart.wxml

@@ -14,7 +14,7 @@
       </view>
     </view>
   </view>
-  <view class="cart-view" wx:if="{{cartGoods.length > 0}}">
+  <view class="cart-view" >
     <!-- <view class="group-item" wx:if="{{couponInfoList.length > 0}}">
       <view class="coupon-info header" wx:for="{{couponInfoList}}" wx:key="{{item}}">
         <text class="txt" wx:if="{{item.type===0}}">{{item.msg}}</text>
@@ -26,7 +26,9 @@
     <view class="list">
       <view class="group-item">
         <view class="goods">
-          <view wx:if="{{cartGoods00.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus00 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="00"><text class="title-name">保税仓</text></view>
+          <view wx:if="{{cartGoods00.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus00 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="00">
+          <image src="../../../static/images/service-bao.png" class="search-icon-shop"></image>
+          <text class="title-name ">保税仓</text></view>
           <view class="item" wx:for="{{cartGoods}}" wx:if="{{item.goodsBizType == 00}}" wx:key="{{item.id}}">
             <view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-item-index="{{index}}"></view>
             <view class="cart-goods">
@@ -50,7 +52,9 @@
                   <view class="selnum">
                     <view class="cut" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="cutNumber"></view>
                     <input value="{{item.number}}" class="number" disabled="true" type="number" />
-                    <view class="add" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="addNumber"></view>
+                    
+                    <image class="add2" src="{{item.number < item.stockNum ? '/static/images/service-hsjh.png':'/static/images/service-ehsjh.png'}}" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" catchtap="{{item.number < item.stockNum ?  'addNumber' : ''}}"></image>
+                    
                   </view>
                 </view>
                 <view class="handle">
@@ -60,7 +64,10 @@
             </view>
           </view>
 
-        <view wx:if="{{cartGoods02.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus02 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="02"><text class="title-name">保税展示</text></view>
+        <view wx:if="{{cartGoods02.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus02 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="02">
+          <image src="../../../static/images/service-zs.png" class="search-icon-shop"></image>
+          <text class="title-name">保税展示</text>
+        </view>
 
           <view class="item" wx:for="{{cartGoods}}" wx:if="{{item.goodsBizType == 02}}" wx:key="{{item.id}}">
             <view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-item-index="{{index}}"></view>
@@ -85,7 +92,9 @@
                   <view class="selnum">
                     <view class="cut" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="cutNumber"></view>
                     <input value="{{item.number}}" class="number" disabled="true" type="number" />
-                    <view class="add" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="addNumber"></view>
+                    
+                    <image class="add2" src="{{item.number < item.stockNum ? '/static/images/service-hsjh.png':'/static/images/service-ehsjh.png'}}" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" catchtap="{{item.number < item.stockNum ?  'addNumber' : ''}}"></image>
+                    
                   </view>
                 </view>
                 <view class="handle">
@@ -96,7 +105,10 @@
           </view>
 
    
-          <view wx:if="{{cartGoods10.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus10 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="10"><text class="title-name">现场速递</text></view>
+          <view wx:if="{{cartGoods10.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus10 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="10">
+            <image src="../../../static/images/service-ziti.png" class="search-icon-shop"></image>
+            <text class="title-name">现场速递</text>
+          </view>
 
           <view class="item" wx:for="{{cartGoods}}" wx:if="{{item.goodsBizType == 10}}" wx:key="{{item.id}}">
             <view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-item-index="{{index}}"></view>
@@ -121,7 +133,9 @@
                   <view class="selnum">
                     <view class="cut" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="cutNumber"></view>
                     <input value="{{item.number}}" class="number" disabled="true" type="number" />
-                    <view class="add" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="addNumber"></view>
+                    
+                    <image class="add2" src="{{item.number < item.stockNum ? '/static/images/service-hsjh.png':'/static/images/service-ehsjh.png'}}" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" catchtap="{{item.number < item.stockNum ?  'addNumber' : ''}}"></image>
+                    
                   </view>
                 </view>
                 <view class="handle">
@@ -132,7 +146,10 @@
           </view>
    
 
-          <view wx:if="{{cartGoods11.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus11 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="11"><text class="title-name">普通商品</text></view>
+          <view wx:if="{{cartGoods11.length != 0}}" class="checkbox-biz-type {{checkedTypeStatus11 ? 'checked' : ''}}" bindtap="checkedAllGoodType" data-goods-Biz-Type="11">
+            <image src="../../../static/images/service-ptsp.png" class="search-icon-shop"></image>
+            <text class="title-name">普通商品</text>
+          </view>
 
           <view class="item" wx:for="{{cartGoods}}" wx:if="{{item.goodsBizType == 11}}" wx:key="{{item.id}}">
             <view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-item-index="{{index}}"></view>
@@ -156,7 +173,9 @@
                   <view class="selnum">
                     <view class="cut" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="cutNumber"></view>
                     <input value="{{item.number}}" class="number" disabled="true" type="number" />
-                    <view class="add" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" bindtap="addNumber"></view>
+                   
+                    <image class="add2" src="{{item.number < item.stockNum ? '/static/images/service-hsjh.png':'/static/images/service-ehsjh.png'}}" data-goods-id="{{item.id}}" data-item-index="{{index}}" data-product-id="{{item.product_id}}" catchtap="{{item.number < item.stockNum ?  'addNumber' : ''}}"></image>
+                    
                   </view>
                 </view>
                 <view class="handle">

+ 34 - 16
wx-mall/pages/cart/cart.wxss

@@ -42,7 +42,7 @@ page {
 .no-cart .c {
   width: 100%;
   height: auto;
-  margin-top: 200rpx;
+  margin-top: 300rpx;
 }
 
 .no-cart .c image {
@@ -66,11 +66,11 @@ page {
 
 .title-box {
   width: 100%;
-  padding-top: 330rpx;
+  padding-top: 98rpx;
   text-align: center;
   font-size: 28rpx;
   color: #999;
-  background: url(http://image.meiping123.com/upload/20180104/1055343561cd30.png) no-repeat center 205rpx;
+  background: url(http://image.meiping123.com/upload/20180104/1055343561cd30.png) no-repeat center 5rpx;
   background-size: 100rpx auto;
   margin-bottom: 50rpx;
 }
@@ -86,6 +86,7 @@ page {
   font-size: 28rpx;
   margin: 0 auto;
   display: block;
+  margin-bottom:180rpx;
 }
 
 .cart-view .group-item .header {
@@ -126,7 +127,7 @@ page {
   float: left;
   height: 34rpx;
   width: 5%;
-  margin: 65rpx 18rpx 65rpx 26rpx;
+  margin: 65rpx 18rpx 65rpx 22rpx;
   background: url(http://image.meiping123.com/upload/20180104/105653607bcb4b.png) no-repeat;
   background-size: 34rpx;
 }
@@ -256,6 +257,12 @@ page {
   background-size: 100% 100%;
 }
 
+.goods .number-item .selnum .add2 {
+  display: block;
+  width: 52rpx;
+  height: 52rpx;
+}
+
 .cart-view .item .b {
   height: 28rpx;
   line-height: 28rpx;
@@ -637,18 +644,6 @@ page {
   color: #fff;
 }
 
-.title-name {
-  width: 100%;
-  height: 30rpx;
-  text-align: center;
-  font-size: 28rpx;
-  color: rgba(87, 86, 86, 0.63);
-  background:url(http://image.meiping123.com/upload/20180104/1055343561cd30.png) no-repeat center 205rpx;
-  background-size: 100rpx 100rpx;
-  margin-left: 60rpx;
-  font-weight: bolder;
-}
-
 .checkbox-biz-type {
   float: left;
   height: 30rpx;
@@ -662,4 +657,27 @@ page {
 .checkbox-biz-type.checked {
   background: url(http://image.meiping123.com/upload/20180104/1057387862b4e8.png) no-repeat;
   background-size: 30rpx;
+}
+
+.search-icon-shop {
+  width: 30rpx;
+  height: 30rpx;
+  /* margin-left: 15rpx;
+  margin-top: 20rpx; 
+  margin-bottom:-18rpx;*/
+  margin-left:60rpx;
+
+}
+
+
+.title-name {
+  width: 100%;
+  height: 30rpx;
+  line-height: 30rpx;
+  text-align: left;
+  font-size: 28rpx;
+  color: rgba(87, 86, 86, 0.63);
+  margin-left: 10rpx;
+  font-weight: bolder;
+  padding-bottom: 10rpx;
 }

+ 2 - 2
wx-mall/pages/catalog/catalog.wxml

@@ -60,12 +60,12 @@
       <view class="item {{goodsBizType == '00' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultActivity">
         <text class="txt">保税仓</text>
       </view>
-      <view class="item by-sell {{goodsBizType == '02' ? 'active' : ''}}" bindtap="openSortFilter" id="discountActivity">
+      <!-- <view class="item by-sell {{goodsBizType == '02' ? 'active' : ''}}" bindtap="openSortFilter" id="discountActivity">
         <text class="txt">保税展示</text>
       </view>
       <view class="item by-price {{goodsBizType == '10' ? 'active' : ''}}" bindtap="openSortFilter" id="groupActivity">
         <text class="txt">现场速递</text>
-      </view>
+      </view> -->
       <view class="item by-price {{goodsBizType == '11' ? 'active' : ''}}" bindtap="openSortFilter" id="ordActivity">
         <text class="txt">普通商品</text>
       </view>

+ 36 - 14
wx-mall/pages/goods/goods.js

@@ -27,7 +27,10 @@ Page({
     noCollectImage: "/static/images/icon_collect.png",
     hasCollectImage: "/static/images/icon_collect_checked.png",
     collectBackImage: "/static/images/icon_collect.png",
-    showNavList: false
+    showNavList: false,
+    stockNum: 0,
+    cartNumber: 0,
+    defaultFreight: 0
   },
   toggleNav() {
     this.setData({
@@ -53,7 +56,10 @@ Page({
           brand: res.data.brand,
           specificationList: res.data.specificationList,
           productList: res.data.productList,
-          userHasCollect: res.data.userHasCollect
+          userHasCollect: res.data.userHasCollect,
+          stockNum: res.data.stockNum,
+          cartNumber: res.data.cartNumber,
+          defaultFreight: res.data.defaultFreight
         });
 
         if (res.data.userHasCollect == 1) {
@@ -77,7 +83,7 @@ Page({
         for (let i = 0; i < _specificationList.length; i++) {
           if (_specificationList[i].valueList.length == 1) {
             //如果已经选中,则反选
-            _specificationList[i].valueList[0].checked = true;
+            _specificationList[i].valueList[0].checked = false;
           }
         }
         that.setData({
@@ -244,6 +250,11 @@ Page({
     this.setData({
       openAttr: !this.data.openAttr
     })
+  },  
+  hideSwitchAttrPop: function() {
+    this.setData({
+      openAttr: false
+    })
   },
   closeAttrOrCollect: function () {
     let that = this;
@@ -291,22 +302,32 @@ Page({
         return false;
       }
 
-      //根据选中的规格,判断是否有对应的sku信息
-      let checkedProduct = goodsUtil.getCheckedProductItem(goodsUtil.getCheckedSpecKey(that), that);
-      if (!checkedProduct || checkedProduct.length <= 0) {
-        wx.showToast({
-          title: '库存不足',
-          mask: true
-        });
+      if (that.data.number + that.data.cartNumber > that.data.stockNum){
+        // wx.showToast({
+        //   title: '库存不足',
+        //   mask: true
+        // });
+        util.showErrorToast('库存不足');
         //找不到对应的product信息,提示没有库存
         return false;
       }
 
+      // //根据选中的规格,判断是否有对应的sku信息
+      let checkedProduct = goodsUtil.getCheckedProductItem(goodsUtil.getCheckedSpecKey(that), that);
+      // if (!checkedProduct || checkedProduct.length <= 0) {
+      //   wx.showToast({
+      //     title: '库存不足',
+      //     mask: true
+      //   });
+      //   //找不到对应的product信息,提示没有库存
+      //   return false;
+      // }
+
       //验证库存
-      if (checkedProduct.goods_number < this.data.number) {
-        //找不到对应的product信息,提示没有库存
-        return false;
-      }
+      // if (checkedProduct.goods_number < this.data.number) {
+      //   //找不到对应的product信息,提示没有库存
+      //   return false;
+      // }
 
       //添加到购物车
       util.request(api.CartAdd, {
@@ -341,6 +362,7 @@ Page({
             });
           }
         });
+
     }
   },
   cutNumber: function () {

+ 19 - 14
wx-mall/pages/goods/goods.wxml

@@ -37,37 +37,40 @@
     <view wx:if="{{showNavList}}" class="close" bindtap="toggleNav">X</view>
   </view>
   <view>
-    <swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
+    <swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000" bindtap="hideSwitchAttrPop">
       <swiper-item wx:for="{{gallery}}" wx:key="{{item.id}}">
         <image src="{{item.img_url}}" background-size="cover"></image>
       </swiper-item>
     </swiper>
-    <view class="service-policy">
+    <!-- <view class="service-policy">
       <view class="item">30分钟速达</view>
       <view class="item">每日优选生鲜</view>
       <view class="item">满88元免运费</view>
-    </view>
+    </view> -->
     <view class="goods-info">
-      <view class="c">
-        <text class="name">{{goods.name}}</text>
-        <text class="desc">{{goods.goods_brief}}</text>
+      <view class="c" bindtap="hideSwitchAttrPop">
         <view class="goods-do">
           <text class="price">¥{{goods.retail_price}}</text>
           <text class="org-price line-through">¥{{goods.market_price}}</text>
         </view>
+        <text class="name">{{goods.name}}</text>
+        <text class="desc">{{goods.goods_brief}}</text>
         <!-- <view class="brand" wx:if="{{brand.name}}">
           <navigator url="../brandDetail/brandDetail?id={{brand.id}}">
             <text>{{brand.name}}</text>
           </navigator>
         </view> -->
+        <view>
+          <text class="desc">快递:{{defaultFreight==0?"免邮":"元"}}</text>
+        </view>
       </view>
     </view>
     <view class="section-nav section-attr" bindtap="switchAttrPop">
-      <view class="t">请选择规格数量</view>
+      <view class="t">{{checkedSpecText=="请选择规格数量"?"请选择规格数量":"已选:【"+checkedSpecText+"】"}}</view>
       <image class="i" src="../../static/images/address_right.png" background-size="cover"></image>
     </view>
 
-    <view class="crash-goods" wx:if="{{crashList.length > 0}}">
+    <view class="crash-goods" wx:if="{{crashList.length > 0}}" bindtap="hideSwitchAttrPop">
       <view class="h">
         <view class="line"></view>
         <text class="title">搭配减价</text>
@@ -96,7 +99,7 @@
       </view>
       <image class="i" src="../../static/images/address_right.png" background-size="cover"></image>
     </view>-->
-    <view class="comments" wx:if="{{comment.count > 0}}">
+    <view class="comments" wx:if="{{comment.count > 0}}"  bindtap="hideSwitchAttrPop">
       <view class="h">
         <navigator url="../comment/comment?valueId={{goods.id}}&typeId=0">
           <text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
@@ -122,7 +125,7 @@
         </view>
       </view>
     </view>
-    <view class="goods-attr">
+    <view class="goods-attr" bindtap="hideSwitchAttrPop">
       <view class="t">商品参数</view>
       <view class="l">
         <view class="item" wx:for="{{attribute}}" wx:key="{{item.name}}">
@@ -132,13 +135,13 @@
       </view>
     </view>
 
-    <view class="detail">
+    <view class="detail"  bindtap="hideSwitchAttrPop">
       <import src="../../lib/wxParse/wxParse.wxml" />
       <template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
     </view>
 
 
-    <view class="common-problem">
+    <view class="common-problem" bindtap="hideSwitchAttrPop">
       <view class="h">
         <view class="line"></view>
         <text class="title">常见问题</text>
@@ -183,13 +186,15 @@
         <view class="c">
           <view class="p">价格:¥{{goods.retail_price}}</view>
           <view class="a" wx:if="{{productList.length>0}}">已选择:{{checkedSpecText}}</view>
+          <view class="a">库存{{stockNum}}件</view>
+          
         </view>
       </view>
     </view>
     <view class="spec-con">
       <view class="spec-item" wx:for="{{specificationList}}" wx:key="{{item.specification_id}}">
         <view class="name">{{item.name}}</view>
-        <view class="values">
+        <view class="values">        
           <view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name-id="{{vitem.specification_id}}">{{vitem.value}}</view>
         </view>
       </view>
@@ -199,7 +204,7 @@
         <view class="selnum">
           <view class="cut" bindtap="cutNumber">-</view>
           <input value="{{number}}" class="number" disabled="true" type="number" />
-          <view class="add" bindtap="addNumber">+</view>
+          <view class="{{number+cartNumber>= stockNum? 'addEnabel':'add'}}" bindtap="{{number+cartNumber>= stockNum ? '':'addNumber'}}">+</view>
         </view>
       </view>
     </view>

+ 14 - 5
wx-mall/pages/goods/goods.wxss

@@ -52,14 +52,16 @@
 .goods-info .c text {
   display: block;
   width: 687.5rpx;
-  text-align: center;
+  text-align: left;
+  font-weight: bolder;
 }
 
 .goods-info .name {
   height: 41rpx;
   margin-bottom: 5.208rpx;
-  font-size: 41rpx;
+  font-size: 35rpx;
   line-height: 41rpx;
+  margin-top: 10rpx;
 }
 
 .goods-info .desc {
@@ -71,7 +73,7 @@
 }
 
 .goods-info .goods-do {
-  text-align:center;
+  text-align:left;
 }
 
 .goods-info .goods-do .price {
@@ -80,7 +82,7 @@
   line-height: 35rpx;
   color: #b4282d;
   display: inline;
-  text-align: center;
+  text-align: left;
 }
 
 .goods-info .goods-do .org-price {
@@ -89,7 +91,7 @@
   line-height: 35rpx;
   color: #303030;
   display: inline;
-  text-align: center;
+  text-align: left;
 }
 
 .goods-info .brand {
@@ -748,6 +750,13 @@
   text-align: center;
   line-height: 65rpx;
 }
+.number-item .addEnabel {
+  width: 93.75rpx;
+  height: 100%;
+  text-align: center;
+  line-height: 65rpx;
+  color: #ccc;
+}
 
 .line-through {
   text-decoration: line-through;

+ 1 - 1
wx-mall/pages/index/index.js

@@ -52,7 +52,7 @@ Page({
           // brand: res.data.brandList,
           // floorGoods: res.data.categoryList,
           banner: res.data.banner,
-          groupBanner: res.data.groupBanner,
+          // groupBanner: res.data.groupBanner,
           channel: res.data.channel
         });
       }

+ 6 - 2
wx-mall/pages/index/index.wxml

@@ -39,18 +39,22 @@
       <image src="../../static/images/service-bao.png" background-size="cover"></image>
       <text>保税仓</text>
     </navigator>
-    <navigator class="itemb" bindtap="goCatalog" data-goods-Biz-Type="02">
+    <!-- <navigator class="itemb" bindtap="goCatalog" data-goods-Biz-Type="02">
       <image src="../../static/images/service-zs.png" background-size="cover"></image>
       <text>保税展示</text>
     </navigator>
     <navigator class="itemb" bindtap="goCatalog" data-goods-Biz-Type="10">
       <image src="../../static/images/service-ziti.png" background-size="cover"></image>
       <text>现场速递</text>
-    </navigator>
+    </navigator> -->
     <navigator class="itemb" bindtap="goCatalog" data-goods-Biz-Type="11">
       <image src="../../static/images/service-ptsp.png" background-size="cover"></image>
       <text>普通商品</text>
     </navigator>
+    <navigator class="itemb" bindtap="scanGoodsCode">
+      <image src="../../static/images/service-smgw.png" background-size="cover"></image>
+      <text>扫码购物</text>
+    </navigator>
 
   </view>
   <!-- <view class="m-menu">

+ 20 - 14
wx-mall/pages/shopping/checkout/checkout.js

@@ -12,22 +12,25 @@ Page({
     couponList: [],
     goodsBizTypeList: ['00','02','10','11'],
     goodsTotalPrice: 0.00, //商品总价
-    freightPrice: 0.00,    //快递费
+    freightPrice00: 0.00,    //备货业务快递费
+    freightPrice02: 0.00,    //补货业务快递费
+    freightPrice10: 0.00,    //现场发包快递费
+    freightPrice11: 0.00,    //普通商品快递费
     couponPrice: 0.00,     //优惠券的价格
     orderTotalPrice: 0.00,  //订单总价
     actualPrice: 0.00,     //实际需要支付的总价
     userCouponId: 0,
     fullCutCouponId: 0,
     fullCutCouponDec: 0, //满减优惠券
-    goodsTotalByType00: 0,
-    goodsTotalByType02: 0,
-    goodsTotalByType10: 0,
-    goodsTotalByType11: 0, 
+    goodsTotalByType00: 0,//备货业务商品总计
+    goodsTotalByType02: 0,//补货业务商品总计
+    goodsTotalByType10: 0,//现场发包商品总计
+    goodsTotalByType11: 0, //普通商品商品总计
     postscript: "",
-    postscript00: '',
-    postscript02: '',
-    postscript10: '',
-    postscript11: '',
+    postscript00: '',//备货业务备注
+    postscript02: '',//补货业务备注
+    postscript10: '',//现场发包备注
+    postscript11: '',//普通商品备注
     checkStore: false,
     storeVo: {},
     delivery_date: '',
@@ -105,7 +108,10 @@ Page({
           couponList: res.data.couponList,
           fullCutCouponId: res.data.fullCutCouponId,
           couponPrice: res.data.couponPrice,
-          freightPrice: res.data.freightPrice,
+          freightPrice00: res.data.freightPrice00,
+          freightPrice02: res.data.freightPrice02,
+          freightPrice10: res.data.freightPrice10,
+          freightPrice11: res.data.freightPrice11,
           goodsTotalPrice: res.data.goodsTotalPrice,
           orderTotalPrice: res.data.orderTotalPrice,
           fullCutCouponDec: res.data.fullCutCouponDec,
@@ -164,10 +170,10 @@ Page({
           goodsTotalByType02: num02,
           goodsTotalByType10: num10,
           goodsTotalByType11: num11,
-          goodsTotalPrice00: goodsTotalPrice00,
-          goodsTotalPrice02: goodsTotalPrice02,
-          goodsTotalPrice10: goodsTotalPrice10,
-          goodsTotalPrice11: goodsTotalPrice11
+          goodsTotalPrice00: goodsTotalPrice00 + that.data.freightPrice00,
+          goodsTotalPrice02: goodsTotalPrice02 + that.data.freightPrice02,
+          goodsTotalPrice10: goodsTotalPrice10 + that.data.freightPrice10,
+          goodsTotalPrice11: goodsTotalPrice11 + that.data.freightPrice11
         });
         // console.log(that.data.goodsTotalByType00);
         // console.log(that.data.goodsTotalByType02);

+ 30 - 14
wx-mall/pages/shopping/checkout/checkout.wxml

@@ -51,7 +51,7 @@
     <text class='id-card-txt'>身份证信息用于跨境商品入境申报,请输入购买者姓名和身份证号码一致的身份证信息确保正常清关;姓名需要与身份证信息一致。</text>
   </view>
   
-<view class="{{goodsTotalByType11==0 && goodsTotalByType10==0 && goodsTotalByType02==0 && goodsTotalByType00!=0 ?'goods-items-all-end':'goods-items-all'}}"  wx:if="{{goodsTotalByType00!=0}}">
+<view class="{{goodsTotalByType11==0 && goodsTotalByType10==0 && goodsTotalByType02==0 && goodsTotalByType00!=0 && couponList.length == 0 ?'goods-items-all-end':'goods-items-all'}}"  wx:if="{{goodsTotalByType00!=0}}">
   <view class='item-view'><text class="biz-type">保税仓</text></view>
   <view class="goods-items">
     <view class="item" wx:for="{{checkedGoodsList}}" wx:if="{{item.goodsBizType==00}}" wx:key="{{item.id}}">
@@ -85,17 +85,17 @@
         <view class="list-label">配送方式</view>
       </view>
       <view class="list-cell-checked-ft">
-        <text class="txt">{{freightPrice==0?'快递免邮': '¥'+freightPrice}}</text>
+        <text class="txt">{{freightPrice00==0?'快递免邮': '¥'+freightPrice00}}</text>
       </view>
     </view>
-    <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
+    <!-- <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
       <view class="list-cell-checked-bd">
         <view class="list-label">满减</view>
       </view>
       <view class="list-cell-checked-ft">
         <text class="red-txt">-¥{{fullCutCouponDec}}</text>
       </view>
-    </view>
+    </view> -->
     <view class="list-cell-checked">
       <view class="list-cell-checked-hd">
         <view class="list-label">留言:</view>
@@ -118,7 +118,7 @@
   </view>
   </view>
 
-  <view class="{{goodsTotalByType11==0 && goodsTotalByType10==0 && goodsTotalByType02!=0?'goods-items-all-end':'goods-items-all'}}" wx:if="{{goodsTotalByType02!=0}}">
+  <view class="{{goodsTotalByType11==0 && goodsTotalByType10==0 && goodsTotalByType02!=0 && couponList.length == 0?'goods-items-all-end':'goods-items-all'}}" wx:if="{{goodsTotalByType02!=0}}">
     <view class='item-view'><text class="biz-type">保税展示</text></view>
     <view class="goods-items">
       <view class="item" wx:for="{{checkedGoodsList}}" wx:if="{{item.goodsBizType==02}}" wx:key="{{item.id}}">
@@ -151,17 +151,17 @@
         <view class="list-label">配送方式</view>
       </view>
       <view class="list-cell-checked-ft">
-        <text class="txt">{{freightPrice==0?'快递免邮': '¥'+freightPrice}}</text>
+        <text class="txt">{{freightPrice02==0?'快递免邮': '¥'+freightPrice02}}</text>
       </view>
     </view>
-    <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
+    <!-- <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
       <view class="list-cell-checked-bd">
         <view class="list-label">满减</view>
       </view>
       <view class="list-cell-checked-ft">
         <text class="red-txt">-¥{{fullCutCouponDec}}</text>
       </view>
-    </view>
+    </view> -->
     <view class="list-cell-checked">
       <view class="list-cell-checked-hd">
         <view class="list-label">留言:</view>
@@ -183,7 +183,7 @@
   </view>
   </view>
 
-  <view class="{{goodsTotalByType11==0 && goodsTotalByType10!=0 ?'goods-items-all-end':'goods-items-all'}}" wx:if="{{goodsTotalByType10!=0}}">
+  <view class="{{goodsTotalByType11==0 && goodsTotalByType10!=0 && couponList.length == 0 ?'goods-items-all-end':'goods-items-all'}}" wx:if="{{goodsTotalByType10!=0}}">
     <view class='item-view'><text class="biz-type">现场速递</text></view>
     <view class="goods-items">
       <view class="item" wx:for="{{checkedGoodsList}}" wx:if="{{item.goodsBizType==10}}" wx:key="{{item.id}}">
@@ -215,7 +215,7 @@
         <view class="list-label">配送方式</view>
       </view>
       <view class="list-cell-checked-ft">
-        <text class="txt">{{freightPrice==0?'快递免邮': '¥'+freightPrice}}</text>
+        <text class="txt">{{freightPrice10==0?'快递免邮': '¥'+freightPrice10}}</text>
       </view>
     </view>
     <!-- <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
@@ -248,7 +248,7 @@
   </view>
   </view>
 
-  <view class="{{goodsTotalByType11!=0?'goods-items-all-end':'goods-items-all'}}" wx:if="{{goodsTotalByType11!=0}}">
+  <view class="{{goodsTotalByType11!=0 && couponList.length == 0?'goods-items-all-end':'goods-items-all'}}" wx:if="{{goodsTotalByType11!=0}}">
     <view class='item-view'><text class="biz-type">普通商品</text></view>
     <view class="goods-items">
       <view class="item" wx:for="{{checkedGoodsList}}" wx:if="{{item.goodsBizType==11}}" wx:key="{{item.id}}">
@@ -280,17 +280,17 @@
         <view class="list-label">配送方式</view>
       </view>
       <view class="list-cell-checked-ft">
-        <text class="txt">{{freightPrice==0?'快递免邮': '¥'+freightPrice}}</text>
+        <text class="txt">{{freightPrice11==0?'快递免邮': '¥'+freightPrice11}}</text>
       </view>
     </view>
-    <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
+    <!-- <view class="list-cell-checked" wx:if="{{fullCutCouponDec!=0}}">
       <view class="list-cell-checked-bd">
         <view class="list-label">满减</view>
       </view>
       <view class="list-cell-checked-ft">
         <text class="red-txt">-¥{{fullCutCouponDec}}</text>
       </view>
-    </view>
+    </view> -->
     <view class="list-cell-checked">
       <view class="list-cell-checked-hd">
         <view class="list-label">留言:</view>
@@ -311,8 +311,23 @@
       </view>
     </view>
   </view>
+  
 </view>
 
+  <view class="goods-items-all-end" wx:if="{{couponList.length > 0}}">
+    
+    <view class="list-cell-checked" bindtap="selectCoupon" wx:if="{{couponList.length > 0}}">
+      <view class="list-cell-checked-bd">
+        <text wx:if="{{checkedCoupon.id > 0}}" class="name">优惠券:{{checkedCoupon.coupon_name}}</text>
+        <text wx:if="{{!checkedCoupon}}" class="name">优惠券:未选择</text>
+      </view>
+      <view class="list-cell-checked-ft router">
+        <text wx:if="{{checkedCoupon.id > 0}}" class="money red-txt">-¥{{checkedCoupon.type_money}}</text>
+        <text wx:if="{{!checkedCoupon}}" class="txt">{{couponList.length}}张</text>
+      </view>
+    </view>
+  </view>
+
 <!-- 
     <view class="list-cell">
       
@@ -326,6 +341,7 @@
     </view > -->
 
 
+
     <view class="order-total">
       <view class="l">实付:¥{{actualPrice}}</view>
       <button class="r" form-type="submit" wx:if="{{!isEditCart}}">去付款</button>

+ 1 - 1
wx-mall/pages/shopping/checkout/checkout.wxss

@@ -330,7 +330,7 @@ page {
   overflow: hidden;
   background: #fff;
   /* padding-left: 31.25rpx; */
-  margin-bottom: 140rpx;
+  padding-bottom: 200rpx;
   margin-left:10rpx;
 }
 .goods-items-all-end .item-view {

+ 6 - 0
wx-mall/pages/ucenter/coupon/coupon.js

@@ -67,5 +67,11 @@ Page({
         util.showErrorToast(res.errmsg);
       }
     });
+  },
+  linkCoupon(event){
+    let url = event.currentTarget.dataset.couponUrl;
+    wx.switchTab({
+      url: url,
+    });
   }
 })

+ 4 - 3
wx-mall/pages/ucenter/coupon/coupon.wxml

@@ -2,12 +2,12 @@
   <view class="coupon-form">
     <view class="input-box">
       <input class="coupon-sn" placeholder="请输入优惠码" bindinput="bindCouponNumberInput" />
-      <image class="clear-icon" src="/static/images.clear.png"></image>
+      <image class="clear-icon" src="/static/images/clear.png"></image>
     </view>
     <button class="add-btn" bindtap="exchangeCoupon">兑换</button>
   </view>
   <view class="help">使用说明</view>
-  <view style="margin: 5px 10px;" wx:for="{{couponList}}" wx:key="{{item.id}}" bindtap="" data-coupon-id="{{item.id}}">
+  <view style="margin: 5px 10px;" wx:for="{{couponList}}" wx:key="{{item.id}}" bindtap="linkCoupon" data-coupon-Url ="{{item.couponUrl}}" data-coupon-id="{{item.id}}">
     <view class="coupon-box coupon-box1 coupon-box-g">
       <view class="coupon-bg coupon-bg1">
         <view>
@@ -19,7 +19,8 @@
         <view class="coupon-title">{{ item.coupon_name }}</view>
         <view class="coupon-desc">
           <view>{{ item.add_time }}-{{ item.end_time }}</view>
-          <view>{{ null!=item.coupon_txt?item.coupon_txt:"" }}</view>
+          <view style='font-size:24rpx;color:#000;'>{{ item.isAll==1 ? '全场商品可用,不可抵扣运费':'' }}</view>
+          <view style='font-size:24rpx;color:#b4282d;'>{{'满'+item.min_goods_amount+'可用' }}</view>
         </view>
       </view>
     </view>

+ 5 - 5
wx-mall/pages/ucenter/order/order.wxml

@@ -2,7 +2,7 @@
   <view class="tab-bar">
     <view wx:for="{{tabList}}" wx:key="{{index}}" bindtap="toggleTab" data-index="{{index}}" class="tab-bar-item {{ index == tabIndex ? 'active' : '' }}">{{ item }}</view>
   </view>
-  <view style='height:40rpx;margin-left:20rpx;margin-top:-10rpx;padding-bottom: 10rpx;'>
+  <view style='height:40rpx;margin-left:20rpx;margin-top:-10rpx;margin-bottom: 20rpx;'>
     <text style='font-size:24rpx;color:red;'>
       * 非保税仓商品不允许再来一单,需门店扫描二维码进行购买
     </text>
@@ -13,13 +13,13 @@
         <view class="list-cell-bd">
           <view class="list-label" style="color: #FE7200;">
             
-            <image wx:if="{{item.orderBizType==00}}" src="../../../static/images/service-bao.png" class="search-icon-shop" bindtap="scanGoodsCode"></image>
+            <image wx:if="{{item.orderBizType==00}}" src="../../../static/images/service-bao.png" class="search-icon-shop"></image>
             <text class="biz-type" wx:if="{{item.orderBizType==00}}"> 保税仓 </text>
-            <image wx:if="{{item.orderBizType==02}}" src="../../../static/images/service-zs.png" class="search-icon-shop" bindtap="scanGoodsCode"></image>
+            <image wx:if="{{item.orderBizType==02}}" src="../../../static/images/service-zs.png" class="search-icon-shop"></image>
             <text class="biz-type" wx:if="{{item.orderBizType==02}}">保税展示</text>
-            <image wx:if="{{item.orderBizType==10}}" src="../../../static/images/service-ziti.png" class="search-icon-shop" bindtap="scanGoodsCode"></image>
+            <image wx:if="{{item.orderBizType==10}}" src="../../../static/images/service-ziti.png" class="search-icon-shop"></image>
             <text class="biz-type" wx:if="{{item.orderBizType==10}}">现场速递</text>
-            <image wx:if="{{item.orderBizType==11}}" src="../../../static/images/service-ptsp.png" class="search-icon-shop" bindtap="scanGoodsCode"></image>
+            <image wx:if="{{item.orderBizType==11}}" src="../../../static/images/service-ptsp.png" class="search-icon-shop"></image>
             <text class="biz-type" wx:if="{{item.orderBizType==11}}">普通商品</text> 
             
             <!-- <text class="add_time">{{item.add_time}}{{orderList[0].id}}</text> -->

BIN
wx-mall/static/images/icon_collect_checked.png


BIN
wx-mall/static/images/service-ehsjh.png


BIN
wx-mall/static/images/service-hsjh.png


BIN
wx-mall/static/images/service-smgw.png