|
|
@@ -54,6 +54,7 @@ import Vue from 'vue'
|
|
|
import store from '@/utils/vuexStore'
|
|
|
import network from '@/utils/network'
|
|
|
import tool from '@/utils/tool'
|
|
|
+import userInfo from '@/utils/userInfo'
|
|
|
|
|
|
export default {
|
|
|
name: 'finance_withdraw-add',
|
|
|
@@ -62,18 +63,18 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- allWallet:{'bonus':'Bonus','cash':'Ecoin'},// 会员奖金 现金钱包
|
|
|
+ allWallet: {'bonus': 'Bonus', 'cash': 'Ecoin'}, // 会员奖金 现金钱包
|
|
|
form: {
|
|
|
- type:1,
|
|
|
+ type: 1,
|
|
|
toUserName: '',
|
|
|
toRealName: '',
|
|
|
amount: 0,
|
|
|
payPassword: '',
|
|
|
remark: '',
|
|
|
- transferCode: '',
|
|
|
+ transferCode: ''
|
|
|
},
|
|
|
userInfo: {
|
|
|
- TRANSFER_PROP:100,
|
|
|
+ TRANSFER_PROP: 100
|
|
|
},
|
|
|
balance: 0,
|
|
|
cash: 0,
|
|
|
@@ -87,30 +88,39 @@ export default {
|
|
|
submitButtonStat: false,
|
|
|
openBanks: null,
|
|
|
tool: tool,
|
|
|
- transferConfig: [],
|
|
|
+ transferConfig: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleChange() {
|
|
|
- this.loading = true
|
|
|
- network.getData('user/full-info', {userName: this.form.toUserName}).then(response => {
|
|
|
- this.form.toRealName = response.REAL_NAME
|
|
|
- this.loading = false
|
|
|
- }).catch(response => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
+ handleChange () {
|
|
|
+ if (this.form.toUserName.trim() != userInfo.userName()){
|
|
|
+ this.loading = true
|
|
|
+ network.getData('user/full-info', {userName: this.form.toUserName}).then(response => {
|
|
|
+ console.log(userInfo.userName())
|
|
|
+ this.form.toRealName = response.REAL_NAME
|
|
|
+ this.loading = false
|
|
|
+ }).catch(response => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.form.toUserName = ''
|
|
|
+ this.$message({
|
|
|
+ message: 'Not allowed to transfer to yourself',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- chkReal(){
|
|
|
- this.realAmount = tool.formatPrice(this.form.amount * (100-this.fee) * 0.01)
|
|
|
+ chkReal () {
|
|
|
+ this.realAmount = tool.formatPrice(this.form.amount * (100 - this.fee) * 0.01)
|
|
|
},
|
|
|
- getWalletName(out,inw) {
|
|
|
- return this.allWallet[out] +' To ' + this.allWallet[inw]
|
|
|
+ getWalletName (out, inw) {
|
|
|
+ return this.allWallet[out] + ' To ' + this.allWallet[inw]
|
|
|
},
|
|
|
- handleTypeChange(){
|
|
|
+ handleTypeChange () {
|
|
|
// 奖金转现金
|
|
|
- this.fee = this.transferConfig[this.form.type-1].fee
|
|
|
+ this.fee = this.transferConfig[this.form.type - 1].fee
|
|
|
},
|
|
|
- chkTransferUserinfo() {
|
|
|
+ chkTransferUserinfo () {
|
|
|
network.getData(`finance/chk-transfer-user`).then(response => {
|
|
|
this.loading = false
|
|
|
this.userInfo = response.userInfo
|
|
|
@@ -122,7 +132,7 @@ export default {
|
|
|
this.$router.go(-1)
|
|
|
})
|
|
|
},
|
|
|
- getBalance() {
|
|
|
+ getBalance () {
|
|
|
this.$message({
|
|
|
message: 'Collecting your bonus...', // 正获取您的奖金
|
|
|
type: 'info'
|
|
|
@@ -135,7 +145,7 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
- getMaxAmount(){
|
|
|
+ getMaxAmount () {
|
|
|
this.maxAmount = Math.floor(tool.formatPrice(this.balance * this.userInfo.TRANSFER_PROP * 0.01))
|
|
|
this.transferProp = this.userInfo.TRANSFER_PROP
|
|
|
},
|
|
|
@@ -152,35 +162,34 @@ export default {
|
|
|
inputType: 'password',
|
|
|
inputPattern: /\S+/,
|
|
|
inputErrorMessage: 'Please enter your payment password', // 请输入支付密码
|
|
|
- beforeClose:async (action, instance, done)=>{
|
|
|
+ beforeClose: async (action, instance, done) => {
|
|
|
if (action === 'confirm') {
|
|
|
- instance.confirmButtonLoading = true;
|
|
|
- instance.confirmButtonText = 'executing...'; // 执行中...
|
|
|
- console.log(instance.inputValue);
|
|
|
- this.form.payPassword = instance.inputValue;
|
|
|
+ instance.confirmButtonLoading = true
|
|
|
+ instance.confirmButtonText = 'executing...' // 执行中...
|
|
|
+ console.log(instance.inputValue)
|
|
|
+ this.form.payPassword = instance.inputValue
|
|
|
await network.postData(path, this.form).then(response => {
|
|
|
-
|
|
|
- instance.confirmButtonLoading = false;
|
|
|
- done();
|
|
|
+ instance.confirmButtonLoading = false
|
|
|
+ done()
|
|
|
this.$message({
|
|
|
message: response,
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.submitButtonStat = false
|
|
|
this.$router.go(-1)
|
|
|
- }).catch(error=>{
|
|
|
- instance.confirmButtonLoading = false;
|
|
|
+ }).catch(error => {
|
|
|
+ instance.confirmButtonLoading = false
|
|
|
this.submitButtonStat = false
|
|
|
- done();
|
|
|
+ done()
|
|
|
})
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.submitButtonStat = false
|
|
|
- done();
|
|
|
+ done()
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|