<template>
	<view class="pages-box">
		<uv-navbar autoBack title="连锁店数据" placeholder />
		<template v-for="item in RowsList">
			<view class="multiple-box">
				<view class="multiple-shop">
					<image class="multiple-icon" :src="item.image" mode="aspectFill" />
					<view class="multiple-content">
						<view class="content-name">{{ item.businessName }}</view>
						<view class="content-user">{{ item.contactPerson || '' }}
							{{ item.contactPhone || item.customerServicePhone || '' }}
						</view>
						<view class="content-site">
							<text class="iconfont site-icon">&#xe990;</text>
							<text>{{ getAddress(item) }}</text>
						</view>
						<view class="content-time">
							<text class="iconfont time-icon">&#xe63b;</text>
							<text>入驻时间：{{ item.createTime || '' }}</text>
						</view>
					</view>
				</view>
				<view class="multiple-btn" @click.stop="CheckShopData(item.businessId)">
					查看
				</view>
			</view>
		</template>

		<template v-if="LoadStatus && LoadStatus!=='loading' && !RowsList.length">
			<noData />
		</template>

		<template v-else-if="LoadStatus">
			<uv-load-more :status="LoadStatus" line />
		</template>
	</view>
</template>

<script lang="ts" setup>
	import { getPartnerPageApi } from "@/api/ShopContent.ts";
	import { usePageData } from "@/hooks/usePageData.ts";
	const CheckShopData = (businessId) => {
		uni.navigateTo({
			url: `/pages/shop/setting/ShopData?businessId=${businessId}`
		})
	}
	const { RowsList, LoadStatus, initData } = usePageData(getPartnerPageApi);

	initData();



	const getAddress = (store) => {
		try {
			const StoreAddress = `${store.provinceName || ''}${store.cityName || ''}${store.areaName || ''}${store.address || ''}`;
			return StoreAddress
		} catch (error) {
			return ''
		}
	}
</script>

<style lang="scss" scoped>
	.pages-box {
		width: 100%;
		padding: 30rpx;
	}

	.multiple-box {
		background: #ffffff;
		border-radius: 20rpx;
		padding: 30rpx 23rpx;
		margin-bottom: 30rpx;
	}

	.multiple-shop {
		width: 100%;
		box-sizing: border-box;
		display: flex;
		align-items: stretch;

		.multiple-icon {
			flex-shrink: 0;
			width: 166rpx;
			height: 166rpx;
			border-radius: 10rpx;
		}

		.multiple-content {
			padding-left: 30rpx;
			width: calc(100% - 166rpx);
			display: flex;
			flex-direction: column;
			justify-content: center;

			.content-name {
				font-size: 28rpx;
				font-family: PingFang SC, PingFang SC-Bold;
				font-weight: 700;
				color: #1a1a1a;
			}

			.content-user,
			.content-site,
			.content-time {
				padding-top: 5rpx;
			}

			.content-user {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				color: #666666;
			}

			.content-site {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				color: #999999;

				.site-icon {
					font-size: 24rpx;
				}
			}

			.content-time {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				color: #999999;

				.time-icon {
					font-size: 24rpx;
				}
			}
		}
	}

	.multiple-btn {
		margin-top: 30rpx;
		width: 100%;
		height: 70rpx;
		background: #ffffff;
		border: 1rpx solid #eb5153;
		border-radius: 36rpx;
		text-align: center;
		line-height: 70rpx;
		font-size: 24rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		color: #eb5153;
	}
</style>