瀏覽代碼

Merge branch 'test' into dev_220318_test

# Conflicts:
#	src/view/components/currency-list.vue
wenliming 3 年之前
父節點
當前提交
bfec7cfbb0

+ 93 - 81
src/view/components/currency-list.vue

@@ -14,53 +14,45 @@
         <div class="list-wrapper">
             <div class="page-list" v-if="!showSearch">
                 <div class="list-item" v-for="(item, index) in currencyInfoList" :key="index">
-                    <div class="item-title">
-                        <img
-                            class="icon"
-                            :src="item.type == 1 ? require('../../assets/svg/icon-currency-category-01.svg') : require('../../assets/svg/icon-currency-category-02.svg')"
-                        />
-                        {{item.type == 1 ? 'Legal Tender' : 'Token'}}
-                    </div>
-                    <div class="item-detail" 
-                        v-for="(data, idx) in item.data"
-                        :key="idx"
-                        @click="selectCurrency(data)">
-                        <div class="left">
-                            <img
-                                class="icon-currency"
-                                :src="data.iconPath"
-                            />
-                            <div class="currency-info">
-                                <div class="name">{{data.currencyCode == 'USD' ? 'USD' : data.tokenSymbol}}</div>
-                                <div class="desc">{{data.currencyCode == 'USD' ? 'Paypal' : data.currencyName}}</div>
-                            </div>
+
+                    <template v-if="props.page != 'top-up' || item.type != 1">
+                        <div class="item-title">
+                            <img class="icon"
+                                :src="item.type == 1 ? require('../../assets/svg/icon-currency-category-01.svg') : require('../../assets/svg/icon-currency-category-02.svg')" />
+                            {{ item.type == 1 ? 'Legal Tender' : 'Token' }}
                         </div>
-                        <div class="right">
-                            <div class="num">{{data.balance}}</div>
-                            <div class="amount" v-if="data.currencyType == 2">${{data.usdEstimateBalance}}</div>
+                        <div class="item-detail" v-for="(data, idx) in item.data" :key="idx"
+                            @click="selectCurrency(data)">
+                            <div class="left">
+                                <img class="icon-currency" :src="data.iconPath" />
+                                <div class="currency-info">
+                                    <div class="name">{{ data.currencyCode == 'USD' ? 'USD' : data.tokenSymbol }}</div>
+                                    <div class="desc">{{ data.currencyCode == 'USD' ? 'Paypal' : data.currencyName }}
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="right">
+                                <div class="num">{{ data.balance }}</div>
+                                <div class="amount" v-if="data.currencyType == 2">${{ data.usdEstimateBalance }}</div>
+                            </div>
                         </div>
-                    </div>
+                    </template>
                 </div>
+
             </div>
             <!-- 显示搜索结果列表 -->
             <div class="search-list" v-else>
-                <div class="item-detail" 
-                    v-for="(data, idx) in searchList"
-                    :key="idx"
-                    @click="selectCurrency(data)">
+                <div class="item-detail" v-for="(data, idx) in searchList" :key="idx" @click="selectCurrency(data)">
                     <div class="left">
-                        <img
-                            class="icon-currency"
-                            :src="data.iconPath"
-                        />
+                        <img class="icon-currency" :src="data.iconPath" />
                         <div class="currency-info">
-                            <div class="name">{{data.currencyName}}</div>
-                            <div class="desc">{{data.tokenSymbol}}</div>
+                            <div class="name">{{ data.currencyName }}</div>
+                            <div class="desc">{{ data.tokenSymbol }}</div>
                         </div>
                     </div>
                     <div class="right">
-                        <div class="num">{{data.balance}}</div>
-                        <div class="amount" v-if="data.currencyType == 2">${{data.usdEstimateBalance}}</div>
+                        <div class="num">{{ data.balance }}</div>
+                        <div class="amount" v-if="data.currencyType == 2">${{ data.usdEstimateBalance }}</div>
                     </div>
                 </div>
                 <div class="no-data" v-if="!searchList.length">
@@ -73,10 +65,16 @@
 
 <script setup>
 /* eslint-disable */
-import { defineEmits, ref, onMounted } from "vue";
+import { defineEmits, ref, onMounted, defineProps } from "vue";
 import {getCurrencyInfo, searchCurrencyInfo, syncChainTokenRechargeRecord} from "@/http/publishApi";
-import {debounce} from "@/uilts/help";
+import { debounce } from "@/uilts/help";
 
+const props = defineProps({
+    page: {
+        type: String,
+        default: '',
+    }
+})
 let keywords = ref('');
 let showSearch = ref(false);
 let currencyInfoList = ref([]);
@@ -91,7 +89,7 @@ const selectCurrency = (params) => {
 
 const onInput = (val) => {
     console.log(keywords.value);
-    if(keywords.value) {
+    if (keywords.value) {
         showSearch.value = true;
         searchCurrency(keywords.value);
     } else {
@@ -102,7 +100,7 @@ const onInput = (val) => {
 
 const clearIpt = () => {
     keywords.value = '';
-    showSearch.value = false;   
+    showSearch.value = false;
     searchList.value = [];
 }
 
@@ -121,18 +119,19 @@ const refresh = () => {
 /**
  * 搜索结果列表
  */
-const searchCurrency = debounce(function(searchWords) {
+const searchCurrency = debounce(function (searchWords) {
     searchCurrencyInfo({
         params: {
             pageNum: 1,
             pageSize: 100,
-            searchWords
+            searchWords,
+            filterFiatCurrency: props.page == 'top-up'
         }
     }).then(res => {
-        if(res.code == 0) {
-            if(res.data.currencyCategories && res.data.currencyCategories.length) {
+        if (res.code == 0) {
+            if (res.data.currencyCategories && res.data.currencyCategories.length) {
                 let list = res.data.currencyCategories[0];
-                if(list && list.data && list.data.length) {
+                if (list && list.data && list.data.length) {
                     searchList.value = list.data;
                 } else {
                     searchList.value = [];
@@ -149,19 +148,20 @@ const searchCurrency = debounce(function(searchWords) {
  */
 const getCurrencyInfoList = () => {
     let params = {
-        params : {
+        params: {
             pageNum: 1,
-            pageSize: 100
+            pageSize: 100,
+            filterFiatCurrency: props.page == 'top-up'
         }
     };
     getCurrencyInfo(params).then(res => {
-        if(res.code == 0) {
+        if (res.code == 0) {
             currencyInfoList.value = res.data.currencyCategories;
-            if(params.params.pageNum < 2) {
-                emits('setCurrencyList', {list: currencyInfoList.value})
+            if (params.params.pageNum < 2) {
+                emits('setCurrencyList', { list: currencyInfoList.value })
             }
         }
-    })  
+    })
 }
 
 
@@ -182,7 +182,7 @@ const asyncTokenRechRecord = (cb) => {
 
 onMounted(() => {
     getCurrencyInfoList();
-}) 
+})
 
 </script>
 
@@ -201,6 +201,7 @@ onMounted(() => {
         align-items: center;
         justify-content: space-between;
         position: relative;
+
         .input {
             background: #f1f1f1;
             border-radius: 110px;
@@ -229,9 +230,11 @@ onMounted(() => {
             cursor: pointer;
         }
     }
+
     .list-wrapper {
         height: calc(100% - 60px);
         overflow-y: auto;
+
         .list-item {
             .item-title {
                 display: flex;
@@ -243,6 +246,7 @@ onMounted(() => {
                 font-weight: 500;
                 font-size: 14px;
                 color: #a2a2a2;
+
                 .icon {
                     width: 24px;
                     height: 24px;
@@ -250,48 +254,56 @@ onMounted(() => {
                 }
             }
         }
+
         .item-detail {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            padding: 12px 20px;
+            box-sizing: border-box;
+            cursor: pointer;
+
+            .left {
                 display: flex;
-                justify-content: space-between;
-                align-items: center;
-                padding: 12px 20px;
-                box-sizing: border-box;
-                cursor: pointer;
-                .left {
-                    display: flex;
-
-                    .icon-currency {
-                        width: 24px;
-                        height: 24px;
-                        margin-right: 12px;
-                    }
-                    .currency-info {
-                        .name {
-                            font-weight: 500;
-                            font-size: 15px;
-                            margin-bottom: 5px;
-                        }
-                        .desc {
-                            font-weight: 400;
-                            font-size: 12px;
-                            color: #a2a2a2;
-                        }
-                    }
+
+                .icon-currency {
+                    width: 24px;
+                    height: 24px;
+                    margin-right: 12px;
                 }
-                .right {
-                    text-align: right;
-                    .num {
+
+                .currency-info {
+                    .name {
                         font-weight: 500;
                         font-size: 15px;
                         margin-bottom: 5px;
                     }
-                    .amount {
+
+                    .desc {
                         font-weight: 400;
                         font-size: 12px;
                         color: #a2a2a2;
                     }
                 }
+            }
+
+            .right {
+                text-align: right;
+
+                .num {
+                    font-weight: 500;
+                    font-size: 15px;
+                    margin-bottom: 5px;
+                }
+
+                .amount {
+                    font-weight: 400;
+                    font-size: 12px;
+                    color: #a2a2a2;
+                }
+            }
         }
+
         .search-list {
             .no-data {
                 font-weight: 500;

+ 30 - 30
src/view/components/option-withdraw.vue

@@ -21,26 +21,20 @@
                     <div class="form-item">
                         <div class="label">PayPal account</div>
                         <div class="input-wrapper">
-                            <el-input type="text" v-model="
-                                requestWithdrawParams.withdrawReceiveAccount
-                            " placeholder="Enter PayPal account" :input-style="{
-    'box-shadow': 'none',
-    height: '48px',
-    'border-radius': '8px',
-}" />
+                            <input type="text" 
+                                v-model="requestWithdrawParams.withdrawReceiveAccount" placeholder="Enter PayPal account"/>
                         </div>
                     </div>
                     <div class="form-item">
                         <div class="label">Withdrawal amount<span
-                                class="msg">(${{ walletWithdrawConfig.withdrawUSDPreMinAmount / 100 }} minimum)</span></div>
+                                class="msg">(${{ walletWithdrawConfig.withdrawUSDPreMinAmount }} minimum)</span></div>
                         <div class="input-wrapper amount-wrapper">
-                            <el-input type="text" @input="onAmountInput" @blur="onAmountBlur"
-                                v-model="requestWithdrawParams.amountValue" placeholder="$0" :input-style="{
-                                    'box-shadow': 'none',
-                                    width: '220px',
-                                    height: '46px',
-                                    'border-radius': '8px',
-                                }" />
+                            <input type="text" 
+                                v-model="requestWithdrawParams.amountValue" 
+                                placeholder="$0"
+                                style="width: 220px"
+                                @input="onAmountInput" 
+                                @blur="onAmountBlur" />
                             <div @click="withdrawalAll" class="withdrawal-all-btn">
                                 Withdrawal All
                             </div>
@@ -49,10 +43,10 @@
 
                     <div class="error-msg">
                         <template v-if="showWithdrawError">
-                            The minimum withdrawal amount is ${{ walletWithdrawConfig.withdrawUSDPreMinAmount / 100 }} USD
+                            The minimum withdrawal amount is ${{ walletWithdrawConfig.withdrawUSDPreMinAmount }} USD
                         </template>
                         <template v-if="showWithdrawIptError">
-                            The withdrawal amount exceeds the total account balance of ${{ canWithdrawBalance / 100 }} USD
+                            The withdrawal amount exceeds the total account balance of ${{ canWithdrawBalance }} USD
                         </template>
                     </div>
                 </div>
@@ -181,7 +175,7 @@ const withdrawalAll = () => {
     console.log(canWithdrawBalance.value);
     showWithdrawIptError.value = false;
     requestWithdrawParams.value.amountValue =
-        canWithdrawBalance.value / 100;
+        canWithdrawBalance.value;
     setWithdrawIptStatus(canWithdrawBalance.value);
     withdrawCalcAmount();
 };
@@ -190,14 +184,14 @@ const withdrawCalcAmount = () => {
     calcReq.value = true;
     withdrawCalcFee({
         params: {
-            amountValue: requestWithdrawParams.value.amountValue * 100,
+            amountValue: requestWithdrawParams.value.amountValue,
             currencyCode: requestWithdrawParams.value.currencyCode,
-            withdrawChannel: requestWithdrawParams.value.withdrawChannel
+            withdrawNetwork: 'paypal'
         }
     }).then(res => {
         calcReq.value = false;
         if (res.code == 0) {
-            finalWithdrawalAmount.value = res.data.finalAmountValue / 100;
+            finalWithdrawalAmount.value = res.data.finalAmountValue;
         }
     })
 }
@@ -222,7 +216,7 @@ const withdraw = () => {
         return;
     }
     params.withdrawReceiveAccount = params.withdrawReceiveAccount.replace(/\s*/g, "");
-    params.amountValue = params.amountValue * 100;
+    params.amountValue = params.amountValue;
     if (params.amountValue > canWithdrawBalance.value) {
         // ElMessage({
         //     message: '大于可提现金额',
@@ -258,8 +252,9 @@ const onAmountBlur = () => {
     withdrawCalcAmount();
 }
 
-const onAmountInput = (value) => {
+const onAmountInput = () => {
     //限制输入数字 小数点俩位
+    let value = requestWithdrawParams.value.amountValue;
     value = value
         .replace(/[^\d.]/g, "")
         .replace(/\.{2,}/g, ".")
@@ -270,15 +265,10 @@ const onAmountInput = (value) => {
         .replace(/^\./g, "");
     requestWithdrawParams.value.amountValue = value;
 
-    let amount = value * 100;
-
-    setWithdrawIptStatus(amount);
+    setWithdrawIptStatus(value);
 
     // 输入金额大于可提现金额
-    if (amount > canWithdrawBalance.value) {
-        // value = '';
-        // requestWithdrawParams.value.amountValue = '';
-
+    if (value > canWithdrawBalance.value) {
         if (!showWithdrawError.value) {
             showWithdrawIptError.value = true;
         }
@@ -374,6 +364,16 @@ const setWithdrawIptStatus = (amount) => {
                         padding-right: 10px;
                         cursor: pointer;
                     }
+
+                    input {
+                        width: 100%;
+                        height: 48px;
+                        border: none;
+                        border-radius: 8px;
+                        padding: 0 16px;
+                        box-sizing: border-box;
+                        outline: none;
+                    }
                 }
             }
 

+ 1 - 1
src/view/popup/top-up/home.vue

@@ -2,7 +2,7 @@
     <!-- 公共组件 -->
     <div class="info">
         <v-head :title="'TopUp'" :show_more="true" :show_refresh="true" :back_url="'/'"></v-head>
-        <currency-list style="height: calc(100% - 48px);" @selectCurrency="selectCurrency"></currency-list>
+        <currency-list style="height: calc(100% - 48px);" @selectCurrency="selectCurrency" :page="'top-up'"></currency-list>
     </div>
 
 </template>

+ 1 - 1
src/view/popup/withdraw/home.vue

@@ -2,7 +2,7 @@
     <!-- 公共组件 -->
     <div class="info">
         <v-head :title="'Withdraw'" :show_more="true" :back_url="'/'"></v-head>
-        <currency-list style="height: calc(100% - 48px);" @selectCurrency="selectCurrency"></currency-list>
+        <currency-list style="height: calc(100% - 48px);" @selectCurrency="selectCurrency" ></currency-list>
     </div>
 
 </template>

+ 8 - 1
src/view/popup/withdraw/paypal.vue

@@ -2,7 +2,7 @@
     <!-- 公共组件 -->
     <div class="info">
         <v-head :title="'Withdraw'" :show_more="true"></v-head>
-        <option-withdraw style="height: calc(100% - 48px);"></option-withdraw>
+        <option-withdraw style="height: calc(100% - 48px);" @back="back"></option-withdraw>
     </div>
 
 </template>
@@ -10,6 +10,13 @@
 <script setup>
 import VHead from '@/view/popup/components/head.vue'
 import OptionWithdraw from "@/view/components/option-withdraw.vue";
+import { useRouter } from "vue-router";
+
+let router = useRouter()
+
+const back = () => {
+    router.replace('/')
+}
 
 </script>