<template>
	  <orderItem :list="orderList" :typeStyle.sync="typeStyle"></orderItem>
</template>

<script>
	  import orderItem from '../../tabbar/orderItem.vue';
	  import {
	    getOrderListApi
	  } from '@/api/merchant/order';
	export default {
		components: {
		  orderItem
		},
		data() {
			return {
				orderList: [],
				params: {
				  pageNum: 1,
				  pageSize: 10,
				},
				typeStyle: 0,
				status: '2',
			}
		},
		created() {
		  this.getOrderList();
		},
		methods: {
			async getOrderList(status) {
			  let result = Object.assign({}, {
			    paging: `${this.params.pageNum},${this.params.pageSize}`,
			    status: this.status
			  }, );
			  let res = await getOrderListApi({
			    ...result
			  });
			  if (res.code === 'OK') {
			    this.orderList = res.data.records;
			  }
			},
		}
	}
</script>

<style>
	.container {
		padding: 20px;
	}

	.title {
		font-size: 24px;
		font-weight: bold;
		margin-bottom: 20px;
	}

	.list {
		/* height: 400px; */
		margin-bottom: 20px;
	}

	.item {
		display: flex;
		flex-direction: column;
		margin-bottom: 20px;
		padding: 10px;
		border: 1px solid #ccc;
		border-radius: 10px;
	}

	.order-info {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 10px;
	}

	.order-number {
		font-weight: bold;
	}

	.status {
		color: green;
		font-size: 16px;
	}

	.order-details {
		display: flex;
	}

	.order-image {
		width: 100px;
		height: 100px;
	}

	.order-text {
		margin-left: 20px;
	}

	.order-name {
		font-weight: bold;
	}

	.order-price {
		margin-top: 5px;
	}

	.order-quantity {
		margin-top: 5px;
	}

	.order-date {
		margin-top: 5px;
	}

	.loading {
		text-align: center;
		margin-top: 10px;
	}
</style>