1
0
Переглянути джерело

第三方商户新增地图是否显示配置相关开发,以及样式修改

hyq 6 роки тому
батько
коміт
08ce7d6fe6

+ 2 - 2
wx-mall/config/api.js

@@ -1,7 +1,7 @@
 //开发环境
 //var NewApiRootUrl = 'http://localhost:8080/api/';
 //var NewApiRootUrl = 'http://192.168.1.138:8080/api/';
-// var NewApiRootUrl = 'http://qhdswl.f3322.net:9001/platform-framework/api/';//hyq
+// var NewApiRootUrl = 'http://qhdswl.f3322.net:9001/framework/api/';//hyq
 // var NewApiRootUrl = 'http://qhdswl.f3322.net:9003/api/';
 
 //测试环境
@@ -20,7 +20,7 @@ module.exports = {
     // 权限
     AuthLoginByWeixin: NewApiRootUrl + 'auth/login_by_weixin', //微信登录
     ChooseStoreId: NewApiRootUrl + 'auth/chooseStoreId', //选择门店Id
-    NearbyList: NewApiRootUrl + 'auth/nearbyList',//根据经纬度获取配送范围内的门店
+    NearbyList: NewApiRootUrl + 'auth/nearbyLists',//根据经纬度获取配送范围内的门店
     StoreByCity: NewApiRootUrl + 'auth/storeListByCity',//获取地市的门店
     //
     ActivityList: NewApiRootUrl + 'activity/list', //活动列表

+ 0 - 4
wx-mall/pages/cart/cart.js

@@ -73,10 +73,6 @@ Page({
         });
         that.getCartList();
         that.getFootprintList();
-      }else{
-        wx.switchTab({
-          url: '/pages/index/index'
-        });
       }
     } else {
       wx.navigateTo({

+ 14 - 6
wx-mall/pages/catalog/catalog.js

@@ -91,9 +91,21 @@ Page({
         }
       }
 
-      if (that.data.goodsList.length == 0) {
+      if (that.data.goodsList.length == 0 || wx.getStorageSync('storeId') != wx.getStorageSync('mapCatalogStoreId')) {
+        wx.setStorageSync('mapCatalogStoreId', wx.getStorageSync('storeId'));
+        that.setData({
+          page: 1
+        });
         that.getCategoryData();
-      }
+      } 
+      // if (wx.getStorageSync('storeId') != wx.getStorageSync('mapCatalogStoreId')) {
+      //   wx.setStorageSync('mapCatalogStoreId', wx.getStorageSync('storeId'));
+      //   that.setData({
+      //     page: 1
+      //   });
+      //   that.getCategoryData();
+      // }
+      
       wx.hideLoading();
     });
     util.request(api.GoodsCount).then(function (res) {
@@ -139,10 +151,6 @@ Page({
         });
         that.getFootCart();
         that.getCatalog();
-      } else {
-        wx.switchTab({
-          url: '/pages/index/index'
-        });
       }
     } else {
       wx.navigateTo({

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

@@ -107,8 +107,7 @@
           <text class="txt">{{item.name?item.name:""}}</text>
         </navigator>
       </view>
-      
-      <view class="sort" wx:if="{{goodsList.length > 0 }}">
+      <view class="sort">
         <view class="sort-box">
           <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
             <text class="txt">综合</text>

+ 4 - 3
wx-mall/pages/catalog/catalog.wxss

@@ -186,12 +186,13 @@ page {
 }
 
 .sort-box {
-  background: #fff;
+  background: rgb(250, 247, 247);
   width: 100%;
   height: 78rpx;
   overflow: hidden;
-  padding: 0 30rpx;
+  /* padding: 0 30rpx; */
   display: flex;
+  margin-top:20rpx;
 }
 
 .sort-box .item {
@@ -251,7 +252,7 @@ page {
   height: auto;
   overflow: hidden;
   border-top: 1rpx solid #f4f4f4;
-  margin-top: 20rpx;
+  /* margin-top: 20rpx; */
   margin-bottom: 200rpx;
 }
 

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

@@ -22,6 +22,7 @@ Page({
     size: 3,
     list: [],
     openAttr: false,
+    isMapShow: ''
   },
   showCouponPop() {
     let that = this;
@@ -65,7 +66,17 @@ Page({
           // groupBanner: res.data.groupBanner,
           channel: res.data.channel
         });
-        if (that.data.hotGoods.length==0){
+        // 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 (wx.getStorageSync('storeId') != wx.getStorageSync('mapIndexStoreId')){
+          that.setData({
+            hotGoods: [],
+            page: 1
+          });
           that.getGoodsList();
         }
       }
@@ -103,8 +114,8 @@ Page({
   onLoad: function (options) {
     let that = this;
     wx.setStorageSync("navUrl", "/pages/index/index");
+    // options.scene = 38;
     if (options.scene) {
-      console.log("has scene");
       var scene = decodeURIComponent(options.scene);
       console.log("scene is ", scene);
       that.setData({
@@ -112,6 +123,7 @@ Page({
       });
       wx.setStorageSync('storeId', scene);
     } else {
+      wx.removeStorageSync('storeId');
       console.log("no scene");
     }
   },
@@ -186,6 +198,11 @@ Page({
           },
           success: function (wxRes) {
             if (wxRes.data.errno === 0) {
+              that.setData({
+                isMapShow: wxRes.data.data.isMapShow
+              });
+              wx.setStorageSync('thirdPartyMerchCode', wxRes.data.data.thirdPartyMerchCode);
+              // console.log(that.data.isMapShow)
               // console.log("用户信息更新成功");
             }
           },
@@ -206,43 +223,37 @@ Page({
     //获取附件门店信息
     util.getLocation((lng, lat) => {
       wx.setStorageSync('location', JSON.stringify({ lng, lat }));
-      util.request(api.NearbyList, { longitude: lng, latitude: lat, storeId: that.data.storeId }).then((res) => {
+      let storeId = wx.getStorageSync('storeId');
+      util.request(api.NearbyList, { longitude: lng, latitude: lat, storeId: storeId, thirdPartyMerchCode: '' }).then((res) => {
         let nlist = res.data;
-        // console.log(nlist);
-        wx.removeStorageSync('nearStoreList');
-        wx.removeStorageSync('storeId');
-        wx.removeStorageSync('storeVo');
-        // console.log('sasas:' + wx.getStorageSync('currentCategory'));
+        // wx.removeStorageSync('nearStoreList');
+        // wx.removeStorageSync('storeId');
+        // wx.removeStorageSync('storeVo');
+        // wx.setStorageSync('storeId', storeId);
         if (!wx.getStorageSync('currentCategory')) {
           wx.removeStorageSync('currentCategory');
         }
         if (!nlist.length) {
           wx.removeStorageSync('nearStoreList');
+          wx.removeStorageSync('mapIndexStoreId');
         } else {
           wx.setStorageSync('nearStoreList', JSON.stringify(nlist));
+          wx.setStorageSync('mapIndexStoreId', nlist[0].id);
         }
-        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]));
-          }
+
+        if (!nlist.length) {
+          wx.removeStorageSync('storeId');
+          wx.removeStorageSync('storeVo');
+          that.setData({
+            storeName: '附近暂无门店'
+          })
         } else {
-          var storeVo = JSON.parse(wx.getStorageSync('storeVo'));
-          that.chooseStore(storeVo.id, storeVo.merchSn);
           that.setData({
-            storeName: storeVo.storeName,
-            storeId: storeVo.id
-          });
+            storeName: nlist[0].storeName,
+            storeId: nlist[0].id
+          })
+          that.chooseStore(nlist[0].id, nlist[0].merchSn);
+          wx.setStorageSync('storeVo', JSON.stringify(nlist[0]));
         }
       })
     });
@@ -525,7 +536,6 @@ Page({
   },
 
   shows: function (e) {
-
     wx.redirectTo({
       url: '/pages/images/images'
     })

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

@@ -24,8 +24,8 @@
     <image src="../../static/images/service-sao.png" class="search-icon-shop" bindtap="scanGoodsCode"></image>
   </view>
   <view class="home-header">
-    <!-- <view bindtap="handleStore" class="current-store arrow arrow-down">{{ storeName }}</view> -->
-    <view class="current-store">{{ storeName }}</view>
+    <view bindtap="handleStore" class="current-store arrow arrow-down" wx:if="{{isMapShow == 1}}">{{ storeName }}</view>
+    <view class="current-store" wx:if="{{isMapShow == 0}}">{{ storeName }}</view>
   </view>
 
   <swiper class="banner" indicator-dots="true" autoplay="true" interval="15000" duration="750">

+ 4 - 2
wx-mall/pages/index/index.wxss

@@ -303,7 +303,8 @@
   justify-content: center;
   overflow: hidden;
   height: 264rpx;
-  width: 456rpx;
+  width: 446rpx;
+  margin-left:30rpx;
 }
 
 .a-popular .b .name {
@@ -311,7 +312,8 @@
   display: block;
   color: #333;
   line-height: 50rpx;
-  font-size: 26rpx;
+  font-size: 30rpx;
+  /* font-weight: bolder; */
 }
 
 .a-popular .b .desc {

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

@@ -30,13 +30,17 @@ Page({
     this.setData({
       nearStoreList: nearStoreList
     })
-  
+    // console.log(nearStoreList)
+    let thirdPartyMerchCode = wx.getStorageSync('thirdPartyMerchCode') ? wx.getStorageSync('thirdPartyMerchCode') : '';
+    // console.log(thirdPartyMerchCode)
     let that = this;
     util.getLocation((lng, lat) => {
-      util.request(api.NearbyList, { longitude: lng, latitude: lat }).then((res) => {
+      util.request(api.NearbyList, { longitude: lng, latitude: lat, storeId:'', thirdPartyMerchCode: thirdPartyMerchCode }).then((res) => {
+
         let markers = [];
         let points = [];
         let nlist = res.data;
+        // console.log(nlist);
         for (var i = 0; i < nlist.length; i++) {
           let marker = {
             iconPath: "/static/images/address.png",
@@ -53,12 +57,13 @@ Page({
             merchSn: nlist[i].merchSn
           };
           markers.push(marker);
-
+          // console.log(markers);
           let point = {
             latitude: nlist[i].latitude,
             longitude: nlist[i].longitude,
           };
           points.push(point);
+          // console.log(points);
         }
 
         this.mapCtx.includePoints({
@@ -116,9 +121,12 @@ Page({
         wx.removeStorageSync('storeId');
         wx.removeStorageSync('storeVo');
         wx.removeStorageSync('currentCategory');
+        wx.removeStorageSync('mapStoreId');
         wx.setStorageSync('storeId', storeId);
         var item = "";
         for (var i = 0; i < that.data.nearStoreList.length; i++) {
+          wx.setStorageSync('mapIndexStoreId', that.data.nearStoreList[i].id);//地图切换的门店id,提供给首页tab页做条件
+          wx.setStorageSync('mapCatalogStoreId', that.data.nearStoreList[i].id);//地图切换的门店id,提供给分类tab页做条件
           if (storeId == that.data.nearStoreList[i].id) {
             item = that.data.nearStoreList[i];
             wx.setStorageSync('storeVo', JSON.stringify(item));
@@ -129,25 +137,20 @@ Page({
         var pages = getCurrentPages();
         var currPage = pages[pages.length - 1];  //当前页面
         var prevPage = pages[pages.length - 2]; //上一个页面
+        // console.log(item)
         if (item == "") {
-          wx.removeStorageSync('nearStoreList');
-          wx.removeStorageSync('storeId');
-          wx.removeStorageSync('storeVo');
-          that.setData({
-            storeName: '附近暂无门店'
-          })
+          // wx.removeStorageSync('nearStoreList');
+          // wx.removeStorageSync('storeId');
+          // wx.removeStorageSync('storeVo');
+          // that.setData({
+          //   storeName: '附近暂无门店'
+          // })
         } else {
           //直接调用上一个页面的setData()方法,把数据存到上一个页面中去
           prevPage.setData({
             storeName: item.storeName
           })
-          // that.setData({
-          //   storeName: item.storeName
-          // })
         }
-        // wx.switchTab({
-        //   url: '/pages/index/index'
-        // });
 
         prevPage.getIndexData();
         prevPage.enableActivity();

+ 1 - 1
wx-mall/project.config.json

@@ -9,7 +9,7 @@
 		"uglifyFileName": true
 	},
 	"compileType": "miniprogram",
-	"libVersion": "2.6.0",
+	"libVersion": "2.6.2",
 	"appid": "wxb6b30b1b14ee502a",
 	"projectname": "kmall-mp",
 	"condition": {