<template>
	<mobile-frame>
		<view class="main">
			<view class="one">
				<input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
			</view>
			<view class="two">
				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
					<view class="list-scroll-view">
						<view class="two_1">
							<view class="cond_1">
								全部
							</view>
							<view class="cond_1">
								待付款
							</view>
							<view class="cond_1">
								待发货
							</view>
							<view class="cond_1">
								待发货/消费
							</view>
						</view>
						<view class="two_2">
							<view class="list" v-for="(item,index) in list" :key="index">
								<view class="list_1">
									<view class="name">
										<text @click="toDel(item)" class="iconfont icon-shangdian"></text>
										<text>{{item.shop}}</text>
									</view>
									<view class="status">{{item.status=='0'?'待付款':'已付款'}}</view>
								</view>
								<view class="list_2">
									<image class="image" :src="item.url" mode=""></image>
									<view class="other">
										<view class="name">{{item.name}}</view>
										<view class="other_1">
											口味: {{item.num||'暂无'}}
										</view>
									</view>
									<view class="money">
										<text>¥</text>
										<text>{{item.money}}</text>
										<view class="num">
											×{{item.num}}
										</view>
									</view>
								</view>
								<view class="list_3">
									<text>共{{item.num}}件商品</text>
									<view class="money">
										<text>总价¥</text>
										<text>{{item.money}}</text>
									</view>
								</view>
								<view class="list_4">
									<button type="default" size="mini" plain="true"
										@click="toCancel(item)">取消订单</button>
									<button type="warn" size="mini" plain="true" @click="toPay(item)">付款</button>
								</view>
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</mobile-frame>
</template>

<script>
	export default {
		data() {
			return {
				searchInfo: {},
				list: [ //商品列表
					{
						url: require('@/static/test.png'),
						shop: '官方自营店',
						name: '商品名称',
						money: '10.00',
						status: '0',
						num: 2,
					},
					{
						url: require('@/static/test.png'),
						name: '商品名称',
						shop: '官方自营店',
						money: '10.00',
						status: '0',
						num: 2,
					},
					{
						url: require('@/static/test.png'),
						name: '商品名称',
						shop: '官方自营店',
						money: '10.00',
						status: '0',
						num: 2,
					},
				]
			};
		},
		onShow: function() {},
		methods: {
			// 分页
			toPage(e) {

			},
			// 输入框
			toInput(e) {
				const that = this;
				that.$set(that.searchInfo, `name`, e.detail.value)
			},
			// 取消订单
			toCancel(e) {
				console.log(e);
			},
			// 付款
			toPay(e) {
				console.log(e);
			}
		}
	}
</script>

<style lang="scss">
	.main {
		display: flex;
		flex-direction: column;
		width: 100vw;
		height: 100vh;

		.one {
			padding: 2vw;

			input {
				padding: 2vw;
				background-color: var(--f1Color);
				font-size: var(--font14Size);
				border-radius: 5px;
			}
		}

		.two {
			position: relative;
			flex-grow: 1;
			background-color: var(--f9Color);

			.two_1 {
				background-color: var(--fffColor);
				padding: 2vw;
				display: flex;
				flex-direction: row;
			}

			.two_2 {
				display: flex;
				flex-direction: column;

				.list {
					width: 100vw;
					margin: 2vw 0 0 0;
					background-color: var(--mainColor);

					.list_1 {
						display: flex;
						flex-direction: row;
						justify-content: space-between;
						padding: 2vw;

						.name {
							font-size: var(--font14Size);

							text {
								margin: 0 1vw 0 0;
							}
						}

						.status {
							font-size: var(--font14Size);
							color: var(--ff0Color);
						}
					}

					.list_2 {
						display: flex;
						flex-direction: row;
						justify-content: space-between;
						padding: 2vw;
						background-color: var(--f8Color);

						.image {
							width: 20vw;
							height: 20vw;
							margin: 0 2vw 0 0;
						}

						.other {
							display: flex;
							flex-direction: column;
							flex-grow: 1;

							.name {
								font-size: var(--font14Size);
								font-weight: bold;
								margin: 0 0 2vw 0;
							}

							.other_1 {
								font-size: var(--font12Size);
								color: var(--f85Color);
							}
						}

						.money {
							font-size: var(--font12Size);

							.num {
								text-align: right;
							}
						}
					}

					.list_3 {
						display: flex;
						justify-content: flex-end;
						padding: 2vw;
						border-bottom: 0.5vw solid var(--f9Color);
						font-size: var(--font12Size);

						text {
							margin: 0 1vw;
						}
					}

					.list_4 {
						padding: 2vw;
						text-align: right;

						button {
							margin: 0 1vw 0 2vw;
						}
					}
				}
			}
		}
	}

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

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