<template>
	  <view style="padding: 0upx 5%;">
		  <TextArea ref="getValue" :tips="tips" @submitValue="submitValue"/>
		  <button class="submitRemin" @click="submitRemin" :loading="Loading" :disabled="Loading">提交</button>
	  </view>
	  
</template>

<script>
	import TextArea from '@/component/textarea.vue'
	export default {
		components: {
			TextArea
		},
		data() {
			return{
				tips: '填写催单内容',
				reminder: '',
				order_id:'',
				types: 0,
				Loading:false,
			}
		},
		onLoad(e) {
			this.order_id = e.order_id;
			this.types = e.a;
			if(this.types== 1) {
				uni.setNavigationBarTitle({
				    title: '催单'
				});
				this.tips="填写催单内容";
			}else if(this.types== 2) {
				uni.setNavigationBarTitle({
				    title: '联系酒店'
				});
				this.tips="填写内容";
			}
		},
		methods: {
			submitValue(e) {
				this.reminder = e.detail.value;
			},
			submitRemin() {
			   if(this.reminder == '') {
				   this.$msg("请填写内容");
				   return;
			   }
			   this.Loading=true;
			   this.request({
				   url: '/v1/order/urge',
				   method:'post',
				   data: {
					   order_id: this.order_id,
					   content: this.reminder
				   },
				   success:(res) => {
					   this.Loading=false;
					   if(res.data.code == 1000) {
						   if(this.types == 1) {
							   this.$msg("催单成功");
						   }else if(this.types== 2) {
							    this.$msg("联系酒店成功");
						   }
						   setTimeout(() => {
							  uni.navigateBack();
						   }, 500)
					   }
 				   },
				   complete:()=>{
					    this.Loading=false;
				   }
			   })
			}
		}
	}
</script>

<style>
	.submitRemin {
		color: #fff !important;
		background-color: #D9332E !important;
		height: 70upx;
		text-align: center;
		line-height: 70upx;
        margin-top: 25upx;
		width: 100%;
	}
</style>
