<template>
	<!-- 订单详情 -->
	<view>
		<u-navbar title="" autoBack placeholder></u-navbar>
		<view class="card_order_detail">
			<view class="orderNumber"><span>运单号:</span>{{orderList.waybillNo}}</view>
			<view class="title_delivery">寄件人:</view>
			<x-orderCard :list="senderList"></x-orderCard>
			<view class="title_delivery">收件人:</view>
			<x-orderCard :list="consigneeList"></x-orderCard>
			<view class="card_humiture">
				<view class="title_claim">
					<span>温度需求:</span>
					<view style="width: auto;">
						<u-tag :text="orderList.temperatureInterval" plain size="mini" type="success"></u-tag>
					</view>
				</view>
				<view class="title_claim">
					<span>配送要求:</span>
					<view style="width: auto;">
						<u-tag :text="orderList.deliveryCondition" plain size="mini" type="primary"></u-tag>
					</view>
				</view>
				<view class="title_claim">
					<span>货物类型:</span>
					<view style="width: auto;">
						<u-tag :text="orderList.cargoType" plain size="mini" type="warning"></u-tag>
					</view>
				</view>
				<view class="title_claim"><span>备注:</span>{{orderList.remark}}</view>
			</view>
			<view v-if="orderList.status != 1">
				<view class="line_back" style="margin-top: 40rpx;" @click="logistics">查看物流详情</view>
				<view class="line_back" @click="goHumiture">查看温湿度</view>
			</view>
		</view>
		<!-- <view class="btn_print" v-if="type == 'details' && orderList.status == 2 || orderList.status == 3">
			<u-button type="primary" text="打印条码"></u-button>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 'details',
				senderList: {
					name: '',
					phone: '',
					address: '',
				},
				consigneeList: {
					name: '',
					phone: '',
					address: '',
				},
				orderList: {}
			}
		},
		onLoad(value) {
			this.type = value.type
		},
		onShow() {
			var orderList = this.$cache.getCache('orderDetails')
			// console.log(orderList,26)
			this.orderList = orderList
			this.senderList.name = orderList.senderAddressName
			this.senderList.phone = orderList.senderAddressPhone
			this.senderList.address = orderList.senderAddressDetails
			this.consigneeList.name = orderList.consigneeAddressName
			this.consigneeList.phone = orderList.consigneeAddressPhone
			this.consigneeList.address = orderList.consigneeAddressDetails
		},
		methods: {
			// 物流详情
			logistics() {
				uni.navigateTo({
					url: '/pages/order/logisticsDetails'
				});
			},
			// 温湿度记录
			goHumiture() {
				uni.navigateTo({
					url: '/pages/order/humiture'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.card_order_detail {
		margin: 20rpx;
	}

	.orderNumber {
		background-color: #fff;
		border-radius: 20rpx;
		padding: 15rpx;

		span {
			font-size: 28rpx;
			color: #909399;
			margin-right: 10rpx;
		}
	}

	.title_delivery {
		font-size: 30rpx;
		font-weight: 600;
		margin: 20rpx 0rpx 10rpx 10rpx;
	}

	.card_humiture {
		margin-top: 30rpx;
		border-radius: 20rpx;
		padding: 1rpx 20rpx;
		background-color: #fff;
	}

	.title_claim {
		display: flex;
		margin: 20rpx 0rpx;

		span {
			font-size: 28rpx;
			color: #909399;
			margin-right: 10rpx;
		}
	}

	.line_back {
		font-size: 30rpx;
		margin: 20rpx 0rpx;
		color: #3c9cff;
	}
</style>