<template>
	<view class="min-body" v-if="class_pid > 0">
		<u-gap height="20rpx"></u-gap>
		<template v-for="(item, index) in storeList">
			<view class="b-Store-Item" :key="index" @tap="Pagego(item)">
				<image class="img" :src="item['img_url']"></image>
			</view>
		</template>
	</view>
	<view v-else>
		<image src="https://img.agrimedia.cn/chwl/v2/qx.png" style="width: 100vw" mode="widthFix"></image>
	</view>
</template>

<script>
	// 获取连锁商家
	import {
		brandQueryAPI
	} from "@/request/restaurant/index.js";
	import {
		consumerCard,
		GetUserInvitationCode
	} from "@/static/js/share.js";
	import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
	export default {
		mixins: [restaurantmixins],
		data() {
			return {
				tabActive: {
					color: "#FF7700",
					"font-weight": "bold",
					"font-size": "28rpx",
				},
				baseList: [],
				// 商家支持
				Businesssupport: [],
				list: [],
				page: 1,
				lock: true,
				class_pid: 10,
				code: "",
				// 一级选项数据及配置
				// 一级选项列表
				TabsAConfig: {
					// 当前激活索引
					currentindex: 0,
					// 选中时的样式
					activeStyle: {
						color: "#FF7700",
					},
					// 是否滑动
					scrollable: false,
					// 滑块颜色
					lineColor: "#FF7700",
				},
				// 连锁商家列表
				storeList: [],
				// 用户信息
				UserInfor: {},
			};
		},
		onReachBottom() {
			if (this["TabsAConfig"]["currentindex"] == 2) {
				this.GetquotaStoreList();
			}
			if (this.lock == false) {
				this.getGoods();
			}
		},
		methods: {
			Pagego(item) {
				// console.log(item,'item');
				// return
				// uni.navigateTo({
				// 	url: `/pages/diy/index_diy`,
				// });
				// return
				// https://qa.yinge.tech/reseller-xxx?outProductId=111&outSkuId=222&outUserId=ddd
				// this.SETBRANDINFOR({
				// 	brand_id: 19,
				// 	brand_name: '电影院'
				// })
				if (!this['GetcityInfor']?.city) {
					uni.showToast({
						title: '未获取到您的位置信息',
						icon: 'none',
						mask: true
					})
					return;
				};
				console.log(`/pages${item["url"]}`)
				if (!item["url"]) return;
				uni.navigateTo({
					url: `/pages${item["url"]}`,
				});
			},
			/**
			 * @获取品牌列表
			 * */
			GetList() {
				brandQueryAPI({
					// TODO 正式删除
					// brand_text:1
				}).then((res) => {
					console.log(res)
					this["storeList"].push(...res["data"]);
					this.page++;
				});
			},
			/**
			 * @初始化
			 */
			init() {
				this["UserInfor"] = GetUserInvitationCode();
				this.GetList();
			},
		},
		onLoad() {
			this.init();
		},
		onShareAppMessage() {
			return consumerCard(this["UserInfor"]["userInfo"]["invite_code"]);
		},
	};
</script>

<style lang="scss">
	.min-body {
		padding: 32rpx;
	}

	.b-Store-Item {
		width: 100%;
		height: 232rpx;
		border-radius: 15rpx;
		color: #ffffff;
		margin-bottom: 20rpx;

		.img {
			width: 100%;
			height: 100%;
		}
	}
</style>
