<template>
	<view class="page">
		<view class="item_line" >
		</view>
		<view class="item item_line item_textarea" >
			<view class="itemname redMi">回复内容</view>
			<textarea class="textarea" placeholder="请输入回复内容" v-model="msg"  ></textarea>
		</view>
		<view class="fixMargin"></view>
		<view class="goHome" @click='goMain("payInfo")'>
			<img src="../../static/img/gohome.png">
		</view>
		<view class="fixBottom">
			<view class="uni-flex uni-row">
				<view style="-webkit-flex:1;flex: 1;">
					<button type="primary"  style="width: 100%;"  @click="submit()">确认提交</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		config
	} from '../../request/js/config.js'
	export default {
		data() {
			return {
				config:config,
				id:'',
				msg:'',
			}
		},
		onLoad(option) {
			var _this = this;
			this.id = option.id||'';
			if (this.id == undefined ) {
				uni.reLaunch({
					url: 'payApply'
				});
				return false;
			}
		},
		methods: {
			submit(){
				if(!(this.msg)){
					uni.showToast({
							title: '请填写回复内容',
							duration: 2000,
							icon:"none"
						});
					return false;
				}
				//提交回复内容
				this.$http.request({
				  url: '/apis/payApply/comment',
				  params:{
					  payApplyId:this.id,
					  comment:this.msg,
				  }
				}).then(res=>{
					if(res.data.code == 0){
						uni.showToast({
							title: '操作成功',
							duration: 	1000,
							icon:"none"
						});
						setTimeout( function(){
							uni.navigateTo({
							    url: 'payApply'
							});
						},1000)
					}else{
						uni.showToast({
							title: res.data.msg,
							duration: 	2000,
							icon:"none"
						});
					}
				}).catch(err=>{
					uni.showToast({
						title: '操作失败',
						duration: 	2000,
						icon:"none"
					});
				});
			}
		}
	}
</script>

