<template>
	<view>
		<view v-if="!serviceList" class="mart60 fotct font14 fcor666">
			<image mode="widthFix" style="width: 70vw;" src="../../../static/img/noorder.png"></image>
		</view>
		<view class="width94 backcorfff border-r mart15" v-for="(item,index) in serviceList" :key="index"
			@click="jumpdetails(item.orderNo)">
			<view class="notes">
				<view class="width75 margle">
					<view class="font18 fcor333 fontwig6">{{item.orderNo}}</view>
					<view class="font13 fcor999 mart5">支付金额: ¥{{item.payPrice}}</view>
					<view class="font13 fcor999 mart5">支付时间: {{item.payTime | timeFormat('yyyy-mm-dd hh:mm:ss')}}
					</view>
				</view>
				<view class="storestus" v-if="item.status == 2">
					已支付
				</view>
				<view class="storestus" v-if="item.status == 3">
					已完成
				</view>
				<view class="otstatucs" v-if="item.status == 4">
					已退款
				</view>
			</view>
			<view class="conts" v-if="item.orderAssignList !=''">
				<view class="margle10 font13 fcor999">设备编号: {{item.orderAssignList[0].deviceNo}}</view>
			</view>
			<view class="conts">
				<view class="margle10 font13 fcor999">设备类型: {{item.deviceType | toFilter()}}</view>
				<view class="margle10 font13 fcor999">申请数量: 1台</view>
			</view>
		</view>
		<image src="../../../static/img/addser.png" mode="widthFix" class="xfimg" @click="jumpaddservice"></image>
	</view>
</template>

<script>
	import {
		getOrderList
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				serviceList: '', //设备列表
				pageNum: 1,
				pagesize: 999
			}
		},
		filters: {
			// 过滤器
			toFilter: function(id) {
				let codeName;
				for (let i = 0; i < app.globalData.Dictionaries.DEVICE_TYPE.length; i++) {
					if (id == app.globalData.Dictionaries.DEVICE_TYPE[i].codeValue) {
						codeName = app.globalData.Dictionaries.DEVICE_TYPE[i].codeName;
					}
				}
				return codeName;
			}
		},
		onShow() {
			this.getOrderList();
		},
		methods: {
			//查询订单设备
			getOrderList() {
				let datas = {
					pageNum: this.pageNum,
					pageSize: this.pagesize,
					status: '2,3,4'
				}
				getOrderList(datas).then(res => {
					if (res.return_code == '000000' && res.return_data.list != '') {
						this.serviceList = res.return_data.list;
					}
				})
			},
			// 添加设备
			jumpaddservice() {
				uni.navigateTo({
					url: '../addService/addService'
				})
			},
			//进入详情
			jumpdetails(item) {
				uni.navigateTo({
					url: '../serviceOrderDetails/serviceOrderDetails?orderNo=' + item
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f6f6f6;
	}

	.notes {
		width: calc(100% - 40rpx);
		display: flex;
		align-items: center;
		padding: 30rpx 0 10rpx 20rpx;
	}

	.storestus {
		padding: 1px 5px;
		color: #91bb88;
		font-size: 14px;
		background-color: #e8fbe6;
	}

	.otstatucs {
		background-color: #fbeee4;
		color: #db8c73;
		font-size: 14px;
		padding: 1px 5px;
	}

	.conts {
		width: calc(100% - 60rpx);
		display: flex;
		align-items: center;
		padding: 2px 0rpx 14rpx 14rpx;
	}

	.xfimg {
		width: 100rpx;
		bottom: 60rpx;
		position: fixed;
		right: 40rpx;
	}
</style>
