<template>
	<view class="page" :style="themeColor">
		<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex homePage_flex_0"
			:style="{height:(180+StatusBarRpx)+'rpx', paddingTop:StatusBarRpx+'rpx', background: backgroundColor}">
			<view class='flex flex-wrap align-center justify-between homePage_fd0_0'
				:style="{height: barHeight+'px', paddingRight: menuButtonWidth + 'px'}">
				<view v-if="address" class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="navigateTo"
					:data-url="`/pages/sy/selectlocationAddress/selectlocationAddress?city=${city}&addr=${address}`">
					<text class='fu-iconfont2  homePage_fd0_0_c0_c0'>&#xe844;</text>
					<view class='homePage_fd0_0_c0_c1 text-cut'>{{address || '请选择'}}</view>
					<text class='fu-iconfont2  homePage_fd0_0_c0_c2'>&#xe78a;</text>
					<!-- <image class='homePage_fd0_0_c0_c2' mode="aspectFit" :src='STATIC_URL+"29.png"'></image> -->
				</view>
				<view v-else class='flex flex-wrap align-center' data-type="navigateTo"
					:data-url="`/pages/sy/selectlocationAddress/selectlocationAddress?city=${city}`">
					<text class='fu-iconfont2  homePage_fd0_0_c0_c0'>&#xe844;</text>
					<view class='homePage_fd0_0_c0_c1 text-cut'>{{address || '请选择'}}</view>
					<text class='fu-iconfont2  homePage_fd0_0_c0_c2'>&#xe78a;</text>
					<!-- <image class='homePage_fd0_0_c0_c2' mode="aspectFit" :src='STATIC_URL+"29.png"'></image> -->
				</view>
				<view class='flex flex-wrap align-center' @tap.stop="handleScan">
					<image class='homePage_fd0_0_c1_c0' mode="aspectFit" :src='STATIC_URL + "scan_code.png" '></image>
				</view>
			</view>
			<view class='flex flex-wrap align-center homePage_fd0_1' @tap.stop="handleJumpDiy" data-type="navigateTo"
				:data-url="`/pages/sy/searchPage/searchPage`">
				<text class='fu-iconfont2  homePage_fd0_1_c0'>&#xe741;</text>
				<input class='flex-sub' type="text" placeholder="请输入关键字" confirm-type="done" :maxlength="-1" :disabled='true'
					placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx" v-model="fd0_1_c1" />
			</view>

		</view>
		<!-- <image src="https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/13.png" mode="widthFix" style="position: absolute; top: 0; width: 100%"></image> -->
		<view :style="{height: (180+StatusBarRpx)+'rpx'}"></view>

		<view v-if="isHandLocation && !lat" class="kaiqiweizhi flex align-center justify-between"
			:style="{top:(70 + StatusBar ) + 'px'}">
			<view class="flex align-center">
				<view class="" style="font-size: 32upx;font-weight: 550;">开启定位权限,显示周边商家及商品</view>
				<view class="kaiqiweizhi-button" @click="_getPermission">
					去开启
				</view>
			</view>
			<view class="text-df flex align-center">
				<image src="/static/close.png" @click="isHandLocation = false" style="width:32rpx;height: 32rpx;"
					mode="aspectFill"></image>
			</view>
		</view>
		<!-- <view class="fu-my-background">
      <image src="https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/13.png" mode="widthFix" />
    </view> -->
		<!---flex布局flex布局开始-->
		<view class="flex flex-wrap align-center justify-center benben-flex-layout homePage_flex_1">
			<view style="position: relative">
				<swiper ref="benbenSwiperfd1_0" @change="bannerIndexfd1_0 = $event.detail.current"
					class='flex position-relative homePage_fd1_0' previous-margin="0rpx" next-margin="0rpx"
					:display-multiple-items="1" :interval="5000" :duration="500" :autoplay='true' indicator-active-color="#fff"
					indicator-dots="true" :circular='true'>


					<swiper-item class='flex  homePage_fd1_0_c1' v-for="(item, index) in banners" :key="item.aid"
						@tap="swiperTap(item)">
						<image class='homePage_fd1_0_c1_c0' mode="aspectFill" :src='item.thumb'></image>
					</swiper-item>


				</swiper>
				<!-- <view style="position: absolute" class="flex dot flex align-center justify-center homePage_swiperDotfd1_0">
          <view class='flex flex align-center justify-center homePage_numberfd1_0_c0'>
            <text>{{bannerIndexfd1_0+1}}</text>
            <text>/</text>
            <text>{{banners.length}}</text>
          </view>

        </view> -->
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center homePage_flex_2" v-if="noticeList.length">
			<view class='flex flex-wrap align-center flex-sub homePage_fd2_0'>
				<image class='homePage_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"15.png"'></image>
				<!-- <text class='homePage_fd2_0_c1'>{{notice}}</text> -->
				<swiper class="swiper" vertical="true" autoplay="true" interval="3000">
					<swiper-item v-for="(item, index) in noticeList" :key="index">
						<view class="swiper-notice" @tap="handleToNotice(item)">{{item.content}}</view>
					</swiper-item>
				</swiper>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center homePage_flex_3">
			<view style="position: relative">
				<swiper ref="benbenSwiperfd3_0" @change="bannerIndexfd3_0 = $event.detail.current"
					class='flex position-relative homePage_fd3_0' previous-margin="0rpx" next-margin="0rpx"
					:display-multiple-items="1" :interval="5000" :duration="500" :circular='true'>


					<swiper-item class='flex  homePage_fd3_0_c1' v-for="(page, index) in cateList" :key="index">
						<view class='flex flex-wrap align-start'>
							<view class='flex flex-direction flex-wrap align-center homePage_fd3_0_c1_c0_c0' v-for="item of page"
								:key="item.aid" @tap.stop="handleToClassify(item)" data-type="navigateTo"
								:data-url="`/pages/sy/classificationList/classificationList?id=${item.aid}&title=${item.title}`">
								<image class='homePage_fd3_0_c1_c0_c0_c0' mode="aspectFill" :src='item.thumb'></image>
								<!-- <view class="homePage_fd3_0_c1_c0_c0_c0" :style="{backgroundImage: `url(${item.thumb})`}"></view> -->
								<text class='homePage_fd3_0_c1_c0_c0_c1'>{{item.title}}</text>
							</view>
							<!-- <view class='flex flex-direction flex-wrap align-center homePage_fd3_0_c1_c0_c1' @tap.stop="handleJumpDiy"
                data-type="navigateTo" :data-url="`/pages/sy/allLIstcategories/allLIstcategories`">
                <image class='homePage_fd3_0_c1_c0_c1_c0' mode="aspectFill" :src='STATIC_URL+"all.png"'></image>
                <text class='homePage_fd3_0_c1_c0_c1_c1'>全部分类</text>
              </view> -->
						</view>
					</swiper-item>


					<!-- <swiper-item class='flex'>
            <view class='flex flex-wrap align-center'>
              <view class='flex flex-direction flex-wrap align-center homePage_fd3_0_c2_c0_c0'>
                <image class='homePage_fd3_0_c2_c0_c0_c0' mode="aspectFit" :src='STATIC_URL+"51.png"'></image>
                <text class='homePage_fd3_0_c2_c0_c0_c1'>精品午餐</text>
              </view>
            </view>
          </swiper-item> -->


				</swiper>
				<!-- <view style="position: absolute" class="flex dot flex align-center justify-center homePage_swiperDotfd3_0">
          <view class='flex flex align-center justify-center homePage_numberfd3_0_c0'>
            <text>{{bannerIndexfd3_0+1}}</text>
            <text>/</text>
            <text>{{cateList.length}}</text>
          </view>

        </view> -->
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout homePage_flex_4">
			<view class='flex flex-direction flex-wrap align-start homePage_fd4_0' v-if="list.length">
				<view class='flex flex-wrap align-center'>
					<text class='homePage_fd4_0_c0_c0'>热门店铺</text>
				</view>
				<image class='homePage_fd4_0_c1' mode="aspectFit" :src='STATIC_URL+"30.png"'></image>
			</view>

			<block v-if="permissionStatus == 1">
				<fu-loading v-if="isShowLoading"></fu-loading>
				<fu-empty-ui v-if="list.length === 0 && isInit"></fu-empty-ui>
				<view v-for="(item, index) in list" :key="index" class='flex flex-wrap align-center homePage_fd4_1' style="position: relative;"
					@tap.stop="handleJumpDiy" data-type="navigateTo"
					:data-url="`/pages/dpxq/storeDetails/storeDetails?id=${item.aid}`">
					<view class="point-bg">
						<view class="point-bg-txt">积分{{item.score_rate}}%</view>
					</view>
					<view class='flex flex-direction flex-wrap align-start' style="position: relative;">
						<view class='flex flex-wrap align-center'>
							<image class='homePage_fd4_1_c0_c1_c0' mode="aspectFill" :src='item.logo'></image>
						</view>
						<image style="width: 50rpx; height: 50rpx; position: absolute; top: 0; right: 0; z-index: 10;"
							v-if="item.storelevel_thumb" :src="item.storelevel_thumb" mode="aspectFill"></image>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch flex-sub homePage_fd4_1_c1'>
						<view class='flex flex-direction flex-wrap align-start'>
							<view class='flex flex-wrap align-center'>
								<text class='homePage_fd4_1_c1_c0_c0_c0'>{{item.store_name}}</text>
							</view>
						</view>
						<view class='flex flex-wrap align-center homePage_fd4_1_c1_c1'>
							<text class='storeDetails_fd2_0_c1_c1_c1' style="margin: 0 20rpx 0 0; color: #FF9D00;font-size: 26rpx;" v-if="item.store_type">{{item.store_type}}</text>
							<text style="margin-right: 20rpx;color:#E5E5E5">|</text>
								<!-- <uv-rate count="5" :value="item.score" inactiveColor="#FF5951" activeColor="#FF5951" gutter="1" :allowHalf="true"></uv-rate> -->
								<!-- <text class='homePage_fd4_1_c1_c1_c1'>{{item.score}}</text> -->
							<image class='homePage_fd4_1_c1_c1_c0' mode="aspectFit" :src='STATIC_URL+"31.png"'></image>
							<text class='homePage_fd4_1_c1_c1_c1'>{{item.score}}</text>
							<text class='homePage_fd4_1_c1_c1_c2'>分</text>
						</view>
						<view class='flex flex-wrap align-center justify-between homePage_fd4_1_c1_c2'>
							<view class='flex flex-wrap align-center' style="background-color: #FFEEED;padding: 4rpx 8rpx;color:#FF5951;">
								<text class='homePage_fd4_1_c1_c2_c0_c0'>关注人数</text>
								<text class='homePage_fd4_1_c1_c2_c0_c1'>{{item.collect_num}}</text>
							</view>
					<!-- 		<view class='flex flex-wrap align-center'>
								<text class='homePage_fd4_1_c1_c2_c1_c0'>人均￥</text>
								<text class='homePage_fd4_1_c1_c2_c1_c1'>{{item.per_capita}}</text>
							</view> -->
						</view>
						<view class='flex flex-wrap align-center justify-between homePage_fd4_1_c1_c3'>
							<view class='flex flex-wrap align-center'>
								<text class='homePage_fd4_1_c1_c3_c0_c0'>起送¥</text>
								<text class='homePage_fd4_1_c1_c3_c0_c1'>{{item.start_price}} </text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='homePage_fd4_1_c1_c3_c1_c0'>约</text>
								<text class='homePage_fd4_1_c1_c3_c1_c1'>{{item.minute}}</text>
								<text class='homePage_fd4_1_c1_c3_c1_c2'>分钟</text>
								<text class='homePage_fd4_1_c1_c3_c1_c3'>{{item.distance}}</text>
								<text class='homePage_fd4_1_c1_c3_c1_c4'>km</text>
							</view>
						</view>
					</view>
				</view>
				<uni-load-more v-if="list.length !=0 " :status="status"></uni-load-more>
			</block>
			<block v-if="permissionStatus != 1">
				<fu-empty-ui @permission="handlePermission" v-if="permissionStatus == 0" emptyImage="addr"
					pagingListNoListDataText="暂无开启位置权限"></fu-empty-ui>
				<fu-empty-ui @permission="handlePermission" v-if="permissionStatus == -1" emptyImage="permission"
					pagingListNoListDataText="您已永久拒绝位置权限, 需要您去手机'手机-设置'中开启后重新启动应用"></fu-empty-ui>
			</block>
		</view>

		<!---flex布局flex布局结束-->
		<!-- 网络监测 start -->
		<fu-notwork @retry="retry"></fu-notwork>
		<!-- 网络监测 end -->

	</view>
</template>
<script>
	import amap from '@/common/amap-wx.js';
	import permision from '@/common/permission.js';
	import {
		LOGIN_PAGE_URL
	} from '@/common/config.js'
	export default {
		components: {},


		data() {
			return {
				bannerIndexfd3_0: 0,
				bannerIndexfd1_0: 0,
				fd0_1_c1: "",
				scan: "",
				banners: [], // 轮播图列表
				cateList: [],
				// backgroundColor: 'rgba(255, 147, 0, 0)',
				backgroundColor: 'rgba(255,213,172, 0)',
				lat: '',
				lng: '',
				list: [],
				isShowLoading: false,
				isInit: false,
				status: 'more', // 表示是否有数据可以请求
				page: 1,
				address: '',
				amapPlugin: null, //new地图
				key: '886bfe2d6c32bd8eac97c2e6d821ed0b',
				permissionStatus: 1,
				notice: "", //公告
				noticeList: [],
				city: '',
				barHeight: 45,
				menuButtonWidth: 20,
				isHandLocation: false
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		onPageScroll(e) {
			let opacity = e.scrollTop / 150
			this.backgroundColor =
				`rgba(215,255,213, ${opacity})`;
		},
		watch: {},
		onLoad(options) {
			if (options.invite_id) {
				uni.setStorageSync('INVITE_CODE', options.invite_id);
			}
			// #ifdef MP-WEIXIN
			this.barHeight = this.$barHeight;
			this.menuButtonWidth = this.$menuButtonWidth;
			// #endif
			if (global.appTabBarType) this.toHomeDiy()




			this.amapPlugin = new amap.AMapWX({
				key: this.key
			});
			this.judgeIsLocation()
			// uni.$on('LOCATION_SUCCESS', () => {
			//   this.judgeIsLocation()
			// })
			// let lat = uni.getStorageSync('LVTAI_LAT') || '';
			// let lng = uni.getStorageSync('LVTAI_LNG') || '';
			// // 定位功能
			// if (!lat) {
			// 	// #ifndef MP-WEIXIN
			// 	let platform = uni.getSystemInfoSync().platform == 'ios' ? 1 : 2
			// 	console.log(platform)
			// 	if (platform == 2) {
			// 		this.isHandLocation = true;
			// 	} else {
			// 		this._getLocation()
			// 		this.isHandLocation = false;
			// 	}
			// 	//  #endif
			// 	// #ifdef MP-WEIXIN 
			// 	this._getLocation()
			// 	this.toppop = false;
			// 	//  #endif
			// } else {
			// 	this._getLocation()
			// }
			// // #ifdef APP-PLUS
			// this._getPermission();
			// // #endif

			// // #ifndef APP-PLUS
			// this._getLocation()
			// // #endif
			uni.$on('COLLECT_SUCCESS', () => {
				this._getLocation()
			})



			uni.$on('SELECT_ADDRESS', (data) => {
				console.log('监听到数据', data)
				this.lat = data.lat;
				this.lng = data.lng;
				this.city = data.city;
				this.address = data.address;
				global.lat = data.lat;
				global.lng = data.lng;
				global.city = data.city;
				global.address = data.address;
				uni.setStorageSync('LVTAI_LAT', data.lat)
				uni.setStorageSync('LVTAI_LNG', data.lng)
				this.status = 'more';
				this.page = 1;
				this.isInit = false;
				this.list = [];
				this.getRecommendList(true);
			})
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.getSwiper();
			this.getCateList();
			console.log(this.permissionStatus)
			// if (this.permissionStatus == -1) {
			// this.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
			// }
			// let lat = uni.getStorageSync('LVTAI_LAT') || '';
			// let lng = uni.getStorageSync('LVTAI_LNG') || '';
			// // 定位功能
			// if (!lat) {
			// 	// #ifndef MP-WEIXIN
			// 	let platform = uni.getSystemInfoSync().platform == 'ios' ? 1 : 2
			// 	console.log(platform)
			// 	if (platform == 2) {
			// 		this.isHandLocation = true;
			// 	} else {
			// 		this._getLocation()
			// 		this.isHandLocation = false;
			// 	}
			// 	//  #endif
			// 	// #ifdef MP-WEIXIN 
			// 	this._getLocation()
			// 	this.toppop = false;
			// 	//  #endif
			// } else {
			// 	this._getLocation()
			// }
			if (global.token) {
				this.get6437c28c6c105()
			}
			// uni.$off('SELECT_ADDRESS')

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.getSwiper();
			this.getCateList();
			if (this.lat) {
				this.status = 'more';
				this.page = 1;
				this.isInit = false;
				this.list = [];
				this.getRecommendList(true);
			} else {
				// #ifdef APP-PLUS
					let platform = uni.getSystemInfoSync().platform == 'ios' ? 1 : 2
					console.log(platform)
					if (platform == 1) {
						this._getPermission()
					}
				// this._getPermission()
				// #endif

				// #ifndef APP-PLUS
				this._getLocation()
				// #endif
			}

			// this.$refs.guess && this.$refs.guess.refresh();
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom(e) {
			if (this.lat && this.lng) {
				this.getRecommendList();
			}
		},
		methods: {
			retry() {
				this.getSwiper();
				this.getCateList();
				if (this.lat) {
					this.status = 'more';
					this.page = 1;
					this.isInit = false;
					this.list = [];
					this.getRecommendList(true);
				} else {
					// #ifdef APP-PLUS
					let platform = uni.getSystemInfoSync().platform == 'ios' ? 1 : 2
					console.log(platform)
					if (platform == 1) {
						this._getPermission()
					}
					// this._getPermission()
					// #endif

					// #ifndef APP-PLUS
					this._getLocation()
					// #endif
				}
			},


			judgeIsLocation() {
				let lat = uni.getStorageSync('LVTAI_LAT') || '';
				let lng = uni.getStorageSync('LVTAI_LNG') || '';
				// 定位功能
				if (!lat) {
					// #ifndef MP-WEIXIN
					let platform = uni.getSystemInfoSync().platform == 'ios' ? 1 : 2
					console.log(platform)
					if (platform == 2) {
						this.isHandLocation = true;
					} else {
						this._getLocation()
						this.isHandLocation = false;
					}
					//  #endif
					// #ifdef MP-WEIXIN 
					this._getLocation()
					this.toppop = false;
					//  #endif
				} else {
					this._getLocation()
				}
			},
			isokdingwei() {
				this.$util.showModal({
					title: "提示",
					content: "萬家商超访问位置权限用于上传用户位置,是否允许?",
					confirmColor: "#FF2020",
					confirmText: "允许",
					cancelText: "取消",
					success: (res) => {
						if (res.confirm) {
							// uni.setStorageSync('PLATFORM_PERMISSION_CONTACT', true)
							this.toppop = false;
							this._getLocation();
						}
					},
				});

			},
			handleToClassify(item) {
				if (item.aid != -9999) {
					uni.navigateTo({
						url: `/pages/sy/classificationList/classificationList?id=${item.aid}&title=${item.title}`
					})
				} else {
					uni.navigateTo({
						url: `/pages/sy/allLIstcategories/allLIstcategories`
					})
				}
			},
			handleToNotice(item) {
				uni.navigateTo({
					url: `/pages/my/messageDetails/messageDetails?id=${item.id}`
				})
			},
			get6437c28c6c105() {
				this.$api.get(global.apiUrls.get6437c28c6c105).then(res => {
					if (res.data.code == 1) {
						this.noticeList = res.data.data.data;
						// if(list.length>0){
						// 	this.notice = list[0].content
						// }
					}
				}).catch(err => {
					this.isShowLoading = false;
					uni.stopPullDownRefresh();
				});
			},

			//轮播图跳转
			swiperTap(item) {

				if (global.token) {
					uni.navigateTo({
						url: item.href
					})
				} else {
					this.$message.info('请先登录')
				}
			},
			handlePermission(type) {
				console.log(type, '~~~~~~~~~')
				if (type == 1) {
					this.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
				} else {
					permision.gotoAppPermissionSetting()
				}
			},
			async requestAndroidPermission(permisionID) {
				var result = await permision.requestAndroidPermission(permisionID);
				console.log(result)
				var strStatus
				if (result == 1) {
					this._getLocation();
				}
				this.permissionStatus = result;
			},
			_getPermission() {
				const that = this;
				uni.getSystemInfo({
					success: (res) => {
						if (res.platform == 'android') {
							let isLocation = uni.getStorageSync('LVTAI_USER_LOCATION') || false;
							if (!isLocation) {
								that.$util.showModal({
									title: '提示',
									content: '获取您的定位权限以展示附近推荐商家?',
									success: res => {
										if (res.confirm) {
											that.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
										} else {
											that.permissionStatus = 0;
										}
									}
								});
							} else {
								this._getLocation();
							}
						} else {
							this._getLocation();
						}
					}
				});
			},

			handleScan() {

				if (global.token) {
					const that = this;
					uni.scanCode({
						scanType: ['qrCode'],
						success: function(res) {
							// console.log('条码类型：' + res.scanType);
							let codeContent = res.result
							// let codeContent = 'https://app.wanjiashangchao.com/store?store_id=381&name=壹号店铺'
							if (codeContent.indexOf('/store?store_id=') != -1) {
								// let params = queryAll.split("&")[1];
								// let pair = params.split("=")[1] ? params.split("=")[1] : '';
								let params = codeContent.split("?")[1];
								let params1 = params.split("&")[0];
								let params2 = params.split("&")[1];
								let pair = params1.split("=")[1] ? params1.split("=")[1] : '';
								let name = params2.split("=")[1] ? params2.split("=")[1] : '';
								if (pair && name) {
									uni.navigateTo({
										url: `/pages/dpxq/scanPay/index?id=${pair}&name=${name}`
									})
								} else {
									that.$message.info('暂不能识别此二维码');
									return
								}
							}

						}
					});
				} else {
					uni.navigateTo({
						url: LOGIN_PAGE_URL
					})
				}
			},
			/**
			 * 获取附近商家列表
			 * @param {Object} value
			 */
			getRecommendList(value) {
				if (this.status != 'more') return;
				this.status = 'loading';
				let data = {
					list_rows: 20,
					page: this.page,
					lat: this.lat,
					lng: this.lng,
					is_recommend: 1
				};
				// console.log('请求的数据', data);
				if (this.page == 1 && value) {
					this.isShowLoading = true;
				}
				this.$api
					.post(global.apiUrls.getShopList, data)
					.then(res => {
						console.log('订单列表', res);
						this.isShowLoading = false;
						if (res.data.code == 1) {
							var curPageData = res.data.data.data;
							if (this.page == 1) this.list = [];
							this.list = this.list.concat(curPageData);
							console.log('上拉加载', curPageData.length, this.size);
							if (res.data.data.last_page > this.page) {
								this.status = 'more';
								this.page++;
							} else {
								this.status = 'noMore';
							}
						} else {
							this.$message.info(res.data.msg);
						}
						this.isInit = true;
						uni.stopPullDownRefresh();
					})
					.catch(err => {
						this.isShowLoading = false;
						uni.stopPullDownRefresh();
					});
			},



			// vue的method里编写如下代码
			// async requestAndroidPermission(permisionID) {
			//   var permisionStatus = await permision.requestAndroidPermission(permisionID);
			//   console.log(permisionStatus);
			//   return permisionStatus;
			// },

			_getLocation() {
				// #ifdef H5
				this.lat = '34.738695';
				this.lng = '113.64328';
				uni.setStorageSync('LVTAI_LAT', this.lat)
				uni.setStorageSync('LVTAI_LNG', this.lng)
				this.status = 'more';
				this.page = 1;
				this.isInit = false;
				this.list = [];
				this.address = '华城国际中心'
				this.city = '郑州市'
				this.getRecommendList(true);
				// #endif
				// #ifndef H5
				this.amapPlugin.getRegeo({
					success: res => {
						console.log(res[0]);
						// uni.$off('LOCATION_SUCCESS', ()=>{})
						// uni.$emit('LOCATION_SUCCESS', {})
						uni.setStorageSync('LVTAI_USER_LOCATION', true);
						this.address = res[0].desc;
						this.city = res[0].regeocodeData.addressComponent.city;
						this.lat = res[0].latitude;
						this.lng = res[0].longitude;
						global.lat = this.lat;
						global.lng = this.lng;
						global.city = this.city;
						global.address = this.address;
						uni.setStorageSync('LVTAI_LAT', this.lat)
						uni.setStorageSync('LVTAI_LNG', this.lng)
						this.status = 'more';
						this.page = 1;
						this.isInit = false;
						this.list = [];
						this.getRecommendList(true);
					},
					fail: err => {
						console.log(err)
						// uni.showModal({
						//   title: '温馨提示',
						//   content: '手机GPS信号弱，获取城市失败，请选择城市',
						//   // showCancel: false,
						//   confirmText: '去选择',
						//   success: res => {
						//     if (res.confirm) {
						//       global.router.navigateTo('/pages/shop/city/city');
						//     } else if (res.cancel) {
						//       console.log('用户点击取消');
						//     }
						//   }
						// });
					}
				});
				// #endif

			},
			// 获取轮播图
			getSwiper() {
				this.$api.post(global.apiUrls.getSwiperList, {
						operationadstype_id: 2
					})
					.then(res => {
						if (res.data.code == 1) {
							this.banners = res.data.data;
						}
					})
					.catch(err => {
						console.log(err);
					});
			},

			// 获取金刚区分类
			getCateList() {
				this.$api.post(global.apiUrls.getCateList).then(res => {
						if (res.data.code == 1) {
							let cateList = res.data.data;
							cateList.push({
								aid: -9999,
								thumb: this.STATIC_URL + "all2.png",
								title: '全部'
							})
							console.log(cateList)
							const pages = []
							cateList.forEach(function(item, index) {
								const page = Math.floor(index / 10)
								if (!pages[page]) {
									pages[page] = []
								}
								pages[page].push(item)
							})
							this.cateList = pages;
						}
					})
					.catch(err => {
						console.log(err);
					});
			},
		}
	};
</script>
<style lang="scss" scoped>
	.kaiqiweizhi-button {
		padding: 8rpx 10rpx;
		line-height: 1;
		background-color: #64BF1D;
		color: #fff;
		font-size: 24rpx;
		border-radius: 12rpx;
		margin-left: 18rpx;
	}

	.kaiqiweizhi {
		position: fixed;
		left: 24rpx;
		right: 24rpx;
		width: calc(100% - 48rpx);
		height: 80rpx;
		line-height: 80rpx;
		border-radius: 18rpx;
		padding: 0 24rpx;
		background: rgba(0, 0, 0, 0.8);
		z-index: 999;
		font-size: 24rpx;
		color: #fff;
	}

	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		// background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/13.png) no-repeat;

		background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/index_bg2.png) no-repeat;
		background-size: 100% auto !important;
	}

	.point-bg {
		background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/point_bg.png) no-repeat;
		background-size: cover;
		position: absolute;
		top: -32rpx;
		left: -32rpx;
		z-index: 10;
		width: 112rpx;
		height: 112rpx;
	}

	.point-bg-txt {
		transform: rotate(315deg);
		font-size: 20rpx;
		color: #fff;
		margin-left: 12rpx;
		margin-top: 32rpx;
	}

	.fu-my-background {
		position: absolute;
		top: 0;
		z-index: 1;
		width: 100%;

		image {
			width: 100%;
		}
	}

	.homePage_flex_0 {
		// background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/13.png) no-repeat;
		width: 750rpx;
		height: 190rpx;
		overflow: hidden;
		z-index: 11;
		top: 0rpx;
		// background-size: 100% auto !important;
		// background-position: left top;
	}

	.homePage_fd0_1_c0 {
		margin: 0rpx 16rpx 0rpx 0rpx;
		color: rgba(153, 153, 153, 1);
	}

	.homePage_fd0_1 {
		background: rgba(255, 255, 255, 1);
		margin: 10rpx 24rpx 10rpx 24rpx;
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		background-size: 100% auto !important;
		padding: 12rpx 32rpx 12rpx 32rpx;
	}

	.homePage_fd0_0_c1_c0 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd0_0_c0_c2 {
		font-size: 12rpx;
		// width: 20rpx;
		// height: 20rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		color: #333;
	}

	.homePage_fd0_0_c0_c1 {
		max-width: 380rpx;
		color: #333;
		font-size: 36rpx;
		font-weight: 700;
		line-height: 40rpx;
		margin: 0rpx 21rpx 0rpx 16rpx;
	}

	.homePage_fd0_0_c0_c0 {
		// color: rgba(255, 255, 255, 1);
		color: #333333;
		font-size: 34rpx;
	}

	.homePage_fd0_0 {
		width: 100%;
		padding: 0rpx 31rpx 0rpx 24rpx;
		margin: 0rpx 0rpx 0rpx 0rpx;
	}

	.homePage_flex_1 {
		padding: 24rpx 0rpx 0rpx 0rpx;
	}

	.homePage_numberfd1_0_c0 {
		background: #d5d5d5;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.homePage_fd1_0_c1 {
		width: 702rpx;
		height: 244rpx;
	}

	.homePage_fd1_0_c1_c0 {
		width: 702rpx;
		height: 244rpx;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
	}

	.homePage_fd1_0 {
		width: 702rpx;
		height: 244rpx;
	}

	.homePage_swiperDotUnselectedfd1_0 {
		border: 1px solid rgba(0, 0, 0, 0.3);
		background: rgba(0, 0, 0, 0.3);
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	.homePage_swiperDotSelectedfd1_0 {
		border: 1px solid #00A7FF;
		background: #00A7FF;
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	::v-deep .homePage_swiperDotfd1_0 {
		position: absolute;
		bottom: 8rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.homePage_flex_2 {
		padding: 20rpx 24rpx 0rpx 24rpx;
	}

	.homePage_fd2_0_c1 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 27rpx;
	}

	.homePage_fd2_0_c0 {
		width: 59rpx;
		height: 42rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.homePage_fd2_0 {
		background: rgba(255, 255, 255, 1);
		padding: 12rpx 20rpx 12rpx 20rpx;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		background-size: 100% auto !important;
	}

	.homePage_flex_3 {
		padding: 32rpx 23rpx 32rpx 23rpx;
	}

	.homePage_numberfd3_0_c0 {
		background: #525050;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.homePage_fd3_0_c2_c0_c0_c1 {
		margin: 8rpx 0rpx 0rpx 0rpx;
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 24rpx;
	}

	.homePage_fd3_0_c2_c0_c0_c0 {
		width: 104rpx;
		height: 104rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd3_0_c2_c0_c0 {
		width: 140rpx;
	}

	.homePage_fd3_0_c1 {
		width: 700rpx;
		height: 300rpx;
	}

	.homePage_fd3_0_c1_c0_c1_c1 {
		margin: 8rpx 0rpx 0rpx 0rpx;
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 24rpx;
	}

	.homePage_fd3_0_c1_c0_c1_c0 {
		width: 104rpx;
		height: 104rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd3_0_c1_c0_c1 {
		width: 140rpx;
	}

	.homePage_fd3_0_c1_c0_c0_c1 {
		margin: 8rpx 0rpx 0rpx 0rpx;
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 24rpx;
	}

	.homePage_fd3_0_c1_c0_c0_c0 {
		width: 104rpx;
		height: 104rpx;
		border-radius: 52rpx;
		background-size: 100% 100%;
	}

	.homePage_fd3_0_c1_c0_c0 {
		width: 140rpx;
	}

	.homePage_fd3_0 {
		width: 700rpx;
		height: 300rpx;
	}

	.homePage_swiperDotUnselectedfd3_0 {
		border: 1px solid rgba(0, 0, 0, 0.3);
		background: rgba(0, 0, 0, 0.3);
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	.homePage_swiperDotSelectedfd3_0 {
		border: 1px solid #00A7FF;
		background: #00A7FF;
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	::v-deep .homePage_swiperDotfd3_0 {
		position: absolute;
		bottom: 20rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.homePage_flex_4 {
		padding: 24rpx 24rpx 0rpx 24rpx;
	}

	.homePage_fd4_1_c1_c3_c1_c4 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c3_c1_c3 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
		margin-left: 8rpx;
	}

	.homePage_fd4_1_c1_c3_c1_c2 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c3_c1_c1 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c3_c1_c0 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c3_c0_c1 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c3_c0_c0 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c3 {
		margin: 18rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd4_1_c1_c2_c1_c1 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c2_c1_c0 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c2_c0_c1 {
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c2_c0_c0 {
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.homePage_fd4_1_c1_c2 {
		margin: 18rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd4_1_c1_c1_c2 {
		color: #FF9D00;
		font-size: 28rpx;
		font-weight: 700;
		line-height: 30rpx;
	}

	.homePage_fd4_1_c1_c1_c1 {
		color: #FF9D00;
		font-size: 28rpx;
		font-weight: 700;
		line-height: 30rpx;
	}

	.homePage_fd4_1_c1_c1_c0 {
		width: 20rpx;
		height: 19rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	.homePage_fd4_1_c1_c1 {
		margin: 18rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd4_1_c1_c0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 600;
		line-height: 32rpx;
	}

	.homePage_fd4_1_c1 {
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.homePage_fd4_1_c0_c1_c0 {
		width: 180rpx;
		height: 180rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.homePage_fd4_1_c0_c0_c2 {
		color: #FFFFFF;
		font-size: 20rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.homePage_fd4_1_c0_c0_c1 {
		color: #FFFFFF;
		font-size: 20rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.homePage_fd4_1_c0_c0_c0 {
		color: #FFFFFF;
		font-size: 20rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.homePage_fd4_1_c0_c0 {
		background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/23.png) no-repeat, rgba(255, 162, 31, 1);
		width: 128rpx;
		height: 36rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx 0rpx 24rpx 0rpx;
		position: absolute;
		z-index: 10;
	}

	.homePage_fd4_1 {
		background: rgba(255, 255, 255, 1);
		margin: 0rpx 0rpx 24rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 24rpx 24rpx 24rpx 24rpx;
	}

	.homePage_fd4_0_c1 {
		width: 160rpx;
		height: 10rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: -9rpx 0rpx 0rpx 0rpx;
	}

	.homePage_fd4_0_c0_c0 {
		color: #333333;
		font-size: 40rpx;
		font-weight: 600;
		line-height: 40rpx;
		position: relative;
		z-index: 10;
	}

	.homePage_fd4_0 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.swiper {
		flex: 1;
		height: 32rpx;
	}

	.swiper-notice {
		height: 32rpx;
		line-height: 32rpx;
		font-size: 24rpx;
		color: #666;
	}
</style>