瀏覽代碼

Merge branch 'master' of hyq/kmall-pt into master

黄亚琴 6 年之前
父節點
當前提交
8a35721492

+ 67 - 35
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -53,13 +53,14 @@ public class ApiCartController extends ApiBaseAction {
      * 获取购物车中的数据
      */
     @GetMapping("getCartMoney")
-    public Object getCartMoney(@LoginUser UserVo loginUser) {
+    public Object getCartMoney(@LoginUser UserVo loginUser, String checkCart) {
         Map<String, Object> resultObj = new HashMap();
         //查询列表数据
         Map param = new HashMap();
         param.put("user_id", loginUser.getId());
         Long storeId = getStoreId();
         param.put("store_id", storeId);
+        param.put("checkCart",checkCart);
         List<CartVo> cartList = cartService.queryList(param);
         //获取购物车统计信息
         Integer goodsCount = 0;
@@ -91,7 +92,7 @@ public class ApiCartController extends ApiBaseAction {
      * 获取购物车中的数据
      */
     @GetMapping("getCart")
-    public Object getCart() {
+    public Object getCart(String checkCart) {
         UserVo loginUser = new UserVo();
         loginUser.setId(getUserId());
         Map<String, Object> resultObj = new HashMap();
@@ -101,8 +102,8 @@ public class ApiCartController extends ApiBaseAction {
         Long storeId = getStoreId();
         param.put("store_id", storeId);
         param.put("merchSn", getMerchSn());
+        param.put("checkCart", checkCart);
         List<CartVo> cartList = cartService.queryList(param);
-
         List<CartVo> validCartList = cartService.queryValidCartList(param);
         //获取购物车统计信息
         Integer goodsCount = 0;
@@ -172,8 +173,14 @@ public class ApiCartController extends ApiBaseAction {
         cartTotal.put("goodsAmount", goodsAmount);
         cartTotal.put("checkedGoodsCount", checkedGoodsCount);
         cartTotal.put("checkedGoodsAmount", checkedGoodsAmount);
-        //
         resultObj.put("cartTotal", cartTotal);
+
+        param.put("checkCart","00");
+        int total00 = cartService.queryTotal(param);
+        param.put("checkCart","11");
+        int total11 = cartService.queryTotal(param);
+        resultObj.put("total00", total00);
+        resultObj.put("total11", total11);
         return resultObj;
     }
 
@@ -216,8 +223,8 @@ public class ApiCartController extends ApiBaseAction {
      * 获取购物车信息,所有对购物车的增删改操作,都要重新返回购物车的信息
      */
     @GetMapping("index")
-    public Object index() {
-        return toResponsSuccess(getCart());
+    public Object index(String checkCart) {
+        return toResponsSuccess(getCart(checkCart));
     }
 
     /**
@@ -229,6 +236,7 @@ public class ApiCartController extends ApiBaseAction {
         Long goodsId = jsonParam.getLong("goodsId");
         Long productId = jsonParam.getLong("productId");
         Integer number = jsonParam.getInteger("number");
+        String checkCart = jsonParam.getString("checkCart");
         //判断商品是否可以购买
         GoodsVo goodsInfo = goodsService.queryObject(goodsId);
         if (null == goodsInfo || goodsInfo.getIs_delete() == 1 || goodsInfo.getIs_on_sale() == 0) {
@@ -291,7 +299,7 @@ public class ApiCartController extends ApiBaseAction {
             cartInfo.setStockNum(productInfo.getStock_num());
             cartService.update(cartInfo);
         }
-        return toResponsSuccess(getCart());
+        return toResponsSuccess(getCart(checkCart));
     }
 
     /**
@@ -301,6 +309,7 @@ public class ApiCartController extends ApiBaseAction {
     public Object addByGoodsId(@LoginUser UserVo loginUser) {
         JSONObject jsonParam = getJsonRequest();
         Long goodsId = jsonParam.getLong("goodsId");
+        String checkCart = jsonParam.getString("checkCart");
         //判断商品是否可以购买
         GoodsVo goodsInfo = goodsService.queryObject(goodsId);
         if (null == goodsInfo || goodsInfo.getIs_delete() == 1 || goodsInfo.getIs_on_sale() == 0) {
@@ -311,7 +320,7 @@ public class ApiCartController extends ApiBaseAction {
         if (0 != MapUtils.getInteger("errno", resultObj)) {
             return toResponsObject(MapUtils.getInteger("errno", resultObj), MapUtils.getString("errmsg", resultObj), "");
         }
-        return toResponsSuccess(getCart());
+        return toResponsSuccess(getCart(checkCart));
     }
 
     /**
@@ -422,14 +431,15 @@ public class ApiCartController extends ApiBaseAction {
         Long productId = jsonParam.getLong("productId");
         Integer number = jsonParam.getInteger("number");
         Integer id = jsonParam.getInteger("id");
+        String checkCart = jsonParam.getString("checkCart");
         boolean isAdd = true;
         //取得规格的信息,判断规格库存
         ProductVo productInfo = productService.queryByStoreId(productId, storeId);
         if (null == productInfo) {
-            return this.toResponsObject(400, "商品已下架", getCart());
+            return this.toResponsObject(400, "商品已下架", getCart(checkCart));
         }
         if(productInfo.getStock_num() == null || number > productInfo.getStock_num() || productInfo.getStock_num() <= 0){
-            return this.toResponsObject(400, "该商品库存不足", getCart());
+            return this.toResponsObject(400, "该商品库存不足", getCart(checkCart));
         }
         String msg = "";
 //        if (productInfo.getStock_num() < number) {
@@ -444,7 +454,7 @@ public class ApiCartController extends ApiBaseAction {
             cartInfo.setNumber(number);
             cartInfo.setStockNum(productInfo.getStock_num());
             cartService.update(cartInfo);
-            return toResponsObject(0, msg, getCart());
+            return toResponsObject(0, msg, getCart(checkCart));
         }
 
         Map cartParam = new HashMap();
@@ -473,7 +483,7 @@ public class ApiCartController extends ApiBaseAction {
             cartInfo.setGoods_specification_ids(productInfo.getGoods_specification_ids());
             cartService.update(cartInfo);
         }
-        return toResponsObject(0, msg, getCart());
+        return toResponsObject(0, msg, getCart(checkCart));
     }
 
     /**
@@ -485,6 +495,7 @@ public class ApiCartController extends ApiBaseAction {
         String productIds = jsonParam.getString("productIds");
         Integer isChecked = jsonParam.getInteger("isChecked");
         String goodsBizType = jsonParam.getString("goodsBizType");
+        String checkCart = jsonParam.getString("checkCart");
         String[] productIdArray = null;
         if(StringUtils.isNullOrEmpty(goodsBizType)) {
             if (StringUtils.isNullOrEmpty(productIds)) {//点击全选时
@@ -500,7 +511,7 @@ public class ApiCartController extends ApiBaseAction {
             }
         }
         cartService.updateCheck(productIdArray, isChecked, loginUser.getId(), getStoreId());
-        return toResponsSuccess(getCart());
+        return toResponsSuccess(getCart(checkCart));
     }
 
     //删除选中的购物车商品,批量删除
@@ -508,11 +519,12 @@ public class ApiCartController extends ApiBaseAction {
     public Object delete(@LoginUser UserVo loginUser) {
         JSONObject jsonObject = getJsonRequest();
         Long cartId = jsonObject.getLong("cartId");
+        String checkCart = jsonObject.getString("checkCart");
         if (null == cartId) {
             return toResponsFail("删除出错");
         }
         cartService.delete(cartId);
-        return toResponsSuccess(getCart());
+        return toResponsSuccess(getCart(checkCart));
     }
 
     //  获取购物车商品的总件件数
@@ -545,7 +557,7 @@ public class ApiCartController extends ApiBaseAction {
      * 订单提交前的检验和填写相关订单信息
      */
     @GetMapping("checkout")
-    public Object checkout(@LoginUser UserVo loginUser, Long userCouponId,String merchSn) {
+    public Object checkout(@LoginUser UserVo loginUser, Long userCouponId, String merchSn, String checkCart) {
         Map<String, Object> resultObj = new HashMap();
         //选择的收货地址
         Map param = new HashMap();
@@ -554,7 +566,7 @@ public class ApiCartController extends ApiBaseAction {
         List<AddressVo> addressEntityList = addressService.queryList(param);
 
         //获取要购买的商品
-        Map<String, Object> cartData = (Map<String, Object>) this.getCartMoney(loginUser);
+        Map<String, Object> cartData = (Map<String, Object>) this.getCartMoney(loginUser,checkCart);
 
         List<CartVo> checkedGoodsList = new ArrayList();
         for (CartVo cartEntity : (List<CartVo>) cartData.get("cartList")) {
@@ -588,23 +600,44 @@ public class ApiCartController extends ApiBaseAction {
         BigDecimal freightPrice11 = new BigDecimal("00");
         //查询运费模板
         for (CartVo vo: checkedGoodsList) {
-            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
-                freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;
-            }
-            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_02.getItem())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
-                freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;
-            }
-            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_10.getItem())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
-                freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;
-            }
-            if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
-                freightPrice11 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice11;
+            if(org.apache.commons.lang.StringUtils.isEmpty(checkCart)){
+                if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                    freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;
+                }
+                if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_02.getItem())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                    freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;
+                }
+                if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_10.getItem())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                    freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;
+                }
+                if (vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())) {
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                    freightPrice11 = freightEntity != null ? freightEntity.getDefaultFreight() : freightPrice11;
+                }
+            }else{
+                if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(checkCart)) {
+                    if (vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())) {
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                        freightPrice11 = freightEntity != null ? freightEntity.getDefaultFreight() : freightPrice11;
+                    }
+                }else{
+                    if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                        freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;
+                    }
+                    if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_02.getItem())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                        freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;
+                    }
+                    if(vo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_10.getItem())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(vo.getGoods_id());
+                        freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;
+                    }
+                }
             }
-
         }
         // 计算优惠券 todo 暂时不计算全场金额满减
         BigDecimal fullCutCouponDec = Constant.ZERO;
@@ -620,7 +653,6 @@ public class ApiCartController extends ApiBaseAction {
         //订单的总价
         BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice00).add(freightPrice02).add(freightPrice10).add(freightPrice11);
 
-        //
         BigDecimal actualPrice = orderTotalPrice.subtract(fullCutCouponDec).subtract(couponPrice);  //减去其它支付的金额后,要实际支付的金额
 
         resultObj.put("freightPrice00", freightPrice00);
@@ -702,7 +734,7 @@ public class ApiCartController extends ApiBaseAction {
      * @return
      */
     @GetMapping("deleteValidCart")
-    public Object deleteValidCart() {
+    public Object deleteValidCart(String checkCart) {
         try{
             Map param = new HashMap();
             param.put("user_id", getUserId());
@@ -712,7 +744,7 @@ public class ApiCartController extends ApiBaseAction {
             for (CartVo cart: list) {
                 cartService.delete(cart.getId());
             }
-            return toResponsSuccess(getCart());
+            return toResponsSuccess(getCart(checkCart));
         }catch (Exception e){
             return toResponsFail("清空失败");
         }

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

@@ -106,7 +106,7 @@ public class ApiFootprintController extends ApiBaseAction {
      * 猜你喜欢
      */
     @GetMapping("glist")
-    public Object glist(@LoginUser UserVo loginUser,String storeId) {
+    public Object glist(@LoginUser UserVo loginUser,String storeId,String checkCart) {
         Map resultObj = new HashMap();
 
         //查询列表数据
@@ -117,6 +117,7 @@ public class ApiFootprintController extends ApiBaseAction {
         params.put("order", "desc");
         params.put("bizType", true);
         params.put("store_id", storeId);
+        params.put("checkCart", checkCart);
         List<FootprintVo> footprintVos = footprintService.queryList(params);
         List<FootprintVo> list = new ArrayList();
         if (null != footprintVos) {

+ 16 - 14
kmall-api/src/main/java/com/kmall/api/api/ApiPayController.java

@@ -169,20 +169,22 @@ public class ApiPayController extends ApiBaseAction {
                 } else if (result_code.equalsIgnoreCase(WechatUtil.WXTradeState.SUCCESS.getCode())) {
                     // 添加信息
                     for (OrderVo orderInfo: orderVoList) {
-                        CusPayDataOpenVo cusPayDataOpen = cusPayDataOpenService.queryObjectByOrderNo(orderInfo.getOrder_sn());
-                        if (cusPayDataOpen == null) {
-                            cusPayDataOpen = new CusPayDataOpenVo();
-                            cusPayDataOpen.setMerchOrderSn(merchOrderSn);
-                            cusPayDataOpen.setOrderNo(orderInfo.getOrder_sn());
-                            cusPayDataOpen.setInitalRequest(xml);
-                            cusPayDataOpen.setCreateTime(new Date());
-                            cusPayDataOpen.setModTime(new Date());
-                            cusPayDataOpenService.save(cusPayDataOpen);
-                        } else {
-                            cusPayDataOpen.setMerchOrderSn(merchOrderSn);
-                            cusPayDataOpen.setInitalRequest(xml);
-                            cusPayDataOpen.setModTime(new Date());
-                            cusPayDataOpenService.update(cusPayDataOpen);
+                        if(!orderInfo.getOrderBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())) {
+                            CusPayDataOpenVo cusPayDataOpen = cusPayDataOpenService.queryObjectByOrderNo(orderInfo.getOrder_sn());
+                            if (cusPayDataOpen == null) {
+                                cusPayDataOpen = new CusPayDataOpenVo();
+                                cusPayDataOpen.setMerchOrderSn(merchOrderSn);
+                                cusPayDataOpen.setOrderNo(orderInfo.getOrder_sn());
+                                cusPayDataOpen.setInitalRequest(xml);
+                                cusPayDataOpen.setCreateTime(new Date());
+                                cusPayDataOpen.setModTime(new Date());
+                                cusPayDataOpenService.save(cusPayDataOpen);
+                            } else {
+                                cusPayDataOpen.setMerchOrderSn(merchOrderSn);
+                                cusPayDataOpen.setInitalRequest(xml);
+                                cusPayDataOpen.setModTime(new Date());
+                                cusPayDataOpenService.update(cusPayDataOpen);
+                            }
                         }
                     }
 

+ 16 - 14
kmall-api/src/main/java/com/kmall/api/api/pingan/ApiPayPinganController.java

@@ -238,20 +238,22 @@ public class ApiPayPinganController extends ApiBaseAction {
                             orderInfo.setOrder_status(Integer.parseInt(Dict.orderStatus.item_100.getItem()));
                             orderInfo.setPayFlag(Dict.payFlag.item_pingan.getItem());
 
-                            CusPayDataOpenVo cusPayDataOpen = cusPayDataOpenService.queryObjectByOrderNo(orderInfo.getOrder_sn());
-                            if (cusPayDataOpen == null) {
-                                cusPayDataOpen = new CusPayDataOpenVo();
-                                cusPayDataOpen.setMerchOrderSn(merchOrderSn);
-                                cusPayDataOpen.setOrderNo(orderInfo.getOrder_sn());
-                                cusPayDataOpen.setInitalRequest(rspStr);
-                                cusPayDataOpen.setCreateTime(new Date());
-                                cusPayDataOpen.setModTime(new Date());
-                                cusPayDataOpenService.save(cusPayDataOpen);
-                            } else {
-                                cusPayDataOpen.setMerchOrderSn(merchOrderSn);
-                                cusPayDataOpen.setInitalRequest(rspStr);
-                                cusPayDataOpen.setModTime(new Date());
-                                cusPayDataOpenService.update(cusPayDataOpen);
+                            if(!orderInfo.getOrderBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())) {
+                                CusPayDataOpenVo cusPayDataOpen = cusPayDataOpenService.queryObjectByOrderNo(orderInfo.getOrder_sn());
+                                if (cusPayDataOpen == null) {
+                                    cusPayDataOpen = new CusPayDataOpenVo();
+                                    cusPayDataOpen.setMerchOrderSn(merchOrderSn);
+                                    cusPayDataOpen.setOrderNo(orderInfo.getOrder_sn());
+                                    cusPayDataOpen.setInitalRequest(rspStr);
+                                    cusPayDataOpen.setCreateTime(new Date());
+                                    cusPayDataOpen.setModTime(new Date());
+                                    cusPayDataOpenService.save(cusPayDataOpen);
+                                } else {
+                                    cusPayDataOpen.setMerchOrderSn(merchOrderSn);
+                                    cusPayDataOpen.setInitalRequest(rspStr);
+                                    cusPayDataOpen.setModTime(new Date());
+                                    cusPayDataOpenService.update(cusPayDataOpen);
+                                }
                             }
                         }
                         orderService.updateBatch(orderVoList);

+ 1 - 1
kmall-api/src/main/java/com/kmall/api/dao/ApiCartMapper.java

@@ -20,7 +20,7 @@ public interface ApiCartMapper extends BaseDao<CartVo> {
 
     void deleteByProductIds(@Param("productIds") String[] productIds, @Param("store_id") Long store_id);
 
-    void deleteByCart(@Param("user_id") Long user_id, @Param("store_id") Long store_id, @Param("checked") Integer checked);
+    void deleteByCart(@Param("user_id") Long user_id, @Param("store_id") Long store_id, @Param("checked") Integer checked,@Param("checkCart")String checkCart);
 
     List<CartVo> queryCartByGoodsBizType(@Param("goodsBizType") String goodsBizType);
 

+ 56 - 30
kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java

@@ -159,6 +159,7 @@ public class ApiOrderService {
         String postscript02 = jsonParam.getString("postscript02");
         String postscript10 = jsonParam.getString("postscript10");
         String postscript11 = jsonParam.getString("postscript11");//留言备注
+        String checkCart = jsonParam.getString("checkCart");//业务区分,11为普通商品,00为保税商品
         UserVo user = apiUserMapper.queryObjectByIdNoAndName(idNo, userName);
         UserVo userVo = new UserVo();
         userVo.setId(loginUser.getId());
@@ -187,6 +188,7 @@ public class ApiOrderService {
         param.put("user_id", loginUser.getId());
         param.put("store_id", storeId);
         param.put("checked", 1);
+        param.put("checkCart", checkCart);
         List<CartVo> checkedGoodsList = apiCartMapper.queryList(param);
         if (null == checkedGoodsList) {
             resultObj.put("errno", 400);
@@ -224,25 +226,51 @@ public class ApiOrderService {
         //订单按业务类型进行分单
         for (CartVo goodsItem : checkedGoodsList) {
             //订单业务类型:00:保税备货, 02:保税展示补货,10:保税展示跨境,11:普通商品
-            if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
-                freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;//查询商品运费信息
-                isBizType00 =true;
-            }
-            if(Dict.orderBizType.item_02.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
-                freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;//查询商品运费信息
-                isBizType02 =true;
-            }
-            if(Dict.orderBizType.item_10.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
-                freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;//查询商品运费信息
-                isBizType10 =true;
-            }
-            if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
-                FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
-                freightPrice11 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice11;//查询商品运费信息
-                isBizType11 =true;
+            if(org.apache.commons.lang.StringUtils.isEmpty(checkCart)){
+                if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                    freightPrice11 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice11;//查询商品运费信息
+                    isBizType11 =true;
+                }
+                if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                    freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;//查询商品运费信息
+                    isBizType00 =true;
+                }
+                if(Dict.orderBizType.item_02.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                    freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;//查询商品运费信息
+                    isBizType02 =true;
+                }
+                if(Dict.orderBizType.item_10.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                    FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                    freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;//查询商品运费信息
+                    isBizType10 =true;
+                }
+            }else{
+                if(checkCart.equalsIgnoreCase(Dict.orderBizType.item_11.getItem())){
+                    if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                        freightPrice11 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice11;//查询商品运费信息
+                        isBizType11 =true;
+                    }
+                }else{
+                    if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                        freightPrice00 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice00;//查询商品运费信息
+                        isBizType00 =true;
+                    }
+                    if(Dict.orderBizType.item_02.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                        freightPrice02 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice02;//查询商品运费信息
+                        isBizType02 =true;
+                    }
+                    if(Dict.orderBizType.item_10.getItem().equalsIgnoreCase(goodsItem.getGoodsBizType())){
+                        FreightEntity freightEntity = apiFreightService.queryObjectByGoodsId(goodsItem.getGoods_id());
+                        freightPrice10 = freightEntity!=null ? freightEntity.getDefaultFreight() : freightPrice10;//查询商品运费信息
+                        isBizType10 =true;
+                    }
+                }
             }
         }
 
@@ -318,7 +346,7 @@ public class ApiOrderService {
             orderProcessRecordMapper.saveBatch(processRecordEntityList);//新增订单流转信息
 
             //清空已购买的商品
-            apiCartMapper.deleteByCart(loginUser.getId(), storeId, 1);
+            apiCartMapper.deleteByCart(loginUser.getId(), storeId, 1, checkCart);
 
             if (apiOrderMapper.queryCountByMerchOrderSn(merchOrderSn) > 1) {//不止一笔订单则为拆单订单
                 OrderVo orderVo = new OrderVo();
@@ -424,21 +452,19 @@ public class ApiOrderService {
 //        String merchSn = OmsMerchPropertiesBuilder.instance().getMerchSn();
 //        String merchShortName = OmsMerchPropertiesBuilder.instance().getMerchShortName();
         MerchVo merchVo = apiMerchMapper.queryObjectByMerchSn(merchSn);
-        String merchShortName = "";
-        if(merchVo != null){
-            merchShortName = merchVo.getMerchShortName();
-        }
-        String oneMerchName = "";
-        if(!merchShortName.equalsIgnoreCase("ZW")){
-            oneMerchName = "ZW";
-        }
+//        String merchShortName = "";
+//        if(merchVo != null){
+//            merchShortName = merchVo.getMerchShortName();
+//        }
         String thirdMerchSn = "";
         StoreVo storeVo = apiStoreMapper.queryObject(storeId);
         if(storeVo != null){
             thirdMerchSn = storeVo.getThirdPartyMerchCode()==null?"":storeVo.getThirdPartyMerchCode();
         }
-        //一级商户 + 二级商户(拼音首字母)+ 三级商户 + 业务类型 + 编号
-        String orderSn = oneMerchName + merchShortName + thirdMerchSn + bizType + CommonUtil.generateOrderNumber();
+//        //一级商户 + 二级商户(拼音首字母)+ 三级商户 + 业务类型 + 编号
+//        String orderSn = oneMerchName + merchShortName + thirdMerchSn + bizType + CommonUtil.generateOrderNumber();
+        //一级商户 + 三级商户(拼音首字母) + 业务类型 + 编号
+        String orderSn = "ZW" + thirdMerchSn + bizType + CommonUtil.generateOrderNumber();
         orderInfo.setOrder_sn(orderSn);
         orderInfo.setMerchSn(merchSn);
 

+ 13 - 11
kmall-api/src/main/java/com/kmall/api/service/ApiPayService.java

@@ -141,17 +141,19 @@ public class ApiPayService {
                         processRecordEntityList.add(entity);
                     }
 
-                    CusPayDataOpenVo cusPayDataOpen = cusPayDataOpenMapper.queryObjectByOrderNo(orderInfo.getOrder_sn());
-                    if (cusPayDataOpen != null) {
-                        cusPayDataOpen.setInitalResponse(reponseStr);
-                        cusPayDataOpen.setPayTransactionId(transaction_id);
-                        cusPayDataOpen.setTotalAmount(new BigDecimal(total_fee).divide(Constant.ONE_HUNDRED));
-                        cusPayDataOpen.setVerDept(Dict.verDept.item_3.getItem());
-                        cusPayDataOpen.setPayType(Dict.payType.item_1.getItem());
-                        cusPayDataOpen.setCurrency(Constant.CURRENCY_142);
-                        cusPayDataOpen.setTradingTime(time_end);
-                        cusPayDataOpen.setModTime(new Date());
-                        cusPayDataOpenMapper.update(cusPayDataOpen);
+                    if(!orderInfo.getOrderBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())) {
+                        CusPayDataOpenVo cusPayDataOpen = cusPayDataOpenMapper.queryObjectByOrderNo(orderInfo.getOrder_sn());
+                        if (cusPayDataOpen != null) {
+                            cusPayDataOpen.setInitalResponse(reponseStr);
+                            cusPayDataOpen.setPayTransactionId(transaction_id);
+                            cusPayDataOpen.setTotalAmount(new BigDecimal(total_fee).divide(Constant.ONE_HUNDRED));
+                            cusPayDataOpen.setVerDept(Dict.verDept.item_3.getItem());
+                            cusPayDataOpen.setPayType(Dict.payType.item_1.getItem());
+                            cusPayDataOpen.setCurrency(Constant.CURRENCY_142);
+                            cusPayDataOpen.setTradingTime(time_end);
+                            cusPayDataOpen.setModTime(new Date());
+                            cusPayDataOpenMapper.update(cusPayDataOpen);
+                        }
                     }
 
                     orderInfo.setPayTransactionId(transaction_id);

+ 35 - 3
kmall-api/src/main/resources/mybatis/mapper/ApiCartMapper.xml

@@ -57,6 +57,12 @@
         left join mall_product_store_rela psr on psr.product_id = c.id and psr.store_id = #{store_id}
         where 1 = 1  and b.is_delete = 0 and b.is_on_sale = 1
         and psr.stock_num > 0
+        <if test="checkCart != null and checkCart == '00'">
+            and b.goods_biz_type != '11'
+        </if>
+        <if test="checkCart != null and checkCart == '11'">
+            and b.goods_biz_type = '11'
+        </if>
         <if test="user_id != null">
             AND a.user_id = #{user_id}
         </if>
@@ -96,6 +102,12 @@
         left join mall_product_store_rela psr on psr.product_id = c.id and psr.store_id = #{store_id}
         where 1 = 1
         and (psr.stock_num = 0 or b.is_on_sale = 0)
+        <if test="checkCart != null and checkCart == '00'">
+            and b.goods_biz_type != '11'
+        </if>
+        <if test="checkCart != null and checkCart == '11'">
+            and b.goods_biz_type = '11'
+        </if>
         <if test="merchSn != null">
             and a.merch_sn = #{merchSn}
         </if>
@@ -128,17 +140,31 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-        select count(*) from mall_cart a
-        where 1 = 1
+        select count(*)
+        from mall_cart a
+        left join mall_goods b on a.goods_id = b.id
+        left join mall_product c on c.goods_id = a.goods_id and c.id = a.product_id
+        left join mall_product_store_rela psr on psr.product_id = c.id and psr.store_id = #{store_id}
+        where 1 = 1  and b.is_delete = 0 and b.is_on_sale = 1
+        and psr.stock_num > 0
+        <if test="checkCart != null and checkCart == '00'">
+            and b.goods_biz_type != '11'
+        </if>
+        <if test="checkCart != null and checkCart == '11'">
+            and b.goods_biz_type = '11'
+        </if>
         <if test="user_id != null">
             AND a.user_id = #{user_id}
         </if>
         <if test="goods_id != null">
             AND a.goods_id = #{goods_id}
         </if>
-        <if test="product_id != product_id">
+        <if test="product_id != null">
             AND a.product_id = #{product_id}
         </if>
+        <if test="store_id != null">
+            AND a.store_id = #{store_id}
+        </if>
         <if test="checked != null">
             AND a.checked = #{checked}
         </if>
@@ -389,5 +415,11 @@
     <delete id="deleteByCart">
         delete from mall_cart
         where  user_id = #{user_id} and store_id = #{store_id} and  checked = #{checked}
+        <if test="checkCart != null and checkCart == '00'">
+            and goods_biz_type != '11'
+        </if>
+        <if test="checkCart != null and checkCart == '11'">
+            and goods_biz_type = '11'
+        </if>
     </delete>
 </mapper>

+ 6 - 1
kmall-api/src/main/resources/mybatis/mapper/ApiFootprintMapper.xml

@@ -42,7 +42,12 @@
                 and max.id is null
             </if>
             <if test="bizType == true">
-                and g.goods_biz_type in ('00','11')
+                <if test="checkCart != null and checkCart == '00'">
+                    and g.goods_biz_type = '00'
+                </if>
+                <if test="checkCart != null and checkCart == '11'">
+                    and g.goods_biz_type = '11'
+                </if>
             </if>
             <if test="store_id != null and store_id != ''">
                 and psr.store_id = #{store_id}

+ 6 - 1
wx-mall/app.json

@@ -95,5 +95,10 @@
     "request": 10000,
     "downloadFile": 10000
   },
-  "debug": true
+  "debug": true,
+  "permission":{
+    "scope.userLocation":{
+      "desc": "您的位置信息将用于小程序位置接口的效果展示"
+    }
+  }
 }

+ 117 - 72
wx-mall/pages/cart/cart.js

@@ -6,14 +6,14 @@ var app = getApp();
 
 Page({
   data: {
-    cartGoods00: [],//保税仓数据
-    cartGoods02: [],//保税展示数据
-    cartGoods10: [],//现场速递数据
-    cartGoods11: [],//普通商品
+    cartGoods00: [], //保税仓数据
+    cartGoods02: [], //保税展示数据
+    cartGoods10: [], //现场速递数据
+    cartGoods11: [], //普通商品
     cartGoods: [],
     validCartList: [],
-    goodsBizTypeList: ['保税仓','保税展示','现场速递','普通商品'],
-    goodsBizType: '',//货品业务类型
+    goodsBizTypeList: ['保税仓', '保税展示', '现场速递', '普通商品'],
+    goodsBizType: '', //货品业务类型
     footprintList: [],
     cartTotal: {
       "goodsCount": 0,
@@ -36,15 +36,18 @@ Page({
     retailPrice: '',
     stockNum: 0,
     cartNumber: 0,
+    checkCart: '00',
+    total00: 0,
+    total11: 0
   },
-  onLoad: function (options) {
+  onLoad: function(options) {
     // 页面初始化 options为页面跳转所带来的参数
   },
-  onReady: function () {
+  onReady: function() {
     // 页面渲染完成
 
   },
-  onShow: function () {
+  onShow: function() {
     // 页面显示
     if (wx.getStorageSync('userInfo') || wx.getStorageSync('token')) {
       this.getCartList();
@@ -55,11 +58,38 @@ Page({
       })
     }
   },
-  onHide: function () {
+  openSortFilter: function(event) {
+    let that = this;
+    let currentId = event.currentTarget.id;
+    switch (currentId) {
+      case 'defaultActivity':
+        that.setData({
+          'checkCart': '00'
+        });
+        this.getCartList();
+        this.getFootprintList();
+        break;
+      case 'ordActivity':
+        that.setData({
+          'checkCart': '11'
+        });
+        this.getCartList();
+        this.getFootprintList();
+        break;
+      default:
+        //综合排序
+        that.setData({
+          'checkCart': '00'
+        });
+        this.getCartList();
+        this.getFootprintList();
+    }
+  },
+  onHide: function() {
     // 页面隐藏
 
   },
-  onUnload: function () {
+  onUnload: function() {
     // 页面关闭
 
   },
@@ -73,7 +103,9 @@ Page({
       cartGoods11: res.data.cart11List,
       validCartList: res.data.validCartList,
       cartTotal: res.data.cartTotal,
-      couponInfoList: res.data.couponInfoList
+      couponInfoList: res.data.couponInfoList,
+      total00: res.data.total00,
+      total11: res.data.total11
     });
   },
   setCheckedData() {
@@ -96,12 +128,14 @@ Page({
       checkedTypeStatus11: that.isCheckedAll()
     });
   },
-  getCartList: function () {//获取购物车数据
+  getCartList: function() { //获取购物车数据
     let that = this;
     wx.showLoading({
       title: '加载中...',
     });
-    util.request(api.CartList).then(function (res) {
+    util.request(api.CartList, {
+      checkCart: that.data.checkCart
+    }).then(function(res) {
       if (res.errno === 0) {
         that.setCommonData(res);
       }
@@ -110,9 +144,9 @@ Page({
       that.setCheckedData();
     });
   },
-  isCheckedAll: function () {
+  isCheckedAll: function() {
     //判断购物车所有商品是否已全选
-    return this.data.cartGoods.every(function (element, index, array) {
+    return this.data.cartGoods.every(function(element, index, array) {
       if (element.checked == true) {
         return true;
       } else {
@@ -120,19 +154,19 @@ Page({
       }
     });
   },
-  isCheckedTypeStatus00: function () {
-      //判断该业务类型的购物车商品是否已全选
-      return this.data.cartGoods00.every(function (element, index, array) {
-        if (element.checked == true) {
-          return true;
-        } else {
-          return false;
-        }
-      });     
+  isCheckedTypeStatus00: function() {
+    //判断该业务类型的购物车商品是否已全选
+    return this.data.cartGoods00.every(function(element, index, array) {
+      if (element.checked == true) {
+        return true;
+      } else {
+        return false;
+      }
+    });
   },
-  isCheckedTypeStatus02: function () {
+  isCheckedTypeStatus02: function() {
     //判断该业务类型的购物车商品是否已全选
-    return this.data.cartGoods02.every(function (element, index, array) {
+    return this.data.cartGoods02.every(function(element, index, array) {
       if (element.checked == true) {
         return true;
       } else {
@@ -140,9 +174,9 @@ Page({
       }
     });
   },
-  isCheckedTypeStatus10: function () {
+  isCheckedTypeStatus10: function() {
     //判断该业务类型的购物车商品是否已全选
-    return this.data.cartGoods10.every(function (element, index, array) {
+    return this.data.cartGoods10.every(function(element, index, array) {
       if (element.checked == true) {
         return true;
       } else {
@@ -150,9 +184,9 @@ Page({
       }
     });
   },
-  isCheckedTypeStatus11: function () {
+  isCheckedTypeStatus11: function() {
     //判断该业务类型的购物车商品是否已全选
-    return this.data.cartGoods11.every(function (element, index, array) {
+    return this.data.cartGoods11.every(function(element, index, array) {
       if (element.checked == true) {
         return true;
       } else {
@@ -160,19 +194,20 @@ Page({
       }
     });
   },
-  toIndexPage: function () {
+  toIndexPage: function() {
     wx.switchTab({
       url: "/pages/index/index"
     });
   },
-  checkedItem: function (event) {
+  checkedItem: function(event) {
     let itemIndex = event.target.dataset.itemIndex;
     let that = this;
 
     util.request(api.CartChecked, {
       productIds: that.data.cartGoods[itemIndex].product_id,
-      isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1
-    }, 'POST').then(function (res) {
+      isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1,
+      checkCart: that.data.checkCart
+    }, 'POST').then(function(res) {
       if (res.errno === 0) {
         that.setCommonData(res);
       }
@@ -180,9 +215,9 @@ Page({
     });
 
   },
-  getCheckedGoodsCount: function () {
+  getCheckedGoodsCount: function() {
     let checkedGoodsCount = 0;
-    this.data.cartGoods.forEach(function (v) {
+    this.data.cartGoods.forEach(function(v) {
       if (v.checked === true) {
         checkedGoodsCount += v.number;
       }
@@ -190,22 +225,22 @@ Page({
     console.log(checkedGoodsCount);
     return checkedGoodsCount;
   },
-  checkedAll: function () {
+  checkedAll: function() {
     let that = this;
-    var productIds = this.data.cartGoods.map(function (v) {
+    var productIds = this.data.cartGoods.map(function(v) {
       return v.product_id;
     });
     util.request(api.CartChecked, {
       productIds: productIds.join(','),
       isChecked: that.isCheckedAll() ? 0 : 1
-    }, 'POST').then(function (res) {
+    }, 'POST').then(function(res) {
       if (res.errno === 0) {
         that.setCommonData(res);
       }
       that.setCheckedAllData();
     });
   },
-  checkedAllGoodType: function (e) {
+  checkedAllGoodType: function(e) {
     let that = this;
     let goodsBizType = e.target.dataset.goodsBizType;
     let isCheckedTypeStatu;
@@ -224,14 +259,14 @@ Page({
     util.request(api.CartChecked, {
       isChecked: isCheckedTypeStatu ? 0 : 1,
       goodsBizType: goodsBizType
-    }, 'POST').then(function (res) {
+    }, 'POST').then(function(res) {
       if (res.errno === 0) {
         that.setCommonData(res);
       }
 
       if (goodsBizType == '00') {
-          that.setData({
-            checkedTypeStatus00: that.isCheckedTypeStatus00()
+        that.setData({
+          checkedTypeStatus00: that.isCheckedTypeStatus00()
         });
       }
       if (goodsBizType == '02') {
@@ -254,15 +289,16 @@ Page({
       });
     });
   },
-  updateCart: function (productId, goodsId, number, beforeNumber, id, itemIndex) {
+  updateCart: function(productId, goodsId, number, beforeNumber, id, itemIndex) {
     let that = this;
 
     util.request(api.CartUpdate, {
       productId: productId,
       goodsId: goodsId,
       number: number,
-      id: id
-    }, 'POST').then(function (res) {
+      id: id,
+      checkCart: that.data.checkCart
+    }, 'POST').then(function(res) {
       if (res.errno === 0) {
         // console.log(res.data);
         that.setCommonData(res);
@@ -283,7 +319,7 @@ Page({
       that.setCheckedData();
     });
   },
-  cutNumber: function (event) {
+  cutNumber: function(event) {
     let itemIndex = event.target.dataset.itemIndex;
     let cartItem = this.data.cartGoods[itemIndex];
     let beforeNumber = cartItem.number;
@@ -294,7 +330,7 @@ Page({
     });
     this.updateCart(cartItem.product_id, cartItem.goods_id, number, beforeNumber, cartItem.id, itemIndex);
   },
-  addNumber: function (event) {
+  addNumber: function(event) {
     let itemIndex = event.target.dataset.itemIndex;
     let cartItem = this.data.cartGoods[itemIndex];
     let beforeNumber = cartItem.number;
@@ -305,12 +341,12 @@ Page({
     });
     this.updateCart(cartItem.product_id, cartItem.goods_id, number, beforeNumber, cartItem.id, itemIndex);
   },
-  checkoutOrder: function () {
+  checkoutOrder: function() {
     //获取已选择的商品
     let that = this;
     util.request(api.getCurUser, {
       userInfo: app.globalData.userInfo
-    }, 'POST').then(function (res) {
+    }, 'POST').then(function(res) {
       if (res.errno === 0) {
         // console.log('that.data.mobile:' + res.data.mobile);
         if (res.data.mobile == '' || res.data.mobile == null) {
@@ -319,7 +355,7 @@ Page({
             confirmColor: '#b4282d',
             showCancel: false,
             content: '您的手机号码未绑定,请先绑定手机号再进行购买',
-            success: function (res) {
+            success: function(res) {
               if (res.confirm) {
                 wx.navigateTo({
                   url: '../../pages/auth/newuser/newuser'
@@ -328,7 +364,7 @@ Page({
             }
           });
         } else {
-          var checkedGoods = that.data.cartGoods.filter(function (element, index, array) {
+          var checkedGoods = that.data.cartGoods.filter(function(element, index, array) {
             if (element.checked == true) {
               return true;
             } else {
@@ -340,13 +376,13 @@ Page({
             return false;
           }
           wx.navigateTo({
-            url: '../shopping/checkout/checkout'
+            url: '../shopping/checkout/checkout?checkCart=' + that.data.checkCart
           })
         }
       }
     });
   },
-  deleteCart: function (event) {
+  deleteCart: function(event) {
     //获取已选择的商品
     let that = this;
 
@@ -356,11 +392,12 @@ Page({
     wx.showModal({
       title: '',
       content: '确定要删除' + goodsName + '?',
-      success: function (res) {
+      success: function(res) {
         if (res.confirm) {
           util.request(api.CartDelete, {
-            cartId: cartId
-          }, 'POST').then(function (res) {
+            cartId: cartId,
+            checkCart: that.data.checkCart
+          }, 'POST').then(function(res) {
             if (res.errno === 0) {
               that.setCommonData(res);
             }
@@ -373,7 +410,10 @@ Page({
   },
   getFootprintList() {
     let that = this;
-    util.request(api.GuessFootprintList, { storeId: wx.getStorageSync('storeId') },).then(function (res) {
+    util.request(api.GuessFootprintList, {
+      storeId: wx.getStorageSync('storeId'),
+      checkCart: that.data.checkCart
+    }, ).then(function(res) {
       if (res.errno === 0) {
         that.setData({
           footprintList: res.data.list
@@ -381,12 +421,12 @@ Page({
       }
     });
   },
-  switchAttrPop: function () {
+  switchAttrPop: function() {
     this.setData({
       openAttr: !this.data.openAttr
     })
   },
-  clickSkuValue: function (event) {
+  clickSkuValue: function(event) {
     let that = this;
     let specValueId = event.currentTarget.dataset.valueId;
     let index = event.currentTarget.dataset.index;
@@ -409,25 +449,27 @@ Page({
     //重新计算spec改变后的信息
     goodsUtil.changeSpecInfo(that);
   },
-  cutNumber2: function () {
+  cutNumber2: function() {
     this.setData({
       number: (this.data.number - 1 > 1) ? this.data.number - 1 : 1
     });
   },
-  addNumber2: function () {
+  addNumber2: function() {
     this.setData({
       number: this.data.number + 1
     });
   },
 
   //购物车增加
-  addCart: function (e) {
+  addCart: function(e) {
     let that = this;
     that.setData({
-      number:1
+      number: 1
     });
     var goodsId = e.currentTarget.dataset.goodsId;
-    util.request(api.GoodsSku, { goodsId: goodsId }).then(function (res) {
+    util.request(api.GoodsSku, {
+      goodsId: goodsId
+    }).then(function(res) {
       if (res.errno === 0 && null != res.data) {
         that.setData({
           goodsVo: res.data.goodsVo,
@@ -453,7 +495,7 @@ Page({
     });
   },
   //购物车增加
-  addToCart: function () {
+  addToCart: function() {
     let that = this;
     var goodsId = that.data.goodsVo.id;
     //提示选择完整规格
@@ -479,8 +521,9 @@ Page({
     util.request(api.CartAdd, {
       goodsId: goodsId,
       productId: checkedProduct[0].id,
-      number: this.data.number
-    }, 'POST').then(function (res) {
+      number: this.data.number,
+      checkCart: that.data.checkCart
+    }, 'POST').then(function(res) {
       if (res.errno === 0 && null != res.data) {
         wx.showToast({
           title: '添加成功',
@@ -501,14 +544,16 @@ Page({
       }
     });
   },
-  deleteValidCart: function () {//获取购物车数据
+  deleteValidCart: function() { //获取购物车数据
     let that = this;
     wx.showModal({
       title: '',
       content: '确定要清空所有失效商品?',
-      success: function (res) {
+      success: function(res) {
         if (res.confirm) {
-          util.request(api.deleteValidCart).then(function (res) {
+          util.request(api.deleteValidCart, {
+            checkCart: that.data.checkCart
+          }).then(function(res) {
             if (res.errno === 0) {
               that.setCommonData(res);
             } else {

+ 16 - 3
wx-mall/pages/cart/cart.wxml

@@ -1,11 +1,24 @@
 <view class="container">
-  <view class="service-policy">
+  <view class="activity">
+    <view class="activity-box" bindtap="switchAttrPop">
+      <view class="item {{checkCart == '00' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultActivity">
+        <view class="unpay-num" wx:if="{{total00>0}}">{{total00}}</view>
+        <text class="txt">保税直营</text>
+      </view>
+      <view class="item by-price {{checkCart == '11' ? 'active' : ''}}" bindtap="openSortFilter" id="ordActivity">
+        <view class="unpay-num2" wx:if="{{total11>0}}">{{total11}}</view>
+        <text class="txt">一般贸易</text>
+      </view>
+    </view>
+  </view>
+
+  <view class="service-policy" bindtap="switchAttrPop">
     <!-- <view class="item">30分钟速达</view>
     <view class="item">每日优选生鲜</view>
     <view class="item">满88元免配送费</view> -->
     <view class="item">新用户可领取5元优惠券</view>
   </view> 
-  <view class="no-cart" wx:if="{{cartGoods.length <= 0}}">
+  <view class="no-cart" wx:if="{{cartGoods.length <= 0}}" bindtap="switchAttrPop">
     <view class="c">
       <view class="title-box">
         购物车空空如也~
@@ -24,7 +37,7 @@
         </navigator>
       </view>
     </view> -->
-    <view class="list">
+    <view class="list" bindtap="switchAttrPop">
       <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">

+ 66 - 0
wx-mall/pages/cart/cart.wxss

@@ -102,6 +102,7 @@ page {
   height: auto;
   overflow: hidden;
   margin-left: 14rpx;
+  margin-top:20rpx;
 }
 
 .cart-view .list {
@@ -722,3 +723,68 @@ page {
   line-height: 65rpx;
   color: #ccc;
 }
+
+/* activity */
+
+.activity {
+  position: fixed;
+  background: #fff;
+  width: 100%;
+  height: 78rpx;
+  z-index: 999999;
+}
+
+.activity-box {
+  background: #fff;
+  width: 100%;
+  height: 78rpx;
+  overflow: hidden;
+  padding: 0 30rpx;
+  display: flex;
+}
+
+.activity-box .item {
+  height: 78rpx;
+  line-height: 78rpx;
+  text-align: center;
+  flex: 1;
+  color: #333;
+  font-size: 26rpx;
+}
+
+.activity-box .item .txt {
+  display: block;
+  width: 100%;
+  height: 100%;
+  color: #333;
+}
+
+.activity-box .item.active .txt {
+  color: #b4282d;
+}
+.unpay-num {
+  position: absolute;
+  width: 30rpx;
+  height: 30rpx;
+  line-height: 30rpx;
+  text-align: center;
+  top: 0rpx;
+  left: 280rpx;
+  background-color: #b4282d;
+  color: #fff;
+  border-radius: 50%;
+  font-size: 20rpx;
+}
+.unpay-num2 {
+  position: absolute;
+  width: 30rpx;
+  height: 30rpx;
+  line-height: 30rpx;
+  text-align: center;
+  top: 0rpx;
+  left: 620rpx;
+  background-color: #b4282d;
+  color: #fff;
+  border-radius: 50%;
+  font-size: 20rpx;
+}

+ 186 - 188
wx-mall/pages/category/category.js

@@ -3,163 +3,161 @@ var goodsUtil = require('../../utils/goods.js');
 var api = require('../../config/api.js');
 
 Page({
-    data: {
-        // text:"这是一个页面"
-        navList: [],
-        goodsList: [],
-        id: 0,
-        goodsBizType: '00',
-        currentTab: 0,
-        navIndex: 0,
-        currentCategory: {},
-        scrollLeft: 0,
-        scrollTop: 0,
-        scrollHeight: 0,
-        page: 1,
-        size: 10,
-        showNavList: false,
-        footCart: {},
-        openAttr: false,
-        productList: {},
-        specificationList: {},
-        checkedSpecText: '请选择规格数量',
-        number: 1
-    },
-    toggleNav() {
-        this.setData({
-            showNavList: !this.data.showNavList
-        })
-    },
-    // 滚动切换标签样式
-    switchTab: function (e) {
-      let that = this;
-      that.setData({
-        goodsList: []
+  data: {
+    // text:"这是一个页面"
+    navList: [],
+    goodsList: [],
+    id: 0,
+    goodsBizType: '00',
+    currentTab: 0,
+    navIndex: 0,
+    currentCategory: {},
+    scrollLeft: 0,
+    scrollTop: 0,
+    scrollHeight: 0,
+    page: 1,
+    size: 10,
+    showNavList: false,
+    footCart: {},
+    openAttr: false,
+    productList: {},
+    specificationList: {},
+    checkedSpecText: '请选择规格数量',
+    number: 1
+  },
+  toggleNav() {
+    this.setData({
+      showNavList: !this.data.showNavList
+    })
+  },
+  // 滚动切换标签样式
+  switchTab: function (e) {
+    let that = this;
+    //当页面改变是会触发
+    console.log("e.detail.current:" + e.detail.current);
+    this.setData({
+      currentTab: e.detail.current
+    });
+    // console.log("currentTab:" + that.data.currentTab);
+    if (that.data.navIndex == e.detail.current) {
+      this.setData({
+        navIndex: -1
       });
-        //当页面改变是会触发
-      console.log("e.detail.current:" + e.detail.current);
-        this.setData({
-            currentTab: e.detail.current
-        });
-      // console.log("currentTab:" + that.data.currentTab);
-        if (that.data.navIndex == e.detail.current) {
-            this.setData({
-                navIndex: -1
-            });
-            return;
-        }
-        let navListCount = that.data.navList.length;
-        for (let i = 0; i < navListCount; i++) {
-            if (i == e.detail.current) {
-                that.setData({
-                    id: that.data.navList[i].id
-                });
-                break;
-            }
-        }
-        that.setData({
-            scrollLeft: (e.detail.current - 1) * 60
-        });
-        that.refreshCategoryInfo();
-    },
-    switchNav(event) {
-        let name = event.currentTarget.dataset.name;
-        wx.switchTab({
-            url: `/pages/${name}/${name}`,
-        });
-    },
-    onLoad: function (options) {
-        // 页面初始化 options为页面跳转所带来的参数
-      var that = this; 
-      if (options.id) {
-        that.setData({
-          id: parseInt(options.id)
-        });
-      } else {
+      return;
+    }
+    let navListCount = that.data.navList.length;
+    for (let i = 0; i < navListCount; i++) {
+      if (i == e.detail.current) {
         that.setData({
-          id: 0,
-          currentCategory: {}
+          id: that.data.navList[i].id
         });
+        break;
       }
-      if (options.goodsBizType) {
+    }
+    that.setData({
+      scrollLeft: (e.detail.current - 1) * 60
+    });
+    that.refreshCategoryInfo();
+  },
+  switchNav(event) {
+    let name = event.currentTarget.dataset.name;
+    wx.switchTab({
+      url: `/pages/${name}/${name}`,
+    });
+  },
+  onLoad: function (options) {
+    // 页面初始化 options为页面跳转所带来的参数
+    var that = this;
+    if (options.id) {
+      that.setData({
+        id: parseInt(options.id)
+      });
+    } else {
+      that.setData({
+        id: 0,
+        currentCategory: {}
+      });
+    }
+    if (options.goodsBizType) {
+      that.setData({
+        goodsBizType: options.goodsBizType
+      });
+    }
+    if (options.currentIndex) {
+      that.setData({
+        currentTab: options.currentIndex
+      });
+    }
+    wx.getSystemInfo({
+      success: function (res) {
+        var clientHeight = res.windowHeight,
+          clientWidth = res.windowWidth,
+          rpxR = 750 / clientWidth;
+        var calc = clientHeight * rpxR - 180;
         that.setData({
-          goodsBizType: options.goodsBizType
+          scrollHeight: calc
         });
       }
-      if (options.currentIndex) {
+    });
+    this.getCategoryInfo();
+  },
+  getFootCart: function () {
+    let that = this;
+    util.request(api.GetFootCart).then(function (res) {
+      if (res.errno === 0) {
         that.setData({
-          currentTab: options.currentIndex
+          footCart: res.data,
         });
       }
-      wx.getSystemInfo({
-        success: function (res) {
-          var clientHeight = res.windowHeight,
-          clientWidth = res.windowWidth,
-          rpxR = 750 / clientWidth;
-          var calc = clientHeight * rpxR - 180;
+    });
+  },
+  getCategoryInfo: function () {
+    let that = this;
+    util.request(api.GoodsCategory, { id: that.data.id, goodsBizType: that.data.goodsBizType })
+      .then(function (res) {
+        if (res.errno == 0) {
           that.setData({
-            scrollHeight: calc
+            navList: res.data.brotherCategory,
+            currentCategory: res.data.currentCategory
           });
-        }
-      });
-      this.getCategoryInfo();
-    },
-    getFootCart: function () {
-        let that = this;
-        util.request(api.GetFootCart).then(function (res) {
-            if (res.errno === 0) {
-                that.setData({
-                    footCart: res.data,
-                });
-            }
-        });
-    },
-    getCategoryInfo: function () {
-      let that = this;
-      util.request(api.GoodsCategory, { id: that.data.id, goodsBizType: that.data.goodsBizType})
-        .then(function (res) {
-          if (res.errno == 0) {
-            that.setData({
-              navList: res.data.brotherCategory,
-              currentCategory: res.data.currentCategory
-            });
-            //nav位置
-            let currentIndex = that.data.currentTab;
-            let navListCount = that.data.navList.length;
-            for (let i = 0; i < navListCount; i++) {
-              if (that.data.navList[i].id == that.data.id) {
-                break;
-              }
-            }
-            if (currentIndex > navListCount / 2 && navListCount > 5) {
-              that.setData({
-                scrollLeft: currentIndex * 60
-              });
+          //nav位置
+          let currentIndex = that.data.currentTab;
+          let navListCount = that.data.navList.length;
+          for (let i = 0; i < navListCount; i++) {
+            if (that.data.navList[i].id == that.data.id) {
+              break;
             }
+          }
+          if (currentIndex > navListCount / 2 && navListCount > 5) {
             that.setData({
-              currentTab: currentIndex,
-              navIndex: currentIndex
+              scrollLeft: currentIndex * 60
             });
-            that.getGoodsList();
-          } else {
-            //显示错误信息
           }
-        });
-    },
-    refreshCategoryInfo: function () {
-        let that = this;
-        util.request(api.GoodsCategory, {id: this.data.id})
-            .then(function (res) {
-                if (res.errno == 0) {
-                    that.setData({
-                        navList: res.data.brotherCategory,
-                        currentCategory: res.data.currentCategory
-                    });
-                    that.getGoodsList();
-                } else {
-                    //显示错误信息
-                }
-            });
+          that.setData({
+            currentTab: currentIndex,
+            navIndex: currentIndex
+          });
+          that.getGoodsList();
+        } else {
+          //显示错误信息
+        }
+      });
+  },
+  refreshCategoryInfo: function () {
+    let that = this;
+    util.request(api.GoodsCategory, { id: this.data.id })
+      .then(function (res) {
+        if (res.errno == 0) {
+          that.setData({
+            navList: res.data.brotherCategory,
+            currentCategory: res.data.currentCategory,
+            goodsList: []
+          });
+          that.getGoodsList();
+        } else {
+          //显示错误信息
+        }
+      });
     },
     onReady: function () {
         // 页面渲染完成
@@ -171,19 +169,19 @@ Page({
     onHide: function () {
         // 页面隐藏
     },
-    getGoodsList: function () {
-      wx.showLoading({
-        title: '加载中...',
-      });
-      var that = this;
-      util.request(api.GoodsList, { categoryId: that.data.id, goodsBizType: that.data.goodsBizType, page: that.data.page, size:   that.data.size })
-        .then(function (res) {
-          let goodsList = that.data.goodsList.concat(res.data.data);
-          that.setData({
-            goodsList: goodsList,
-          });
-          wx.hideLoading();
+  getGoodsList: function () {
+    var that = this;
+    wx.showLoading({
+      title: '加载中...',
+    });
+    util.request(api.GoodsList, { categoryId: that.data.id, goodsBizType: that.data.goodsBizType, page: that.data.page, size: that.data.size })
+      .then(function (res) {
+        let goodsList = that.data.goodsList.concat(res.data.data);
+        that.setData({
+          goodsList: goodsList,
         });
+        wx.hideLoading();
+      });
     },
     onUnload: function () {
         // 页面关闭
@@ -302,41 +300,41 @@ Page({
                 util.showErrorToast(res.errmsg)
             }
         });
-    }
-    ,
-    switchCate: function (event) {
-        if (this.data.id == event.currentTarget.dataset.id) {
-            return false;
-        }
-        var that = this;
-        that.setData({
-            goodsList: [],
-            page: 1,
-            currentTab: event.currentTarget.dataset.current
-        });
-        console.log("currentIndex:" + that.data.currentTab);
-        var clientX = event.detail.x;
-        var currentTarget = event.currentTarget;
-        if (clientX < 60) {
-            that.setData({
-                scrollLeft: currentTarget.offsetLeft - 60
-            });
-        } else if (clientX > 330) {
-            that.setData({
-                scrollLeft: currentTarget.offsetLeft
-            });
-        }
-        this.setData({
-            id: event.currentTarget.dataset.id,
-            goodsBizType: that.data.goodsBizType
-        });
-        this.getCategoryInfo();
     },
-    onReachBottom() {
-        var that = this;
-        that.setData({
-            page: that.data.page + 1,
-        });
-        that.getGoodsList();
+  switchCate: function (event) {
+    console.log(this.data.scrollLeft);
+    if (this.data.id == event.currentTarget.dataset.id) {
+      return false;
+    }
+    var that = this;
+    that.setData({
+      goodsList: [],
+      page: 1,
+      currentTab: event.currentTarget.dataset.current
+    });
+    console.log("currentIndex:" + that.data.currentTab);
+    var clientX = event.detail.x;
+    var currentTarget = event.currentTarget;
+    if (clientX < 60) {
+      that.setData({
+        scrollLeft: currentTarget.offsetLeft - 60
+      });
+    } else if (clientX > 330) {
+      that.setData({
+        scrollLeft: currentTarget.offsetLeft
+      });
     }
+    this.setData({
+      id: event.currentTarget.dataset.id,
+      goodsBizType: that.data.goodsBizType
+    });
+    this.getCategoryInfo();
+  },
+  onReachBottom() {
+    var that = this;
+    that.setData({
+      page: that.data.page + 1,
+    });
+    that.getGoodsList();
+  }
 })

+ 3 - 2
wx-mall/pages/category/category.wxml

@@ -50,13 +50,14 @@
     <view wx:if="{{showNavList}}" class="close" bindtap="toggleNav">X</view>
   </view>
   <view class="cate-nav">
-    <scroll-view scroll-x="true" class="cate-nav-body" style="width: 750rpx;" scroll-left="{{scrollLeft}}">
+    <scroll-view scroll-x="true" class="cate-nav-body" style="width: 750rpx;" scroll-left="{{scrollLeft}}" >
       <view wx:for="{{navList}}" class="item {{ id == item.id ? 'active' : ''}}" data-current="{{index}}" data-id="{{item.id}}" bindtap="switchCate" wx:key="{{index}}">
         <view class="name">{{item.name}}</view>
       </view>
     </scroll-view>
   </view>
-  <swiper class="" current="{{currentTab}}"  scroll-top="{{scrollTop}}" style="height:{{scrollHeight}}px;">
+  <!-- bindchange="switchTab" -->
+  <swiper class="" current="{{currentTab}}" scroll-top="{{scrollTop}}" style="height:{{scrollHeight}}px;">
     <swiper-item wx:for="{{navList}}"  wx:key="{{navIndex}}">
       <scroll-view scroll-y="true" class="cate-item">
         <view class="h">

+ 39 - 33
wx-mall/pages/index/index.js

@@ -130,8 +130,8 @@ Page({
     let that = this;
     if (wx.getStorageSync('storeId')) {
       // console.log(wx.getStorageSync('userId'));
-      // console.log(wx.getStorageSync('storeId'));
-      console.log(wx.getStorageSync('merchSn'));
+      console.log(wx.getStorageSync('storeId'));
+      // console.log(wx.getStorageSync('merchSn'));
       if (wx.getStorageSync('userId')){
         wx.request({
           url: api.updateLoginUser,
@@ -160,37 +160,43 @@ Page({
   // 同步门店
   syncStore: function () {
     let that = this;
-    if (!wx.getStorageSync('storeId')) {
-        util.getLocation((lng, lat) => {
-          wx.setStorageSync('location', JSON.stringify({ lng, lat }));
-          util.request(api.NearbyList, { longitude: lng, latitude: lat }).then((res) => {
-            let nlist = res.data;
-            if (!nlist.length) {
-              wx.removeStorageSync('nearStoreList');
-              wx.removeStorageSync('storeId');
-              wx.removeStorageSync('storeVo');
-              that.setData({
-                storeName: '附近暂无门店'
-              })
-            } else {
-              that.setData({
-                storeName: nlist[0].storeName,
-                storeId: nlist[0].id
-              })
-              that.chooseStore(nlist[0].id, nlist[0].merchSn);
-              wx.setStorageSync('nearStoreList', JSON.stringify(nlist));
-              wx.setStorageSync('storeVo', JSON.stringify(nlist[0]));
-            }
-          })
-        });
-    } else {
-      var storeVo = JSON.parse(wx.getStorageSync('storeVo'));
-      that.chooseStore(storeVo.id,storeVo.merchSn);
-      that.setData({
-        storeName: storeVo.storeName,
-        storeId: storeVo.id
-      });
-      }
+    //获取附件门店信息
+    util.getLocation((lng, lat) => {
+      wx.setStorageSync('location', JSON.stringify({ lng, lat }));
+      util.request(api.NearbyList, { longitude: lng, latitude: lat }).then((res) => {
+        let nlist = res.data;
+        // console.log(nlist);
+        if (!nlist.length) {
+          wx.removeStorageSync('nearStoreList');
+        } else {
+          wx.setStorageSync('nearStoreList', JSON.stringify(nlist));
+        }
+        if (!wx.getStorageSync('storeId')) {
+          if (!nlist.length) {
+            wx.removeStorageSync('storeId');
+            wx.removeStorageSync('storeVo');
+            that.setData({
+              storeName: '附近暂无门店'
+            })
+          } else {
+            that.setData({
+              storeName: nlist[0].storeName,
+              storeId: nlist[0].id
+            })
+            that.chooseStore(nlist[0].id, nlist[0].merchSn);
+            wx.setStorageSync('storeVo', JSON.stringify(nlist[0]));
+          }
+        } else {
+          var storeVo = JSON.parse(wx.getStorageSync('storeVo'));
+          that.chooseStore(storeVo.id, storeVo.merchSn);
+          that.setData({
+            storeName: storeVo.storeName,
+            storeId: storeVo.id
+          });
+        }
+      })
+    });
+    
   },
   // 更新门店Id
   chooseStore: function (storeId,merchSn) {

+ 15 - 12
wx-mall/pages/map/map.js

@@ -115,8 +115,8 @@ Page({
         wx.removeStorageSync('nearStoreList');
         wx.removeStorageSync('storeId');
         wx.removeStorageSync('storeVo');
-        wx.setStorageSync('storeId', storeId);
         wx.removeStorageSync('currentCategory');
+        wx.setStorageSync('storeId', storeId);
         var item = "";
         for (var i = 0; i < that.data.nearStoreList.length; i++) {
           if (storeId == that.data.nearStoreList[i].id) {
@@ -126,9 +126,9 @@ Page({
           }
         }
 
-        // var pages = getCurrentPages();
-        // var currPage = pages[pages.length - 1];  //当前页面
-        // var prevPage = pages[pages.length - 2]; //上一个页面
+        var pages = getCurrentPages();
+        var currPage = pages[pages.length - 1];  //当前页面
+        var prevPage = pages[pages.length - 2]; //上一个页面
         if (item == "") {
           wx.removeStorageSync('nearStoreList');
           wx.removeStorageSync('storeId');
@@ -138,18 +138,21 @@ Page({
           })
         } else {
           //直接调用上一个页面的setData()方法,把数据存到上一个页面中去
-          that.setData({
+          prevPage.setData({
             storeName: item.storeName
           })
+          // that.setData({
+          //   storeName: item.storeName
+          // })
         }
-        wx.switchTab({
-          url: '/pages/index/index'
-        });
+        // wx.switchTab({
+        //   url: '/pages/index/index'
+        // });
 
-        // prevPage.getIndexData();
-        // prevPage.enableActivity();
-        // prevPage.getGroupData();
-        // wx.navigateBack()
+        prevPage.getIndexData();
+        prevPage.enableActivity();
+        prevPage.getGroupData();
+        wx.navigateBack()
       }
     })
   }

+ 10 - 3
wx-mall/pages/shopping/checkout/checkout.js

@@ -41,7 +41,8 @@ Page({
     idNo: '',
     userName: '',
     idNoM: '',
-    idNoDisabled: false
+    idNoDisabled: false,
+    checkCart: ''
   },
   bindMultiPickerColumnChange: function (e) {
     let that = this;
@@ -97,7 +98,8 @@ Page({
   },
   getCheckoutInfo: function () {
     let that = this;
-    util.request(api.CartCheckout, { userCouponId: that.data.userCouponId, merchSn: wx.getStorageSync('merchSn') }).then(function (res) {
+    util.request(api.CartCheckout, { userCouponId: that.data.userCouponId, merchSn: wx.getStorageSync('merchSn'),
+      checkCart: that.data.checkCart }).then(function (res) {
       if (res.errno === 0) {
         console.log(res.data);
         that.setData({
@@ -293,7 +295,8 @@ Page({
       delivery_remark: that.data.delivery_remark,
       idNo: that.data.idNo,
       userName: that.data.userName,
-      merchSn: wx.getStorageSync("merchSn")
+      merchSn: wx.getStorageSync("merchSn"),
+      checkCart: that.data.checkCart
     }, 'POST').then(function (res) {
       if (res.errno === 0) {
         let actualPrice = that.data.actualPrice;
@@ -338,6 +341,10 @@ Page({
   },
   onLoad: function (options) {
     // 页面初始化 options为页面跳转所带来的参数
+    // console.log(options.checkCart);
+    this.setData({
+      checkCart: options.checkCart
+    });
   },
   onReady: function () {
     // 页面渲染完成

+ 3 - 2
wx-mall/project.config.json

@@ -5,10 +5,11 @@
 		"es6": true,
 		"postcss": true,
 		"minified": true,
-		"newFeature": true
+		"newFeature": true,
+		"uglifyFileName": true
 	},
 	"compileType": "miniprogram",
-	"libVersion": "2.3.2",
+	"libVersion": "2.4.3",
 	"appid": "wxb6b30b1b14ee502a",
 	"projectname": "kmall-mp",
 	"condition": {