<template>
	<view class="lr-form-container">
	    <view>
			<l-select v-model="queryData.PayFeeStatus" :range="dataSource.PayStatus" title="线上缴费状态" placeholder="请选择" />
	    </view>
	    <view>
			<l-input v-model="queryData.StudentLoan" :disabled="disabled" title="贷款回执码" placeholder="请填写贷款回执码" right />
	    </view>
	    <view>
			<l-select v-model="queryData.OnsitePayFeeStatus" :range="dataSource.OnsitePayStatus" title="现场缴费状态" placeholder="请选择" />
	    </view>
		<view class="btn" @click="tapBtn">
			提交
		</view>
	</view>
</template>

<script>
export default{
	data() {
		return {
			disabled: false,
			// 数据源
			dataSource: {
				PayStatus: Object.values(this.GET_GLOBAL('dataDictionary').PayStatus).map(t => ({ value: t.value, text: t.text })),
				OnsitePayStatus: Object.values(this.GET_GLOBAL('dataDictionary').OnsitePayStatus).map(t => ({ value: t.value, text: t.text }))
			},
			queryData: {
				StudentLoan: '',
				PayFeeStatus: '',
				OnsitePayFeeStatus: '',
				StudentLoanStatus: '0'
			},
			pageInfo:{}
		}
	},
	methods:{
		init() {
			// console.log(this.dataSource)
			this.pageInfo = this.GET_PARAM(); //获取页面传递参数
			this.LOADING('加载数据中…');
			this.HTTP_GET('StuInfoFresh/form', this.pageInfo.ID,'加载数据时出错').then(res => {
				this.HIDE_LOADING();
				// console.log(res)
				if(res){
					let data = res.StuInfoFresh;
					this.queryData.StudentLoan = data.StudentLoan == null? '' : data.StudentLoan;
					this.queryData.PayFeeStatus = data.PayFeeStatus == null? '' : data.PayFeeStatus;
					this.queryData.OnsitePayFeeStatus = data.OnsitePayFeeStatus == null? '' : data.OnsitePayFeeStatus;
					this.disabled = data.StudentLoanStatus == "1"? true : false;
				}
			})
		},
		tapBtn() {
			if(this.queryData.StudentLoan.trim() != ""){
				this.queryData.StudentLoanStatus = 1;
			}
			let _postData = {
				keyValue: this.pageInfo.ID,
				strEntity: JSON.stringify(this.queryData)
			}
			this.LOADING('提交数据中…');
			this.HTTP_POST('StuInfoFresh/save', _postData,'加载数据时出错').then(res => {
				this.HIDE_LOADING();
				console.log(res)
				if(res){
					this.TOAST('提交数据成功');
					this.EMIT('stuInfoFreshPayFee');
					this.NAV_BACK()
				}
			})
		}
	},
	created() {
		this.init()
	}
}
</script>

<style lang="less" scoped>
</style>

