<template>
	<view class="content">
		<view class="yt-list">
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">订单编号</text>
				<view class="desc">{{id}}</view>
			</view>
			<!-- <view class="yt-list-cell b-b">
				<text class="cell-tit clamp">服务项目</text>
				<view class="desc">{{type}}</view>
			</view> -->
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">上门时日期</text>
				<view class="desc">{{day}}</view>
			</view>
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">上门时间</text>
				<view class="desc">{{time}}</view>
			</view>
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">审核结果</text>
				<picker @change="bindPickerChange" :range="typeArray" range-key="lable" mode="selector">
					<view class="desc">{{stateName || '请选择审核意见'}}</view>
				</picker>
			</view>
		</view>
		<view class="bz">
			<view class="tit">
				备注说明<text>(选填)</text>
			</view>
			<textarea name="" id="bzinfo" cols="30" rows="10" placeholder="请输入备注说明" maxlength="140"
				v-model="remark"></textarea>
		</view>
		<buuug7-simple-datetime-picker ref="myPicker" @submit="handleSubmit"
			:time-hide="[true, true, true, true, true, false]" :time-label="['年', '月', '日', '时', '分']" />
		<view class="base-btn" @click="gonow">
			提交
		</view>
		<uni-popup ref="popupkf" type="bottom">
			<smh-time-range @confrim="confrim" @cancel="cancel"></smh-time-range>
		</uni-popup>
	</view>
</template>

<script>
	import {
		getDefaultAddress,
		createSubscribe,
		agentOrderAuth
	} from '@/api/user.js'


	export default {
		data() {
			return {
				id:'',
				type: '',
				day: '',
				time: '',
				state: "",
				stateName: '',
				remark:'',
				typeArray: [
					{
						value: 1,
						lable: '通过'
					},
					{
						value: -1,
						lable: '拒绝'
					}
				]
			}
		},
		onLoad(opt) {
			this.id = opt.id
			this.type = opt.type
			this.day = opt.day
			this.time = opt.time
		},
		onShow() {},
		onReachBottom() {

		},
		onReady() {

		},
		methods: {
			bindPickerChange(e) {
				console.log(e);
				this.state = e.detail.value
				this.stateName = this.typeArray[e.detail.value].lable
			},
			gonow() {
			
				if (!this.typeArray[this.state].value ) {
					return this.$api.msg('请选择审核意见')
				}
				agentOrderAuth({
					order_id: this.id,
					status: this.typeArray[this.state].value,
					remark: this.remark,
					
				}).then(res => {
					console.log();
					uni.showToast({
						title: '提交成功',
						duration: 2000
					});
					setTimeout(()=> {
						uni.navigateBack()
					},1500)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.address-section {
		padding: 30rpx 0;
		background: #fff;
		position: relative;
		border-top: 1px solid $border-color-light;

		.order-content {
			min-height: 100rpx;
			display: flex;
			align-items: center;

			.addAddress {
				text-align: center;
				width: 100%;
				display: flex;
				justify-content: center;
				align-items: center;

				.iconaddition {
					font-size: 55rpx;
					line-height: 1;
					border-radius: 100rpx;
					margin-right: 20rpx;
				}
			}
		}

		.iconlocation {
			flex-shrink: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			width: 90rpx;
			color: #888;
			font-size: 44rpx;
		}

		.cen {
			display: flex;
			flex-direction: column;
			flex: 1;
			font-size: 28rpx;
			color: $font-color-dark;
		}

		.name {
			font-size: 34rpx;
			margin-right: 24rpx;
		}

		.address {
			margin-top: 16rpx;
			margin-right: 20rpx;
			color: $font-color-light;
		}

		.icon-you {
			font-size: 32rpx;
			color: $font-color-light;
			margin-right: 30rpx;
		}

		.a-bg {
			position: absolute;
			left: 0;
			bottom: 0;
			display: block;
			width: 100%;
			height: 5rpx;
		}
	}

	.yt-list {
		margin-top: 16rpx;
		background: #fff;
	}

	.yt-list-cell {
		display: flex;
		align-items: center;
		padding: 10rpx 30rpx 10rpx 40rpx;
		line-height: 70rpx;
		position: relative;

		&.cell-hover {
			background: #fafafa;
		}

		&.b-b:after {
			left: 30rpx;
		}

		.cell-icon {
			height: 32rpx;
			width: 32rpx;
			font-size: 22rpx;
			color: #fff;
			text-align: center;
			line-height: 32rpx;
			background: #f85e52;
			border-radius: 4rpx;
			margin-right: 12rpx;

			&.hb {
				background: #ffaa0e;
			}

			&.lpk {
				background: #3ab54a;
			}
		}

		.cell-more {
			align-self: center;
			font-size: 24rpx;
			color: $font-color-light;
			margin-left: 8rpx;
			margin-right: -10rpx;
		}

		.cell-tit {
			flex: 1;
			font-size: 30rpx;
			color: #222222;
			margin-right: 10rpx;

		}

		.desc {
			flex: 1;
			min-width: 300rpx;
			text-align: right;
			font-size: $font-base;
			color: $font-color-dark;
		}
	}

	.bz {
		padding: 30rpx;
		margin-top: 20rpx;
		background-color: #fff;
		margin-bottom: 50rpx;
	}

	#bzinfo {
		padding: 20rpx 10rpx 10rpx;
		width: 100%;
	}
</style>