<template>
	<view class="need-submit" :class="['qn-page-' + theme]">
		<u-input v-model="demand" placeholder="说点您的需要吧……" type="textarea" :border="true" :height="300" :auto-height="true" />
		<button class="add-btn primary-bg" @click="addCustomerdemand">保存提交</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			demand: ''
		};
	},
	computed:{
		userId(){
			return this.$store.state.userStatus.id
		}
	},
	methods: {
		addCustomerdemand() {
			if(!this.demand){
				this.$u.toast('说点什么再提交吧')
				return
			}
			this.$u.api
				.addCustomerdemand({
					customerId: this.userId,
					demand: this.demand
				})
				.then(res => {
					this.$u.toast('提交成功')
					setTimeout(()=>{
						uni.navigateBack()
					},2000)
				});
		}
	}
};
</script>
<style>
page {
	background-color: #ffffff;
}
</style>
<style scoped lang="scss">
.need-submit {
	padding: 30rpx;
}
.add-btn {
	width: 690upx;
	height: 80upx;
	font-size: 32upx;
	color: #fff;
	border-radius: 10upx;
	margin: 30rpx auto;
}

.add-btn:after {
	border: 0 none;
}
</style>
