<template>
	<view class="mould-page">
		<navigation title="工单管理"></navigation>
		
		<view class="list-box">
			<view class="list-item">
				<view class="item-text flex-box">
					<view class="item-text-left">订单名称：</view>
					<view>{{form.taskName}}</view>
				</view>
				<view class="item-text flex-box"> 
					<view class="item-text-left">订单编号：</view>
					<view>{{form.taskNum}}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单编号：</view>
					<view>{{form.orderNum}}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单计划数量：</view>
					<view>{{form.orderAmounts || 0}}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单完成数量：</view>
					<view>{{form.orderFinishNum || 0}}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单状态：</view>
					<view v-if="form.orderStatus == 0">执行</view>
					<view v-if="form.orderStatus == 1">待质检</view>
					<view v-if="form.orderStatus == 2">完成</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">客户名称：</view>
					<view>{{form.customerName || '-'}}</view>
				</view>
				<!-- <view class="item-text flex-box">
					<view class="item-text-left">工单类型：</view>
					<view>工单转任务</view>
				</view> -->
				<view class="item-text flex-box">
					<view class="item-text-left">车间名称：</view>
					<view>{{form.workShop}}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工艺名称：</view>
					<view v-for="item of processGroupData" :key="item.id" v-if="form.processGroupId == item.id">
						{{item.groupName}}
					</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单交付周期：</view>
					<view>{{form.deliveryCycle}}天</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单创建人：</view>
					<view>{{form.createUserName }}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单开始时间：</view>
					<view>{{form.createTime}}</view>
				</view>
				<view class="item-text flex-box">
					<view class="item-text-left">工单结束时间：</view>
					<view>{{form.completeTime || '-'}}</view>
				</view>
			</view>
		</view>

		<!-- <empty v-else text="暂无数据"></empty> -->
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{},
				orderId:0,
				processGroupData:[], // 工艺字典数据
			}
		},
		onLoad(e) {
			this.processGrouplistfun()
			this.orderId = e.orderId
			this.productOrderIdfun()
		},
		onShow() {
			
		},
		methods: {
			// 详情数据
			productOrderIdfun(){
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				this.$api.productOrderId(this.orderId).then(res=>{
					this.form = res.data
					uni.hideLoading();
				})
			},
			// 获取工艺名称字典
			processGrouplistfun(){
				this.$api.processGrouplist().then(res=>{
					this.processGroupData = res.rows
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.mould-page {
		.white-card {
			background-color: $uni-bg-color;
		}
		.list-box {
			padding: 0 20rpx;
			color: $uni-text-color-list; 	// #666
			.list-item {
				background-color: $uni-bg-color; // #ffffff
				padding: 20rpx;
				border-radius: 20rpx;
				margin-top: 28rpx;
	
				.item-text {
					// margin-top: 10rpx;
					font-size: 30rpx;
					margin: 20rpx 0;
					.item-text-left {
						// width: 200rpx;
						text-align: right;
					}
				}
			}
	
		}
		.flex-box {
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
	}
</style>
