|  | @@ -14,7 +14,7 @@
 | 
	
		
			
				|  |  |          :src="currencyInfo.iconPath"/>
 | 
	
		
			
				|  |  |        <div class="amount">
 | 
	
		
			
				|  |  |          <div class="balance"
 | 
	
		
			
				|  |  | -             :class="{'direction-column': (currencyInfo.totalBalance.length + currencyInfo.tokenSymbol.length) > 15}">
 | 
	
		
			
				|  |  | +            :class="{'direction-column': (currencyInfo.totalBalance.length + currencyInfo.tokenSymbol.length) > 15}">
 | 
	
		
			
				|  |  |            <a-tooltip :title="currencyInfo.totalBalance">
 | 
	
		
			
				|  |  |                {{ getBit(currencyInfo.totalBalance) }}
 | 
	
		
			
				|  |  |            </a-tooltip> 
 | 
	
	
		
			
				|  | @@ -22,7 +22,7 @@
 | 
	
		
			
				|  |  |                
 | 
	
		
			
				|  |  |            </template>
 | 
	
		
			
				|  |  |            <span class="symbol">
 | 
	
		
			
				|  |  | -             {{currencyInfo.tokenSymbol}}
 | 
	
		
			
				|  |  | +            {{currencyInfo.tokenSymbol}}
 | 
	
		
			
				|  |  |            </span>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div class="final">
 | 
	
	
		
			
				|  | @@ -34,22 +34,18 @@
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |      <div class="bottom">
 | 
	
		
			
				|  |  |        <template v-if="showSendBtn">
 | 
	
		
			
				|  |  | -        <div class="btn send-btn" @click="showSendGiveawayDialog(currencyInfo)">
 | 
	
		
			
				|  |  | +        <div class="btn send-btn" v-if="enableRecharge == 1" @click="showSendGiveawayDialog(currencyInfo)">
 | 
	
		
			
				|  |  |            <img :src="require('@/assets/svg/icon-send-giveaway.svg')" /> 
 | 
	
		
			
				|  |  |            Send Giveaway
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div class="btn-wrapper">
 | 
	
		
			
				|  |  | -          <div class="button "
 | 
	
		
			
				|  |  | -            v-if="currencyInfo.currencyCode != 'USD'"
 | 
	
		
			
				|  |  | -            @click="clickDeposit">Deposit</div>
 | 
	
		
			
				|  |  | -          <div class="button" @click="clickWithdraw">Withdrawal</div>
 | 
	
		
			
				|  |  | +          <div class="button left" v-if="enableRecharge == 1" @click="clickDeposit">Deposit</div>
 | 
	
		
			
				|  |  | +          <div class="button" v-if="enableWithdraw == 1" @click="clickWithdraw">Withdrawal</div>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        </template>
 | 
	
		
			
				|  |  |        <template v-else>
 | 
	
		
			
				|  |  | -        <div class="btn deposit-btn"
 | 
	
		
			
				|  |  | -          v-if="currencyInfo.currencyCode != 'USD'"
 | 
	
		
			
				|  |  | -          @click="clickDeposit">Deposit</div>
 | 
	
		
			
				|  |  | -        <div class="btn withdrawal-btn" @click="clickWithdraw">Withdrawal</div>
 | 
	
		
			
				|  |  | +        <div class="btn deposit-btn" v-if="enableRecharge == 1" @click="clickDeposit">Deposit</div>
 | 
	
		
			
				|  |  | +        <div class="btn withdrawal-btn" v-if="enableWithdraw == 1" @click="clickWithdraw">Withdrawal</div>
 | 
	
		
			
				|  |  |        </template>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -63,6 +59,14 @@
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div class="selectBg" @click="showCurrencySelect = false"></div>
 | 
	
		
			
				|  |  |      </template>
 | 
	
		
			
				|  |  | +    <input-action-sheet 
 | 
	
		
			
				|  |  | +      :visible="showDepositInput"
 | 
	
		
			
				|  |  | +      title="Enter the USD amount to be deposited"
 | 
	
		
			
				|  |  | +      :desc="depositDesc"
 | 
	
		
			
				|  |  | +      position="absolute"
 | 
	
		
			
				|  |  | +      @onInput="onDepositAmountInput"
 | 
	
		
			
				|  |  | +      @cancel="cancelDeposit"
 | 
	
		
			
				|  |  | +      @confirm="confirmDeposit"></input-action-sheet>
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -72,12 +76,14 @@ import router from "@/router/popup.js";
 | 
	
		
			
				|  |  |  import Report from "@/log-center/log";
 | 
	
		
			
				|  |  |  import { getStorage } from "@/uilts/help";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import { getCurrencyInfoBySymbol } from "@/http/publishApi";
 | 
	
		
			
				|  |  | +import { getCurrencyInfoBySymbol, syncChainTokenRechargeRecord } from "@/http/publishApi";
 | 
	
		
			
				|  |  |  import {setChromeStorage} from "@/uilts/chromeExtension"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import VHead from '@/view/popup/components/head.vue'
 | 
	
		
			
				|  |  |  import currencySelect from "@/view/components/currency-select.vue";
 | 
	
		
			
				|  |  | +import inputActionSheet from "@/view/components/input-action-sheet.vue";
 | 
	
		
			
				|  |  |  import { getBit } from "@/uilts/help";
 | 
	
		
			
				|  |  | +import { payCalcFee } from "@/http/pay";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  let currenciesData = ref([]);
 | 
	
		
			
				|  |  |  let currencyInfo = ref({
 | 
	
	
		
			
				|  | @@ -90,15 +96,35 @@ let currencyOpertionType = '';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  let showSendBtn = ref(true);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +let enableRecharge = ref(1);
 | 
	
		
			
				|  |  | +let enableWithdraw = ref(1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +let showDepositInput = ref(false);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +let reqCalcIng = false;
 | 
	
		
			
				|  |  | +let depositDesc = ref('');
 | 
	
		
			
				|  |  | +let finalAmountData = ref({});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const selectCurrency = (params) => {
 | 
	
		
			
				|  |  |      showCurrencySelect.value = false;
 | 
	
		
			
				|  |  | +    let {enableRecharge, enableWithdraw} = params;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      if(currencyOpertionType == 'WITHDRAW') {
 | 
	
		
			
				|  |  | +      if(enableWithdraw != 1) {
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        withdrawHandle(params);
 | 
	
		
			
				|  |  |      } else if(currencyOpertionType == 'DEPOSIT') {
 | 
	
		
			
				|  |  | +      if(enableRecharge != 1) {
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        depositHandle(params);
 | 
	
		
			
				|  |  |      } else if(currencyOpertionType == 'SEND') {
 | 
	
		
			
				|  |  | +      if(enableRecharge != 1) {
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        showSendGiveawayDialog(params);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -122,18 +148,20 @@ const clickWithdraw = () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const withdrawHandle = (_params) => {
 | 
	
		
			
				|  |  |    withdraw_info.chainInfo = _params.chainInfo;
 | 
	
		
			
				|  |  | +  withdraw_info.source = 'home'
 | 
	
		
			
				|  |  | +  withdraw_info.balance = _params.balance
 | 
	
		
			
				|  |  | +  withdraw_info.token_symbol = _params.tokenSymbol || ''
 | 
	
		
			
				|  |  | +  withdraw_info.currency_name = _params.currencyName || ''
 | 
	
		
			
				|  |  | +  withdraw_info.token_chain = _params.tokenChain || ''
 | 
	
		
			
				|  |  | +  withdraw_info.currency_code = _params.currencyCode
 | 
	
		
			
				|  |  | +  withdraw_info.icon_token = _params.iconPath || ''
 | 
	
		
			
				|  |  | +  withdraw_info.icon_net = require('@/assets/svg/icon-BNB.svg')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    if (_params.currencyCode == 'USD') {
 | 
	
		
			
				|  |  |        withdraw_info.currency_code = _params.currencyCode
 | 
	
		
			
				|  |  | +      withdraw_info.paypal.amount_value = _params.balance
 | 
	
		
			
				|  |  |        router.push('/withdraw/paypal')
 | 
	
		
			
				|  |  |    } else {
 | 
	
		
			
				|  |  | -      withdraw_info.source = 'home'
 | 
	
		
			
				|  |  | -      withdraw_info.balance = _params.balance
 | 
	
		
			
				|  |  | -      withdraw_info.token_symbol = _params.tokenSymbol || ''
 | 
	
		
			
				|  |  | -      withdraw_info.currency_name = _params.currencyName || ''
 | 
	
		
			
				|  |  | -      withdraw_info.token_chain = _params.tokenChain || 'BNB Chain'
 | 
	
		
			
				|  |  | -      withdraw_info.currency_code = _params.currencyCode
 | 
	
		
			
				|  |  | -      withdraw_info.icon_token = _params.iconPath || ''
 | 
	
		
			
				|  |  | -      withdraw_info.icon_net = require('@/assets/svg/icon-BNB.svg')
 | 
	
		
			
				|  |  |        console.log(withdraw_info.chainInfo.iconPath)
 | 
	
		
			
				|  |  |        router.push('/withdraw/info')
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -154,10 +182,32 @@ const clickDeposit = () => {
 | 
	
		
			
				|  |  |        showCurrencySelect.value = true;
 | 
	
		
			
				|  |  |        currencyOpertionType = "DEPOSIT";
 | 
	
		
			
				|  |  |      } else if(currenciesData.value.length == 1){
 | 
	
		
			
				|  |  | -      depositHandle(currenciesData.value[0]);
 | 
	
		
			
				|  |  | +      let currencyInfo = currenciesData.value[0];
 | 
	
		
			
				|  |  | +      if(currencyInfo.currencyCode == 'USD') {
 | 
	
		
			
				|  |  | +        // 法币充值
 | 
	
		
			
				|  |  | +        showDepositInput.value = true;
 | 
	
		
			
				|  |  | +        setDepositDesc();
 | 
	
		
			
				|  |  | +          
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        depositHandle(currencyInfo);
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const setDepositDesc = async () => {
 | 
	
		
			
				|  |  | +  let res = await payCalcFee({
 | 
	
		
			
				|  |  | +      params: {
 | 
	
		
			
				|  |  | +          amountValue: 0,
 | 
	
		
			
				|  |  | +          currencyCode: currencyInfo.value.currencyCode,
 | 
	
		
			
				|  |  | +          payChannel: 'ach',
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +  if(res.code == 0) {
 | 
	
		
			
				|  |  | +    let {feeDesc} = res.data;
 | 
	
		
			
				|  |  | +    depositDesc.value = `${feeDesc}`;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const depositHandle = (_params) => {
 | 
	
		
			
				|  |  |    top_up_info.token = _params.currencyName || ''
 | 
	
		
			
				|  |  |    top_up_info.token_chain = _params.tokenChain 
 | 
	
	
		
			
				|  | @@ -172,22 +222,37 @@ const depositHandle = (_params) => {
 | 
	
		
			
				|  |  |    router.push('/top-up/info');
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const asyncTokenRechRecord = (currencyCode = '', cb) => {
 | 
	
		
			
				|  |  | +    syncChainTokenRechargeRecord({
 | 
	
		
			
				|  |  | +        params: {
 | 
	
		
			
				|  |  | +            currencyCode: currencyCode
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }).then(res => {
 | 
	
		
			
				|  |  | +      cb && cb(res.data)
 | 
	
		
			
				|  |  | +    }).catch((err) => {
 | 
	
		
			
				|  |  | +      cb && cb()
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const onRefresh = () => {
 | 
	
		
			
				|  |  | -  getCurrencyInfoBySymbol({
 | 
	
		
			
				|  |  | -    params: {
 | 
	
		
			
				|  |  | -      symbol: currencyInfo.value.tokenSymbol
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  }).then(res => {
 | 
	
		
			
				|  |  | -    if(res.code == 0) {
 | 
	
		
			
				|  |  | -      if(res.data && res.data.currencyCategories && res.data.currencyCategories.length) {
 | 
	
		
			
				|  |  | -        let data = res.data.currencyCategories[0].data;
 | 
	
		
			
				|  |  | -        if(data.length) {
 | 
	
		
			
				|  |  | -          let {totalBalance = '', totalUsdEstimateBalance = ''} = data[0] || {};
 | 
	
		
			
				|  |  | -          currencyInfo.value.totalBalance = totalBalance;
 | 
	
		
			
				|  |  | -          currencyInfo.value.totalUsdEstimateBalance = totalUsdEstimateBalance;
 | 
	
		
			
				|  |  | +  asyncTokenRechRecord('', () => {
 | 
	
		
			
				|  |  | +    getCurrencyInfoBySymbol({
 | 
	
		
			
				|  |  | +      params: {
 | 
	
		
			
				|  |  | +        symbol: currencyInfo.value.tokenSymbol
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }).then(res => {
 | 
	
		
			
				|  |  | +      if(res.code == 0) {
 | 
	
		
			
				|  |  | +        if(res.data && res.data.currencyCategories && res.data.currencyCategories.length) {
 | 
	
		
			
				|  |  | +          let data = res.data.currencyCategories[0].data;
 | 
	
		
			
				|  |  | +          if(data.length) {
 | 
	
		
			
				|  |  | +            let {totalBalance = '', totalUsdEstimateBalance = ''} = data[0] || {};
 | 
	
		
			
				|  |  | +            currencyInfo.value.totalBalance = totalBalance;
 | 
	
		
			
				|  |  | +            currencyInfo.value.totalUsdEstimateBalance = totalUsdEstimateBalance;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -212,6 +277,54 @@ const setLocalSelectCurrencyInfo = (params = {}) => {
 | 
	
		
			
				|  |  |      setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})    
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const cancelDeposit = () => {
 | 
	
		
			
				|  |  | +  showDepositInput.value = false;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const confirmDeposit = (params) => {
 | 
	
		
			
				|  |  | +  if(reqCalcIng) {
 | 
	
		
			
				|  |  | +    return;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  showDepositInput.value = false;
 | 
	
		
			
				|  |  | +  depositDesc.value = '';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  let achPayInfo = {
 | 
	
		
			
				|  |  | +      amountValue: finalAmountData.value.finalAmountValue
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +  let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
 | 
	
		
			
				|  |  | +  setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  chrome.tabs.create({
 | 
	
		
			
				|  |  | +    url: guideUrl
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const onDepositAmountInput = async (params = {}) => {
 | 
	
		
			
				|  |  | +  let {inputVal} = params;
 | 
	
		
			
				|  |  | +  reqCalcIng = true;
 | 
	
		
			
				|  |  | +  if(inputVal === '') {
 | 
	
		
			
				|  |  | +    inputVal = 0;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  let res = await payCalcFee({
 | 
	
		
			
				|  |  | +      params: {
 | 
	
		
			
				|  |  | +          amountValue: inputVal,
 | 
	
		
			
				|  |  | +          currencyCode: currencyInfo.value.currencyCode,
 | 
	
		
			
				|  |  | +          payChannel: 'ach',
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +  reqCalcIng = false;
 | 
	
		
			
				|  |  | +  if(res.code == 0) {
 | 
	
		
			
				|  |  | +    let {feeAmountValue, feeDesc} = res.data;
 | 
	
		
			
				|  |  | +    finalAmountData.value = res.data;
 | 
	
		
			
				|  |  | +    if(inputVal === 0) {
 | 
	
		
			
				|  |  | +      depositDesc.value = `${feeDesc}`;
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +      depositDesc.value = `Charge Fee:${feeAmountValue} USD(${feeDesc})`;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  onMounted(() => {
 | 
	
		
			
				|  |  |      let {params = '{}'} = router.currentRoute.value.query;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -225,7 +338,10 @@ onMounted(() => {
 | 
	
		
			
				|  |  |          totalBalance,
 | 
	
		
			
				|  |  |          totalUsdEstimateBalance
 | 
	
		
			
				|  |  |        };
 | 
	
		
			
				|  |  | -      console.log(currencyInfo.value )
 | 
	
		
			
				|  |  | +      if(currencies.length == 1) {
 | 
	
		
			
				|  |  | +        enableRecharge.value = currencyInfo.value.enableRecharge;
 | 
	
		
			
				|  |  | +        enableWithdraw.value = currencyInfo.value.enableWithdraw;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      } 
 | 
	
		
			
				|  |  |      if(window.location.pathname.indexOf('/home.html') > -1) {
 | 
	
		
			
				|  |  |        showSendBtn.value = false;
 | 
	
	
		
			
				|  | @@ -233,6 +349,7 @@ onMounted(() => {
 | 
	
		
			
				|  |  |        showSendBtn.value = true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -340,7 +457,7 @@ onMounted(() => {
 | 
	
		
			
				|  |  |        justify-content: space-between;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        .button {
 | 
	
		
			
				|  |  | -        width: 163px;
 | 
	
		
			
				|  |  | +        flex: 1;
 | 
	
		
			
				|  |  |          height: 50px;
 | 
	
		
			
				|  |  |          border: 1px solid #d7e8f4;
 | 
	
		
			
				|  |  |          display: flex;
 | 
	
	
		
			
				|  | @@ -353,6 +470,10 @@ onMounted(() => {
 | 
	
		
			
				|  |  |          color: #1D9BF0;
 | 
	
		
			
				|  |  |          cursor: pointer;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      .left {
 | 
	
		
			
				|  |  | +        margin-right: 20px;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 |