<template>
	<view style="min-height: 100vh;background-color: #f8f8f8;box-sizing: border-box;">
		<view class="content_wrapper">
			<view v-for="(item,index) in dataList" :key="index" class="list-item">
				<view class="text-box">
					<view style="font-size: 14px;line-height: 22px;font-weight: bold;">{{item.storename}}</view>
					<view class="text">订单号：{{item.orderno}}</view>
					<view class="text">支付金额：{{item.price}}</view>
					<view class="text">订单状态：
						<text v-if="item.status==8">待发货</text>
						<text v-if="item.status==7">已退款</text>
						<text v-if="item.status==6">待退款</text>
						<text v-if="item.status==5">已取消</text>
						<text v-if="item.status==4">待收货待消费</text>
						<text v-if="item.status==3">已完成</text>
						<text v-if="item.status==2">已消费</text>
						<text v-if="item.status==1">已支付</text>
						<text v-if="item.status==0">未支付</text>
					</view>
					<view class="text" v-if="item.status==3">付款时间：{{formatDate(item.paytime)}}</view>
				</view>
			</view>
			<view class="" v-if="dataList.length==0">
				<loadmore :isMore="true" v-if="dataList.length=='0'" />
			</view>
		</view>
	</view>
</template>

<script>
	import App from '@/common/js/app.js';
	import loadmore from '@/components/template/loadmore.vue'
	export default {
		data() {
			return {
				page: 1,
				dataList: [],
			}
		},
		components: {
			loadmore
		},
		onLoad(e){
			
		},
		onShow() {
			this.getList();
		},
		methods: {
			getList(){
				let _this = this;
				App._post_form('&p=rights&do=getRightsOrderList', {page:_this.page, page_index: 10}, res => {
					if(_this.page===1){
						if(res.data.length>0){
							_this.setData({
								dataList: res.data
							})
						}
					}else{
						if(res.data.length>0){
							let dataList = _this.dataList.concat(res.data);
							_this.setData({
								dataList
							})
						}
					}
				}, false, err=>{
					
				});
			},
			formatDate(timestamp){
				let date = new Date(parseInt(timestamp) * 1000);
				let Year = date.getFullYear();
				let Moth = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
				let Day = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
				let Hour = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
				let Minute = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
				let Sechond = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
				let  GMT =  Year + '-' + Moth + '-' + Day + '   '+ Hour +':'+ Minute  + ':' + Sechond;
				return GMT;
			}
		},
		onReachBottom(){
			this.page++;
			this.getList();
		}
	}
</script>

<style lang="scss">
.dis-flex{
	display: flex;
	align-items: center;
}
.content_wrapper{
	padding: 10px 15px;
	.list-item{
		display: flex;
		padding: 15px 0px;
		border-bottom: 1px solid #efefef;
	}
	image{
		width: 80px;
		height: 80px;
		border-radius: 6px;
		margin-right: 10px;
	}
	.text-box{
		flex: 1;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.text{
		display: -webkit-box;//将盒子转换为弹性盒子
		-webkit-box-orient: vertical;//文本显示方式，默认水平
		-webkit-line-clamp: 2;//设置显示多少行
		overflow: hidden;
		font-size: 13px;
		color: #999;
	}
}
</style>
