<template>
	<view class="ticket-handle">
		<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="200rpx" leftText="加签"
			leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
		<view class="ticket-info">
			<view class="form-item border-bottom" v-if="ticketType === 'add'">
				<view class="form-left">
					<text class="star">*</text>
					<text class="form-left-text">加签给</text>
				</view>
				<view class="form-right">
					<uni-data-select v-model="toadd_user" :localdata="range" label="加签给">
					</uni-data-select>
				</view>
			</view>
			<view class="form-item border-bottom" v-else>
				<view class="form-left">
					<text class="star">*</text>
					<text class="form-left-text">转交给</text>
				</view>
				<view class="form-right">
					<uni-data-select v-model="target_user" :localdata="range" label="转交给">
					</uni-data-select>
				</view>
			</view>
			<view class="form-item" style="height: 300rpx;">
				<view class="form-left-text">
					<text class="star">*</text>
					<text>{{labelText}}</text>
				</view>
				<textarea class="apply-reason-text" v-model="form.name" maxlength="250" placeholder="请输入" />
			</view>
			<view class="btn" style="display: flex;justify-content: space-between;">
				<button class="handleBtn" type="primary" @click="handleClick">提交</button>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		name: "addNode",
		data() {
			return {
				ticketId: "",
				ticketType: "",
				labelText: '加签原因',
				form:{
					suggestion:'',
				},
				toadd_user:'',
				target_user:'',
			}
		},
		onLoad(params) {
			// debugger;
			console.log(params)
			this.ticketId = params.ticketId;
			this.ticketType = params.type;
		},
		onShow() {
			if (this.ticketType === 'add') {
				this.labelText = '加签原因'
			} else {
				this.labelText = '转交原因'
			}
		},
		methods: {
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			handleClick(){
				if (this.ticketType === 'add') {
					this.form.toadd_user = this.toadd_user;
					this.$u.api.getTicketItem(this.form).then((res) => {
						this.ticketDetail = res;
					});
				} else {
					this.form.target_user = this.target_user;
					this.$u.api.getTicketItem(this.form).then((res) => {
						this.ticketDetail = res;
					});
				}
			},
		}
	}
</script>

<style>
	/* 主体 */
	>>>.uni-navbar__header,
	>>>.uni-status-bar {
		background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
	}
	.ticket-handle {
		background-color: #f3fbff;
		padding-bottom: 227rpx;
	}

	.ticket-info {
		width: 720rpx;
		margin: 0 auto;
		background-color: #FFFFFF;
		border-radius: 10rpx;
		padding: 25rpx 32rpx;
		box-sizing: border-box;
		margin-top: 24rpx;
	}
.form-item {
    /* display: flex; */
    font-family: PingFang-SC-Medium;
    font-size: 16px;
    min-height: 160rpx;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.form-left {
		/* min-width: 160rpx; */
		width: 100%;
	}
	.form-left-text {
		color: #212121;
		margin-bottom: 13rpx;
	}
.form-right {
		margin-left: 20rpx;
		flex: 1;
		color: #414141;
	}
.star {
    color: red;
}
	.apply-reason-text {
		width: 653rpx;
		height: 179rpx;
		background-color: #f6f8fc;
		border: solid 1rpx #e5e5e5;
		padding: 14rpx 24rpx;
		font-size: 26rpx;
		box-sizing: border-box;
	}

.border-bottom {
		border-bottom: 1rpx solid #eeeeee;
		margin-bottom: 20rpx;
	}

	.fixed-assets-list .ticket-info {
		padding-top: 0rpx;
	}
</style>
