<template>
	<view class="exchange_record">
		<div class="goods-list">
			<div
				class="goods-item"
				v-for="(item, index) in orderList"
				:key="index"
				@click="btn(item)"
			>
				<div class="order_no">订单号：{{ item.order_no }}</div>
				<div class="goods-info">
					<image
						:src="$util.img(item.goods_image)"
						mode="aspectFill"
						class="cover"
					></image>
					<div class="right">
						<div class="name">{{ item.goods_name }}</div>
						<div class="integral">
							<div class="price">{{ item.point }}积分 <span v-if="Number(item.price)">+{{ item.price }}元</span> </div>

							<div>x{{ item.num }}</div>
						</div>
					</div>
				</div>
				<div class="status-box">
					<div v-if="item.type==1">
						<div class="status" v-show="item.order_status==1">待发货</div>
						<div class="status" v-show="item.order_status==3">已发货</div>
						<div class="status" v-show="item.order_status==10">已收货</div>
					</div>
					<div v-else>
						<div class="status" >虚拟商品</div>
					</div>
					
					<div class="disburse">
						实付：
						<span>
							{{ item.point }}积分
							<span v-if="Number(item.price)">{{ item.price }}元</span>
						</span>
					</div>
				</div>
				
			</div>
		</div>
	</view>
</template>

<script>
export default {
	data() {
		return {
			orderList: []
		};
	},
	mounted() {
		this.getAllOrderList();
	},
	methods: {
		getAllOrderList() {
			this.$api.sendRequest({
				url: '/api/goodsexchange/getExchangeOrderList',
				success: res => {
					console.log(res.data.list);
					this.orderList = res.data.list;
				}
			});
		},
		btn(item) {
			this.$util.redirectTo(`/pages_tool/details/details?order_id=${item.order_id}`);
		},
		
	}
};
</script>

<style lang="scss">
.exchange_record {
	line-height: 1;

	.goods-list {
		padding: 32rpx;

		.goods-item {
			background: #ffffff;
			border-radius: 24rpx;
			padding: 32rpx;
			margin-bottom: 32rpx;
			.order_no {
				margin-bottom: 30rpx;
				color: #aaa;
			}
			.btns {
				display: flex;
				align-items: center;
				justify-content: flex-end;

				.btn1 {
					width: 176rpx;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #fff;
					text-align: center;
					line-height: 60rpx;
					height: 60rpx;
					border-radius: 30rpx;
					margin-left: 24rpx;
					background: #21bbf3;
				}

				.cancel {
					width: 176rpx;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					text-align: center;
					line-height: 60rpx;
					height: 60rpx;
					border-radius: 30rpx;
					border: 2rpx solid #e8e8e8;
				}
			}

			.status-box {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.status {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #f33b50;
				}

				.disburse {
					margin: 36rpx 0 22rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #222222;

					span {
						font-size: 40rpx;
						font-family: DINAlternate-Bold, DINAlternate;
						font-weight: bold;
						color: #222222;
					}
				}
			}

			.goods-info {
				display: flex;
				align-items: center;

				.right {
					width: 50%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					height: 176rpx;

					.name {
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #222222;
						line-height: 40rpx;
					}

					.integral {
						display: flex;
						align-items: center;
						justify-content: space-between;
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}
				}

				.cover {
					margin-right: 24rpx;
					width: 176rpx;
					min-width: 176rpx;
					height: 176rpx;
					border-radius: 8rpx;
				}
			}
		}
	}

	.tabs {
		background-color: #fff;
		padding: 10rpx 0 6rpx;
	}
}
</style>
