Browse Source

首页冲突问题

忆雪 11 tháng trước cách đây
mục cha
commit
6b0298540b

+ 55 - 176
src/components/service/serviceItem.vue

@@ -1,208 +1,87 @@
 <template>
-  <view class="sort">
-<!--    <u-swipe-action>
-      <u-swipe-action-item :options="options1"
-        @click="handlerClearItem(itm,index)"> -->
-        <view class="list_item" :key="index" v-for="(itm, index) of item">
-          <view class="list" @click="handlerRouterSkip(itm, index)">
-            <view class="list-img">
-              <!-- <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : itm.logo"
-                mode="scaleToFill"></image> -->
-                <image class="img" :src="itm.logo"  mode="aspectFill"></image>
-            </view>
-
-            <view class="list-main">
-              <view class="item-text">{{  itm.name }}</view>
-              <!-- <view class="item-flex">
-                <view class="star">
-                  <u-rate :count="itm.score" disabled :size="14" />
-                  <text class="line">|</text>
-                  <text class="points">{{ itm.score }}分</text>
-                </view>
-                <view>{{ itm.sale }}单</view>
-                <view></view>
-              </view> -->
-              <view class="list-item">
-                <view class="item-l">{{ itm.address }}</view>
-                <view class="item-r">{{ (itm.distance / 1000).toFixed(2) }}KM</view>
-              </view>
-            </view>
-          </view>
+  <view class='container'>
+    <view class='item-box' v-for="(itm, index) of item" :key="index" @click='handlerRouterSkip(itm)'>
+      <image :src='itm.logo' mode="aspectFill" class='img'></image>
+      <view class='item-right'>
+        <view class='right-top'>{{ itm.name }}</view>
+        <view class='right-bottom'>
+          <view class='bottom-left'>{{ itm.address }}</view>
+          <view class='bottom-right'>{{ (itm.distance / 1000).toFixed(2) }}KM</view>
         </view>
-
-<!--      </u-swipe-action-item>
-    </u-swipe-action> -->
+      </view>
+    </view>
   </view>
 </template>
 
 <script>
-  import {
-    cancelFavorite
-  } from '@/api/client/business.js';
   export default {
     data() {
       return {
-        show: false,
-        showDate: false,
-        value1: Number(new Date()),
-        count: 2,
-        value: 10,
-        options1: [{
-          text: '删除'
-        }]
-      };
+
+      }
     },
-    props: ['item', 'skipType'],
+    props: ['item'],
     methods: {
-      click(item) {},
-      open() {},
-      close() {
-        this.show = false;
-      },
-
-      // 点击跳转1
-      handlerRouterSkip(item) {
-        // if (this.skipType == 0) {
+      handlerRouterSkip(itm) {
         uni.navigateTo({
-          url: `/pagesHome/marketer/index?id=${item.id}`,
+          url: `/pagesHome/marketer/index?id=${itm.id}`,
         });
-        // } else if (this.skipType == 1) {
-        //   uni.navigateTo({
-        //     url: `/pages/client/clientPackage/serviceDetail/index?id=${item.id}`,
-        //   });
-        // }
       },
-      // 点击取消
-      handlerClearItem(item, index) {
-        cancelFavorite(item.id).then(res => {
-          if (res.code == 'OK') {
-            uni.showToast({
-              title: '取消成功',
-              icon: 'none'
-            })
-            this.$emit('uploadIniList', 0)
-          } else {
-            uni.showToast({
-              title: res.message,
-              icon: 'none'
-            })
-            return
-          }
-        })
-      }
-    },
-  };
+    }
+  }
 </script>
 
 <style lang="scss" scoped>
-  /*商家服务分类的是实现 */
-
-  .sort {
-    min-height: 100vh;
-    .list_item{
-      // height: 200rpx;
-    }
-    .list {
-      // height: 200rpx;
+  .container {
+    padding: 32rpx;
+    box-sizing: border-box;
+
+    .item-box {
+      margin-bottom: 16rpx;
+      width: 100%;
+      height: 172rpx;
+      border-radius: 8rpx;
       background-color: #fff;
-      padding:10rpx 20rpx;
-      margin-bottom: 3rpx;
+      padding: 16rpx;
+      box-sizing: border-box;
       display: flex;
-
-      .list-img {
-
-        // background-color: #ec5729;
-        margin-right: 20rpx;
-
-        image {
-          width: 150rpx;
-          height:150rpx;
-          margin-top: 10rpx;
-        }
-      }
-
-      .list-main {
-        width: calc(100% - 180rpx);
-      }
-
-      .item-text {
-        font-weight: bold;
-        font-size: 32rpx;
-        margin: 10rpx 0 10rpx;
-        color: #333;
+      align-items: center;
+      box-sizing: 0 0rpx 5rpx 0rpx rgba(0,0,0,1);
+      .img {
+        width: 140rpx;
+        height: 140rpx;
+        border-radius: 8rpx;
       }
 
-      .item-flex {
+      .item-right {
+        width: calc( 100% - 180rpx );
+        height: 100%;
+        margin-left: 20rpx;
         display: flex;
-        justify-content: space-between;
-        font-size: 28rpx;
-        margin: 0 20rpx 10rpx 0;
-        color: #0d0d0d66;
+        flex-direction: column;
+        justify-content: space-around;
 
-        .star {
-          display: flex;
-
-          .line {
-            margin-left: 16rpx;
-            margin-top: 5rpx;
-            font-size: 22rpx;
-          }
-
-          .points {
-            color: #ff4b04;
-            font-size: 22rpx;
-            margin-top: 6rpx;
-            margin-left: 10rpx;
-          }
+        .right-top {
+          color: #0C1223;
         }
-      }
 
-      .list-item {
-        display: flex;
-        justify-content: space-between;
-        margin-top: 30rpx;
-        flex:1;
-        .item-l {
-          color: #cfcfcf;
-          font-size: 28rpx;
-        }
-
-        .item-r {
-          color: #252525;
+        .right-bottom {
+          display: flex;
+          justify-content: space-between;
+           color:#999999;
+          .bottom-left {
+            width: 70%;
+            white-space: nowrap;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            font-size: 28rpx;
+          }
 
-          .Buy {
-            width: 40px;
-            height: 32px;
-            color: #fff;
-            line-height: 32px;
-            text-align: center;
-            display: inline-block;
-            border-radius: 0 16px 16px 0;
-            background-color: #ec5729;
-            padding-bottom: 20rpx;
+          .bottom-right {
+            font-size: 24rpx;
           }
         }
       }
     }
   }
-
-  .u-page {
-    padding: 0;
-  }
-
-  .u-demo-block__title {
-    padding: 10px 0 2px 15px;
-  }
-
-  .swipe-action {
-    &__content {
-      padding: 25rpx 0;
-
-      &__text {
-        font-size: 15px;
-        color: $u-main-color;
-        padding-left: 30rpx;
-      }
-    }
-  }
 </style>

+ 55 - 42
src/pages/tabbar/components/HotItem.vue

@@ -2,73 +2,86 @@
   <view class="container">
     <view class="content">
       <view class="img-box">
-       <!-- <image
+        <!-- <image
           :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo"
           mode="scaleToFill"
         ></image> -->
         <image class='img' mode="scaleToFill" :src='item.logo'></image>
         <view class="name u-line-1">{{ item.name }}</view>
       </view>
-      <view class="pd-10">{{ item.address }}</view>
-      <view class="pd-10">{{ item.distance | mToKm }}</view>
+      <view class="pd-10 address">{{ item.address }}</view>
+      <view class="pd-10 distance">{{ item.distance | mToKm }}</view>
     </view>
   </view>
 </template>
 
 <script>
-export default {
-  props: {
-    item: {
-      type: Object,
-      default: () => {},
+  export default {
+    props: {
+      item: {
+        type: Object,
+        default: () => {},
+      },
     },
-  },
-  filters: {
-    mToKm(v) {
-      return (Number(v) / 1000).toFixed(2) + 'km';
+    filters: {
+      mToKm(v) {
+        return (Number(v) / 1000).toFixed(2) + 'km';
+      },
     },
-  },
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.container {
-  width: 100%;
-  padding: 20rpx;
-  box-sizing: border-box;
-
-  .content {
-    background-color: #ffffff;
+  .container {
     width: 100%;
-    height: 400rpx;
-
-    .img-box {
-      position: relative;
-      height: 240rpx;
+    box-sizing: border-box;
 
-      .img {
-        width: calc(50vw - 30rpx);
+    .content {
+      background-color: #ffffff;
+      width: 100%;
+      padding-bottom:20rpx;
+      border-radius:16rpx;
+      margin-bottom:24rpx;
+      .img-box {
+        position: relative;
         height: 240rpx;
+        .img {
+          width: 100%;
+          height: 240rpx;
+          border-radius:16rpx 16rpx 0 0;
+        }
+
+        .name {
+          width: 100%;
+          position: absolute;
+          bottom: 0;
+          left: 0;
+          background-color: rgba(0, 0, 0, 0.2);
+          color: #ffffff;
+          padding: 10rpx;
+          box-sizing: border-box;
+          white-space: nowrap;
+          overflow: hidden;
+          text-overflow: ellipsis;
+        }
       }
 
-      .name {
-        width: 100%;
-        position: absolute;
-        bottom: 0;
-        left: 0;
-        background-color: rgba(0, 0, 0, 0.2);
-        color: #ffffff;
-        padding: 10rpx;
-        box-sizing: border-box;
-        white-space: nowrap;
+      .address {
+        width:95%;
         overflow: hidden;
         text-overflow: ellipsis;
+        white-space: nowrap;
+        font-size: 24rpx;
+      }
+
+      .distance {
+        color: #1B5FC5;
+        font-weight: bold;
       }
-    }
 
-    .pd-10 {
-      padding: 10rpx;
+      .pd-10 {
+        padding: 10rpx;
+      }
     }
   }
-}
 </style>

+ 18 - 6
src/pages/tabbar/components/RecommendItem.vue

@@ -6,8 +6,8 @@
         <image class='img' :src="item.logo " mode="scaleToFill" />
         <view class="name u-line-1">{{ item.name }}</view>
       </view>
-      <view class="pd-10">{{ item.address }}</view>
-      <view class="pd-10">{{ item.distance | mToKm }}</view>
+      <view class="pd-10 address">{{ item.address }}</view>
+      <view class="pd-10 distance">{{ item.distance | mToKm }}</view>
     </view>
   </view>
 </template>
@@ -31,18 +31,19 @@ export default {
 <style lang="scss" scoped>
 .container {
   width: 100%;
-  padding: 20rpx;
   box-sizing: border-box;
   .content {
     background-color: #ffffff;
     width: 100%;
-    height: 400rpx;
+    padding-bottom:20rpx;
+    border-radius:16rpx;
+    margin-bottom:24rpx;
     .img-box {
       position: relative;
       height: 240rpx;
       .img {
-        width: calc(50vw - 30rpx);
-        height: 240rpx;
+        width: 100%;
+        height: 212rpx;
         border-radius: 10rpx;
       }
       .name {
@@ -60,6 +61,17 @@ export default {
         text-overflow: ellipsis;
       }
     }
+    .address{
+      width:95%;
+      overflow:hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      font-size:24rpx;
+    }
+    .distance{
+      color:#1B5FC5;
+      font-weight:bold;
+    }
     .pd-10 {
       padding: 10rpx;
     }

+ 391 - 375
src/pages/tabbar/home.vue

@@ -1,375 +1,391 @@
-<template>
-	<view class="home">
-		<view>
-			<!-- 顶部导航 -->
-			<view class="nav-bar">
-				<u-navbar :bgColor="'#ffffff'" :placeholder="true">
-					<view slot="left" @click.stop="manualGetLocation">
-						<view class="address-text">{{ nowAddress }}</view>
-						<text class="iconfont icon-chevron-down" />
-					</view>
-					<view slot="center" style="width: 350rpx">
-						<u-search placeholder="请输入搜索内容" :showAction="false" v-model="keyword"
-							@click="$Router.push('/pagesHome/homeSearch')" :disabled="true" />
-					</view>
-				</u-navbar>
-			</view>
-			<!-- 轮播图 -->
-			<view class="home-swiper">
-				<u-swiper :list="swiperUrlList" @click="handlerSwiperSkip" indicator imgMode='aspectFit' />
-			</view>
-
-			<!-- 商品分类 -->
-			<view class="home-list">
-				<u-grid :border="false" col="5">
-					<u-grid-item v-for="item in categories" :key="item.id" @tap="handleMenuClick(item)">
-						<u-icon :customStyle="{ paddingTop: 20 + 'rpx' }" :name="item.icon" :size="25"></u-icon>
-						<text class="grid-text">{{ item.name }}</text>
-					</u-grid-item>
-				</u-grid>
-				<u-toast ref="uToast" />
-			</view>
-
-			<!-- 热门推荐 -->
-			<view class="hot">
-				<u-cell :border="false" value="查看更多" isLink @click="$Router.push('/pagesHome/home/popularRecommend')">
-					<view slot="title" class="hot-title"> 热门推荐 </view>
-				</u-cell>
-				<block v-if="homeData.recommends && homeData.recommends.length > 0">
-					<view>
-						<u-grid :border="false" col="2">
-							<u-grid-item @click="$Router.push(`/pagesHome/marketer/index?id=${item.id}`)"
-								v-for="(item,index) in homeData.recommends" :key="item.id">
-								<recommend-item v-if="index < 4" :item="item"></recommend-item>
-							</u-grid-item>
-						</u-grid>
-					</view>
-				</block>
-				<block v-else>
-					<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
-					</u-empty>
-				</block>
-			</view>
-
-			<!-- 附近商家 -->
-			<view class="near">
-				<u-cell :border="false" value="查看更多" isLink @click="$Router.push('/pagesHome/home/nearbyBusiness')">
-					<view slot="title" class="near-title"> 附近商家 </view>
-				</u-cell>
-				<block v-if="homeData.nears && homeData.nears.length > 0">
-					<view>
-						<u-grid :border="false" col="2">
-							<u-grid-item @click="$Router.push(`/pagesHome/marketer/index?id=${item.id}`)"
-								v-for="(item,index) in homeData.nears" :key="item.id">
-								<hot-item v-if="index < 4" :item="item"></hot-item>
-							</u-grid-item>
-						</u-grid>
-					</view>
-				</block>
-				<block v-else>
-					<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
-					</u-empty>
-				</block>
-			</view>
-
-			<!-- 询价 -->
-			<!-- <drag-button :isDock="true" :existTabBar="true" @btnClick="btnClick" /> -->
-		</view>
-	</view>
-</template>
-
-<script>
-	import {
-		getCurrentLocation,
-		getHomePageApi,
-		getSwiperListApi
-	} from '@/api/client/home';
-	import RecommendItem from './components/RecommendItem.vue';
-	import HotItem from './components/HotItem.vue';
-	import {
-		getMapLocation
-	} from "@/utils/mapUtil.js"
-	import {
-		mapGetters
-	} from 'vuex';
-	import {
-		inviteBind
-	} from "@/api/client/mine.js"
-	export default {
-		components: {
-			RecommendItem,
-			HotItem,
-		},
-		data() {
-			return {
-				list: [],
-				keyword: '',
-				swiperUrlList: [], // 轮播图url列表
-				swiperList: [],
-				homeData: {
-					categories: [],
-					nears: [],
-					recommends: [],
-				},
-				queryParams: {
-					longitude: '',
-					latitude: '',
-					region: ''
-				},
-				nowAddress: '', //当前地址
-			};
-		},
-
-		computed: {
-			...mapGetters(['location', 'userId', 'invitationCode']),
-			categories() {
-				let initData = this.homeData.categories.map(item => {
-					if (!item.icon) {
-						item.icon = 'level';
-					}
-					return item;
-				});
-				let result =
-					initData.length > 14 ?
-					initData.splice(0, 14).concat([{
-						id: 'all',
-						icon: 'grid-fill',
-						name: '全部',
-						type: {
-							code: 'ALL',
-							description: '全部',
-						},
-					}, ]) :
-					initData.push({
-						id: 'all',
-						icon: 'grid-fill',
-						name: '全部',
-					});
-				return result;
-			},
-		},
-		onShow() {
-			console.log("首页执行了没有", this.invitationCode)
-			// 如果 invitationCode 存在且不等于特殊值时执行代码
-			if (this.invitationCode) {
-				console.log("存在邀请码")
-				// let params = {
-				// 	userId: this.userId,
-				// 	targetId: this.invitationCode,
-				// 	type: 1
-				// };
-				let params = {
-					userId: this.invitationCode,
-					targetId: this.userId,
-					type: 1
-				};
-				inviteBind(params).then(res => {
-					if(res&& res.code ==200){
-						uni.showToast({
-							title:'您已成功加入团队',
-							icon:'success',
-							dration:2000
-						})
-					}
-					// console.log("绑定邀请码结果:", res);
-				});
-				this.$store.commit('SET_INVITATIONCODE', '')
-				
-			}else{
-				console.log("执行了一次")
-			}
-		},
-		mounted() {
-			this.getSwiperList();
-			// 页面显示时  获取当前零维度
-			uni.getLocation({
-				type: 'gcj02',
-				success: res => {
-					let {
-						longitude,
-						latitude
-					} = res
-					this.queryParams.longitude = longitude;
-					this.queryParams.latitude = latitude;
-					// getCurrentLocation 获取当前编码region
-					this.handlerGetRegion(longitude, latitude)
-				},
-				fail: () => {
-					this.manualGetLocation();
-				},
-			});
-		},
-		methods: {
-			// 获取当前编码region
-			handlerGetRegion(longitude, latitude) {
-				let point = `${latitude},${longitude}`
-				getCurrentLocation({
-					point
-				}).then(res => {
-					let {
-						city,
-						district,
-						id
-					} = res.data
-					this.queryParams.region = res.data.id;
-					if (district) {
-						this.nowAddress = district.name
-					} else if (city) {
-						this.nowAddress = city.name
-					} else {
-						this.nowAddress = '地图'
-					}
-					this.getHomeData(this.queryParams)
-					this.$store.commit('SET_LOCATION', {
-						longitude: longitude,
-						latitude: latitude,
-						region: res.data.id,
-						address: res.data.name
-					});
-				})
-			},
-			/* 轮播图 */
-			getSwiperList() {
-				getSwiperListApi().then(res => {
-					this.swiperList = res.data
-					res.data.map(rs => {
-						this.swiperUrlList.push(rs.viewUrl)
-					})
-				});
-			},
-			// 获取首页数据
-			getHomeData(location) {
-				getHomePageApi(location)
-					.then(res => {
-						this.homeData = res.data;
-						// 将分类数据做缓存处理
-						this.$store.commit('SET_CATEGORIES', this.homeData.categories);
-					})
-			},
-			// 手动选择城市
-			manualGetLocation() {
-				uni.chooseLocation({
-					success: res => {
-						let {
-							longitude,
-							latitude
-						} = res
-						this.queryParams.longitude = longitude.toFixed(5);
-						this.queryParams.latitude = latitude.toFixed(5);
-						this.handlerGetRegion(longitude.toFixed(5), latitude.toFixed(5))
-					},
-					fail: err => {}
-				});
-			},
-			// 点击swiper跳转
-			handlerSwiperSkip(e) {
-				console.log("@@@swiperList", this.swiperList[e])
-			},
-			// 点击菜单
-			handleMenuClick(item) {
-				if (item.id === 'all') {
-					this.$Router.push('/pagesHome/category/categoryStoreList');
-				} else {
-					uni.navigateTo({
-						url: `/pagesHome/category/index?id=${item.id}`,
-					});
-				}
-			},
-
-			/* 询价 */
-			btnClick() {
-				uni.navigateTo({
-					url: `/pages/client/clientUser/inquiry`,
-				});
-			},
-		},
-	};
-</script>
-
-<style lang="scss" scoped>
-	.home {
-		background-color: #f0efef;
-
-		.nav-bar {
-			::v-deep .u-navbar__content {
-				background-color: #ffffff;
-			}
-
-			.address-text {
-				min-width: 120rpx;
-				overflow: hidden;
-				text-overflow: ellipsis;
-				white-space: nowrap;
-			}
-		}
-	}
-
-	/* 头部搜索栏 */
-	.home-header {
-		display: flex;
-		align-items: center;
-		height: 90rpx;
-		line-height: 90rpx;
-		padding: 0 20rpx;
-		background-color: #ffffff;
-
-		.goto-address {
-			display: flex;
-			align-items: center;
-
-			.icon-sanjiaoxing1 {
-				font-size: 24rpx;
-				margin: 17rpx 10rpx 0 6rpx;
-			}
-		}
-
-		.search-item {
-			flex: 1;
-		}
-	}
-
-	/* 轮播图 */
-	.home-swiper {
-		padding: 20rpx;
-		margin-bottom: 10rpx;
-	}
-
-	/* 商品分类 */
-	.home-list {
-		background-color: #ffffff;
-		height: 360rpx;
-		margin: 0 20rpx 20rpx 20rpx;
-		padding: 20rpx 0 50rpx 0;
-		border-radius: 10rpx;
-
-		.grid-text {
-			font-size: 12px;
-			color: #909399;
-			padding: 10rpx 0 20rpx 0rpx;
-			box-sizing: border-box;
-		}
-	}
-
-	/* 热门推荐 */
-	.hot {
-		::v-deep .u-cell__body {
-			padding: 10rpx 20rpx;
-
-			.hot-title {
-				border-left: 4px solid $uni-color-primary;
-				padding-left: 20rpx;
-			}
-		}
-	}
-
-	.near {
-		::v-deep .u-cell__body {
-			padding: 10rpx 20rpx;
-
-			.near-title {
-				border-left: 4px solid $uni-color-primary;
-				padding-left: 20rpx;
-			}
-		}
-	}
-</style>
+<template>
+  <view class="container">
+    <view class="container-top-box">
+      <view class="top-title">
+        <view class="address" @click.stop="manualGetLocation">
+          <span>{{ nowAddress }}</span>
+          <u-icon name="arrow-down-fill" color="#333333" size="16"></u-icon>
+        </view>
+        <view class="title">车旅程</view>
+        <view></view>
+      </view>
+      <view class="top-search">
+        <u-search
+          placeholder="请输入搜索内容"
+          :showAction="false"
+          v-model="keyword"
+          @click="$Router.push('/pagesHome/homeSearch')"
+          bgColor="#fff"
+          :disabled="true"
+        />
+      </view>
+
+      <view class="top-swiper-box">
+        <u-swiper :list="swiperUrlList" @click="handlerSwiperSkip" indicator />
+      </view>
+    </view>
+
+    <view class="container-tabbar-box">
+      <view class="tabar-box">
+        <view
+          class="tabbar-item"
+          v-for="(item, index) of categories"
+          :key="index"
+          @tap="handleMenuClick(item)"
+        >
+          <view class="item-img">
+            <image class="img" :src="item.icon"></image>
+          </view>
+          <view class="item-name">{{ item.name }}</view>
+        </view>
+      </view>
+    </view>
+
+    <view class="container-list-box">
+      <view class="item-box">
+        <view class="item-top">
+          <view class="top-title">热门推荐</view>
+          <view class="top-more" @click="$Router.push('/pagesHome/home/popularRecommend')">
+            <span>查看更多</span>
+            <u-icon name="arrow-right" color="#999999" size="14"></u-icon>
+          </view>
+        </view>
+        <view class="item-list">
+          <view
+            class="item"
+            v-for="(item, index) in homeData.recommends"
+            :key="item.id"
+            @click="$Router.push(`/pagesHome/marketer/index?id=${item.id}`)"
+          >
+            <hot-item v-if="index < 4" :item="item"></hot-item>
+          </view>
+        </view>
+        <u-empty
+          v-if="!homeData.recommends"
+          mode="data"
+          icon="http://cdn.uviewui.com/uview/empty/data.png"
+        >
+        </u-empty>
+      </view>
+
+      <view class="item-box">
+        <view class="item-top">
+          <view class="top-title">附近商家</view>
+          <view class="top-more" @click="$Router.push('/pagesHome/home/nearbyBusiness')">
+            <span>查看更多</span>
+            <u-icon name="arrow-right" color="#999999" size="14"></u-icon>
+          </view>
+        </view>
+        <view class="item-list">
+          <view
+            class="item"
+            v-for="(item, index) in homeData.nears"
+            :key="item.id"
+            @click="$Router.push(`/pagesHome/marketer/index?id=${item.id}`)"
+          >
+            <recommend-item v-if="index < 4" :item="item"></recommend-item>
+          </view>
+        </view>
+        <u-empty
+          v-if="!homeData.nears"
+          mode="data"
+          icon="http://cdn.uviewui.com/uview/empty/data.png"
+        >
+        </u-empty>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { getCurrentLocation, getHomePageApi, getSwiperListApi } from '@/api/client/home';
+import { getMapLocation } from '@/utils/mapUtil.js';
+import { inviteBind } from '@/api/client/mine.js';
+import RecommendItem from './components/RecommendItem.vue';
+import HotItem from './components/HotItem.vue';
+import { mapGetters } from 'vuex';
+export default {
+  components: { RecommendItem, HotItem },
+  data() {
+    return {
+      list: [],
+      keyword: '',
+      swiperUrlList: [], // 轮播图url列表
+      swiperList: [],
+      homeData: {
+        categories: [],
+        nears: [],
+        recommends: [],
+      },
+      queryParams: {
+        longitude: '',
+        latitude: '',
+        region: '',
+      },
+      nowAddress: '', //当前地址
+    };
+  },
+  computed: {
+    ...mapGetters(['location', 'userId', 'invitationCode']),
+    categories() {
+      let initData = this.homeData.categories.map(item => {
+        if (!item.icon) {
+          item.icon = 'level';
+        }
+        return item;
+      });
+      let result =
+        initData.length > 14
+          ? initData.splice(0, 14).concat([
+              {
+                id: 'all',
+                icon: 'grid-fill',
+                name: '全部',
+                type: {
+                  code: 'ALL',
+                  description: '全部',
+                },
+              },
+            ])
+          : initData.push({
+              id: 'all',
+              icon: 'grid-fill',
+              name: '全部',
+            });
+      return result;
+    },
+  },
+  onShow() {
+    console.log('首页执行了没有', this.invitationCode);
+    // 如果 invitationCode 存在且不等于特殊值时执行代码
+    if (this.invitationCode) {
+      console.log('存在邀请码');
+      let params = {
+        userId: this.invitationCode,
+        targetId: this.userId,
+        type: 1,
+      };
+      inviteBind(params).then(res => {
+        if (res && res.code == 200) {
+          uni.showToast({
+            title: '您已成功加入团队',
+            icon: 'success',
+            dration: 2000,
+          });
+        }
+        // console.log("绑定邀请码结果:", res);
+      });
+      this.$store.commit('SET_INVITATIONCODE', '');
+    } else {
+      console.log('执行了一次');
+    }
+  },
+  mounted() {
+    this.getSwiperList();
+    // 页面显示时  获取当前零维度
+    uni.getLocation({
+      type: 'gcj02',
+      success: res => {
+        let { longitude, latitude } = res;
+        this.queryParams.longitude = longitude;
+        this.queryParams.latitude = latitude;
+        // getCurrentLocation 获取当前编码region
+        this.handlerGetRegion(longitude, latitude);
+      },
+      fail: () => {
+        this.manualGetLocation();
+      },
+    });
+  },
+  methods: {
+    // 获取当前编码region
+    handlerGetRegion(longitude, latitude) {
+      let point = `${latitude},${longitude}`;
+      getCurrentLocation({
+        point,
+      }).then(res => {
+        let { city, district, id } = res.data;
+        this.queryParams.region = res.data.id;
+        if (district) {
+          this.nowAddress = district.name;
+        } else if (city) {
+          this.nowAddress = city.name;
+        } else {
+          this.nowAddress = '地图';
+        }
+        this.getHomeData(this.queryParams);
+        this.$store.commit('SET_LOCATION', {
+          longitude: longitude,
+          latitude: latitude,
+          region: res.data.id,
+          address: res.data.name,
+        });
+      });
+    },
+    /* 轮播图 */
+    getSwiperList() {
+      getSwiperListApi().then(res => {
+        this.swiperList = res.data;
+        res.data.map(rs => {
+          this.swiperUrlList.push(rs.viewUrl);
+        });
+      });
+    },
+    // 获取首页数据
+    getHomeData(location) {
+      getHomePageApi(location).then(res => {
+        this.homeData = res.data;
+        // 将分类数据做缓存处理
+        this.$store.commit('SET_CATEGORIES', this.homeData.categories);
+      });
+    },
+    // 手动选择城市
+    manualGetLocation() {
+      uni.chooseLocation({
+        success: res => {
+          let { longitude, latitude } = res;
+          this.queryParams.longitude = longitude.toFixed(5);
+          this.queryParams.latitude = latitude.toFixed(5);
+          this.handlerGetRegion(longitude.toFixed(5), latitude.toFixed(5));
+        },
+        fail: err => {},
+      });
+    },
+    // 点击swiper跳转
+    handlerSwiperSkip(e) {
+      console.log('@@@swiperList', this.swiperList[e]);
+    },
+    // 点击菜单
+    handleMenuClick(item) {
+      if (item.id === 'all') {
+        this.$Router.push('/pagesHome/category/categoryStoreList');
+      } else {
+        uni.navigateTo({
+          url: `/pagesHome/category/index?id=${item.id}`,
+        });
+      }
+    },
+
+    /* 询价 */
+    btnClick() {
+      uni.navigateTo({
+        url: `/pages/client/clientUser/inquiry`,
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.container {
+  font-size: 28rpx;
+  min-height: calc(100vh - 30rpx);
+  background-color: #f9f9f9;
+  padding-bottom: 30rpx;
+  .container-top-box {
+    padding: 108rpx 32rpx 34rpx;
+    box-sizing: border-box;
+    background: linear-gradient(180deg, #d4e3ff 0%, #f0f1f9 53%, #f9f9f9);
+
+    .top-title {
+      display: grid;
+      grid-template-columns: 33% 33% 33%;
+      justify-content: space-between;
+      margin-bottom: 34rpx;
+      align-items: center;
+
+      .address {
+        display: flex;
+        color: #333333;
+      }
+
+      .title {
+        color: #0c1223;
+        font-weight: bold;
+        font-size: 34rpx;
+        text-align: center;
+      }
+    }
+
+    .top-search {
+      margin-bottom: 34rpx;
+    }
+
+    .top-swiper-box {
+      width: 100%;
+      height: 256rpx;
+      border-radius: 20rpx;
+      background-color: #fff;
+    }
+  }
+
+  .container-tabbar-box {
+    padding: 0 32rpx 0;
+
+    .tabar-box {
+      width: 100%;
+      border-radius: 20rpx;
+      padding: 12rpx 34rpx 32rpx;
+      box-sizing: border-box;
+      background-color: #fff;
+      display: grid;
+      grid-template-columns: repeat(5, 18%);
+      justify-content: space-between;
+      grid-gap: 24rpx 0;
+
+      .tabbar-item {
+        text-align: center;
+
+        .item-img {
+          .img {
+            width: 56rpx;
+            height: 56rpx;
+          }
+        }
+
+        .item-name {
+          margin-top: 16rpx;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+        }
+      }
+    }
+  }
+
+  .container-list-box {
+    padding: 0 32rpx 0;
+    box-sizing: border-box;
+    .item-box {
+      margin-top: 32rpx;
+
+      .item-top {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        margin-bottom: 32rpx;
+        .top-title {
+          color: #0c1223;
+          font-size: 34rpx;
+          font-weight: bold;
+        }
+
+        .top-more {
+          display: flex;
+          color: #999999;
+          font-size: 24rpx;
+          align-items: center;
+        }
+      }
+      .item-list {
+        display: grid;
+        grid-template-columns: repeat(2, 47.81%);
+        justify-content: space-between;
+        .item {
+          border-radius: 16rpx;
+        }
+      }
+    }
+  }
+}
+</style>

+ 1 - 0
src/pagesHome/marketer/index.vue

@@ -195,6 +195,7 @@
       };
     },
     onLoad(option) {
+      console.log("@@@@option",option)
       this.ids = option.id
       this.queryParams.id = option.id;
     },

BIN
src/static/home/icon_home_all.png