|
@@ -10,8 +10,8 @@
|
|
|
class="icon-currency"
|
|
|
:src="currencyInfo.iconPath"/>
|
|
|
<div class="amount">
|
|
|
- {{currencyInfo.balance}} {{currencyInfo.currencyName}}
|
|
|
- <div class="final">${{currencyInfo.usdEstimateBalance}}</div>
|
|
|
+ {{currencyInfo.totalBalance}} {{currencyInfo.currencyName}}
|
|
|
+ <div class="final">${{currencyInfo.totalUsdEstimateBalance}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="bottom">
|
|
@@ -29,7 +29,7 @@
|
|
|
@selectCurrency="selectCurrency">
|
|
|
</currency-select>
|
|
|
</div>
|
|
|
- <div class="selectBg"></div>
|
|
|
+ <div class="selectBg" @click="showCurrencySelect = false"></div>
|
|
|
</template>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -50,17 +50,20 @@ let currenciesData = ref([]);
|
|
|
let currencyInfo = ref({});
|
|
|
let showCurrencySelect = ref(false);
|
|
|
|
|
|
+let currencyOpertionType = '';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const selectCurrency = (params) => {
|
|
|
showCurrencySelect.value = false;
|
|
|
-
|
|
|
- currencyInfo.value = {
|
|
|
- ...params,
|
|
|
- totalBalance: currencyInfo.value.totalBalance,
|
|
|
- totalUsdEstimateBalance: currencyInfo.value.totalUsdEstimateBalance
|
|
|
+ if(currencyOpertionType == 'WITHDRAW') {
|
|
|
+ withdrawHandle(params);
|
|
|
+ } else if(currencyOpertionType == 'DEPOSIT') {
|
|
|
+ depositHandle(params);
|
|
|
}
|
|
|
- console.log(currencyInfo.value)
|
|
|
}
|
|
|
|
|
|
+let withdraw_info = inject('withdraw_info')
|
|
|
// 点击提现
|
|
|
const clickWithdraw = () => {
|
|
|
Report.reportLog({
|
|
@@ -68,10 +71,15 @@ const clickWithdraw = () => {
|
|
|
businessType: Report.businessType.buttonClick,
|
|
|
objectType: Report.objectType.withdrawButton
|
|
|
});
|
|
|
- withdrawHandle(currencyInfo.value);
|
|
|
+
|
|
|
+ if(currenciesData.value.length > 1) {
|
|
|
+ showCurrencySelect.value = true;
|
|
|
+ currencyOpertionType = "WITHDRAW";
|
|
|
+ } else if(currenciesData.value.length == 1){
|
|
|
+ withdrawHandle(currenciesData.value[0]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-let withdraw_info = inject('withdraw_info')
|
|
|
const withdrawHandle = (_params) => {
|
|
|
withdraw_info.chainInfo = _params.chainInfo;
|
|
|
if (_params.currencyCode == 'USD') {
|
|
@@ -91,6 +99,10 @@ const withdrawHandle = (_params) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+let top_up_info = inject('top_up_info');
|
|
|
+
|
|
|
const clickDeposit = () => {
|
|
|
Report.reportLog({
|
|
|
pageSource: Report.pageSource.denetHomePage,
|
|
@@ -98,10 +110,14 @@ const clickDeposit = () => {
|
|
|
objectType: Report.objectType.topupButton
|
|
|
});
|
|
|
|
|
|
- depositHandle(currencyInfo.value);
|
|
|
+ if(currenciesData.value.length > 1) {
|
|
|
+ showCurrencySelect.value = true;
|
|
|
+ currencyOpertionType = "DEPOSIT";
|
|
|
+ } else if(currenciesData.value.length == 1){
|
|
|
+ depositHandle(currenciesData.value[0]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-let top_up_info = inject('top_up_info');
|
|
|
const depositHandle = (_params) => {
|
|
|
top_up_info.token = _params.currencyName || ''
|
|
|
top_up_info.token_chain = _params.tokenChain
|
|
@@ -117,22 +133,24 @@ const depositHandle = (_params) => {
|
|
|
};
|
|
|
|
|
|
const onRefresh = () => {
|
|
|
- // 刷新余额接口
|
|
|
- asyncTokenRechRecord(currencyInfo.value, (res) => {
|
|
|
- if(res.code == 0 && res.data && res.data.length) {
|
|
|
- let currencyData = res.data[0];
|
|
|
- if(currencyData.currencyCode == currencyInfo.value.currencyCode) {
|
|
|
- currencyInfo.value.balance = currencyData.balance;
|
|
|
- currencyInfo.value.usdEstimateBalance = currencyData.usdEstimateBalance;
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ asyncTokenRechRecord(currencyInfo.value, (res) => {
|
|
|
+ if(res.code == 0 && res.data && res.data.length) {
|
|
|
+ let currencyData = res.data[0];
|
|
|
+ if(currencyData.currencyCode == currencyInfo.value.currencyCode) {
|
|
|
+ currencyInfo.value.balance = currencyData.balance;
|
|
|
+ currencyInfo.value.usdEstimateBalance = currencyData.usdEstimateBalance;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
};
|
|
|
|
|
|
+
|
|
|
const asyncTokenRechRecord = (_params, cb) => {
|
|
|
+ let { currencyCode = '' } = _params;
|
|
|
+ if(!currencyCode || !currencyOpertionType) return;
|
|
|
syncChainTokenRechargeRecord({
|
|
|
params: {
|
|
|
- currencyCode: _params.currencyCode
|
|
|
+ currencyCode: currencyCode
|
|
|
}
|
|
|
}).then(res => {
|
|
|
cb && cb(res)
|
|
@@ -153,10 +171,6 @@ onMounted(() => {
|
|
|
totalUsdEstimateBalance
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
- if(currenciesData.value.length > 1) {
|
|
|
- showCurrencySelect.value = true;
|
|
|
- }
|
|
|
})
|
|
|
</script>
|
|
|
|