<template>
	<view>
		<view class="box">
			<view class="item">
				<view class="l">客户名称：</view>
				<view class="r">
					{{form.customerName}}
				</view>
			</view>
			<view class="item">
				<view class="l">订单号：</view>
				<view class="r">
					{{form.no}}
				</view>
			</view>
			<view class="item">
				<view class="l" style="flex: 6;"><text style="color: red;">*</text>境外车离场：</view>
				<view class="r">
					<uni-datetime-picker placeholder="离场时间" :start="new Date().getTime()" type="datetime" 
						v-model="form.outDayTime" />
				</view>
			</view>
			<view class="item">
				<view class="l" style="flex: 6;"><text style="color: red;">*</text>中国车离场：</view>
				<view class="r">
					<uni-datetime-picker placeholder="离场时间" :start="new Date().getTime()" type="datetime"
						v-model="form.chinaCarOutTime" />
				</view>
			</view>
		</view>
		<u-button type="primary" @click="confirmFn">确认</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				form: {
					partMoney: 0
				},
			}
		},
		onLoad(options) {
			this.id = options.id;
		},
		onShow() {
			this.getBusinessById();
		},
		methods: {
			getBusinessById() {
				this.$api.getBusinessById({
					id: this.id
				}).then(resp => {
					this.form = resp.data;
					this.form.outDayTime='';
					this.form.chinaCarOutTime='';
				})
			},
			confirmFn() {
				if(!this.form.outDayTime||this.form.outDayTime.length<=12){
					this.$common.toast('请选择境外车出场时间')
					return;
				}
				if(!this.form.chinaCarOutTime||this.form.chinaCarOutTime.length<=12){
					this.$common.toast('请选择中国车出场时间')
					return;
				}
				this.$api.adminSetOut(this.form).then(Resp => {
					this.$common.toast('操作成功');
					setTimeout(() => {
						this.$common.back()
					}, 500)
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	@import '@/common/common.scss'
</style>
