<template>
	<view>
		<view class="content">
			<view class="id">
				<label>充值卡号</label>
				<view><input placeholder="输入充值卡卡号" placeholder-class="placeholder" type="number" @input="getcardId" /></view>
			</view>
			<view class="pas">
				<label>充值卡密码</label>
				<view><input placeholder="输入充值卡密码" placeholder-class="placeholder" @input="getPassword" password type="number" /></view>
			</view>
		</view>
		<view class="chongzhi" @tap="remainder">确认激活</view>
	</view>
</template>

<script>
	const req = require('../../utils/request');
	const app = getApp();
	export default {
		data() {
			return {};
		},
		methods: {
			getcardId(e) {
				console.log(e.detail.value)
				this.setData({
					id: e.detail.value
				})
			},
			getPassword(e) {
				console.log(e.detail.value)
				this.setData({
					password: e.detail.value
				})
			},

			remainder() {
				if (!this.id) {
					return req.msg('请输入充值卡号')
				}
				if (!this.password) {
					return req.msg('请输入充值卡密码')
				}
				req.postRequest('/api/rrLogs/activationCard', {
					cardId: this.id,
					cardPW: this.password
				}, res => {

					if (res == 0) {
						uni.showToast({
						  title: '充值成功！',
						  icon: 'success',
						  success: function () {
						    setTimeout(function () {
						      uni.navigateBack({
						          delta: 1
						      });
						    }, 1500);
						  }
						})
						// app.globalData.navigateTo('wallet/rechargeSuccess/index')
						
					} else {
						
					}
				})
			}
		}
	}
</script>

<style>
	@import "./index.css";
</style>
