203 lines
5.9 KiB
Vue
203 lines
5.9 KiB
Vue
<template>
|
||
<BasePage>
|
||
<div class="transfer">
|
||
<div class="top">
|
||
<div class="tit">
|
||
被赠送人账号
|
||
</div>
|
||
<input v-model="userName" type="text" maxlength="11" @change="checkExists" placeholder="请输入被赠送人ID">
|
||
<hr>
|
||
<span class="errorinfo">{{ errorInfo }}</span>
|
||
</div>
|
||
|
||
<!-- <div class="type_box">
|
||
<div class="title">
|
||
<b>互转类型</b>
|
||
</div>
|
||
|
||
<van-radio-group v-model="checked" icon-size="3.47vw" checked-color="#22a56e">
|
||
<van-radio name="balance" label-position="left">
|
||
<img src="/img/balance-i1.png" alt="">
|
||
<p>
|
||
转余额
|
||
<span>(剩余:265444.00)</span>
|
||
</p>
|
||
</van-radio>
|
||
<van-radio name="2" label-position="left">
|
||
<img src="/img/balance-i1.png" alt="">
|
||
<p>
|
||
转余额
|
||
<span>(剩余:265444.00)</span>
|
||
</p>
|
||
</van-radio>
|
||
</van-radio-group>
|
||
|
||
</div> -->
|
||
|
||
<div class="quota_box">
|
||
<div class="title">
|
||
<b>赠送额度</b>
|
||
<span class="r">
|
||
<van-icon name="info-o" />
|
||
赠送说明
|
||
</span>
|
||
</div>
|
||
<!-- <input v-model="amount" type="number" placeholder="请输入转账数额"> -->
|
||
<b class="nums">500.00</b>
|
||
<hr>
|
||
</div>
|
||
|
||
<div class="com_btn">
|
||
<van-button type="primary" color="#ea3e23" round @click="toTransfer">确认赠送</van-button>
|
||
</div>
|
||
</div>
|
||
</BasePage>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
name: 'WalletTransfer',
|
||
mounted() {
|
||
this.me = this.$ls.get('cellphone');
|
||
// $(".van-stepper__input").val("");
|
||
// this.me = window.localStorage.getItem("member_username");
|
||
// Promise.all([this.$MemberAPI.Post('GetWallet')])
|
||
// .then(data => {
|
||
// this.wallet = data[0];
|
||
|
||
// }).catch(err => {
|
||
// this.$showFailToast("获取钱包信息失败:" + err.message);
|
||
// });
|
||
},
|
||
// watch: {
|
||
// password(val, old) {
|
||
// if (val.length === 6) {
|
||
// this.showKeyboard = false;
|
||
// this.data.PayPassword = val;
|
||
// this.$MemberAPI.Post('WalletTransfer', {
|
||
// TransferType: 'Balance',
|
||
// Member: this.data.id,
|
||
// Amount: this.data.Amount,
|
||
// }).then((data) => {
|
||
// this.$showToast({ type: "success", message: "兑换积分转出成功" });
|
||
// setTimeout(() => {
|
||
// window.location.reload();
|
||
// }, 500);
|
||
// })
|
||
// .catch((error) => {
|
||
// this.$showToast({
|
||
// type: "fail",
|
||
// message: "兑换积分转出失败:" + error,
|
||
// });
|
||
// this.errorInfo = "密码错误";
|
||
// this.showKeyboard = true;
|
||
// setTimeout(() => {
|
||
// this.password = "";
|
||
// }, 500);
|
||
// });
|
||
// }
|
||
// },
|
||
// },
|
||
data() {
|
||
return {
|
||
amount: 500.00,
|
||
checked: 'balance',
|
||
checkedCH: "余额",
|
||
left: 0,
|
||
loading: false,
|
||
toUser: { NickName: null },
|
||
error: false,
|
||
// password: "",
|
||
// show: false,
|
||
// showKeyboard: false,
|
||
data: {},
|
||
wallet: {},
|
||
errorInfo: "",
|
||
me: "",
|
||
userName: "",
|
||
showmeerror: false,
|
||
amount: null,
|
||
};
|
||
},
|
||
methods: {
|
||
checkExists() {
|
||
// if (!this.userName) {
|
||
// this.error = false;
|
||
// this.showmeerror = false;
|
||
// return;
|
||
// }
|
||
this.errorInfo = "";
|
||
if (this.userName.length < 11) {
|
||
this.errorInfo = "请输入11位手机号";
|
||
this.error = true;
|
||
return;
|
||
}
|
||
if (this.userName === this.me) {
|
||
this.errorInfo = "无法转账给自己!";
|
||
this.error = true;
|
||
return;
|
||
}
|
||
|
||
this.$get('/v1/client/DUsersClient/check', { userName: this.userName })
|
||
.then((data) => {
|
||
// this.toUser = data;
|
||
// this.error = !data.id;
|
||
// console.log(data);
|
||
|
||
if (data.status === 404) {
|
||
this.errorInfo = "此账号不存在,无法转账,请重新输入!";
|
||
this.error = true;
|
||
} else {
|
||
this.errorInfo = "";
|
||
this.error = false;
|
||
}
|
||
|
||
})
|
||
},
|
||
toMoney(val) {
|
||
return numberConverter.formatNum(val, 0, "+", 2);
|
||
},
|
||
toTransfer() {
|
||
setTimeout(() => {
|
||
if (this.error) {
|
||
this.$showFailToast("请先修正错误信息");
|
||
return;
|
||
}
|
||
if (!this.amount || this.amount <= 0) {
|
||
this.$showFailToast("请输入正确的转账数额");
|
||
return;
|
||
}
|
||
|
||
this.$showConfirmDialog({
|
||
title: '确认转出?',
|
||
}).then(() => {
|
||
this.$post('/v1/client/DUsermoneysClient', {
|
||
"username": this.userName,
|
||
"amount": this.amount,
|
||
}).then((data) => {
|
||
if (data.status === 200) {
|
||
this.$showSuccessToast(this.checkedCH + "转出成功");
|
||
this.$navigate(`Balance`);
|
||
} else {
|
||
this.$showFailToast(this.checkedCH + "转出失败:" + data.message);
|
||
}
|
||
// this.$navigate(`ExchangePoint`);
|
||
//this.$navigate(this.checked);
|
||
// setTimeout(() => {
|
||
// window.location.reload();
|
||
// }, 500);
|
||
}).catch(err => {
|
||
if (err.errcode == 10702) {
|
||
this.$showFailToast(this.checkedCH + "转出失败:可转出的" + this.checkedCH + "不足");
|
||
} else
|
||
this.$showFailToast(this.checkedCH + "转出失败:" + err.message);
|
||
});
|
||
})
|
||
}, 500);
|
||
|
||
|
||
},
|
||
},
|
||
};
|
||
</script>
|