<template>
	<view class="container">
		<view class="row b-b">
			<text class="tit">积分数</text>
			<input class="input" v-model="account" type="text" placeholder="请填写要转积分数" placeholder-class="placeholder" />
		</view>
		<view class="row b-b">
			<text class="tit">用户ID</text>
			<input class="input" v-model="ID" type="text" placeholder="请填写对应用户ID" placeholder-class="placeholder" />
		</view>
		<button class="add-btn" :class="{'bg-gray':loding}" @click="loding?'':confirm()">提交</button>
	</view>
</template>

<script>
import { verify } from '@/api/login.js';
import { setUserMoney } from '@/api/new.js';
export default {
	data() {
		return {
			account: '', //积分数
			ID: '', //用户id
		};
	},
	methods: {
		confirm(e) {
			this.loding = true;
			uni.showLoading({
				title: '转账中',
				mask: true
			});
			setUserMoney({
				num: this.account,
				uid: this.ID
			})
				.then(({ data }) => {
					uni.hideLoading()
					this.loding = false;
					this.$api.msg('转账成功');
					this.account = '';
					this.ID = '';
				})
				.catch(err => {
					uni.hideLoading()
					this.loding = false;
					console.log(err);
				});
		}
	}
};
</script>

<style lang="scss">
page {
	background: $page-color-base;
}
.container {
	padding-top: 30rpx;
}
.row {
	display: flex;
	align-items: center;
	position: relative;
	padding: 0 30rpx;
	height: 110rpx;
	background: #fff;

	.tit {
		flex-shrink: 0;
		width: 120rpx;
		font-size: 30rpx;
		color: $font-color-dark;
	}
	.input {
		flex: 1;
		font-size: 30rpx;
		color: $font-color-dark;
	}
	.iconlocation {
		font-size: 36rpx;
		color: $font-color-light;
	}
}
.add-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 690rpx;
	height: 80rpx;
	margin: 60rpx auto;
	font-size: $font-lg;
	color: #fff;
	background-color: $base-color;
	border-radius: 10rpx;
	// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
}

.bg-gray{
	background-color: $color-gray;
}
.code {
	color: #5dbc7c;
	font-size: 23rpx;
	border-left: 1px solid #eeeeee;
	width: 150rpx;
	flex-shrink: 0;
	text-align: center;
}
</style>
