<template>
	<view class="page" style="background: #FFFFFF;">
		<view class="feedback-title"><text>姓名</text></view>
		<view class="feedback-body"><input class="feedback-input" v-model="username" placeholder="请输入您的真实姓名" /></view>
		<view class="feedback-title"><text>联系电话</text></view>
		<view class="feedback-body"><input class="feedback-input" v-model="phone" maxlength="11"
				placeholder="请输入您的电话号码" /></view>
		<view class="feedback-title">
			<text>申请描述</text>
		</view>
		<view class="feedback-body"><textarea placeholder="请输入申请描述" v-model="content" class="feedback-textare" />
		</view>
		<view style="padding-left: 40rpx;color: #FF3530;font-size: 28rpx;" v-if="status == 3">拒绝理由：{{auditContent}}</view>
		<button type="primary" style="background: #FF3530;margin-top: 32upx;text-align: center;" class="feedback-submit"
			@tap="send">提交</button>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				phone: '',
				username: '',
				content: "",
				auditContent:'',
				status:0
			};
		},
		onLoad() {
			let EditChannel = this.$queue.getData('EditChannel');
			if(EditChannel){
				console.log(EditChannel.channelRemark)
				this.content = EditChannel.channelRemark;
				this.auditContent = EditChannel.auditContent;
				this.status = EditChannel.status;
				this.username = EditChannel.channelName;
				this.phone = EditChannel.channelPhone;
				
			}
			
		},
		methods: {
			send() {
				let userId = this.$queue.getData('userId');
				if(this.username === ''){
					this.$queue.showToast('请输入您的真实姓名');
					return;
				}
				
				if(this.phone.length != 11){
					this.$queue.showToast('请输入您正确的电话号码');
					return;
				}
				
				if(this.content === ''){
					this.$queue.showToast('请输入申请描述信息');
					return;
				}
				
				let data = {
					"channelRemark": this.content,
					"channelPhone": this.phone,
					"userId": userId,
					"channelName": this.username
				}
				this.$queue.showLoading('加载中...');
				this.$Request
					.postJson('/channel/insertChannel', data).then(res => {
						if (res.code === 0) {
							this.$queue.showToast('申请成功，等待审核！');
							setTimeout(function() {
								uni.navigateBack();
							}, 1000);
						} else {
							uni.hideLoading();
							uni.showModal({
								showCancel: false,
								title: '提交失败',
								content: res.msg
							});
						}
					});
			}
		}
	};
</script>

<style>
	page {
		background-color: #FFFFFF;
	}

	view {
		font-size: 28upx;
	}

	/*问题反馈*/
	.feedback-title {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 0 20upx;
		color: #333;
		font-size: 16px;
		font-weight: 600;
	}

	.feedback-body {
		font-size: 32rpx;
		padding-left: 20rpx;
		margin: 16upx;
		border-radius: 4upx;
		/* background: #F8F8F8; */
		border-bottom: 1px solid #ccc;
	}

	.feedback-textare {
		height: 200upx;
		font-size: 28upx;
		line-height: 50upx;
		padding-left: 8rpx;
		width: 100%;
		box-sizing: border-box;
		/* padding: 20upx 30upx 0; */
	}

	.feedback-input {
		font-size: 28upx;
		height: 60upx;
		padding-left: 8rpx;
		/* padding: 15upx 20upx; */
		line-height: 60upx;
	}

	.feedback-submit {
		background: #007aff;
		color: #ffffff;
		margin: 20upx;
	}

	.integral {
		width: 95%;
		height: 70upx;
		color: #333;
		font-weight: 600;
		border-bottom: 1px solid #ccc;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 0 20upx 20upx;
	}

	.left {
		font-size: 32upx !important;
		display: flex;
		align-items: center;
		flex: 1;
	}

	.uni-picker-container div {
		position: relative;
	}

	.leftSpan {
		position: absolute;
		margin-left: 20upx;
		color: #999;
		font-size: 20upx;
		width: 600upx;
		left: 80upx;
		bottom: 8upx;
	}

	image {
		width: 42upx;
		height: 42upx;
	}

	text {
		margin-left: 20upx;
		color: #333333;
		font-size: 28upx;
	}

	button {
		flex: 1;
		padding: 0;
		margin: 0;
		border: none;
		background: transparent;
		text-align: left;
	}

	button::after {
		border: none;
	}

	button::before {
		border: none;
	}

	.view-text {
		font-size: 28upx;
		color: #333333;
		margin-left: 20upx;
	}

	.cuIcon-right {
		font-size: 28upx;
		color: #999;
	}

	uni-text {
		font-size: 32upx;
	}
</style>
