<template>
	<view class="center">
			<view class="main" v-for="(item, index) in list" :key="index" @click="goToOrderDetail(item)">
				<view class="top flex">
					<view class="userinfo clamp">订单编号ID：{{ item.order_id }}</view>
					<view class="type">{{ item.status_name }}</view>
				</view>
				<view class="mainbox" v-for="(ls, ind) in item._info">
					<view class="bg"><image :src="ls.cart_info.productInfo.image" mode=""></image></view>
					<view class="main-info flex">
						<view class="main-left">
							<view class="name clamp2">{{ ls.cart_info.productInfo.store_name }}</view>
						</view>
						<view class="main-right">
							<view class="price">￥{{ ls.cart_info.productInfo.ot_price }}</view>
							<view class="num">x{{ ls.cart_info.cart_num}}</view>
						</view>
					</view>
				</view>
				<view class="item-btm">共{{ item.total_num }}件商品 合计：￥{{ item.total_price }}</view>
			</view>
			<uni-load-more :status="loadType"></uni-load-more>
		<!-- </scroll-view> -->
	</view>
</template>

<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from '@/components/empty';
import { merchantList } from '@/api/merchant.js';
export default {
	components: {
		empty,
		uniLoadMore
	},
	data() {
		return {
			page: 1,
			limit: 10,
			loadType: 'more',
			list: [],
			maxheight:''
		};
	},
	onReachBottom() {
		this.loadData();
	},
	onPullDownRefresh() {
		this.loadData();
	},
	onLoad() {
		this.loadData();
	},
	methods: {
		loadData() {
			const obj = this;
			if (obj.loadType == 'loading' || obj.loadType == 'noMore') {
				return;
			}
			obj.loadType = 'loading';
			merchantList({ page: obj.page, limit: obj.limit }).then(({ data }) => {
				obj.list = obj.list.concat(data);
				obj.page++
				if (data.length == obj.limit) {
					obj.loadType = 'more';
				} else {
					obj.loadType = 'noMore';
				}
			});
		},
		goToOrderDetail(e) {
			
			uni.navigateTo({
				url: '/user/page/merchant/orderDetail?id=' + e.order_id
			});
		},
	}
};
</script>

<style lang="scss">
page,.center {
	height: 100%;
	background: #f6f4f4;
}
.input-box {
	width: 100%;
	padding: 25rpx;
	background-color: #52c696;
	z-index: 999;
	height: 60px;
	.iconsearch {
		padding-left: 30%;
		font-size: 50rpx;
		color: #9f9f9f;
	}
	.input-content {
		border-radius: 99rpx;
		color: #9f9f9f;
		flex-grow: 1;
		padding: 10rpx 30rpx;
		background-color: #ffffff;
		.input {
			flex-grow: 1;
			input {
				font-size: $font-lg;
			}
		}
	}
	.input-button {
		padding-left: 20rpx;
		font-size: $font-lg;
		height: 100%;
	}
}
.main {
	padding: 30rpx 30rpx 60rpx 30rpx;
	width: 700rpx;
	margin: 20rpx auto 0;
	background: #ffffff;
	box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
	border-radius: 10rpx;
	.top {
		align-items: center;
		.userinfo {
			max-width: 70%;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #666666;
		}
		.type {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #52c696;
		}
	}
	.mainbox {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		margin-top: 30rpx;
		align-items: flex-start;
		.bg {
			flex-shrink: 0;
			width: 160rpx;
			height: 160rpx;
			background: #4cd964;
			image {
				width: 100%;
				height: 100%;
			}
		}
		.main-info {
			justify-content: space-between;
			align-items: flex-start;
			width: 100%;
			.main-left {
				padding-left: 10rpx;
				.name {
					max-width: 338rpx;
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #3f454b;
				}
				.order {
					margin-top: 10rpx;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #666666;
				}
				.ordertype {
					width: 120rpx;
					margin-top: 10rpx;
					background: #ffeae5;
					border-radius: 5rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #ff6f0f;
					text-align: center;
				}
			}
			.main-right {
				text-align: right;
				padding-top: 6rpx;
				.price {
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
				}
				.num {
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #666666;
				}
			}
		}
	}
	.item-btm {
		text-align: right;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}
}

</style>
