<template>
	<view v-if="orderData" @click="goDetails" :class="orderData.orderStatus==2? 'orderItem charging ': 'orderItem '">
		<view class="orderItem_header flex">
			<view class="orderItem_header_number  oneflex">{{orderData.id}}</view>
			<view class="orderItem_header_type"> {{ orderData.orderStatus|orderStatus}} </view>
		</view>
		<view class="orderItem_bottom">
			<view class=" flex ac">
				<view class=" orderItem_bottom_name oneflex">{{orderData.stationName}}</view>
				<view class="orderItem_bottom_price"> ￥{{ orderData.orderStatus==4? tool.getnum(orderData.payMoneyAcc,3)  : tool.getnum(orderData.payMoneyPre,3) }} </view>
			</view>
			<view class="orderItem_bottom_time">{{orderData.startTime}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "orderItem",
		props:{
			orderData:{
				type:Object,
				default:()=>null
			},
			listIndex:{
				type:Number,
				default:0
			}
		},
		data() {
			return {

			};
		},
		filters:{
			orderStatus(e){ 
				switch(Number(e)){
					case 1:
					return '启动中'
					case 2:
					return '充电中'
					case 3:
					return '停止中'
					case 4:
					return '已结束'
					default:
					return '数据错误'
				}
			}
		},
		methods:{
			goDetails(){
				if(this.orderData.orderStatus==2 || this.orderData.orderStatus==3){
					uni.navigateTo({
						url:`/Order/pages/charging/index?id=${this.orderData.id}`
					})
				}else{
					uni.navigateTo({
						url:`/Order/pages/index/index?id=${this.orderData.id}`
					})
				}
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import 'index.scss';
</style>