<template>
	<view class="bg">
		<div class="box">
			<view class="box-title">{{detail.status_text}}</view>
			<view class="item">
				<view class="title">下单日期:</view>
				<view class="subtitle">{{detail.create_time}}</view>
			</view>
			<view class="item">
				<view class="title">订单号:</view>
				<view class="subtitle">{{detail.order_id}}</view>
			</view>
		</div>
		
		<div class="box">
			<view class="box-title" style="text-align: left;">产品信息</view>
			<view class="item">
				<view class="title">产品类型:</view>
				<view class="subtitle">{{detail.type_id == 1 ? '线路' : '导游'}}</view>
			</view>
			<view class="item">
				<view class="title">产品名称:</view>
				<view class="subtitle">{{detail.goods_title}}</view>
			</view>
			<view class="item">
				<view class="title">规格名称:</view>
				<view class="subtitle">{{detail.specifications_name}}</view>
			</view>
			<view class="item">
				<view class="title">产品单价:</view>
				<view class="subtitle">{{detail.money / 100}}元</view>
			</view>
		</div>
		
		<div class="box">
			<view class="box-title" style="text-align: left;">订单信息</view>
			<view class="item">
				<view class="title">订单数量:</view>
				<view class="subtitle">{{detail.num}}</view>
			</view>
			<view class="item" v-if="item.contact_num&&item.contact_num>0">
				<view class="title">出行人数:</view>
				<view class="subtitle">{{detail.contact_num}}</view>
			</view>
			<view class="item">
				<view class="title">总价:</view>
				<view class="subtitle">{{detail.pay_money / 100}}元</view>
			</view>
			<view class="item">
				<view class="title">使用时间:</view>
				<view class="subtitle">{{detail.use_date}}</view>
			</view>
			<view class="item" v-if="detail.contact">
				<view class="title">出行人信息:</view>
				<view class="subtitle">{{detail.contact.name}}</view>
			</view>
			<view class="item" v-if="detail.contact">
				<view class="title">出行人手机号:</view>
				<view class="subtitle">{{detail.contact.tel}}</view>
			</view>
			
			
		</div>
		<view v-if="detail.status=='SUCCESS'" class="hexiao-btn" @click="confirmVerify(detail)">核销</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {}
			}
		},
		onLoad(option) {
			if(option.id) {
				this.getDetail(option.id)
			}
		},
		methods:{
			getDetail (id) {
				this.Post({
					child_id:id
				},'/api/Merchants/detail').then(res => {
					this.detail = res.data
				})
			},
			
			// 核销
			confirmVerify (item) {
				let _this = this
				uni.showModal({
					title: '',
					content: '确认是否核销此订单',
					confirmColor: '#96684F',
					success: function (res) {
						if (res.confirm) {
							_this.Post({child_id: item.child_id}, '/api/Merchants/dispose').then(res=>{
								uni.showToast({title:'核销成功',icon:'success'})
								_this.getDetail( item.child_id)
							})
						}
					}
				});
			
			},
		},
	}
</script>

<style lang="scss" scoped>
	.bg {
		min-height: 100vh;
		background: #F5F5F5;
		padding: 50rpx 26rpx;
	}
	
	.box {
		padding: 30rpx 26rpx;
		background: #FFFFFF;
		border-radius: 13rpx;
		margin-bottom: 30rpx;
		
		.box-title {
			text-align: center;
			font-weight: bold;
			font-size: 32rpx;
			color: #000000;
		}
		
		.item {
			margin-top: 20rpx;
			display: flex;
			
			.title {
				min-width: 210rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #000000;
			}
			
			.subtitle {
				font-weight: 500;
				font-size: 28rpx;
				color: #646464;
				
				span {
					color: #96684F;
				}
			}
		}
	}
	
	.hexiao-btn{
		
		background: #96684F;
		border-radius: 40rpx;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		display: block;

		
		margin: 0;
		margin-left: auto;
		width: 200rpx;
		height: 66rpx;
		line-height: 66rpx;
		font-weight: 500;
		font-size: 28rpx;
	}
</style>