文杰 пре 1 недеља
родитељ
комит
f127b1341b

+ 1 - 0
.cloudbase/container/debug.json

@@ -0,0 +1 @@
+{"containers":[],"config":{}}

+ 1 - 5
app.js

@@ -9,11 +9,7 @@ App({
     let custom = wx.getMenuButtonBoundingClientRect()
     this.globalData.statusBarHeight = windowInfo.statusBarHeight
     this.globalData.navBarHeight = custom.height + (custom.top - windowInfo.statusBarHeight) * 2
-
-    // 默认店铺
-    if(!wx.getStorageSync('shopInfo')){
-      wx.setStorageSync('shopInfo',{shopName:'瑞果商链-“星闪豹”',shopId:1})
-    }
+   
   },
   globalData: {
     // 定义全局请求队列

+ 46 - 139
pages/index/index.js

@@ -8,8 +8,10 @@ const updateManager = wx.getUpdateManager()
 import eventBus from '../../utils/eventBus';
 
 Page({
-  isHand:false,
   data: {
+    isHand:false,
+    shopList:[],
+    showShopList:false,
     isScroll:false,
     active:1,
     imgUrl:'',
@@ -42,7 +44,6 @@ Page({
     hotList: [],
     recommendedList: [],
     totalNum: 1,
-    addCarshow: false,
     shopDetail: {},
     select_address: '',
     categoryList: [],
@@ -79,10 +80,7 @@ Page({
     this.setData({
       select_address: wx.getStorageSync('ADDRESS')
     })
-    // 默认店铺
-    if(!wx.getStorageSync('shopInfo')){
-      wx.setStorageSync('shopInfo',{shopName:'瑞果商链-“星闪豹”',shopId:1})
-    }
+
     if(wx.getStorageSync('loginResult').userId){
       this.getUserInfo().then(()=>{
         this.getAllData();
@@ -553,132 +551,49 @@ Page({
     })
   },
 
-  /**
-   * 秒杀
-   */
-  getSnapUpList: function () {
-    wx.showLoading()
-    var params = {
-      url: "/seckill/pageProd",
-      method: "GET",
-      data: {
-        size: 4,
-        lat: wx.getStorageSync('LATITUDE'),
-        lon: wx.getStorageSync('LONGITUDE'),
-        distance: wx.getStorageSync('DISTANCE') || 0
-      },
-      callBack: (res) => {
-        wx.hideLoading();
-        let result = res.records.filter(item => util.dateToTimestamp(item.endTime) > new Date().getTime()) //过滤掉秒杀时间已结束的商品
-        let img = ''
-        result.map(e => {
-          img = e.pic.split(',')
-          e.pic = img[0]
-        })
-        this.setData({
-          snapUpList: result
-        });
-        let closestItem = null;
-        let minTimeDiff = Infinity;
-        this.data.snapUpList.forEach((e) => {
-          const endTime = util.dateToTimestamp(e.endTime);
-          const now = new Date().getTime();
-          const timeDiff = endTime - now;
-          // 获取距离时间最近的秒杀时间
-          if (timeDiff < minTimeDiff && timeDiff > 0) {
-            minTimeDiff = timeDiff;
-            closestItem = e;
-          }
-        })
-        if (closestItem) {
-          const endTime = util.dateToTimestamp(closestItem.endTime);
-          const interval = setInterval(() => {
-            const now = new Date().getTime();
-            const timeDiff = endTime - now;
-            if (timeDiff <= 0) {
-              clearInterval(interval);
-              return;
-            }
-            const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
-            const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
-            const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
-            const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000);
-            this.setData({
-              days: days,
-              hours: hours,
-              minutes: minutes,
-              seconds: seconds
-            });
-          }, 1000);
-        }
-      }
-    };
-    http.request(params);
-  },
-  /**
-   * 新品推荐
-   */
-  getNewList: function () {
-    // var params = {
-    //   url: "/prod/lastedProdPage",
-    //   method: "GET",
-    //   data: {
-    //     current: 1,
-    //     size: 4,
-    //     lat: wx.getStorageSync('LATITUDE'),
-    //     lon: wx.getStorageSync('LONGITUDE'),
-    //     distance: wx.getStorageSync('DISTANCE') || 0,
-    //     shopId:this.data.shop_id
-    //   },
-    //   callBack: (res) => {
-    //     let img = ''
-    //     res.records.map(e => {
-    //       img = e.pic.split(',')
-    //       e.pic = img[0]
-    //     })
-    //     this.setData({
-    //       newList: res.records,
-    //     })
-    //   }
-    // };
-    // http.request(params);
-  },
+
+
   /**
    * 获取距离最近店铺id
    * @param {*} e 
    */
   get_neighborShop: function () {
-    var params = {
-      url: "/shop/neighborShop",
-      method: "GET",
-      data: {
-        lat: wx.getStorageSync('LATITUDE'),
-        lon: wx.getStorageSync('LONGITUDE'),
-        channelId:wx.getStorageSync('channelId')||3
-      },
-      callBack: (res) => {
-        if(typeof res == 'number'){
-          // this.getaddress_transports(res)
+    return new Promise((resolve,reject)=>{
+      var params = {
+        // url: "/shop/neighborShop",
+        url: "/shop/addrShop",
+        method: "GET",
+        data: {
+          lat: wx.getStorageSync('LATITUDE'),
+          lon: wx.getStorageSync('LONGITUDE'),
+          channelId:wx.getStorageSync('channelId')||3
+        },
+        callBack: (res) => {
           this.setData({
-            shop_id: res
+            shopList:res
           })
-          setTimeout(() => {
-            this.getClassInfo(res);
-          }, 300)
-        }else{
-          wx.setStorageSync('shopInfo', res)
-          // this.getaddress_transports(res.shopId)
-          this.setData({
-            shop_id: res.shopId,
-            shopName:res.shopName
+          if(res.every(i=>!i.hasProduct)){
+           return this.setData({
+              showShopList:true
+            })
+          }
+          res.forEach(item=>{
+            if(item.hasProduct){
+              wx.setStorageSync('shopInfo', item)
+              // this.getaddress_transports(item.shopId)
+              this.setData({
+                shop_id: item.shopId,
+                shopName:item.shopName
+              })
+              resolve()
+               return this.getClassInfo(item.shopId);
+            }
+           
           })
-          setTimeout(() => {
-            this.getClassInfo(res.shopId);
-          }, 300)
         }
-      }
-    };
-    http.request(params);
+      };
+      http.request(params);
+    })
   },
   /**
    * 获取最大配送范围
@@ -708,7 +623,7 @@ Page({
   },
   onClose: function () {
     this.setData({
-      addCarshow: false
+      showShopList: false
     })
   },
   /**
@@ -843,18 +758,13 @@ Page({
    * 选择定位后更新列表
    */
   go_update() {
-    // this.get_neighborShop()
     this.setData({
       current:1,
-      shop_id: wx.getStorageSync("shopInfo").shopId,
-      shopName:wx.getStorageSync("shopInfo").shopName
     })
-    
-    setTimeout(() => {
-      this.getNewList();
-      this.getSnapUpList();
+    this.get_neighborShop().then(res=>{
       this.getHotSalesProds()
-    }, 1000)
+    })
+  
   },
   getAllData() {
     this.setData({
@@ -864,18 +774,15 @@ Page({
     })
     http.getCartCount(); //重新计算购物车总数量
     this.getIndexImgs();
-    this.getClassInfo(this.data.shopId);
-    // this.get_neighborShop()
+    // this.getClassInfo(this.data.shopId);
     // this.getNoticeList();
     this.getAbulk();
     this.getRecommended()
     this.getRecommendeds()
     this.getAdv()
-    setTimeout(() => {
-      this.getNewList();
-      this.getSnapUpList();
-      this.getHotSalesProds();
-    }, 500)
+    this.get_neighborShop().then(res=>{
+      this.getHotSalesProds()
+    })
   },
 
   //加载轮播图

+ 11 - 36
pages/index/index.wxml

@@ -263,7 +263,7 @@
       </view>
       <block wx:else>
         <view style="height: 500rpx;">
-          <van-empty image="search" description="附近暂无可配送门店" />
+          <van-empty image="search" description="暂无可查看商品" />
         </view>
         <!-- <view class="reset-localization" bindtap="toLocationPage">定位不准确?<text style="color: rgb(40,120,255);">点击手动定位</text></view> -->
       </block>
@@ -275,42 +275,17 @@
       </block>
   </view>
 
-    <van-popup show="{{ addCarshow }}" closeable round position="bottom" custom-style="height: 43%" bind:close="onClose">
-      <view class="popup-box">
-        <view class="popup-detail">
-          <view class="popup-img-box">
-            <image style="width: 200rpx;height: 200rpx;" src="{{shopDetail.pic}}" mode="" />
-          </view>
-          <view class="popup-shop-detail">
-            <view class="shop-price"><text style="font-size:26rpx;">¥</text>{{wxs.toPrice(shopDetail.price)}}</view>
-            <view class="shop-detail">
-              <view class="shop-isselect">已选</view>
-              <view class="shop-info">黑色,1件</view>
-            </view>
-          </view>
-        </view>
-        <view class="popup-line"></view>
-        <view class="shop-color">
-          <view class="color-text">颜色</view>
-          <view class="color-btn-box">
-            <view class="color-btn">黑色</view>
-            <view class="color-btn">黑色</view>
-            <view class="color-btn">黑色</view>
-          </view>
-        </view>
-        <view class="popup-num-box">
-          <view class="color-text">数量</view>
-          <view class="stepper-box">
-            <view class="stepper-minus">-</view>
-            <view class="stepper-num">1</view>
-            <view class="stepper-add">+</view>
-          </view>
+
+  <view class="my-popup" wx:if="{{showShopList}}" bind:tap="onClose">
+  
+    <view class="popup-box">
+      <view class="notice">你没有该门店的商品数据查看权限,请切换其他门店</view>
+        <view class="popup-item" wx:for="{{shopList}}">
+          <view class="name {{!item.hasProduct?'disabled':''}}">{{item.shopName}}</view>
+          <view class="tag" wx:if="{{!item.hasProduct}}">无权限</view>
         </view>
-      </view>
-      <view class="bottom-button-box">
-        <view class="bottom-button">选好了</view>
-      </view>
-    </van-popup>
+    </view>
+  </view>
 
     <tabbar active="0" isScroll="{{isScroll}}"></tabbar>
 

+ 44 - 0
pages/index/index.wxss

@@ -1005,3 +1005,47 @@ swiper.pic-swiper .banner {
 .tab-box::-webkit-scrollbar-thumb {
   display: none;
 }
+
+.my-popup{
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 750rpx;
+  height: 100vh;
+  background: rgba(0,0,0,0.5);
+  z-index: 99;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.my-popup .popup-box{
+  width: 572rpx;
+  height: 640rpx;
+  background: #FFFFFF;
+  border-radius: 32rpx 32rpx 32rpx 32rpx;
+  padding: 24rpx;
+  box-sizing: border-box;
+}
+.my-popup .popup-box .notice{
+  font-size: 24rpx;
+  color: #AAAAAA;
+}
+.my-popup .popup-box .popup-item{
+  line-height: 92rpx;
+  display: flex;
+  align-items: center;
+}
+.my-popup .popup-box .popup-item .name.disabled{
+  color: #AAAAAA;
+}
+.my-popup .popup-box .popup-item .tag{
+  width: 104rpx;
+  height: 36rpx;
+  line-height: 36rpx;
+  text-align: center;
+  background: #AAAAAA;
+  border-radius: 22rpx 22rpx 22rpx 22rpx;
+  font-size: 24rpx;
+  color: #FFFFFF;
+  margin-left: 20rpx;
+}

+ 14 - 13
pages/locationAdd/locationAdd.js

@@ -104,24 +104,25 @@ Page({
    * 选择店铺
    */
   chooseShop(e){
+    if(!e.currentTarget.dataset.item.hasProduct) return
     wx.setStorageSync('LATITUDE', e.currentTarget.dataset.item.lat)
     wx.setStorageSync('LONGITUDE', e.currentTarget.dataset.item.lon)
     // this.getTxmap()
     // wx.setStorageSync('ADDRESS', e.currentTarget.dataset.item.address)
     wx.setStorageSync('shopInfo', e.currentTarget.dataset.item)
-        setTimeout(() => {
-          let pages = getCurrentPages();
-          let prevPage = pages[pages.length - 2]; //获取A页面
-          wx.navigateBack({
-            delta: 1,
-            success: function (e) { // 成功的回调
-              if (prevPage == undefined || prevPage == null) return;
-              // prevPage.go_update(); // 调用A页面的方法, 并将值传过去
-              prevPage.getAllData(); // 调用A页面的方法, 并将值传过去
-              
-            }
-          })
-        }, 500)
+    setTimeout(() => {
+      let pages = getCurrentPages();
+      let prevPage = pages[pages.length - 2]; //获取A页面
+      wx.navigateBack({
+        delta: 1,
+        success: function (e) { // 成功的回调
+          if (prevPage == undefined || prevPage == null) return;
+          // prevPage.go_update(); // 调用A页面的方法, 并将值传过去
+          prevPage.getAllData(); // 调用A页面的方法, 并将值传过去
+          
+        }
+      })
+    }, 500)
   },
   /**
    * 设置默认

+ 5 - 3
pages/locationAdd/locationAdd.wxml

@@ -39,15 +39,17 @@
           附近的门店
         </view>
         <view class="shop">
-          {{nearShop.shopName}}
+          <view class="name {{!nearShop.hasProduct?'disabled':''}}">{{nearShop.shopName}}</view>
+          <view class="tag" wx:if="{{!nearShop.hasProduct}}">无权限</view>
         </view>
         <view class="desc">
-          为您选择距离最近的可配送店
+          为您选择距离最近的可配送店
         </view>
       </view>
       <view class="box">
         <view class="shop" bind:tap="chooseShop"  data-item="{{item}}" wx:for="{{shopList}}">
-          {{item.shopName}}
+          <view class="name {{!item.hasProduct?'disabled':''}}">{{item.shopName}}</view>
+          <view class="tag" wx:if="{{!item.hasProduct}}">无权限</view>
         </view>
       </view>
     </view>

+ 16 - 0
pages/locationAdd/locationAdd.wxss

@@ -29,6 +29,22 @@ page {
 }
 .shop{
   line-height: 92rpx;
+  display: flex;
+  align-items: center;
+}
+.shop .name.disabled{
+  color: #AAAAAA;
+}
+.shop .tag{
+  width: 104rpx;
+  height: 36rpx;
+  line-height: 36rpx;
+  text-align: center;
+  background: #AAAAAA;
+  border-radius: 22rpx 22rpx 22rpx 22rpx;
+  font-size: 24rpx;
+  color: #FFFFFF;
+  margin-left: 20rpx;
 }
 .near-shop{
   margin-bottom: 20rpx;

+ 1 - 1
utils/config.js

@@ -5,7 +5,7 @@
 var domain = "https://shop.api.zswlgz.com"; //统一接口域名,正式环境 
 var wsDomain = "wss://shop-h5.dev.zswllife.cn/api"; //统一接口域名,正式环境 
 var domain = "http://47.109.84.152:8112"; //统一接口域名,测试环境 
-// var domain = "http://89561bkaq794.vicp.fun"; //统一接口域名,正式环境 
+var domain = "https://1b5a4ee0.r36.cpolar.top"; //统一接口域名,正式环境 
 // var wsDomain = "wss://shop.haimamart.com/api"; //统一接口域名,正式环境 
 
 // var domain = "http://192.168.1.206:8112"; //统一接口域名,测试环境