<template>
	<view class="content">
		<view class="box">
			<block v-for="(item,index) in pageList" :key="index">
				<view class="box_item">
					<view class="hflex acenter jbetween cell">
						<view class="hflex acenter" @click="toShop(item.id)">
							<view class="title">{{item.name}}</view>
							<u-icon color="#B5B5B5" name="arrow-right" size="10"></u-icon>
						</view>
						<view class="name">{{item.stateName}}</view>
					</view>
					<view>
						<view class="hflex acenter" v-if="item.good.length == 1">
							<view>
								<image :src="item.good[0].img" mode="aspectFill" class="img"></image>
							</view>	
							<view class="img_right">
								<view class="hflex acenter jbetween">
									<view class="name text_hide">{{item.good[0].name}}</view>
									<view class="price">￥{{item.good[0].price}}</view>
								</view>
								<view class="hflex jbetween" style="padding-top: 12rpx;">
									<view class="norm">{{item.good[0].norm}}</view>
									<view class="num">X{{item.good[0].num}}</view>
								</view>
							</view>
						</view>
						<view class="scroll_img" v-else>
							<scroll-view scroll-x="true" style="white-space: nowrap;" class="imgs hflex">
								<block v-for="(item2,index2) in item.good" :key="index2">
									<view class="imgs_item">
										<image :src="item2.img" class="img"></image>
									</view>
								</block>
							</scroll-view>
							<view class="img_leng">共{{item.good.length}}件</view>
						</view>
					</view>
					<view class="hflex acenter jend cell">
						<view class="price">退款：￥{{item.pay}}</view>
					</view>
					<view class="hflex acenter jend cell">
						<view class="btn1">删除记录</view>
						<view class="btn1 btn2" @click="toOrderDetail(item.id)">查看详情</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	var that = ''
	export default {
		data() {
			return {
				pageList: [
					{
						id: 1,
						name: '江南造船厂',
						state: 0,
						stateName: '已退款',
						good: [
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
								
							}
						],
						pay: 29.90
					},
					{
						id: 3,
						name: '福东海官方自营旗舰店',
						state: 1,
						stateName: '退款中',
						good: [
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
								
							},
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
							},
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
							},
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
							}
						],
						pay: 29.90
					},
					{
						id: 4,
						name: '江南造船厂',
						state: 2,
						stateName: '已退款',
						good: [
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
							}
						],
						pay: 29.90
					},
					{
						id: 5,
						name: '江南造船厂',
						state: 3,
						stateName: '已退款',
						good: [
							{
								id:2,
								img: '/static/images/index/class_img3.png',
								name: 'wanpy顽皮鲜封包猫咪鸡胸…',
								price: 29.90,
								norm: '网络类型:无需合约机;颜色:黑色;尺寸:12寸;配置:128G',
								num: 1,
							}
						],
						pay: 29.90
					},
				]
			}
		},
		onLoad() {
			that = this
			that.getList()
		},
		methods: {
			getList() {
				$api.req({
					url: '/data/api.Order/order_list',
					method: 'POST',
					data: {
						status: 5
					}
				}, function(res) {
					if(res.code == 1) {
						that.pageList = res.data.list
					}
				})
			},
			// 店铺
			toShop(id) {
				$api.jump('/page_shop/pages/good/shop?id=' + id)
			},
			toOrderDetail(id) {
				console.log(id);
				$api.jump('/page_shop/pages/order/refundDetail?id=' + id)
			}
		},
	}
</script>

<style lang="scss" scoped>
	.content {
		background: #F3F3F3;
		.top {
			box-sizing: border-box;
			// padding: 30rpx;
			// height: 540rpx;
			.u-nav-slot {
				position: absolute;
				top: 8rpx;
				left: 134rpx;
			}
			.tabs {
				background-color: #fff;
				width: 100%;
				box-sizing: border-box;
				padding: 20rpx 30rpx;
				.tab_item {
					font-size: 32rpx;
					font-weight: 400;
					color: #333333;
					line-height: 44rpx;
				}
				.tab_active {
					font-weight: 500;
					color: #222222;
					position: relative;
				}
				.tab_active::after {
					content: "";
					position: absolute;
					bottom: -14rpx;
					left: 12rpx;
					width: 40rpx;
					height: 6rpx;
					background: #506DFF;
					border-radius: 4rpx;
				}
			}
		}
		.box {
			width: 100%;
			box-sizing: border-box;
			padding: 0 30rpx;
			.box_item {
				background: #FFFFFF;
				border-radius: 20rpx;
				width: 100%;
				margin-top: 20rpx;
				box-sizing: border-box;
				padding: 0 20rpx;
				.cell {
					padding: 20rpx 0;
				}
				.title {
					font-size: 30rpx;
					font-weight: 500;
					color: #333333;
					line-height: 42rpx;
				}
				.text-blue {
					font-size: 26rpx;
					font-weight: 400;
					color: #506DFF;
					line-height: 36rpx;
				}
				.img {
					width: 160rpx;
					height: 160rpx;
					border-radius: 16rpx;
					
				}
				.img_right {
					margin-left: 16rpx;
					width: calc(100% - 176rpx);
					.name {
						width: 392rpx;
						font-size: 28rpx;
						font-weight: 500;
						color: #222222;
						line-height: 40rpx;
					}
					
					.norm {
						width: 308rpx;
						height: 84rpx;
						background: #F5F5F5;
						border-radius: 4rpx;
						font-size: 22rpx;
						font-weight: 400;
						color: #888888;
						line-height: 32rpx;
						box-sizing: border-box;
						padding: 12rpx;
					}
					.num {
						font-size: 24rpx;
						font-weight: 500;
						color: #888888;
						line-height: 28rpx;
					}
					
				}
				.scroll_img {
					position: relative;
					.imgs {
						width: 100%;
						height: 170rpx;
						overflow: hidden;
						white-space: nowrap;
						.imgs_item {
							width: 160rpx;
							height: 160rpx;
							border-radius: 16rpx;
							margin-right: 20rpx;
							display: inline-block;
						}
						
					}
					.img_leng {
						position: absolute;
						right: 0;
						top: 0;
						width: 130rpx;
						height: 160rpx;
						border-radius: 12rpx;
						font-size: 24rpx;
						font-weight: 500;
						color: #222222;
						line-height: 160rpx;
						text-align: center;
						background: linear-gradient(270deg, #FFFFFF 0%, rgba(255,255,255,0.78) 100%);
					}
				}
				
				.price {
					font-size: 30rpx;
					font-weight: 400;
					color: #222222;
					line-height: 24rpx;
				}
				.btn1 {
					width: 180rpx;
					height: 68rpx;
					border-radius: 36rpx;
					border: 1px solid #D0D0D0;
					text-align: center;
					font-size: 28rpx;
					font-weight: 400;
					color: #222222;
					line-height: 68rpx;
				}
				.btn2 {
					border: 1px solid #506DFF;
					color: #506DFF;
					margin-left: 32rpx;
				}
			}
		}
		.box:nth-last-child(1) {
			margin-bottom: 30rpx;
		}
	}
</style>