<template>
	<view>
		<u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff">
			<view class="u-nav-slot" slot="left">
				<u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="30" lineHeight="1"
					lineColor="#E96737" :activeStyle="{
										color: '#E96737',
										transform: 'scale(1)',
										width: '65px',
										
									}" :inactiveStyle="{
										color: '#333',
										transform: 'scale(1)',
										width: '65px'
									}" itemStyle="padding-left: 11px; padding-right: 11px; height: 44px;text-align: center;">
				</u-tabs>
			</view>
		</u-navbar>
		<view class="order-list">
			<view class="order-list-data">
				<view class="order-list-data-item" v-for="(item, index) in list" :key="index">
					<view class="order-list-data-item__info">
						<view class="flex order-list-data-item__info__title">
							<view class="number">
								<text>订单编号：</text>
								<text>{{ item.orderId }}</text>
							</view>
							<view class="success" v-if="item.status.value == 1">{{ item.status.desc }}</view>
							<view v-else>{{ item.status.desc }}</view>
						</view>
						<navigator :url="`/packageGoods/order/detail?id=${ item.orderId }`" hover-class="navigator-hover">
							<view class="flex order-list-data-item__info__detail"
								v-for="(items, index) in item.items" :key="index">
								<view class="order-list-data-item__info__detail__left">
									<view class="img">
										<image class="img" :src="items.picUrl" mode="aspectFill">
										</image>
									</view>
								</view>
								<view class="order-list-data-item__info__detail__right">
									<view class="ells title">{{ items.title }}</view>
									<view class="sku" v-if="items.properties">规格：{{ items.properties }}</view>
									<view class="num">数量：{{ items.goodsNum }}</view>
								</view>
							</view>
						</navigator>
		
						<view class="order-list-data-item__info__total">
							<view>共{{ item.orderNum }}个商品</view>
							<view class="money">
								<text v-if="item.status.value == 0">应付：</text>
								<text v-else>实付：</text>
								<text>￥{{ $numberFormat(item.payAmt) }}</text>
							</view>
						</view>

						<view class="order-list-data-item__info__btn" v-if="item.status.value == 0">
							<text @click="cancelOrder(item.orderId)" style="border-color: #666;">取消订单</text>
							<text @click="payOrder(item)">去支付</text>
						</view>
					</view>
				</view>
			</view>
			<view class="flex empty" v-if="!list.length && !loading">
				<u-empty text="活动为空" mode="order" />
			</view>
		</view>
		<custom-tab-bar :activeValue="'activity'" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				statusArr: [{
					name: '正在进行'
				}, {
					name: '已开奖',
				} ],
			}
		},
		methods: {
			changeTab(e) {
				if (e.index == 0) {
					this.status = null
				} else if (e.index == 1) {
					this.status = '0'
				}
				// this.pageList()
			},
		}
	}
</script>

<style lang="scss" scoped>
.order-list {
			background-color: #F8F8F8;
			margin: 0rpx 10rpx 0;
			padding-top: 100rpx;

			&-data {

				navigator {
					margin-bottom: 10rpx;
				}

				navigator:last-child {
					margin-bottom: 0;
				}

				&-item {
					margin-bottom: 10rpx;
					padding: 20rpx 30rpx;
					background-color: #FFFFFF;
					justify-content: space-between;
					background-color: #FFFFFF;
				}

				&-item {
					&__info {

						&__title {
							justify-content: space-between;

							.number {
								line-height: 40rpx;
							}

							.success {
								color: $uni-text-color;
							}
						}

						&__detail {
							padding: 20rpx 0;
							justify-content: space-between;
							border-bottom: 1px solid rgba(236, 236, 236, 100);

							&__left {
								display: flex;
								height: 170rpx;

								.img {
									image {
										width: 170rpx;
										height: 170rpx;
										margin-right: 20rpx;
									}
								}
							}

							&__right {
								flex: 1;
								display: flex;
								height: 170rpx;
								flex-direction: column;
								justify-content: space-between;
								align-items: flex-start;
								font-size: 30rpx;
								
								.title{
									font-weight: bold;
								}

								.sku {
									color: #848484;
								}
							}

						}

						&__detail:last-child {
							border: none;
						}

						&__total {
							display: flex;
							align-items: center;
							justify-content: flex-end;
							padding: 10rpx 0;

							.money {
								font-weight: bold;
								margin-left: 54rpx;
							}
						}

						&__btn {
							display: flex;
							align-items: center;
							justify-content: flex-end;
							padding-top: 10rpx;
							border-top: 1px solid rgba(236, 236, 236, 100);

							text {
								display: block;
								box-sizing: border-box;
								margin: 0 0 0 40rpx;
								width: 160rpx;
								height: 60rpx;
								line-height: 60rpx;
								text-align: center;
								font-size: 24rpx;
								border-radius: 8rpx;
								border: none;
							}

							text:first-child {
								background-color: #fff;
								line-height: 56rpx;
								border: 2rpx solid $uni-bg-color;
							}

							text:last-child {
								background-color: $uni-bg-color;
								color: #FFFFFF;
							}
						}
					}
				}
			}
		}

		.empty {
			height: 60vh;
		}
</style>
