<template>
	<view class="selectCar-box">
		<view v-if="state.list.length > 0" class="item" v-for="(item, i) in state.list"
			:key="i">
			<view class="iten-left">
				<view class="message">
					<view>渠道：{{ item.agencyId }}</view>
					<view>渠道名称：{{item.agencyName}}</view>
					<view>网点：{{item.name }}</view>
					<view>网点编号：{{item.servicehallId}}</view>
				</view>
			</view>
		</view>
		<view v-else class="flex"> 暂无网点 </view>
	</view>
</template>

<script lang="ts" setup>
	import { reactive, ref } from "vue";
	import { onLoad} from "@dcloudio/uni-app";
	import { outletList } from "@/utils/network/api.js";
	import { requestNew } from "@/utils/network/request.js";
	const state = reactive({
		list: [],
	});
	onLoad(() => {
		wangdian().then((item : any) => {
			console.log("item",item)
			state.list = item;
		});
	});

	const wangdian = () => {
		const options = {
			type: 2,
			data: {},
			method: "POST",
			showLoading: true,
		};
		return new Promise(async (resolve, reject) => {
			const res = await requestNew(outletList, options);
			const data = res;

			resolve(data);
		}).catch((error) => {
			reject(error);
		});
	};
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background-color: #eef7f7;
	}
</style>
<style lang="scss" scoped>
	.flex {
		display: flex;
		justify-content: center;
	}

	.selectCar-box {
		height: 100%;
		padding: 30rpx;

		.item {
			padding: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background: #ffffff;
			box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
			border-radius: 20rpx;
			margin-bottom: 30rpx;

			.iten-left {
				display: flex;
				align-items: center;

				image {
					width: 150rpx;
					height: 90rpx;
				}

				text {
					margin-left: 20rpx;
					font-size: 32rpx;
					font-family: Noto Sans S Chinese;
					font-weight: 400;
					color: #333333;
				}
			}
		}
	}
	.message{
		font-size: 26rpx;
		margin-left: 6rpx;
	}
</style>