Browse Source

修改店铺

文杰 2 tuần trước cách đây
mục cha
commit
3ca0ce1a9f

+ 7 - 17
pages/category/category.js

@@ -54,7 +54,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    
+    console.log('onload');
     this.getRecommended()
     this.get_neighborShop()
     // this.get_categoryInfo()
@@ -325,24 +325,14 @@ Page({
    */
   onShow: function () {
     console.log('show');
-    if(this.data.shopId){
+    // 每次重新加载
+    if(this.data.shopId != wx.getStorageSync('shopInfo').shopId){
+      console.log('店铺切换了 刷新');
+      this.resetData()
+      this.get_neighborShop()
+    }else if(this.data.shopId){
       this.getCarData(this.data.shopId)
     }
-    // if (getApp().globalData.categoryId) {
-    //   let categoryId = getApp().globalData.categoryId
-    //   let index = getApp().globalData.index
-    //   let pic = getApp().globalData.pic
-
-    //   this.setData({
-    //     categoryImg: pic,
-    //     selIndex: index
-    //   });
-    // }else{
-    // this.get_neighborShop()
-    // }
-    // 之前逻辑 每次重新加载
-    // this.resetData()
-    // this.get_neighborShop()
 
   },
 

+ 4 - 19
pages/index/index.js

@@ -402,21 +402,20 @@ Page({
     let _this = this
     //加载分类列表
     var params = {
-      url: "/category/categoryInfo",
+      url: "/category/listCategoryForUser",
       method: "GET",
       data: {
         shopId: shopId,
-        current:1,
-        size:99999
+        channelId:wx.getStorageSync('channelId')||3
       },
       callBack: function (res) {
         console.log(res);
         let categoryName = ''
-        res.records.forEach(e => {
+        res.forEach(e => {
           categoryName = e.categoryName.split('>')
           e.categoryName = categoryName[0]
         })
-        let newRes = _this.splitList(res.records)
+        let newRes = _this.splitList(res)
         let categoryList = newRes.splice(0,2)
         if(categoryList.length == 2){
           categoryList = categoryList[0].concat(categoryList[1])
@@ -443,20 +442,6 @@ Page({
     let index = e.currentTarget.dataset.index + this.data.currentTop
     let pic = e.currentTarget.dataset.pic
     let categories = e.currentTarget.dataset.categories
-    // if(!hassecond) return
-    // if (categories == null || categories.length < 1) {
-    //   wx.navigateTo({
-    //     url: `/pages/sub-category/sub-category?categoryId=${categoryId}&shopId=${this.data.shop_id}`,
-    //   })
-    // } else {
-    //   getApp().globalData.categoryId = categoryId
-    //   getApp().globalData.index = index
-    //   getApp().globalData.pic = pic
-    //   wx.navigateTo({
-    //     url: '/pages/category/category'
-    //   })
-    // }
-    // eventBus.emit('categoryId', categoryId);
     wx.setStorageSync('categoryId', categoryId)
     wx.navigateTo({
       url: '/pages/category1/category'

+ 0 - 8
pages/index/index.wxml

@@ -62,14 +62,6 @@
     <!-- <view class="swiper-grid-box" wx:if="{{categoryList1.length>0}}"> -->
     <view class="swiper-grid-box" wx:if="{{categoryList.length>0}}">
     <view class="grid-box">
-      <!-- <van-grid border="{{false}}" column-num="5">
-            <van-grid-item class="my-grid-item" use-slot bind:click="selectMenu" wx:for="{{categoryList}}" wx:key="categoryId" data-pic="{{item.pic}}" data-itemid="{{item.categoryId}}" data-index="{{index}}" data-categories="{{item.categories}}" data-categoryName="{{item.categoryName}}" badge="应季水果">
-              <image class="swiper-grid-image" src="{{item.icon}}" />
-              <text class="swiper-grid-text">{{item.categoryName}}</text>
-              <view class="label" wx:if="{{item.label}}">{{'应季果蔬'||item.label}}</view>
-            </van-grid-item>
-          </van-grid> -->
-
             <view class="my-grid-item" use-slot bind:tap="selectMenu" wx:for="{{categoryList}}" wx:key="categoryId" data-pic="{{item.pic}}" data-hassecond="{{item.hasSecond}}" data-itemid="{{item.categoryId}}" data-index="{{index}}" data-categories="{{item.categories}}" data-categoryName="{{item.categoryName}}">
               <view class='pic-box  {{selIndex==index?"active":""}}'>
                 <!-- <view wx:if="{{!item.hasSecond}}" class='sell-out-box'>

+ 2 - 1
pages/locationAdd/locationAdd.js

@@ -107,7 +107,8 @@ Page({
     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('ADDRESS', e.currentTarget.dataset.item.address)
+    wx.setStorageSync('shopInfo', e.currentTarget.dataset.item)
         setTimeout(() => {
           let pages = getCurrentPages();
           let prevPage = pages[pages.length - 2]; //获取A页面

+ 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"; //统一接口域名,正式环境 
-// https://5d2f568f.r36.cpolar.top
+// var domain = "https://5d2f568f.r36.cpolar.top"; //统一接口域名,正式环境 
 // var wsDomain = "wss://shop.haimamart.com/api"; //统一接口域名,正式环境 
 
 // var domain = "http://192.168.1.206:8112"; //统一接口域名,测试环境