Jelajahi Sumber

修改搜索样式

zxl 1 tahun lalu
induk
melakukan
852dadae1b

+ 243 - 233
src/pages/client/clientPackage/search.vue

@@ -1,240 +1,250 @@
 <template>
-	<view class="search">
-		<view class="search-item">
-			<u-search v-model="search_text" :clearabled="true" @custom="handlerSearchBtn" />
-			<!-- <button class="search-btn" @click="handlerSearchBtn">搜索</button> -->
-		</view>
-		<!-- 搜索历史 -->
-		<view class="history">
-			<view class="history-top">
-				<hotCom>搜索历史</hotCom>
-				<view class="history-right" @click="handlerAllSearchRecord">
-					<u-icon name="trash" />
-					<text>删除记录</text>
-				</view>
-			</view>
-			<view class="label">
-				<u-tag v-for="(item, index) of search_list" :key="index" :text="item.name" plain closable :show="close2"
-					@close="handlerCloseSearchItem(item, index)" />
-			</view>
-		</view>
-
-		<!-- 热门搜索 -->
-		<view class="history">
-			<view class="history-top">
-				<text class="hotCom">热门搜索</text>
-			</view>
-			<view class="label">
-				<u-tag v-for="(item, index) in favourite_list" :text="item.name" :key="index" class="label-item"
-					@click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)" />
-			</view>
-		</view>
-
-		<u-divider text="猜你喜欢"></u-divider>
-
-		<!-- 列表 -->
-		<view class="popular-box">
-			<view class="hot" v-for="(item, index) of popular_search_list" :key="index"
-				@click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)">
-				<Image src="https://cdn.uviewui.com/uview/album/1.jpg"></Image>
-				<view>
-					<view class="item-text">{{ item.name }}</view>
-					<view class="item-flex">
-						<view class="star">
-							<u-rate :count="count" :value="item.score" readonly />
-							<text class="line">|</text>
-						</view>
-						<view>{{ item.goodReview }}单</view>
-					</view>
-					<view class="address-flex">
-						<view>{{ item.address }}</view>
-						<view>2.7km</view>
-					</view>
-				</view>
-			</view>
-		</view>
-	</view>
+  <view class="search">
+    <view class="search-item">
+      <u-search v-model="search_text" :clearabled="true" @custom="handlerSearchBtn" />
+      <!-- <button class="search-btn" @click="handlerSearchBtn">搜索</button> -->
+    </view>
+
+    <!-- 搜索历史 -->
+    <view class="history">
+      <view class="history-top">
+        <hotCom>搜索历史</hotCom>
+        <view class="history-right" @click="handlerAllSearchRecord">
+          <u-icon name="trash" />
+          <text>删除记录</text>
+        </view>
+      </view>
+      <view class="label">
+        <u-tag v-for="(item, index) of search_list" :key="index" :text="item.name" plain closable :show="close2"
+          @close="handlerCloseSearchItem(item, index)" @click="handlerSelctHistItem(item)" />
+      </view>
+    </view>
+    <!-- 热门搜索 -->
+    <view class="history">
+      <view class="history-top">
+        <text class="hotCom">热门搜索</text>
+      </view>
+      <view class="label">
+        <u-tag v-for="(item, index) in favourite_list" :text="item.name" :key="index" class="label-item"
+          @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)" />
+      </view>
+    </view>
+    <u-divider text="猜你喜欢"></u-divider>
+    <!-- 列表 -->
+    <view class="popular-box">
+      <view class="popular-item">
+        <view class="item-box layered" v-for="(item,index) of popular_search_list"
+          @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)">
+          <view class="item-left">
+            <image class="img" :src='item.logo'></image>
+          </view>
+          <view class="item-right">
+            <view class="item-title">{{ item.name }}</view>
+            <view class="item-score">
+              <u-rate count="5" :value="item.score" readonly />
+            </view>
+            <view class="item-address"> {{ item.address }} </view>
+          </view>
+        </view>
+      </view>
+    </view>
+
+
+  </view>
 </template>
 
 <script>
-	import {
-		listHotMerchant,
-		likeMerchant
-	} from '@/api/client/home.js';
-	export default {
-		data() {
-			return {
-				count: 5,
-				value: 4,
-				close2: true,
-				radios: [{
-					checked: true,
-				}, ],
-				checkboxs: [{
-					checked: true,
-				}, ],
-				search_text: '', // 搜索text
-				search_list: [], // 搜索列表
-
-				popular_search_list: [], //热门搜索列表
-				favourite_list: [], // 猜你喜欢列表
-			};
-		},
-		onShow() {
-			if (uni.getStorageSync('searchItem')) {
-				this.search_list = uni.getStorageSync('searchItem');
-			}
-		},
-		mounted() {
-			this.handlerInitList();
-		},
-		methods: {
-			// 初始化热门搜索 猜你喜欢列表
-			handlerInitList() {
-				listHotMerchant().then(res => {
-					this.popular_search_list = res.data;
-				});
-
-				// 猜你喜欢列表
-				likeMerchant().then(res => {
-					this.favourite_list = res.data;
-				});
-			},
-			// 点击搜索按钮
-			handlerSearchBtn() {
-				if (!this.search_text) {
-					uni.showToast({
-						title: '请输入您要搜索的关键字',
-						icon: 'none',
-					});
-					return;
-				} else {
-					let params = {
-						name: this.search_text,
-					};
-					this.search_list.push(params);
-					uni.setStorageSync('searchItem', this.search_list);
-					this.search_text = '';
-				}
-			},
-			// 删除搜索记录按钮
-			handlerCloseSearchItem(item, index) {
-				this.search_list.splice(index, 1);
-				uni.setStorageSync('searchItem', this.search_list);
-			},
-			// 删除所有搜索记录按钮
-			handlerAllSearchRecord() {
-				uni.removeStorageSync('searchItem');
-				this.search_list = [];
-			},
-		},
-	};
+  import {
+    listHotMerchant,
+    likeMerchant
+  } from '@/api/client/home.js';
+  export default {
+    data() {
+      return {
+        count: 5,
+        value: 4,
+        close2: true,
+        radios: [{
+          checked: true,
+        }, ],
+        checkboxs: [{
+          checked: true,
+        }, ],
+        search_text: '', // 搜索text
+        search_list: [], // 搜索列表
+
+        popular_search_list: [], //热门搜索列表
+        favourite_list: [], // 猜你喜欢列表
+      };
+    },
+    onShow() {
+      if (uni.getStorageSync('searchItem')) {
+        this.search_list = uni.getStorageSync('searchItem');
+      }
+    },
+    mounted() {
+      this.handlerInitList();
+    },
+    methods: {
+      // 初始化热门搜索 猜你喜欢列表
+      handlerInitList() {
+        listHotMerchant().then(res => {
+          this.popular_search_list = res.data;
+        });
+
+        // 猜你喜欢列表
+        likeMerchant().then(res => {
+          this.favourite_list = res.data;
+        });
+      },
+      // 点击搜索按钮
+      handlerSearchBtn() {
+        if (!this.search_text) {
+          uni.showToast({
+            title: '请输入您要搜索的关键字',
+            icon: 'none',
+          });
+          return;
+        } else {
+          let params = {
+            name: this.search_text,
+          };
+          this.search_list.push(params);
+          uni.setStorageSync('searchItem', this.search_list);
+          this.search_text = '';
+        }
+      },
+      // 删除搜索记录按钮
+      handlerCloseSearchItem(item, index) {
+        this.search_list.splice(index, 1);
+        uni.setStorageSync('searchItem', this.search_list);
+      },
+      // 点击搜索历史按钮
+      handlerSelctHistItem(item) {
+        this.search_text = item.name
+      },
+      // 删除所有搜索记录按钮
+      handlerAllSearchRecord() {
+        uni.removeStorageSync('searchItem');
+        this.search_list = [];
+      },
+    },
+  };
 </script>
 
 <style lang="scss" scoped>
-	.search {
-		min-height: 100vh;
-		background-color: #fff;
-	}
-
-	/* 搜索样式 */
-	.search-item {
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		padding: 0 20rpx;
-		height: 80rpx;
-		line-height: 80rpx;
-		background-color: #fff;
-		margin-bottom: 10rpx;
-
-		.search-btn {
-			width: 160rpx;
-			height: 70rpx;
-			font-size: 28rpx;
-			line-height: 70rpx;
-		}
-	}
-
-	/* 搜索历史样式 */
-	.history {
-		padding: 30rpx;
-		margin-bottom: 10rpx;
-
-		.history-top {
-			display: flex;
-			justify-content: space-between;
-			margin-bottom: 20rpx;
-
-			.history-right {
-				margin-top: 15rpx;
-				display: flex;
-				font-size: 12px;
-			}
-
-			hotCom {
-				font-size: 15px;
-				font-weight: bold;
-				color: #404045;
-			}
-		}
-	}
-
-	.label {
-		display: flex;
-		flex-wrap: wrap;
-	}
-
-	// 列表
-	.hot {
-		height: 220rpx;
-		background-color: #fff;
-		padding: 0 20rpx;
-		margin-bottom: 20rpx;
-		display: flex;
-
-		Image {
-			width: 120px;
-			height: calc(100% - 20rpx);
-			margin: 10rpx 20rpx 10rpx 0;
-		}
-
-		.item-text {
-			font-weight: bold;
-			margin: 10rpx 0 10rpx;
-			color: #333;
-		}
-
-		.item-flex {
-			display: flex;
-			justify-content: space-between;
-			font-size: 14px;
-			margin: 0 20rpx 30rpx 0;
-			color: #0d0d0d66;
-
-			.star {
-				display: flex;
-
-				.line {
-					margin-left: 18rpx;
-					margin-top: 5rpx;
-					font-size: 24rpx;
-				}
-			}
-		}
-
-		.address-flex {
-			display: flex;
-			justify-content: space-between;
-			font-size: 12px;
-			color: #999;
-			margin-right: 20rpx;
-		}
-	}
-
-	::v-deep view.data-v-1481d46d,
-	scroll-view.data-v-1481d46d,
-	swiper-item.data-v-1481d46d {
-		margin: 0 4rpx;
-	}
-</style>
+  .search {
+    min-height: 100vh;
+    background-color: #fff;
+  }
+
+  /* 搜索样式 */
+  .search-item {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 20rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+    background-color: #fff;
+    margin-bottom: 10rpx;
+
+    .search-btn {
+      width: 160rpx;
+      height: 70rpx;
+      font-size: 28rpx;
+      line-height: 70rpx;
+    }
+  }
+
+  /* 搜索历史样式 */
+  .history {
+    padding: 30rpx;
+    margin-bottom: 10rpx;
+
+    .history-top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 20rpx;
+
+      .history-right {
+        margin-top: 15rpx;
+        display: flex;
+        font-size: 12px;
+      }
+
+      hotCom {
+        font-size: 15px;
+        font-weight: bold;
+        color: #404045;
+      }
+    }
+  }
+
+  .label {
+    display: flex;
+    flex-wrap: wrap;
+  }
+
+  .label-item {
+    margin-bottom: 20rpx;
+  }
+
+  .popular-box {
+    padding: 20rpx;
+
+    .item-box {
+      display: flex;
+      margin-bottom: 20rpx;
+      border-radius: 20rpx;
+      padding: 20rpx;
+
+      .item-left {
+        margin-right: 20rpx;
+
+        .img {
+          width: 160rpx;
+          height: 160rpx;
+          border-radius: 20rpx;
+        }
+      }
+
+      .item-right {
+        display: flex;
+        flex-direction: column;
+        justify-content: space-between;
+
+        .item-title {
+          color: #000;
+          font-weight: bold;
+          font-size: 32rpx;
+        }
+
+        .item-address {
+          color: #a1a1a1;
+        }
+      }
+    }
+
+    .layered {
+      box-shadow:
+        0 1px 1px hsla(0deg, 0%, 0%, 0.075),
+        0 5px 10px hsla(0deg, 0%, 0%, 0.075),
+        0 4px 4px hsla(0deg, 0%, 0%, 0.075),
+        0 -1px 0px hsla(0deg, 0%, 0%, 0.075),
+        0 6px 8px hsla(0deg, 0%, 0%, 0.025)
+    }
+  }
+
+  ::v-deep view.data-v-1481d46d,
+  scroll-view.data-v-1481d46d,
+  swiper-item.data-v-1481d46d {
+    margin: 0 4rpx;
+  }
+
+  ::v-deep view.data-v-39e33bf2,
+  scroll-view.data-v-39e33bf2,
+  swiper-item.data-v-39e33bf2 {
+    margin-bottom: 10rpx !important;
+  }
+</style>

+ 6 - 15
src/pages/client/clientPackage/storeList.vue

@@ -9,11 +9,11 @@
       </view>
       <view class="filter-box">
         <view class="filter-item">
-          <view class="fiter1">
+   <!--       <view class="fiter1">
             <u-icon name="map"></u-icon>
             <span class="filter-l">贵阳市青少年人才社区</span>
             <u-icon name="arrow-down-fill"></u-icon>
-          </view>
+          </view> -->
           <view class="fiter2" @tap.stop="handlerSelectAllFilter(2)">
             <span>{{ sortCondition }}</span>
             <u-icon name="arrow-down-fill"></u-icon>
@@ -93,18 +93,7 @@
   import { getCurrentLocation } from '@/api/client/home.js';
   import { mapState } from 'vuex';
   export default {
-    async mounted() {
-      // let data = {
-      //   longitude: this.longitude,
-      //   latitude: this.latitude,
-      // };
-      // try {
-      //   let obj = await getCurrentLocation(data);
-      //   this.sellerListParams.region = obj.data.id;
-      //   this.getData();
-      // } catch (e) {}
-
-      // 微信小程序获取当前经纬度 - 暂定
+    mounted() {
       this.getData();
     },
     computed: {
@@ -146,7 +135,9 @@
       };
     },
     onLoad(option) {
-      this.sellerListParams.categoryId = option.id;
+      if(option.id){
+        this.sellerListParams.categoryId = option.id;
+      }
     },
     methods: {
       // 点击综合排序

+ 262 - 250
src/pages/client/tabBar/home/index.vue

@@ -1,273 +1,285 @@
 <template>
-	<view class="home">
-		<view>
-			<!-- 顶部导航 -->
-			<view class="nav-bar">
-				<u-navbar :bgColor="'#ffffff'" :placeholder="true">
-					<view slot="left" @click="manualGetLocation">
-						<text>{{ nowAddress }}</text>
-						<text class="iconfont icon-chevron-down" />
-					</view>
-					<view slot="center">
-						<u-search placeholder="请输入搜索内容" :showAction="false" v-model="keyword"
-							@click="$Router.push('/pages/client/clientPackage/search')" :disabled="true" />
-					</view>
-				</u-navbar>
-			</view>
+  <view class="home">
+    <view>
+      <!-- 顶部导航 -->
+      <view class="nav-bar">
+        <u-navbar :bgColor="'#ffffff'" :placeholder="true">
+          <view slot="left" @click="manualGetLocation">
+            <text>{{ nowAddress }}</text>
+            <text class="iconfont icon-chevron-down" />
+          </view>
+          <view slot="center">
+            <u-search placeholder="请输入搜索内容" :showAction="false" v-model="keyword"
+              @click="$Router.push('/pages/client/clientPackage/search')" :disabled="true" />
+          </view>
+        </u-navbar>
+      </view>
 
-			<!-- 轮播图 -->
-			<view class="home-swiper">
-				<u-swiper :list="swiperUrlList" @click="handlerSwiperSkip" indicator />
-			</view>
+      <!-- 轮播图 -->
+      <view class="home-swiper">
+        <u-swiper :list="swiperUrlList" @click="handlerSwiperSkip" indicator />
+      </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="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('/pages/client/clientPackage/storeHot')">
-					<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(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
-								v-for="item in homeData.recommends" :key="item.id">
-								<recommend-item :item="item"></recommend-item>
-							</u-grid-item>
-						</u-grid>
-					</view>
-				</block>
-				<block v-else>
-					<u-empty icon="/static/default-graph/no-business.png" text="暂无推荐商家"></u-empty>
-				</block>
-			</view>
+      <!-- 热门推荐 -->
+      <view class="hot">
+        <u-cell :border="false" value="查看更多" isLink @click="$Router.push('/pages/client/clientPackage/storeHot')">
+          <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(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
+                v-for="item in homeData.recommends" :key="item.id">
+                <recommend-item :item="item"></recommend-item>
+              </u-grid-item>
+            </u-grid>
+          </view>
+        </block>
+        <block v-else>
+          <u-empty icon="/static/default-graph/no-business.png" text="暂无推荐商家"></u-empty>
+        </block>
+      </view>
 
-			<!-- 附近商家 -->
-			<view class="near">
-				<u-cell :border="false" value="查看更多" isLink
-					@click="$Router.push('/pages/client/clientPackage/storeNearby')">
-					<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(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
-								v-for="item in homeData.nears" :key="item.id">
-								<hot-item :item="item"></hot-item>
-							</u-grid-item>
-						</u-grid>
-					</view>
-				</block>
-				<block v-else>
-					<u-empty icon="/static/default-graph/no-business.png" text="暂无附近商家"></u-empty>
-				</block>
-			</view>
+      <!-- 附近商家 -->
+      <view class="near">
+        <u-cell :border="false" value="查看更多" isLink @click="$Router.push('/pages/client/clientPackage/storeNearby')">
+          <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(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
+                v-for="item in homeData.nears" :key="item.id">
+                <hot-item :item="item"></hot-item>
+              </u-grid-item>
+            </u-grid>
+          </view>
+        </block>
+        <block v-else>
+          <u-empty icon="/static/default-graph/no-business.png" text="暂无附近商家"></u-empty>
+        </block>
+      </view>
 
-			<!-- 询价 -->
-			<!-- <drag-button :isDock="true" :existTabBar="true" @btnClick="btnClick" /> -->
-		</view>
+      <!-- 询价 -->
+      <!-- <drag-button :isDock="true" :existTabBar="true" @btnClick="btnClick" /> -->
+    </view>
 
-		<tabbar currentTab="clientHome" />
-	</view>
+    <tabbar currentTab="clientHome" />
+  </view>
 </template>
 
 <script>
-	import {
-		getCurrentLocation,
-		getHomePageApi,
-		getSwiperListApi
-	} from '@/api/client/home';
-	import {
-		mapGetters
-	} from 'vuex';
-	import RecommendItem from '@/components/merchant/RecommendItem.vue';
-	import HotItem from '@/components/merchant/HotItem.vue';
-	import dragButton from '@/components/drag/drag-button.vue';
-	import { getMapLocation } from "@/utils/mapUtil.js"
-	export default {
-		components: {
-			RecommendItem,
-			HotItem,
-			dragButton,
-		},
-		data() {
-			return {
-				list: [],
-				keyword: '',
-				swiperUrlList: [], // 轮播图url列表
-				swiperList: [],
-				homeData: {
-					categories: [],
-					nears: [],
-					recommends: [],
-				},
-				queryParams: {
-					longitude: '',
-					latitude: '',
-					region: ''
-				},
-				nowAddress: '', //当前地址
-			};
-		},
+  import {
+    getCurrentLocation,
+    getHomePageApi,
+    getSwiperListApi
+  } from '@/api/client/home';
+  import {
+    mapGetters
+  } from 'vuex';
+  import RecommendItem from '@/components/merchant/RecommendItem.vue';
+  import HotItem from '@/components/merchant/HotItem.vue';
+  import dragButton from '@/components/drag/drag-button.vue';
+  import {
+    getMapLocation
+  } from "@/utils/mapUtil.js"
+  export default {
+    components: {
+      RecommendItem,
+      HotItem,
+      dragButton,
+    },
+    data() {
+      return {
+        list: [],
+        keyword: '',
+        swiperUrlList: [], // 轮播图url列表
+        swiperList: [],
+        homeData: {
+          categories: [],
+          nears: [],
+          recommends: [],
+        },
+        queryParams: {
+          longitude: '',
+          latitude: '',
+          region: ''
+        },
+        nowAddress: '', //当前地址
+      };
+    },
 
-		computed: {
-			...mapGetters(['location']),
-			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;
-			},
-		},
-		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) {
+    computed: {
+      ...mapGetters(['location']),
+      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;
+      },
+    },
+    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
+        getCurrentLocation({
+          point
+        }).then(res => {
+          console.log('getCurrentLocation', res)
+          let {
+            city,
+            district,
+            id
+          } = res.data
           this.queryParams.region = res.data.id;
-          if(district){
-            this.nowAddress = district.name
-          }else if(city){
+          if (district) {
             this.nowAddress = district.name
-          }else{
+          } 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,
-					});
-				})
-			},
-			/* 轮播图 */
-			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() {
-				// getMapLocation()
-				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 => {
-						console.log("@@err")
-					}
-				});
-			},
-			// 点击swiper跳转
-			handlerSwiperSkip(e) {
-				console.log("@@@swiperList", this.swiperList[e])
-			},
-			// 点击菜单
-			handleMenuClick(item) {
-				if (item.id === 'all') {
-					this.$Router.push('/pages/client/clientPackage/category');
-				} else {
-					uni.navigateTo({
-						url: `/pages/client/clientPackage/storeList?id=${item.id}`,
-					});
-				}
-			},
+          this.getHomeData(this.queryParams)
+          this.$store.commit('SET_LOCATION', {
+            longitude: longitude,
+            latitude: latitude,
+            region: res.data.id,
+          });
+        })
+      },
+      /* 轮播图 */
+      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: function(err) {
+            console.log('取消按钮', err)
+          }
+        });
+      },
+      // 点击swiper跳转
+      handlerSwiperSkip(e) {
+        console.log("@@@swiperList", this.swiperList[e])
+      },
+      // 点击菜单
+      handleMenuClick(item) {
+        if (item.id === 'all') {
+          this.$Router.push('/pages/client/clientPackage/category');
+        } else {
+          uni.navigateTo({
+            url: `/pages/client/clientPackage/storeList?id=${item.id}`,
+          });
+        }
+      },
 
-			/* 询价 */
-			btnClick() {
-				// uni.chooseImage({
-				//   count: 9,
-				//   sizeType: ['original', 'compressed'],
-				//   sourceType: ['camera', 'album'],
-				//   success: res => {
-				//     const tempFilePaths = res.tempFilePaths;
-				//     this.uploadFileAlbum();
-				//   },
-				// });
+      /* 询价 */
+      btnClick() {
+        // uni.chooseImage({
+        //   count: 9,
+        //   sizeType: ['original', 'compressed'],
+        //   sourceType: ['camera', 'album'],
+        //   success: res => {
+        //     const tempFilePaths = res.tempFilePaths;
+        //     this.uploadFileAlbum();
+        //   },
+        // });
 
-				uni.navigateTo({
-					url: `/pages/client/clientUser/inquiry`,
-				});
-			},
+        uni.navigateTo({
+          url: `/pages/client/clientUser/inquiry`,
+        });
+      },
 
-			// uploadFileAlbum() {
-			//   uni.uploadFile({
-			//     url: '', //服务器地址
-			//     fileType: 'image', //ZFB必填,不然报错
-			//     filePath: tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
-			//     name: 'imgFile',
-			//     success: uploadFileRes => {
-			//       let imgData = JSON.parse(uploadFileRes.data);
-			//       this.imgDataUrl = imgData.data.imgUrl;
-			//     },
-			//   });
-			// },
-		},
-	};
+      // uploadFileAlbum() {
+      //   uni.uploadFile({
+      //     url: '', //服务器地址
+      //     fileType: 'image', //ZFB必填,不然报错
+      //     filePath: tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
+      //     name: 'imgFile',
+      //     success: uploadFileRes => {
+      //       let imgData = JSON.parse(uploadFileRes.data);
+      //       this.imgDataUrl = imgData.data.imgUrl;
+      //     },
+      //   });
+      // },
+    },
+  };
 </script>
 
 <style lang="scss" scoped>
-	@import './index.scss';
+  @import './index.scss';
 </style>