<template>
	<view class="content">
		<view class="list">
			<view class="list-item hflex acenter" v-for="(item,index) in list" :key="index" @click="toinfo(item)">
				<view class="item-left">
					<image :src="item.goods.image" class="img" mode="aspectFill"></image>
					<image src="static/yitijioa.png" class="img-top" mode="aspectFill" v-if="item.status == 'applied'">
					</image>
					<image src="static/duihuanchenggong.png" class="img-top" mode="aspectFill"
						v-if="item.status == 'passed'"></image>
				</view>
				<view class="vflex item-right jbetween">
					<text class="text_hide2">{{item.goods.name}}</text>
					<text>{{item.price}}<span style="font-size: 26rpx;">积分</span></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	var that = ''
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1,
			}
		},
		onLoad() {
			that = this
			this.getlist()
		},
		onShow() {

		},
		onPullDownRefresh() {

		},
		onReachBottom() {
			if (this.page < this.last_page) {
				this.page++
				this.getlist()
			} else {
				uni.$u.toast('已经到底了')
				return
			}
		},
		methods: {
			toinfo(item) {
				uni.navigateTo({
					url: '/pageB/order-detail?id=' + item.id
				})
			},
			getlist() {
				$api.req({
					url: 'integral/order',
					data: {
						is_page: 1,
						page: that.page,
						limit: 10,
					}
				}, function(res) {
					that.list = that.list.concat(res.data.list)
					that.last_page = res.data.last_page
				})
			},
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 24rpx;

		.list {

			.list-item {
				background: #FFFFFF;
				border-radius: 16rpx;
				margin: 0 0 20rpx 0;
				padding: 20rpx;
				box-sizing: border-box;

				.item-left {
					position: relative;
					padding-right: 20rpx;

					.img {
						width: 196rpx;
						height: 196rpx;
						border-radius: 16rpx;
						overflow: hidden;
					}

					.img-top {
						position: absolute;
						width: 144rpx;
						height: 144rpx;
						top: 26rpx;
						left: 26rpx;
					}
				}

				.item-right {
					height: 196rpx;
					padding: 10rpx 0;
					box-sizing: border-box;
					width: calc(100% - 216rpx);



					text:first-child {
						font-size: 32rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #222222;
					}

					text:last-child {
						font-size: 44rpx;
						font-family: SFPro, SFPro;
						font-weight: 500;
						color: #FF4954;
					}
				}
			}
		}
	}
</style>