<template>
	<view class="info-content" v-if="expand.title">
		<view class="header">
			<div class="title">订单详情</div>
		</view>
		<view class="block">
			<view class="block-header border-solid">
				<view class="title">
					<text>业务类型</text>
					<view>{{expand.title}}</view>
				</view>
				<view class="price">
					<text>实付</text>
					<view>{{price}}</view>
				</view>
			</view>
			<view class="block-item border-solid">
				<view class="block-item-flex">
					<label>下单用户</label>
					<view class="val">{{user.nickname}}</view>
				</view>
				<view class="block-item-flex">
					<label>用户手机</label>
					<view class="val">{{user.username}}</view>
				</view>
			</view>
			<view class="block-item">
				<view class="block-item-flex" v-for="(item, index) in params" :key="index" v-if="item.value_text != null">
					<label>{{item.title || '-'}}</label>
					<view class="val" v-if="item.type === 'pro_city'">{{item.value_text.join_text}}</view>
					<view class="val" v-else>{{item.value_text || '-'}}</view>
				</view>
			</view>
		</view>
		<view class="block" v-if="lawyer != null">
			<view class="block-item">
				<view class="block-item-flex">
					<label>服务律师</label>
					<view class="val">{{lawyer.name}}</view>
				</view>
				<view class="block-item-flex">
					<label>律师电话</label>
					<view class="val">{{lawyer.username}}</view>
				</view>
			</view>
		</view>
		<view class="block">
			<view class="block-item">
				<view class="block-item-flex">
					<label>支付方式</label>
					<view class="val">{{payType || '-'}}</view>
				</view>
				<view class="block-item-flex">
					<label>业务姓名</label>
					<view class="val">{{user.parent.nickname}}</view>
				</view>
				<view class="block-item-flex">
					<label>业务手机</label>
					<view class="val">{{user.parent.username}}</view>
				</view>
				<view class="block-item-flex" v-if="centerUser != ''">
					<label>运营中心</label>
					<view class="val">{{centerUser}}</view>
				</view>
				<view class="block-item-flex">
					<label>订单编号</label>
					<view class="val">{{no}}</view>
				</view>
				<view class="block-item-flex">
					<label>创建时间</label>
					<view class="val">{{createdAt}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { expandInfo } from '@/apis/interfaces/synthesisOrder.js'
	export default {
		data() {
			return {
				expand    : {},
				params	  : [],
				createdAt : '',
				user	  : {},
				payType	  : '',
				lawyer	  : null,
				price	  : '0.00',
				centerUser: ''
			};
		},
		created() {
			uni.showLoading({
				title: '加载中...',
				mask : true
			})
			expandInfo(this.$Route.query.id).then(res => {
				let { expand, params, created_at, user, order_no, total, lawyer, pay_driver_text, center_user } = res;
				this.lawyer	   = lawyer
				this.expand    = expand
				this.params	   = params
				this.createdAt = created_at
				this.user	   = user
				this.no		   = order_no
				this.price	   = total
				this.payType   = pay_driver_text || ''
				this.centerUser= center_user
			}).catch(err => {
				uni.showToast({
					title: err.message,
					icon : 'none'
				})
			}).finally(() => {
				uni.hideLoading()
			})
		}
	}
</script>

<style lang="scss" scoped>
	.info-content{ 
		padding-top: var(--status-bar-height);
		position: relative;
		background: #eeefff;
		min-height: 100vh;
		box-sizing: border-box;
		padding-bottom: 10rpx;
		&::before{
			background-image: linear-gradient(180deg, #353ef4 10%, #eeefff);
			height: 50vh;
			content: " ";
			width: 100vw;
			position: absolute;
			top: 0;
			left: 0;
		}
		// 头部
		.header{
			position: relative;
			z-index: 1;
			padding: 100rpx 40rpx 70rpx;
			.title{ 
				font-size: 50rpx;
				color: white;
				font-weight: bold;
				text{
					font-weight: 400;
					font-size: 30rpx;
					margin-left: 20rpx;
				}
			}
			.subtitle{ 
				color: white;
				margin-top: 10rpx;
			}
		}
		// 模块
		.block{
			background: white;
			position: relative;
			z-index: 1;
			margin: 0 40rpx 30rpx;
			border-radius: 20rpx;
			.block-header{
				padding: 32rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.title{
					width: calc(100% - 200rpx);
					text{
						font-size: 30rpx;
						line-height: 30rpx;
						color: gray;
					}
					view{
						font-weight: bold;
						font-size: 40rpx;
						line-height: 50rpx;
						@extend .nowrap;
					}
				}
				.price{
					text-align: right;
					width: 200rpx;
					padding-left: 20rpx;
					text{
						font-size: 30rpx;
						line-height: 30rpx;
						color: gray;
					}
					view{
						font-weight: bold;
						font-size: 40rpx;
						color: #353ef4;
						line-height: 50rpx;
						@extend .nowrap;
					}
				}
			}
			.block-item{
				padding: 32rpx;
				.block-item-flex{ 
					padding: 10rpx 0;
					font-size: 30rpx;
					display: flex;
					color: #555;
					justify-content: space-between;
					label{ width: 240rpx; }
					.val{
						text-align: right;
						width: calc(100% - 240rpx);
					}
				}
			}
		}
	}
</style>

