<template>

	<RefreshView ref="mescrollRef" :hasBack="true" text="人数限制" :useDownScroll="false" :useUpScroll="false"
		useTitleRightBtn="1" titleRightBtnSource="保存" @rightBtn='rightBtnClick'>

		<view style="display: flex;flex-direction: column;margin-top: 50rpx;margin-left: 30rpx;margin-right: 30rpx;">
			<text>人数限制</text>
			<view style="display: flex;flex-direction: row;align-items: center;margin-top: 20rpx;">
				<view style="border: 2px #F1F1F1 solid;display: flex; ">
					<input class="right" type="number" @input="enrollNumbersLimitText" placeholder="请输入人数限制"
						:value="result.enrollNumbersLimit"></input>
				</view>
				<text
					style="display: flex;flex: 1; justify-content: flex-end;  font-size: 30rpx;color: #FF0000;">注：0为不限制</text>
			</view>

		</view>

		<view style="display: flex;flex-direction: column;margin-top: 50rpx;margin-left: 30rpx;margin-right: 30rpx;">
			<text>报名费用</text>
			<view style="display: flex;flex-direction: row;align-items: center;margin-top: 20rpx;">
				<view style="border: 2px #F1F1F1 solid;display: flex; ">
					<input class="right" type="digit" @input="enrollMoneyText" placeholder="请输入报名费用"
						:value="result.enrollMoney"></input>
				</view>
				<text
					style="display: flex;flex: 1; justify-content: flex-end;  font-size: 30rpx;color: #FF0000;">注：0为免费</text>
			</view>

		</view>
		
		
		<!-- <radio-group v-if="!this.IsEmpty(result.enrollMoney)" style="margin-top: 50rpx; display: flex;flex-direction: row; " @change="radioChange">

			<radio style="display: flex;flex: 1;justify-content: center;" :checked="result.checked1">线上收费</radio>
			<radio style="display: flex;flex: 1;justify-content: center;" :checked="result.checked2">线下收费</radio>

		</radio-group>
 -->

	</RefreshView>

</template>

<script>
	export default {
		data() {
			return {
				result: {
					enrollNumbersLimit: "0",
					enrollMoney: "0",
					// type: "",
					// checked1: "",
					// checked2: "",
				},
			}
		},
		onLoad(options) {
			this.result.enrollNumbersLimit = options.enrollNumbersLimit
			this.result.enrollMoney = options.enrollMoney
			// this.result.type = options.type
			// if ("线上收费" == this.result.type) {
			// 	this.result.checked1 = true
			// 	this.result.checked2 = false
			// } else {
			// 	this.result.checked1 = false
			// 	this.result.checked2 = true
			// }
			console.log("1===" + this.result.index)
			console.log("2===" + this.result.enrollNumbersLimit)
			console.log("3===" + this.result.enrollMoney)
			// console.log("4===" + this.result.type)
		},
		methods: {
			enrollNumbersLimitText(e) {
				console.log("1===" + e.detail.value)
				this.result.enrollNumbersLimit = e.detail.value
			},
			enrollMoneyText(e) {
				console.log("2===" + e.detail.value)
				this.result.enrollMoney = e.detail.value
			},
			// radioChange(e) {
			// 	this.result.checked1 = !this.result.checked1
			// 	this.result.checked2 = !this.result.checked2
			// 	console.log('radio发生change事件，携带value值为：', this.result.checked1)
			// 	console.log('radio发生change事件，携带value值为：', this.result.checked2)
			// 	if (this.result.checked1) {
			// 		this.result.type = "线上收费"
			// 	} else {
			// 		this.result.type = "线下收费"
			// 	}
			// 	console.log('type===》：', this.result.type)
			// },
			rightBtnClick() {

				if (this.IsEmpty(this.result.enrollNumbersLimit)) {
					this.result.enrollNumbersLimit = 0
				}
				let o = parseInt(this.result.enrollNumbersLimit)
				if (isNaN(o)) {
					this.Toast("输入的格式有误")
					return
				}

				if (this.IsEmpty(this.result.enrollMoney)) {
					this.result.enrollMoney = 0
				}
				let s = parseInt(this.result.enrollMoney)
				if (isNaN(s)) {
					this.Toast("输入的格式有误")
					return
				}

				this.SetResult(this.result)
			}
		}
	}
</script>

<style lang="scss">
	.right {
		padding: 20rpx;
		flex: 1;
		color: #555555;
		font-size: 30rpx;
	}
</style>
