Browse Source

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

黄亚琴 5 years ago
parent
commit
2f5d89d8c9
25 changed files with 435 additions and 320 deletions
  1. 0 11
      kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java
  2. 3 3
      kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDto.java
  3. 13 0
      kmall-admin/src/main/java/com/kmall/admin/entity/StoreEntity.java
  4. 29 4
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  5. 41 1
      kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java
  6. 1 0
      kmall-admin/src/main/resources/XmlTemplate/GeneralGoodsDtoList.xml
  7. 1 0
      kmall-admin/src/main/resources/XmlTemplate/GoodsDtoList.xml
  8. 8 4
      kmall-admin/src/main/resources/mybatis/mapper/StoreDao.xml
  9. 5 2
      kmall-admin/src/main/webapp/js/shop/goods.js
  10. BIN
      kmall-admin/src/main/webapp/statics/file/general_goods_export_yyyy_mm_dd_v1.0.0.xls
  11. BIN
      kmall-admin/src/main/webapp/statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls
  12. 1 1
      kmall-admin/src/main/webapp/statics/libs/jquery-extend.js
  13. 10 18
      kmall-api/src/main/java/com/kmall/api/api/ApiAuthController.java
  14. 0 50
      kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java
  15. 1 1
      kmall-api/src/main/java/com/kmall/api/api/ApiGoodsController.java
  16. 2 0
      kmall-api/src/main/java/com/kmall/api/dao/ApiStoreMapper.java
  17. 22 0
      kmall-api/src/main/java/com/kmall/api/entity/StoreVo.java
  18. 3 0
      kmall-api/src/main/java/com/kmall/api/service/ApiStoreService.java
  19. 1 1
      kmall-api/src/main/java/com/kmall/api/service/mk/ApiMkStoreCampMinusGoodsService.java
  20. 25 13
      kmall-api/src/main/resources/mybatis/mapper/ApiStoreMapper.xml
  21. 1 0
      wx-mall/config/api.js
  22. 2 2
      wx-mall/pages/cart/cart.wxss
  23. 26 12
      wx-mall/pages/catalog/catalog.js
  24. 90 88
      wx-mall/pages/goods/goods.js
  25. 150 109
      wx-mall/pages/index/index.js

+ 0 - 11
kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java

@@ -99,12 +99,6 @@ public class ProductStoreRelaController {
     @ResponseBody
     public R save(@RequestBody ProductStoreRelaEntity productStoreRela) {
 
-        if (productStoreRela.getStoreId() != null) {
-            StoreEntity store = storeService.queryObject(productStoreRela.getStoreId().intValue());
-            if (store != null) {
-                productStoreRela.setMerchSn(store.getMerchSn());
-            }
-        }
         productStoreRelaService.save(productStoreRela);
 
         return R.ok();
@@ -122,11 +116,6 @@ public class ProductStoreRelaController {
             return R.error("信息不全,保存失败");
         }
 
-        StoreEntity store = storeService.queryObject(productStoreRela.getStoreId().intValue());
-        if (store != null) {
-            productStoreRela.setMerchSn(store.getMerchSn());
-        }
-
         productStoreRelaService.update(productStoreRela);
         return R.ok();
     }

+ 3 - 3
kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDto.java

@@ -27,7 +27,7 @@ public class GoodsDto implements Serializable {
     //品牌
     private String brand;
     //商品库存
-    private Integer goodsNumber;
+    private String goodsNumber;
     //关键字
     private String keywords;
     //简明介绍
@@ -242,14 +242,14 @@ public class GoodsDto implements Serializable {
     /**
      * 设置:商品序列号
      */
-    public void setGoodsNumber(Integer goodsNumber) {
+    public void setGoodsNumber(String goodsNumber) {
         this.goodsNumber = goodsNumber;
     }
 
     /**
      * 获取:商品序列号
      */
-    public Integer getGoodsNumber() {
+    public String getGoodsNumber() {
         return goodsNumber;
     }
 

+ 13 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/StoreEntity.java

@@ -75,10 +75,23 @@ public class StoreEntity implements Serializable {
     private Date tstm;
 
     private String thirdPartyMerchCode;
+
     private String thirdPartyMerchName;
+
     private String exprAgreementType;
+
     private String isValid;
 
+    private String isLoadGoods;
+
+    public String getIsLoadGoods() {
+        return isLoadGoods;
+    }
+
+    public void setIsLoadGoods(String isLoadGoods) {
+        this.isLoadGoods = isLoadGoods;
+    }
+
     public String getIsValid() {
         return isValid;
     }

+ 29 - 4
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -108,7 +108,7 @@ public class GoodsServiceImpl implements GoodsService {
 //        builder.put("brandId", "品牌");
         builder.put("supplierId", "供应商");
 //        builder.put("freightId", "运费模版");
-        builder.put("goodsNumber", "商品库存");
+        builder.put("goodsNumber", "商品库存");
         builder.put("primaryPicUrl", "商品主图");
         builder.put("listPicUrl", "商品列表图");
         builder.put("goodsDesc", "商品描述");
@@ -280,7 +280,7 @@ public class GoodsServiceImpl implements GoodsService {
         builder.put("goodsBizType", "货品业务类型");
 //        builder.put("brandId", "品牌");
         builder.put("supplierId", "供应商");
-        builder.put("goodsNumber", "商品库存");
+        builder.put("goodsNumber", "商品库存");
 //        builder.put("freightId", "运费模版");
         builder.put("primaryPicUrl", "商品主图");
         builder.put("listPicUrl", "商品列表图");
@@ -338,8 +338,11 @@ public class GoodsServiceImpl implements GoodsService {
         Integer goodsNumber = goods.getGoodsNumber();//商品总库存
         Integer storeTotalGoodsNumber = 0;//商品分配库存
         List<ProductStoreRelaEntity> proStoreList = productStoreRelaDao.queryByGoodsId(goodsEntity.getId());
-        for(ProductStoreRelaEntity relaEntity: proStoreList){
+        Long[] storeIds = new Long[proStoreList.size()];
+        for(int i = 0; i < proStoreList.size(); i++){
+            ProductStoreRelaEntity relaEntity = proStoreList.get(i);
             storeTotalGoodsNumber = storeTotalGoodsNumber + relaEntity.getStockNum();
+            storeIds[i] = relaEntity.getStoreId();
         }
         if(goodsNumber < storeTotalGoodsNumber){
             throw new RRException("该商品已在各门店分配库存"+storeTotalGoodsNumber+",当前商品总库存不能小于分配库存总额!请先修改门店库存!");
@@ -535,9 +538,29 @@ public class GoodsServiceImpl implements GoodsService {
                 return productDao.update(product);
             }
         }
+        //更新门店商品是否有修改字段
+        if(storeIds.length > 0){
+            for(int i=0;i<storeIds.length;i++){
+                updateLoadGoodsByStoreId(storeIds[i], user);
+            }
+        }
         return 1;
     }
 
+    /**
+     * 更新门店商品是否有修改字段
+     * @param storeId
+     * @param user
+     */
+    private void updateLoadGoodsByStoreId(Long storeId, SysUserEntity user){
+        StoreEntity storeEntity = new StoreEntity();
+        storeEntity.setIsLoadGoods("1");
+        storeEntity.setModerSn(user.getUsername());
+        storeEntity.setModTime(new Date());
+        storeEntity.setId(storeId);
+        storeDao.update(storeEntity);
+    }
+
     @Override
     public int delete(Integer id) {
         SysUserEntity user = ShiroUtils.getUserEntity();
@@ -677,6 +700,7 @@ public class GoodsServiceImpl implements GoodsService {
 //                builder.put("marketPrice", "市场价");
 //                builder.put("retailPrice", "零售价");
                 builder.put("supplierName", "供应商");
+                builder.put("goodsNumber", "商品总库存");
                 R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
                 if (Integer.valueOf(r.get("code").toString()) != 0) {
                     throw new RRException(r.get("msg").toString());
@@ -809,7 +833,7 @@ public class GoodsServiceImpl implements GoodsService {
                     } else {
                         goodsEntity.setOriCntCode(sysCusNationCodeEntity.getCode());
                     }
-                    goodsEntity.setGoodsRate(BigDecimal.valueOf(Integer.valueOf(goodsDto.getGoodsRate())));
+                    goodsEntity.setGoodsRate(BigDecimal.valueOf(Double.valueOf(goodsDto.getGoodsRate())));
                 }
                 goodsEntity.setIsOnSale(Integer.parseInt(goodsDto.getIsOnSaleStr()));
                 goodsEntity.setIsHot(Integer.parseInt(goodsDto.getIsHotStr()));
@@ -832,6 +856,7 @@ public class GoodsServiceImpl implements GoodsService {
                 goodsEntity.setCreateTime(new Date());
                 goodsEntity.setUpdateTime(new Date());
                 goodsEntity.setModTime(new Date());
+                goodsEntity.setGoodsNumber(Integer.parseInt(goodsDto.getGoodsNumber()));
 
                 if(!isFail){
                     GoodsEntity goods = goodsDao.queryObjectBySn(goodsDto.getGoodsSn());

+ 41 - 1
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -57,6 +57,8 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
     private StoreMngChangeDao storeMngChangeDao;
     @Autowired
     private MkDistSellAllocationDao mkDistSellAllocationDao;
+    @Autowired
+    private StoreDao storeDao;
 
     @Override
     public ProductStoreRelaEntity queryObject(Integer id) {
@@ -142,9 +144,16 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                 throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
             }
         }
+        if (productStoreRela.getStoreId() != null) {
+            StoreEntity store = storeDao.queryObject(productStoreRela.getStoreId().intValue());
+            if (store != null) {
+                productStoreRela.setMerchSn(store.getMerchSn());
+            }
+        }
         if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
             throw new RRException("该商品所属商户不属于该门店所属商户!");
         }
+        //校验总库存
         checkStockNum(productStoreRela, goodsEntity, isStockShare);
 
         String storeId = String.valueOf(productStoreRela.getStoreId());
@@ -234,6 +243,9 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         storeMngChangeEntity.setIsValid(0);
         storeMngChangeDao.save(storeMngChangeEntity);
 
+        //更新门店商品是否有修改字段
+        updateLoadGoodsByStoreId(storeId, user);
+
         productStoreRela.setAttributeCategory(categoryDao.queryObject(productStoreRela.getCategoryId()).getParentId());
         productStoreRela.setProductId(product.getId());
         productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());
@@ -268,6 +280,12 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         if (Integer.valueOf(r.get("code").toString()) != 0) {
             throw new RRException(r.get("msg").toString());
         } else {
+            StoreEntity store = storeDao.queryObject(productStoreRela.getStoreId().intValue());
+            if (store != null) {
+                productStoreRela.setMerchSn(store.getMerchSn());
+            }else{
+                throw new RRException("门店信息不存在!");
+            }
             goodsEntity = goodsDao.queryObjectByStoreId(productStoreRela.getGoodsId(), productStoreRela.getStoreId());
             isStockShare = StockUtil.getIsStockShareByGoodsEntity(goodsEntity.getIsSupplierGoods(),
                     goodsEntity.getIsStockShare(), goodsEntity.getIsStockShareBySuppler());
@@ -293,7 +311,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
             throw new RRException("该商品所属商户不属于该门店所属商户!");
         }
-
+        //校验总库存
         checkStockNum(productStoreRela, goodsEntity, isStockShare);
 
         String storeId = String.valueOf(productStoreRela.getStoreId());
@@ -420,6 +438,8 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             storeMngChangeEntity.setStoreValidNum(changeNum);//可用数
             storeMngChangeDao.save(storeMngChangeEntity);
         }
+        //更新门店商品是否有修改字段
+        updateLoadGoodsByStoreId(storeId, user);
 
         productStoreRela.setAttributeCategory(categoryDao.queryObject(productStoreRela.getCategoryId()).getParentId());
         productStoreRela.setModerSn(user.getUserId().toString());
@@ -428,6 +448,26 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         return productStoreRelaDao.update(productStoreRela);
     }
 
+    /**
+     * 更新门店商品是否有修改字段
+     * @param storeId
+     * @param user
+     */
+    private void updateLoadGoodsByStoreId(String storeId, SysUserEntity user){
+        StoreEntity storeEntity = new StoreEntity();
+        storeEntity.setIsLoadGoods("1");
+        storeEntity.setModerSn(user.getUsername());
+        storeEntity.setModTime(new Date());
+        storeEntity.setId(Long.valueOf(storeId));
+        storeDao.update(storeEntity);
+    }
+
+    /**
+     * 校验总库存
+     * @param productStoreRela
+     * @param goodsEntity
+     * @param isStockShare
+     */
     private void checkStockNum(ProductStoreRelaEntity productStoreRela, GoodsEntity goodsEntity, String isStockShare){
         if(goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())){
             Integer stockNum = productStoreRela.getStockNum();

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

@@ -17,6 +17,7 @@
                 <mapping row="1" col="6">GoodsDto.isOnSaleStr</mapping>
                 <mapping row="1" col="7">GoodsDto.goodsUnit</mapping>
                 <mapping row="1" col="8">GoodsDto.isHotStr</mapping>
+                <mapping row="1" col="8">GoodsDto.goodsNumber</mapping>
                 <!--<mapping row="1" col="12">GoodsDto.marketPrice</mapping>-->
                 <!--<mapping row="1" col="13">GoodsDto.retailPrice</mapping>-->
             </section>

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

@@ -28,6 +28,7 @@
                 <mapping row="1" col="15">GoodsDto.oriCntName</mapping>
                 <mapping row="1" col="16">GoodsDto.cusDeclEle</mapping>
                 <mapping row="1" col="17">GoodsDto.cusRecCode</mapping>
+                <mapping row="1" col="18">GoodsDto.goodsNumber</mapping>
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

+ 8 - 4
kmall-admin/src/main/resources/mybatis/mapper/StoreDao.xml

@@ -27,6 +27,7 @@
 		<result property="thirdPartyMerchName" column="third_party_merch_name"/>
 		<result property="exprAgreementType" column="expr_agreement_type"/>
 		<result property="isValid" column="is_valid"/>
+		<result property="isLoadGoods" column="is_load_goods"/>
 
     </resultMap>
 
@@ -43,7 +44,7 @@
 			`county_name`,
 			`latitude`,
 			`longitude`,
-			`cover_radius`,expr_agreement_type,
+			`cover_radius`,expr_agreement_type,is_load_goods,
 			`remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
 		moder_sn, mod_time, tstm,is_valid
 		from mall_store
@@ -63,7 +64,7 @@
 		`county_name`,
 		`latitude`,
 		`longitude`,
-		`cover_radius`,expr_agreement_type,
+		`cover_radius`,expr_agreement_type,is_load_goods,
 		`remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
     moder_sn, mod_time, tstm,is_valid
 		from mall_store
@@ -103,7 +104,7 @@
 		s.`county_name`,
 		s.`latitude`,
 		s.`longitude`,
-		s.`cover_radius`,
+		s.`cover_radius`,s.is_load_goods,
 		s.`remark`,s.merch_sn, s.merch_name, s.creater_sn, s.create_time,s.third_party_merch_code,t.third_party_merch_name,s.expr_agreement_type,
 		s.moder_sn, s.mod_time, s.tstm,s.is_valid
 		from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
@@ -179,6 +180,7 @@
 			`longitude`,
 			`cover_radius`,
 			is_valid,
+			is_load_goods,
 			`remark`,
 			third_party_merch_code,
 			third_party_merch_name,
@@ -201,6 +203,7 @@
 			#{longitude},
 			#{coverRadius},
 			#{isValid},
+			#{isLoadGoods},
 			#{remark},
 			#{thirdPartyMerchCode},
 			#{thirdPartyMerchName},
@@ -211,7 +214,7 @@
 			#{modTime}
 		)
 	</insert>
-	 
+
 	<update id="update" parameterType="com.kmall.admin.entity.StoreEntity">
 		update mall_store
 		<set>
@@ -227,6 +230,7 @@
 			<if test="longitude != null">`longitude` = #{longitude}, </if>
 			<if test="coverRadius != null">`cover_radius` = #{coverRadius}, </if>
 			<if test="isValid != null">`is_valid` = #{isValid}, </if>
+			<if test="isLoadGoods != null">`is_load_goods` = #{isLoadGoods}, </if>
 			<if test="remark != null">`remark` = #{remark},</if>
 			<if test="createrSn != null" >creater_sn = #{createrSn},</if>
 			<if test="createTime != null" >create_time = #{createTime},</if>

+ 5 - 2
kmall-admin/src/main/webapp/js/shop/goods.js

@@ -440,8 +440,11 @@ var vm = new Vue({
                 } else {
                     vm.productEntityList = [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}];
                 }*/
-
-                $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
+                if(vm.goods.goodsDesc){
+                    $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
+                }else{
+                    $('#goodsDesc').editable('setHTML', '');
+                }
             });
         },
         reload: function (event) {

BIN
kmall-admin/src/main/webapp/statics/file/general_goods_export_yyyy_mm_dd_v1.0.0.xls


BIN
kmall-admin/src/main/webapp/statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls


+ 1 - 1
kmall-admin/src/main/webapp/statics/libs/jquery-extend.js

@@ -12,7 +12,7 @@
                 styleUI: 'Bootstrap',
                 datatype: "json",
                 viewrecords: true,
-                height: 385,
+                height: 550,
                 rowNum: 10,
                 rowList: [10, 30, 50],
                 rownumbers: true,

+ 10 - 18
kmall-api/src/main/java/com/kmall/api/api/ApiAuthController.java

@@ -134,24 +134,6 @@ public class ApiAuthController extends ApiBaseAction {
     }
 
     /**
-     * 根据经纬度选择门店,微信审核后删除
-     */
-    @GetMapping("nearbyList")
-    @IgnoreAuth
-    public Object nearbyList(@RequestParam BigDecimal latitude, @RequestParam BigDecimal longitude, @RequestParam String storeId) {
-        Map param = Maps.newHashMap();
-         if(org.apache.commons.lang3.StringUtils.isNotEmpty(storeId)){
-            param.put("storeId", storeId);
-        }
-        param.put("latitude", latitude);
-        param.put("longitude", longitude);
-        List<StoreVo> storeVoList = apiStoreService.queryNearbyList(param);
-        if (null != storeVoList && storeVoList.size() > 0 && null != getOpenId()) {
-            tokenService.createAndUpdateToken(getOpenId(), storeVoList.get(0).getId(),getUserId(),storeVoList.get(0).getMerchSn());
-        }
-        return toResponsSuccess(storeVoList);
-    }
-    /**
      * 根据经纬度选择门店
      */
     @GetMapping("nearbyLists")
@@ -173,6 +155,16 @@ public class ApiAuthController extends ApiBaseAction {
         return toResponsSuccess(storeVoList);
     }
 
+    @GetMapping("updateStoreLoadGoodsById")
+    @IgnoreAuth
+    public Object updateStoreLoadGoodsById(@RequestParam String storeId) {
+        StoreVo storeVo = new StoreVo();
+        storeVo.setId(Long.valueOf(storeId));
+        storeVo.setIsLoadGoods("0");//门店商品是否修改字段更新为否
+        apiStoreService.updateStoreLoadGoodsById(storeVo);
+        return toResponsSuccess("成功");
+    }
+
     /**
      * 根据城市获取门店
      */

+ 0 - 50
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -683,56 +683,6 @@ public class ApiCartController extends ApiBaseAction {
         resultObj.put("cartTotal", cartTotal);
         return toResponsSuccess(resultObj);
     }
-
-    /**
-     * 订单提交前的检验和填写相关订单信息,微信审核后删除
-     */
-    @GetMapping("checkout")
-    public Object checkout(@LoginUser UserVo loginUser, String merchSn, String checkCart, Long tickDiscId00, Long tickDiscId02, Long tickDiscId10, Long tickDiscId11,
-                           Integer campId00, Integer campId02, Integer campId10, Integer campId11, Integer isLoadStatus) {
-        //获取要购买的商品
-        Map<String, Object> cartData = (Map<String, Object>)this.getCartMoney(loginUser,checkCart);
-        CheckOutDto checkOutDto = new CheckOutDto();
-        checkOutDto.setCheckCart(checkCart);
-        checkOutDto.setLoginUser(loginUser);
-        checkOutDto.setTickDiscId00(tickDiscId00);
-        checkOutDto.setTickDiscId02(tickDiscId02);
-        checkOutDto.setTickDiscId10(tickDiscId10);
-        checkOutDto.setTickDiscId11(tickDiscId11);
-        checkOutDto.setCampId00(campId00);
-        checkOutDto.setCampId02(campId02);
-        checkOutDto.setCampId10(campId10);
-        checkOutDto.setCampId11(campId11);
-        checkOutDto.setStoreId(getStoreId());
-        checkOutDto.setCartData(cartData);
-        checkOutDto.setIsLoadStatus(isLoadStatus);
-
-        Map<String, Object> resultObj = cartService.getCheckOut(checkOutDto);
-
-        //选择的收货地址
-        Map param = Maps.newHashMap();
-        param.put("is_default", 1);
-        param.put("user_id", loginUser.getId());
-        List<AddressVo> addressEntityList = addressService.queryList(param);
-        if (null != addressEntityList && addressEntityList.size() > 0) {
-            resultObj.put("addressVo", addressEntityList.get(0));
-        } else { // 没有默认地址,选择一个
-            param = Maps.newHashMap();
-            param.put("user_id", loginUser.getId());
-            addressEntityList = addressService.queryList(param);
-            if (null != addressEntityList && addressEntityList.size() > 0) {
-                resultObj.put("addressVo", addressEntityList.get(0));
-            }
-        }
-        UserVo userVo = apiUserService.queryObject(loginUser.getId());
-        if(userVo != null){
-            resultObj.put("idNo", userVo.getIdNo());
-            resultObj.put("userName", userVo.getUsername());
-        }
-
-        return toResponsSuccess(resultObj);
-    }
-
     /**
      * 订单提交前的检验和填写相关订单信息
      */

+ 1 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiGoodsController.java

@@ -364,7 +364,7 @@ public class ApiGoodsController extends ApiBaseAction {
 
         List<GoodsVo> goodsEntityList = goodsService.queryList(params);
         params.remove("fields");
-        filterCategory.addAll(categoryService.getFilterCategory(goodsEntityList, filterCategory));
+        categoryService.getFilterCategory(goodsEntityList, filterCategory);
 
         params.put("category_parent_id", categoryId);
         params.put("fields", "a.id,a.name,a.goods_brief,a.list_pic_url,psr1.retail_price," +

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

@@ -18,4 +18,6 @@ import java.util.Map;
 @Service
 public interface ApiStoreMapper extends BaseDao<StoreVo> {
     List<StoreVo> queryNearbyList(Map param);
+
+    Integer updateStoreLoadGoodsById(StoreVo storeVo);
 }

+ 22 - 0
kmall-api/src/main/java/com/kmall/api/entity/StoreVo.java

@@ -69,9 +69,31 @@ public class StoreVo implements Serializable {
     private String merchName;
 
     private String thirdPartyMerchCode;
+
     private String thirdPartyMerchName;
+
     private String isValid;
 
+    private String isLoadGoods;
+
+    private String moderSn;
+
+    public String getModerSn() {
+        return moderSn;
+    }
+
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    public String getIsLoadGoods() {
+        return isLoadGoods;
+    }
+
+    public void setIsLoadGoods(String isLoadGoods) {
+        this.isLoadGoods = isLoadGoods;
+    }
+
     public String getIsValid() {
         return isValid;
     }

+ 3 - 0
kmall-api/src/main/java/com/kmall/api/service/ApiStoreService.java

@@ -36,4 +36,7 @@ public class ApiStoreService {
         return apiStoreMapper.queryNearbyList(map);
     }
 
+    public int updateStoreLoadGoodsById(StoreVo storeVo){
+        return apiStoreMapper.updateStoreLoadGoodsById(storeVo);
+    }
 }

+ 1 - 1
kmall-api/src/main/java/com/kmall/api/service/mk/ApiMkStoreCampMinusGoodsService.java

@@ -87,7 +87,7 @@ public class ApiMkStoreCampMinusGoodsService {
 
         List<GoodsVo> goodsEntityList = apiGoodsMapper.queryList(params);
         params.remove("fields");
-        filterCategory.addAll(categoryService.getFilterCategory(goodsEntityList, filterCategory));
+        categoryService.getFilterCategory(goodsEntityList, filterCategory);
 
         params.put("category_parent_id", categoryId);
         params.put("fields", "a.id,a.name,a.goods_brief,a.list_pic_url,psr1.retail_price," +

+ 25 - 13
kmall-api/src/main/resources/mybatis/mapper/ApiStoreMapper.xml

@@ -18,11 +18,7 @@
         <result property="distance" column="distance"/>
         <result column="merch_sn" property="merchSn" jdbcType="VARCHAR" />
         <result column="merch_name" property="merchName" jdbcType="VARCHAR" />
-        <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
-        <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
         <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="thirdPartyMerchCode" column="third_party_merch_code"/>
         <result property="thirdPartyMerchName" column="third_party_merch_name"/>
@@ -41,8 +37,13 @@
 			`latitude`,
 			`longitude`,
 			`cover_radius`,
-			`remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
-    moder_sn, mod_time, tstm
+			is_load_goods,
+			`remark`,
+			merch_sn,
+			merch_name,
+			third_party_merch_code,
+			third_party_merch_name,
+			moder_sn
 		from mall_store
 		where id = #{id} and is_valid = 0
 	</select>
@@ -59,8 +60,12 @@
         `latitude`,
         `longitude`,
         `cover_radius`,
-        `remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
-        moder_sn, mod_time, tstm
+        `remark`,
+        merch_sn,
+        merch_name,
+        third_party_merch_code,
+        third_party_merch_name,
+        is_load_goods
         from mall_store
         WHERE 1=1  and is_valid = 0
         <if test="province_name != null and province_name.trim() != ''">
@@ -160,11 +165,9 @@
             *pow(sin((a.longitude*pi()/180-#{longitude}*pi()/180)/2),2)))*1000) as distance,
         merch_sn,
         merch_name,
-        creater_sn,
-        create_time,
-        moder_sn,
-        mod_time,
-        tstm,third_party_merch_code,third_party_merch_name
+        is_load_goods,
+        third_party_merch_code,
+        third_party_merch_name
         from mall_store a
         WHERE 1=1  and is_valid = 0
         <if test="province_name != null and province_name.trim() != ''">
@@ -186,4 +189,13 @@
         order by distance asc
         limit 0, 10
     </select>
+    <update id="updateStoreLoadGoodsById" parameterType="com.kmall.api.entity.StoreVo">
+        update mall_store
+        <set>
+            <if test="isLoadGoods != null">`is_load_goods` = #{isLoadGoods}, </if>
+            mod_time = now()
+        </set>
+        where id = #{id}
+    </update>
+
 </mapper>

+ 1 - 0
wx-mall/config/api.js

@@ -148,4 +148,5 @@ module.exports = {
   StoreCampMinusByGoodsIdList: NewApiRootUrl + '/campminus/getStoreCampMinusByGoodsIdList', //详情页查询该商品可支持的满减满折信息
   CampminusByCheckCartList: NewApiRootUrl + '/campminus/getCampminusByCheckCartList', //确认订单页,查看订单商品所支持的满减满折列表
   StoreCampMinusGoodsList: NewApiRootUrl + '/goods/getStoreCampMinusGoodsList', //门店优惠券商品列表 
+  UpdateStoreLoadGoods: NewApiRootUrl + '/auth/updateStoreLoadGoodsById',
 };

+ 2 - 2
wx-mall/pages/cart/cart.wxss

@@ -690,8 +690,8 @@ page {
   color: rgba(87, 86, 86, 0.63);
   margin-left: 10rpx;
   font-weight: bolder;
-  padding-bottom: 10rpx;
-  vertical-align: middle;
+  /* padding-bottom: 10rpx;
+  vertical-align: middle; */
 }
 .number-item-text {
   display: inline-flex;

+ 26 - 12
wx-mall/pages/catalog/catalog.js

@@ -84,8 +84,8 @@ Page({
             navList: res.data.categoryList
           });
           console.log(res.data.categoryList);
-          console.log(res.data.currentCategory);
-          console.log(res.data.brandList);
+          console.log(that.data.currentCategory);
+          console.log(that.data.currentCategory.id);
         } else {
           that.setData({
             navList: res.data.categoryList,
@@ -96,13 +96,14 @@ Page({
           console.log(res.data.currentCategory.id);
         }
       }
-
-      if (that.data.goodsList.length == 0 || wx.getStorageSync('storeId') != wx.getStorageSync('mapCatalogStoreId')) {
+      if (that.data.goodsList.length == 0 || wx.getStorageSync('storeId') != wx.getStorageSync('mapCatalogStoreId')
+        || wx.getStorageSync('isSwitchCatalog') == 'true') {
         wx.setStorageSync('mapCatalogStoreId', wx.getStorageSync('storeId'));
         that.setData({
           page: 1
         });
         that.getCategoryData();
+        wx.setStorageSync('isSwitchCatalog', 'false');
       } 
       // if (wx.getStorageSync('storeId') != wx.getStorageSync('mapCatalogStoreId')) {
       //   wx.setStorageSync('mapCatalogStoreId', wx.getStorageSync('storeId'));
@@ -341,7 +342,9 @@ Page({
           page: 1
         });
         app.globalData.appGoodsBizType = '00';
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
         break;
       case 'discountActivity':
         that.setData({
@@ -350,7 +353,9 @@ Page({
           page: 1
         });
         app.globalData.appGoodsBizType = '02';
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
         break;
       case 'groupActivity':
         that.setData({
@@ -359,7 +364,9 @@ Page({
           page: 1
         });
         app.globalData.appGoodsBizType = '10';
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
         break;
       case 'ordActivity':
         that.setData({
@@ -368,7 +375,9 @@ Page({
           page: 1
         });
         app.globalData.appGoodsBizType = '11';
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
         break;
       case 'sellSort':
         let tmpSortOrder = 'asc';
@@ -381,7 +390,9 @@ Page({
           goodsList: [],
           page: 1
         });
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
         break;
       case 'priceSort':
         tmpSortOrder = 'asc';
@@ -394,8 +405,9 @@ Page({
           goodsList: [],
           page: 1
         });
-
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
         break;
       default:
         //综合排序
@@ -405,7 +417,9 @@ Page({
           goodsList: [],
           page: 1
         });
-        this.getGoodsList();
+        // this.getGoodsList();
+        console.log(that.data.currentCategory.id);
+        that.getCurrentCategory(that.data.currentCategory.id);
     }
   },
   takeShareCoupon() {

+ 90 - 88
wx-mall/pages/goods/goods.js

@@ -57,6 +57,86 @@ Page({
     detailStoreCampMinusList: [],
     storeCampMinusList:[]
   },
+  onLoad: function (options) {
+    // 页面初始化 options为页面跳转所带来的参数
+    //由渠道推广生成的小程序码带来的参数,格式:商品id&门店id&推广id&用户id
+    // options.scene = "1181115&20&1&26"; 
+    // options.scene = "1181167&12&5&26"; 
+    // options.scene = "1181133&12&6&26";
+    // options.scene = "1181133&12&&26";
+    if (options.scene) {
+      var scene = decodeURIComponent(options.scene);
+      console.log("scene is ", scene);
+      var scanArray = scene.split('&');
+      var id = scanArray[0];
+      var storeId = scanArray[1];
+      var promId = scanArray[2];
+      var referrer = scanArray[3];
+      console.log("id is ", id);
+      console.log("storeId is ", storeId);
+      console.log("promId is ", promId);
+      console.log("referrer is ", referrer);
+      this.setData({
+        id: id,
+        storeId: storeId,
+        promId: promId,
+        referrer: referrer
+      });
+      if (storeId) {
+        wx.setStorageSync('storeId', storeId);
+        wx.setStorageSync('isShare', 'true');//商品详情是由用户分享进入的
+      }
+    } else {
+      //由列表页、与普通用户分享点进来带来的参数,商品id,门店id;商品id,门店id,分享用户
+      this.setData({
+        id: parseInt(options.id)
+      });
+      if (options.storeId) {
+        this.setData({
+          storeId: options.storeId
+        });
+        wx.setStorageSync('storeId', options.storeId);
+      }
+      if (options.referrer) {
+        this.setData({
+          referrer: options.referrer
+        });
+        wx.setStorageSync('isShare', 'true');
+      } else {
+        wx.removeStorageSync('isShare');//由列表页、与普通用户分享点进来则清除是否分享缓存
+      }
+    }
+    var that = this;
+    //  高度自适应
+    wx.getSystemInfo({
+        success: function (res) {
+            var clientHeight = res.windowHeight,
+                clientWidth = res.windowWidth,
+                rpxR = 750 / clientWidth;
+            var calc = clientHeight * rpxR - 100;
+            // console.log(calc);
+            that.setData({
+              winHeight: calc,
+              windowWidth: res.windowWidth
+            });
+        }
+    });
+  },
+  onReady: function () {
+    let that = this;
+    this.videoContext = wx.createVideoContext('myVideo');
+    // 页面渲染完成
+    // wx.setClipboardData({
+    //     data: '/pages/goods/goods?id=' + that.data.id,
+    //     success: function (res) {
+    //         wx.getClipboardData({
+    //             success: function (res) {
+    //                 // console.log(res.data) // data
+    //             }
+    //         })
+    //     }
+    // })
+  },
   toggleNav() {
     this.setData({
       showNavList: !this.data.showNavList
@@ -73,7 +153,7 @@ Page({
     var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' };
     return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) { return arrEntities[t]; });
   },
-//调用在需要的地方直接调用即可。如:this.escape2Html(contents)
+  //调用在需要的地方直接调用即可。如:this.escape2Html(contents)
   getGoodsInfo: function () {
     wx.showLoading({
       title: '加载中...',
@@ -84,8 +164,10 @@ Page({
     const regex = new RegExp('<img', 'gi');
     console.log('分享的storeId' + wx.getStorageSync('storeId'))
     // console.log('promId' + that.data.promId)
-    util.request(api.GoodsDetail, { id: that.data.id, referrer: that.data.referrer, 
-      merchSn: wx.getStorageSync('merchSn'), storeId: wx.getStorageSync('storeId'), promId: that.data.promId }).then(function (res) {
+    util.request(api.GoodsDetail, {
+      id: that.data.id, referrer: that.data.referrer,
+      merchSn: wx.getStorageSync('merchSn'), storeId: wx.getStorageSync('storeId'), promId: that.data.promId
+    }).then(function (res) {
       if (res.errno === 0) {
         that.setData({
           goods: res.data.info,
@@ -102,7 +184,7 @@ Page({
           defaultFreight: res.data.defaultFreight,
           checkedSpecText: res.data.specificationList[0].valueList[0].value,
           detailContent: that.escape2Html(res.data.info.goods_desc).replace(regex, `<img style="width: 100%;"`),
-          detailStoreId:res.data.info.storeId,
+          detailStoreId: res.data.info.storeId,
           merchSn: res.data.info.merchSn
         });
 
@@ -137,14 +219,14 @@ Page({
         that.setData({
           'specificationList': _specificationList
         });
-        }
-        wx.hideLoading();
+      }
+      wx.hideLoading();
     });
     if (null != that.data.referrer && that.data.referrer > 0) {
       //转发获取优惠券
       util.request(api.GoodsTransferCoupon, {
         goods_id: that.data.id,
-        referrer: that.data.referrer, 
+        referrer: that.data.referrer,
         send_type: 2
       }).then(function (res) {
 
@@ -202,86 +284,6 @@ Page({
     //重新计算spec改变后的信息
     goodsUtil.changeSpecInfo(that);
   },
-  onLoad: function (options) {
-    // 页面初始化 options为页面跳转所带来的参数
-    //由渠道推广生成的小程序码带来的参数,格式:商品id&门店id&推广id&用户id
-    // options.scene = "1181115&20&1&26"; 
-    // options.scene = "1181167&12&5&26"; 
-    // options.scene = "1181133&12&6&26";
-    // options.scene = "1181133&12&&26";
-    if (options.scene) {
-      var scene = decodeURIComponent(options.scene);
-      console.log("scene is ", scene);
-      var scanArray = scene.split('&');
-      var id = scanArray[0];
-      var storeId = scanArray[1];
-      var promId = scanArray[2];
-      var referrer = scanArray[3];
-      console.log("id is ", id);
-      console.log("storeId is ", storeId);
-      console.log("promId is ", promId);
-      console.log("referrer is ", referrer);
-      this.setData({
-        id: id,
-        storeId: storeId,
-        promId: promId,
-        referrer: referrer
-      });
-      if (storeId) {
-        wx.setStorageSync('storeId', storeId);
-        wx.setStorageSync('isShare', 'true');
-      }
-    } else {
-      //由列表页、与普通用户分享点进来带来的参数,商品id,门店id;商品id,门店id,分享用户
-      this.setData({
-        id: parseInt(options.id)
-      });
-      if (options.storeId) {
-        this.setData({
-          storeId: options.storeId
-        });
-        wx.setStorageSync('storeId', options.storeId);
-      }
-      if (options.referrer) {
-        this.setData({
-          referrer: options.referrer
-        });
-        wx.setStorageSync('isShare', 'true');
-      } else {
-        wx.removeStorageSync('isShare');//由列表页、与普通用户分享点进来则清除是否分享缓存
-      }
-    }
-    var that = this;
-    //  高度自适应
-    wx.getSystemInfo({
-        success: function (res) {
-            var clientHeight = res.windowHeight,
-                clientWidth = res.windowWidth,
-                rpxR = 750 / clientWidth;
-            var calc = clientHeight * rpxR - 100;
-            // console.log(calc);
-            that.setData({
-              winHeight: calc,
-              windowWidth: res.windowWidth
-            });
-        }
-    });
-  },
-  onReady: function () {
-    let that = this;
-    this.videoContext = wx.createVideoContext('myVideo');
-    // 页面渲染完成
-    // wx.setClipboardData({
-    //     data: '/pages/goods/goods?id=' + that.data.id,
-    //     success: function (res) {
-    //         wx.getClipboardData({
-    //             success: function (res) {
-    //                 // console.log(res.data) // data
-    //             }
-    //         })
-    //     }
-    // })
-  },
   //购物车增加
   addNumber2: function (e) {
     let that = this;
@@ -290,7 +292,7 @@ Page({
     var hotGoods = that.data.hotGoods;
     util.request(api.CartAdd, { goodsId: goodsId, productId: productId, number: 1 }, 'POST').then(function (res) {
       if (res.errno === 0 && null != res.data) {
-        util.request(api.CartGoodsCount).then(function (res) {
+        util.request(api.CartGoodsCount, { storeId: wx.getStorageSync('storeId') }).then(function (res) {
           if (res.errno === 0) {
             that.setData({
               cartGoodsCount: res.data.cartTotal.goodsCount

+ 150 - 109
wx-mall/pages/index/index.js

@@ -15,14 +15,65 @@ Page({
     channel: [],
     groupBanner: {},
     storeName: '',
-    showPop: false,//活动弹窗
+    showPop: false, //活动弹窗
     couponVo: {},
     storeId: '',
     page: 1,
     size: 3,
     list: [],
     openAttr: false,
-    isMapShow: ''
+    isMapShow: '', //第三方商户是否启用地图显示
+  },
+  onLoad: function(options) {
+    let that = this;
+    wx.setStorageSync("navUrl", "/pages/index/index");
+    // options.scene = 38;
+    // options.scene = 65;
+    // options.scene = 28;
+    // options.scene = 8;
+    if (options.scene) {
+      console.log("have scene");
+      var scene = decodeURIComponent(options.scene);
+      console.log("scene is ", scene);
+      that.setData({
+        storeId: scene
+      });
+      wx.setStorageSync('storeId', scene);
+      //扫码进入的小程序则清除是否分享缓存
+      wx.removeStorageSync('isShare');
+    } else {
+      //是否分享过商品,有数据则分享过;从首页进入页面则没有分享过,从详情页进入则分享过
+      if (wx.getStorageSync('isShare') == 'true') {
+        console.log('是分享进入首页门店id:' + wx.getStorageSync('storeId') + ',从商品页获取的缓存')
+        console.log('是分享进入首页:' + wx.getStorageSync('isShare'))
+      } else {
+        //小程序入口进入的主页,则清除storeId,获取当前地址最近的门店
+        wx.removeStorageSync('storeId');
+        console.log('不是分享进入首页门店id:【' + wx.getStorageSync('storeId') + '】,获取最近门店')
+        console.log('不是分享进入首页:' + wx.getStorageSync('isShare'))
+      }
+    }
+  },
+  onReady: function() {
+    // 页面渲染完成
+  },
+  onShow: function() {
+    // 页面显示
+    let that = this;
+    wx.setStorageSync("navUrl", "/pages/index/index");
+    if (wx.getStorageSync('userInfo') || wx.getStorageSync('token')) {
+      that.syncStore();
+    } else {
+      wx.navigateTo({
+        url: '/pages/auth/btnAuth/btnAuth',
+      })
+    }
+  },
+  onHide: function() {
+    // 页面隐藏
+  },
+  onUnload: function() {
+    // 页面关闭
   },
   showCouponPop() {
     let that = this;
@@ -39,21 +90,20 @@ Page({
       content: that.data.couponVo.name
     })
   },
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
     return {
       title: '商业版',
       desc: '新人好礼送券',
       path: '/pages/index/index'
     }
   },
-  getIndexData: function () {
-    setTimeout(function () {
-    }, 350)
+  getIndexData: function() {
+    setTimeout(function() {}, 350)
     wx.showLoading({
       title: '加载中...',
     })
     let that = this;
-    util.request(api.IndexUrl).then(function (res) {
+    util.request(api.IndexUrl).then(function(res) {
       if (res.errno === 0) {
         // console.log(res.data.banner);
         that.setData({
@@ -69,28 +119,40 @@ Page({
         // console.log(that.data.hotGoods.length)
         // console.log(wx.getStorageSync('storeId'))
         // console.log(wx.getStorageSync('mapIndexStoreId'))
-        if (that.data.hotGoods.length == 0){
-          that.getGoodsList();
-        }
+        // if (that.data.hotGoods.length == 0) {
+        //   that.getGoodsList();
+        // }
         console.log("isShare:" + wx.getStorageSync('isShare'))
-        if (wx.getStorageSync('storeId') != wx.getStorageSync('mapIndexStoreId') || wx.getStorageSync('isShare')=='true'){
+        console.log("isLoadGoods:" + wx.getStorageSync('isLoadGoods'))
+        //当切换了门店地图(mapIndexStoreId),或是由用户分享进入的商品详情切换进入的首页(isShare:true)
+        if (wx.getStorageSync('storeId') != wx.getStorageSync('mapIndexStoreId') || wx.getStorageSync('isShare') == 'true' || that.data.hotGoods.length == 0 || wx.getStorageSync('isLoadGoods') == '1') {
           that.setData({
             hotGoods: [],
             page: 1
           });
           that.getGoodsList();
+          if (wx.getStorageSync('isLoadGoods') == '1') {
+            util.request(api.UpdateStoreLoadGoods, {
+              storeId: wx.getStorageSync('storeId')
+            }).then(function(res) {});
+          }
           wx.setStorageSync('isShare', 'false');
         }
       }
       wx.hideLoading();
     });
   },
-  getGoodsList: function () {
+  getGoodsList: function() {
     let that = this;
-    util.request(api.GoodsHot).then(function (res) {
+    util.request(api.GoodsHot).then(function(res) {
       if (res.errno == 0) {
-        util.request(api.HotGoodsList, { isHot: 1, page: that.data.page, size: that.data.size, categoryId: 0 })
-          .then(function (res) {
+        util.request(api.HotGoodsList, {
+            isHot: 1,
+            page: that.data.page,
+            size: that.data.size,
+            categoryId: 0
+          })
+          .then(function(res) {
             if (res.errno == 0) {
               let goodsList = that.data.hotGoods.concat(res.data.goodsList);
               that.setData({
@@ -103,9 +165,9 @@ Page({
       }
     });
   },
-  getGroupData: function () {
+  getGroupData: function() {
     let that = this;
-    util.request(api.GroupList).then(function (res) {
+    util.request(api.GroupList).then(function(res) {
       if (res.errno === 0) {
         that.setData({
           groupGoods: res.data.data,
@@ -113,54 +175,6 @@ Page({
       }
     });
   },
-  onLoad: function (options) {
-    let that = this;
-    wx.setStorageSync("navUrl", "/pages/index/index");
-    // options.scene = 65;
-    // options.scene = 28;
-    // options.scene = 8;
-    if (options.scene) {
-      console.log("have scene");
-      var scene = decodeURIComponent(options.scene);
-      console.log("scene is ", scene);
-      that.setData({
-        storeId: scene
-      });
-      wx.setStorageSync('storeId', scene);
-      wx.removeStorageSync('isShare');//扫码进入的小程序则清除是否分享缓存
-    } else {
-      console.log("wx.getStorageSync('isShare')"+wx.getStorageSync('isShare'));
-      if (wx.getStorageSync('isShare')) {//是否分享过商品,有数据则分享过;从首页进入页面则没有分享过,从详情页进入则分享过
-        console.log('是分享进入首页门店id:' + wx.getStorageSync('storeId')+',从商品也获取的缓存')
-        console.log('是分享进入首页:' + wx.getStorageSync('isShare'))
-      } else {
-        wx.removeStorageSync('storeId');
-        console.log('不是分享进入首页门店id:【' + wx.getStorageSync('storeId')+'】,获取最近门店')
-        console.log('不是分享进入首页:' + wx.getStorageSync('isShare'))
-      }
-    }
-  },
-  onReady: function () {
-    // 页面渲染完成
-  },
-  onShow: function () {
-    // 页面显示
-    let that = this;
-    wx.setStorageSync("navUrl", "/pages/index/index");
-    if (wx.getStorageSync('userInfo') || wx.getStorageSync('token')) {
-      that.syncStore();
-    } else {
-      wx.navigateTo({
-        url: '/pages/auth/btnAuth/btnAuth',
-      })
-    }
-  },
-  onHide: function () {
-    // 页面隐藏
-  },
-  onUnload: function () {
-    // 页面关闭
-  },
   handleStore() {
     wx.navigateTo({
       url: '../map/map',
@@ -171,29 +185,26 @@ Page({
       url: '../search/search',
     })
   },
-  goCatalog: function (e) {
+  goCatalog: function(e) {
     let url = '';
     // console.log('dataset.goodsBizType:' + e.currentTarget.dataset.goodsBizType);
     app.globalData.appGoodsBizType = e.currentTarget.dataset.goodsBizType;
     // console.log('appgoodsBizType1:' + app.globalData.appGoodsBizType);
-
+    wx.setStorageSync('isSwitchCatalog', 'true'); //主页跳转至分类页加载商品,
     wx.switchTab({
       url: '/pages/catalog/catalog',
     });
   },
-  onReachBottom: function () {
-
+  onReachBottom: function() {
     if (this.data.bottomLoadDone === true || this.data.bottomLoading === true) {
       return false;
     }
-
     this.setData({
       bottomLoading: true
     });
-
     // this.getFloorCategory();
   },
-  reLoad: function () {
+  reLoad: function() {
     let that = this;
     // console.log(wx.getStorageSync('userId'));
     // console.log(wx.getStorageSync('storeId'));
@@ -203,13 +214,15 @@ Page({
         wx.request({
           url: api.updateLoginUser,
           data: {
-            userId: wx.getStorageSync('userId'), storeId: wx.getStorageSync('storeId'), merchSn: wx.getStorageSync('merchSn')
+            userId: wx.getStorageSync('userId'),
+            storeId: wx.getStorageSync('storeId'),
+            merchSn: wx.getStorageSync('merchSn')
           },
           method: 'POST',
           header: {
             'Content-Type': 'application/json'
           },
-          success: function (wxRes) {
+          success: function(wxRes) {
             if (wxRes.data.errno === 0) {
               that.setData({
                 isMapShow: wxRes.data.data.isMapShow
@@ -219,7 +232,7 @@ Page({
               // console.log("用户信息更新成功");
             }
           },
-          fail: function (err) {
+          fail: function(err) {
             console.log("failed");
           }
         });
@@ -230,15 +243,23 @@ Page({
     }
   },
   // 同步门店
-  syncStore: function () {
+  syncStore: function() {
     let that = this;
     // console.log(wx.getStorageSync('merchSn'));
     //获取附件门店信息
     util.getLocation((lng, lat) => {
-      wx.setStorageSync('location', JSON.stringify({ lng, lat }));
+      wx.setStorageSync('location', JSON.stringify({
+        lng,
+        lat
+      }));
       let storeId = wx.getStorageSync('storeId');
       console.log('查询门店id:' + storeId)
-      util.request(api.NearbyList, { longitude: lng, latitude: lat, storeId: storeId, thirdPartyMerchCode: '' }).then((res) => {
+      util.request(api.NearbyList, {
+        longitude: lng,
+        latitude: lat,
+        storeId: storeId,
+        thirdPartyMerchCode: ''
+      }).then((res) => {
         let nlist = res.data;
         // wx.removeStorageSync('nearStoreList');
         // wx.removeStorageSync('storeId');
@@ -253,6 +274,7 @@ Page({
         } else {
           wx.setStorageSync('nearStoreList', JSON.stringify(nlist));
           wx.setStorageSync('mapIndexStoreId', nlist[0].id);
+          wx.setStorageSync('isLoadGoods', nlist[0].isLoadGoods);
         }
 
         if (!nlist.length) {
@@ -274,9 +296,12 @@ Page({
 
   },
   // 更新门店Id
-  chooseStore: function (storeId, merchSn) {
+  chooseStore: function(storeId, merchSn) {
     let that = this;
-    util.request(api.ChooseStoreId, { storeId: storeId, merchSn: merchSn }, 'POST').then(function (res) {
+    util.request(api.ChooseStoreId, {
+      storeId: storeId,
+      merchSn: merchSn
+    }, 'POST').then(function(res) {
       if (res.errno === 0) {
         wx.setStorageSync('storeId', storeId);
         wx.setStorageSync('merchSn', merchSn);
@@ -285,7 +310,7 @@ Page({
     });
   },
   //购物车减少
-  cutNumber: function (e) {
+  cutNumber: function(e) {
     let that = this;
     var goodsId = e.currentTarget.dataset.goodsId;
     var productId = e.currentTarget.dataset.productId;
@@ -300,21 +325,27 @@ Page({
     //   }
     // });
     // that.setData({ hotGoods: hotGoods });
-    util.request(api.CartMinus, { goodsId: goodsId, productId: productId, number: 1 }, 'POST').then(function (res) {
+    util.request(api.CartMinus, {
+      goodsId: goodsId,
+      productId: productId,
+      number: 1
+    }, 'POST').then(function(res) {
       if (res.errno === 0 && null != res.data) {
         var hotGoods = that.data.hotGoods;
-        hotGoods.forEach(function (val, index, arr) {
+        hotGoods.forEach(function(val, index, arr) {
           if (val.product_id == productId) {
             val.cart_num = res.data;
             hotGoods[index] = val;
-            that.setData({ hotGoods: hotGoods });
+            that.setData({
+              hotGoods: hotGoods
+            });
           }
         }, that);
       }
     });
   },
   //购物车增加
-  addNumber: function (e) {
+  addNumber: function(e) {
     let that = this;
     var goodsId = e.currentTarget.dataset.goodsId;
     var productId = e.currentTarget.dataset.productId;
@@ -326,16 +357,22 @@ Page({
     //   }
     // });
     // that.setData({ hotGoods: hotGoods });
-    util.request(api.CartAdd, { goodsId: goodsId, productId: productId, number: 1 }, 'POST').then(function (res) {
+    util.request(api.CartAdd, {
+      goodsId: goodsId,
+      productId: productId,
+      number: 1
+    }, 'POST').then(function(res) {
       if (res.errno === 0 && null != res.data) {
-        hotGoods.forEach(function (val, index, arr) {
-          res.data.cartList.forEach(function (cartVal, cartIndex, cartArr) {
+        hotGoods.forEach(function(val, index, arr) {
+          res.data.cartList.forEach(function(cartVal, cartIndex, cartArr) {
             if (val.product_id == cartVal.product_id) {
               val.cart_num = cartVal.number;
               hotGoods[index] = val;
             }
           });
-          that.setData({ hotGoods: hotGoods });
+          that.setData({
+            hotGoods: hotGoods
+          });
         }, that);
       } else {
         wx.showToast({
@@ -346,7 +383,7 @@ Page({
     });
   },
   // 查询是否有活动
-  enableActivity: function () {
+  enableActivity: function() {
     let that = this;
     let couponIds = wx.getStorageSync('couponIds');
     if (!couponIds) {
@@ -373,7 +410,7 @@ Page({
     // });
   },
   // 商品扫码
-  scanGoodsCode: function (e) {
+  scanGoodsCode: function(e) {
     var that = this;
     var code;
     var value;
@@ -385,14 +422,14 @@ Page({
       onlyFromCamera: true,
       // 扫码类型, barCode:一维码, qrCode:二维码
       scanType: ['barCode', 'qrCode'],
-      success: function (res) {
+      success: function(res) {
         that.code = "结果:" + res.result + ",路径:" + res.path + ",编码:" + res.rawData;
         that.value = res.result;
         that.scanType = res.scanType;
         that.setData({
           goodsCode: that.code
         });
-        if (that.scanType == 'QR_CODE') {//二维码
+        if (that.scanType == 'QR_CODE') { //二维码
           that.substrValue = that.value.substring(0, 5);
           that.value = that.value.substring(5, that.value.length);
           // var goodId = that.value.substring(18, that.value.length);
@@ -410,12 +447,12 @@ Page({
           var storeId = scanArray[1].substring(8, that.value.length);
           // console.log("storeId:" + storeId);
           // console.log("goodId:" + goodId);
-          if (that.substrValue != 'emato') {//../goods/goods?id=&merchSn=
+          if (that.substrValue != 'emato') { //../goods/goods?id=&merchSn=
             wx.showModal({
               title: '',
               content: '您所扫描的商品无效',
               showCancel: false,
-              success: function (res) {
+              success: function(res) {
                 if (res.confirm) {
                   console.log('用户点击确定')
                 } else if (res.cancel) {
@@ -433,17 +470,21 @@ Page({
             });
             return;
           }
-          util.request(api.GoodsDetail, { id: goodId,storeId:storeId, referrer: '' }).then(function (res) {
+          util.request(api.GoodsDetail, {
+            id: goodId,
+            storeId: storeId,
+            referrer: ''
+          }).then(function(res) {
             if (res.errno === 0) {
               // console.log(res);
               // 跳转页面
-              setTimeout(function () {
+              setTimeout(function() {
                 wx.navigateTo({
                   url: that.value,
-                  success: function (e) {
+                  success: function(e) {
                     console.log('跳转成功');
                   },
-                  fail: function (e) {
+                  fail: function(e) {
                     console.log('跳转失败');
                   }
                 })
@@ -456,7 +497,7 @@ Page({
               });
             }
           });
-        } else {//其他码
+        } else { //其他码
           //弹框显示结果
           wx.showModal({
             title: '扫描结果',
@@ -465,7 +506,7 @@ Page({
           });
         }
       },
-      fail: function () {
+      fail: function() {
         // 显示提示框
         wx.showToast({
           title: '扫码失败',
@@ -477,7 +518,7 @@ Page({
 
     })
   },
-  imgOnLoad: function (e) {
+  imgOnLoad: function(e) {
     let that = this;
     // console.log('图片加载完成');
     // var realthumb = e.target.dataset.thumb;
@@ -491,18 +532,18 @@ Page({
     //   })
     // }
   },
-  switchAttrPop: function () {
+  switchAttrPop: function() {
     this.setData({
       openAttr: !this.data.openAttr
     })
   },
-  hideSwitchAttrPop: function () {
+  hideSwitchAttrPop: function() {
     this.setData({
       openAttr: false
     })
   },
   //购物车增加
-  addCart: function (e) {
+  addCart: function(e) {
     let that = this;
     that.setData({
       number: 1
@@ -511,7 +552,7 @@ Page({
     var retailPrice = e.currentTarget.dataset.retailPrice;
     util.request(api.GoodsSku, {
       goodsId: goodsId
-    }).then(function (res) {
+    }).then(function(res) {
       if (res.errno === 0 && null != res.data) {
         that.setData({
           goodsVo: res.data.goodsVo,
@@ -539,7 +580,7 @@ Page({
     });
   },
 
-  shows: function (e) {
+  shows: function(e) {
     // wx.redirectTo({
     //   url: '/pages/images/images'
     // })
@@ -548,7 +589,7 @@ Page({
     })
   },
   onReachBottom() {
-    var that = this; 
+    var that = this;
     if (that.data.list.length > 0) {
       console.log(that.data.list)
       wx.showLoading({
@@ -560,4 +601,4 @@ Page({
     });
     that.getGoodsList();
   }
-})
+})