<template>
	<view class="content">
		<view class="info">
			<view class="one">
				下单成功 | {{shopInfo.type=='1'?'打包带走':'店内就餐'}}
			</view>
			<view class="two">
				<view class="two_1">
					<view class="left">桌号：{{shopInfo.table}}</view>
					<view class="right">人数：{{shopInfo.num}}人</view>
				</view>
				<view class="two_2">
					<view class="two_2_1">消费明细</view>
					<view class="two_2_2">
						<scroll-view scroll-y="true" class="scroll-view">
							<view class="list-scroll-view">
								<view class="list" v-for="(item,index) in list" :key="index">
									<view class="img">
										<image class="image" :src="item.file" mode=""></image>
									</view>
									<view class="infoList">
										<view class="name textOver">
											<text>{{item.name}}</text>
										</view>
										<view class="spec" v-if="item.spec">
											<text>{{item.spec}}</text>
										</view>
									</view>
									<view class="money">
										<text>¥{{item.price}}</text>
										<text>×{{item.num}}</text>
									</view>
								</view>
							</view>
						</scroll-view>
					</view>
					<view class="two_2_3">
						<view class="two_2_3_1">
							<view class="left">
								餐位费
								<text>×{{shopInfo.person}}</text>
							</view>
							<view class="right">￥{{shopInfo.perMoney}}</view>
						</view>
						<view class="two_2_3_2">
							共{{shopInfo.numTotal}}件商品，合计：<text>￥</text><text>{{shopInfo.total}}</text>
						</view>
					</view>
				</view>
				<view class="two_3">
					<view class="two_3_1">
						<view class="left">下单时间</view>
						<view class="right">{{shopInfo.time}}</view>
					</view>
					<view class="two_3_1">
						<view class="left">备注</view>
						<view class="right">{{shopInfo.remark}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="foot">
			<view class="foot_1">
				<button class="button" @tap.stop="toAdd">加菜</button>
			</view>
			<view class="foot_2">
				<button class="button" @tap.stop="toBuy">结账</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopInfo: {
					table: '1',
					total: 521,
					numTotal: 9,
					money: 3,
					type: '0',
					num: 3,
					person: 3,
					perMoney: 9,
					time: '2023-02-01 14:10',
					remark: '无'
				},
				list: [{
						_id: '1',
						code: '0',
						name: '三文鱼',
						file: require("../../static/foods_1.webp"),
						price: 126,
						spec: '300g',
						stock: 100,
						num: 1,
					},
					{
						_id: '2',
						code: '0',
						name: '蜜汁扇贝',
						file: require("../../static/foods_2.webp"),
						price: 68,
						spec: '400g',
						stock: 140,
						num: 1,
					},
					{
						_id: '3',
						code: '0',
						name: '意大利牛排',
						file: require("../../static/foods_3.webp"),
						price: 128,
						spec: '600g',
						stock: 200,
						num: 1,
					},
					{
						_id: '4',
						code: '0',
						name: '糖醋里脊',
						file: require("../../static/foods_4.webp"),
						price: 58,
						spec: '500g',
						stock: 140,
						num: 1,
					},
					{
						_id: '5',
						code: '2',
						name: '黑糖珍珠奶茶',
						file: require("../../static/foods_1.webp"),
						price: 18,
						spec: '500g',
						stock: 120,
						num: 1,
					},
					{
						_id: '6',
						code: '2',
						name: '雪碧',
						file: require("../../static/foods_2.webp"),
						price: 5,
						spec: '500g',
						stock: 34,
						num: 1,
					},
					{
						_id: '7',
						code: '2',
						name: '可口可乐',
						file: require("../../static/foods_3.webp"),
						price: 5,
						spec: '500g',
						stock: 50,
						num: 1,
					},
					{
						_id: '8',
						code: '1',
						name: '芝士小蛋糕',
						file: require("../../static/foods_2.webp"),
						price: 12,
						spec: '260g',
						stock: 10,
						num: 1,
					},
					{
						_id: '9',
						code: '1',
						name: '草莓千层',
						file: require("../../static/foods_3.webp"),
						price: 15,
						spec: '350g',
						stock: 40,
						num: 1,
					}
				],
			}
		},
		onLoad() {
			const that = this;
		},
		onShow() {
			const that = this;
		},
		methods: {
			async search(e) {
				const that = this;
			},
			// 加菜
			toAdd() {
				let id = '1'
				uni.navigateTo({
					url: `/pagesHome/home/index?id=${id}`
				})
			},
			// 结账
			toBuy() {},
		}
	}
</script>

<style lang="scss">
	.content {
		font-family: 12px/1 Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;

		.info {
			display: flex;
			flex-direction: column;
			position: relative;
			flex-grow: 1;
			background-color: #f1f1f1;

			.one {
				height: 10vh;
				background-color: #FF7800;
				color: #ffffff;
				padding: 4vw 2vw;
				font-size: 18px;
			}

			.two {
				width: 92vw;
				padding: 0 4vw;
				position: absolute;
				top: 16vw;

				.two_1 {
					display: flex;
					justify-content: space-between;
					align-items: center;
					background-color: #ffffff;
					border-radius: 3vw;
					padding: 4vw 2vw;

					.left {
						font-size: 16px;
						font-weight: 600;
					}

					.right {
						font-size: 14px;
					}
				}

				.two_2 {
					margin: 2vw 0;
					padding: 2vw;
					background-color: #ffffff;
					border-radius: 4vw;

					.two_2_1 {
						padding: 2vw 0;
						font-size: 16px;
						font-weight: 600;
					}

					.two_2_2 {
						position: relative;
						display: flex;
						flex-direction: column;
						height: 32vh;

						.list {
							display: flex;
							width: 84vw;
							margin: 0 0 2vw 0;
							padding: 2vw;
							box-shadow: 0 0 5px #f1f1f1;
							border-radius: 5px;

							.img {
								width: 25vw;

								.image {
									width: 25vw;
									height: 20vw;
									border-radius: 5px;
								}
							}

							.infoList {
								width: 35vw;
								padding: 0 0 0 2vw;

								.name {
									font-size: 16px;
								}

								.spec {
									font-size: 12px;
									color: #858585;
								}
							}

							.money {
								display: flex;
								flex-direction: column;
								align-items: flex-end;
								width: 20vw;
								font-size: 14px;

								text:first-child {
									color: #FF8C00;
								}
							}
						}
					}

					.two_2_3 {

						.two_2_3_1 {
							display: flex;
							justify-content: space-between;
							align-items: center;
							font-size: 14px;
							padding: 2vw 3vw;

							.left {
								text {
									color: #858585;
									font-size: 12px;
									margin: 0 2vw;
								}
							}

							.right {
								color: #FF7800;
							}
						}

						.two_2_3_2 {
							padding: 3vw;
							text-align: right;
							font-size: 14px;
							color: #858585;
							border-top: 1px solid #f1f1f1;

							text:first-child {
								color: #FF7800;
							}

							text:last-child {
								color: #FF7800;
								font-size: 18px;
							}
						}
					}
				}

				.two_3 {
					margin: 2vw 0;
					padding: 2vw;
					background-color: #ffffff;
					border-radius: 4vw;

					.two_3_1 {
						display: flex;
						justify-content: space-between;
						padding: 2vw;
						font-size: 14px;
						border-bottom: 1px solid #f1f1f1;
					}
				}
			}
		}

		.foot {
			display: flex;
			justify-content: space-around;
			align-items: center;
			padding: 2vw 3vw;
			background-color: #ffffff;
			border-top: 1px solid #f1f1f1;

			.foot_1 {
				.button {
					background-color: #ffffff;
					color: #FF8C00;
					border: 1px solid #FF8C00;
					border-radius: 5vw;
					padding: 0 15vw;
					font-size: 16px;
				}
			}

			.foot_2 {
				.button {
					background-color: #FF8C00;
					color: #ffffff;
					border-radius: 5vw;
					padding: 0 15vw;
					font-size: 16px;
				}
			}
		}
	}

	.scroll-view {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;

		.list-scroll-view {
			display: flex;
			flex-direction: column;
		}
	}
</style>
