<template>
	<view>
		<view class="box">
			<view class="top">
				<text class="title">{{form.title}}</text>
			</view>
		</view>
		<view class="box" style="margin-top: 50px;">
			<view class="item">
				<view class="l">
					<text style="color: red;" v-if="form.mustRemark==1">*</text>
					备注：
				</view>
				<view class="r">
					<u-textarea placeholder="备注" v-model="form.remark" clearable>
					</u-textarea>
				</view>
			</view>
		</view>
		<view style="margin-top: 50px;">
			<u-button type="primary" text="确定" @click="saveFn"></u-button>
			<u-button type="info" text="重置" @click="form.remark=''" style="margin-top: 20rpx;"></u-button>
		</view>
		<!-- ---------------------------------------------------------- -->
		<view class="bottom-safety"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					itemId: '',
					title: '',
					remark: '',
					mustRemark: 1
				}
			}
		},
		onLoad(options) {
			this.form = options;
		},
		methods: {
			saveFn() {
				let data=this.form;
				if(data.mustRemark==1&&!data.remark){
					this.$common.toast('请填写备注')
					return false;
				}
				uni.navigateBack({
					delta: 1,
					success: function(resp) {
						uni.$emit('getRemark', data) //触发事件
					}
				})
			}
		},
	}
</script>

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

	.hj {
		padding: 50rpx;
		font-size: 40rpx;
		color: red;
		font-weight: bold;
	}

	.save-btn {
		background-color: #ff4200;
		height: 88rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin: 60rpx;
		color: #fff;
		font-size: 30rpx;
		font-weight: bold;
		border-radius: 10rpx;
	}

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