<template>
	<view>
		<view class="boxWarp mb20px">
			<view class="box" style="height:100vh;">
				<my-swiper v-if="dinList.diningCarImg && dinList.diningCarImg.length"
					:datas="dinList.diningCarImg" />
				<div v-else>
					<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
					</u-empty>
				</div>
				<!-- <my-swiper :datas="dinList.diningCarImg" /> -->
				<view class="boxContent2" style="margin-top:-10%;">
					<view class="clearfix" style="margin-bottom: 10px;">
						<text class="fz26px" style="font-weight: bold;">{{dinList.name ? dinList.name : '无'}}</text>
						<u-line dashed></u-line>
					</view>
					<view class="flex-container">
						<text class="flex-item">营业状态</text>
						<u-tag class="flex-item tag-item" plain :text="dinList.openState ? '营业中' : '离线'"
							:type="dinList.openState ? 'success' : 'error'" size="mini"></u-tag>
					</view>
					<text>客服电话：{{dinList.customerPhone ? dinList.customerPhone : '无'}}</text>
				</view>
				<view class="footer">
					<u-button type="primary" shape="circle" icon="phone" text="拨打客服电话"
						color="linear-gradient(to right, #F54319, #FF6D20)" @click="call()"></u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				img: 'https://cdn.uviewui.com/uview/album/1.jpg',
				orderinfo: {},
				dinList: {
					name: '23333',
					openState: 1,
					imageUrl: ''
				},
				swiperDatas: [{
					img: '../../static/banner1.jpg'
				}, {
					img: '../../static/banner2.png'
				}],
			}
		},
		onLoad(e) {
			this.fatchDate(e);
		},
		methods: {
			call() {
				if (this.dinList.customerPhone) {
					uni.makePhoneCall({
						phoneNumber: this.dinList.customerPhone
					});
				} else {
					uni.showToast({
						icon: 'none',
						title: '暂无商家电话'
					})
				}
			},
			async fatchDate(e) {
				console.log('e===========================e', e)
				var queryParmas = {
					id: e.id
				}
				console.log('idididididid', queryParmas)
				const result = await this.$request('post', '/sale/diningCar/queryDiningCarById', queryParmas, true)
				if (result) {
					console.log("result", result)
					this.dinList = result.data
					// this.dinList.diningCarImg = JSON.parse(result.data.diningCarImg)
					this.dinList.diningCarImg = JSON.parse(result.data.diningCarImg).map(item => {
					  return {...item, img: item.url, ...(item.url ? {url: undefined} : {})};
					});

					console.log('this.dinList', this.dinList)
					console.log('this.dinList.diningCarImg', this.dinList.diningCarImg)
				}
			}

		}
	}
</script>

<style lang="scss" scoped>
	.font {
		font-family: "CustomFont";
		color: #fff;
	}

	.flex-container {
		display: flex;
		align-items: center;
		/* 垂直居中 */
		justify-content: flex-start;
		/* 水平左对齐 */
	}

	.flex-item {
		/* 根据需要设置text的宽度 */
		width: 100%;
		/* 或者其他适当的宽度 */
	}

	.tag-item {
		margin-left: auto;
		/* 将标签推到右边 */
	}

	.box {
		padding: 20rpx 0;
		// background-image: linear-gradient(#00a551 10%, #fff 30%);
		border-bottom-left-radius: 30rpx;
		border-bottom-right-radius: 30rpx;
		background-position: top;
		box-shadow: 0 0 5px 2px #ebebeb;
		background-repeat: no-repeat;
	}

	.linear2 {
		// background-image: linear-gradient(#00a551 20%, #fff 50%);
		background-image: url('{{dinList.imageUrl}}');
		// background-image: url('https://cdn.uviewui.com/uview/album/1.jpg');
	}

	.boxText {
		font-size: 28rpx;
		line-height: 40rpx;
		color: #c8c9cc;
	}

	.tabFlexBox {
		display: flex;
		text-align: center;
		// background-color: #fff;
		padding-bottom: 10rpx;
	}

	.tabFlexBox .tabFlexBoxItem {
		flex: 1;
		position: relative;
	}

	.tabFlexBox .tabFlexBoxItem .tabFlexBoxItemTitle {
		font-size: 36rpx;
		font-weight: bold;
		line-height: 80rpx;
	}

	.tabFlexBox .tabFlexBoxItem .tabFlexBoxItemDes {
		color: #c8c9cc;
		font-size: 28rpx;
		line-height: 40rpx;
		display: inline-block;
		padding: 0 20rpx;
	}

	.tabFlexBox .tabFlexBoxItem .tabFlexBoxItemLine {
		width: 1px;
		height: 50rpx;
		background-color: #c8c9cc;
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		right: 0;
	}

	.tabFlexBox .tabFlexBoxItem.active .tabFlexBoxItemTitle {
		color: #00a551;
		font-size: 40rpx;
	}

	.tabFlexBox .tabFlexBoxItem.active .tabFlexBoxItemDes {
		background-color: #00a551;
		border-radius: 20rpx;
		color: #fff;
	}

	.boxContent2 {
		border-radius: 60rpx;
		background-color: #fff;
		padding: 40rpx;
		position: relative; // 确保它相对于其父元素定位
		z-index: 2;
	}

	.carList {
		display: flex;
		// flex-wrap: wrap;
	}

	.footer {
		flex-direction: column;
		position: fixed;
		left: 5px;
		right: 5px;
		bottom: 10px;
	}
</style>