|
@@ -26,24 +26,32 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
- <div class="transactions">
|
|
|
- <img
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-option-list.svg')
|
|
|
- "
|
|
|
- />
|
|
|
- Transactions
|
|
|
+ <img :src="require('@/assets/svg/icon-more-l.svg')"
|
|
|
+ class="more"
|
|
|
+ @click="showMoreOption = true">
|
|
|
+ <div class="area-option"
|
|
|
+ v-if="showMoreOption"
|
|
|
+ @click="showMoreOption = false">
|
|
|
+ <div class="option">
|
|
|
+ <div class="item" @click="goTransactionsList()">
|
|
|
+ <img :src="require('@/assets/svg/icon-menu.svg')">
|
|
|
+ <span>Transactions</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="body">
|
|
|
<!-- 充值组件 -->
|
|
|
- <top-up v-show="showComType == 'topUp'"></top-up>
|
|
|
+ <top-up v-if="showComType == 'topUp'"
|
|
|
+ :currentCurrencyInfo="currentCurrencyInfo"
|
|
|
+ @topUpDone="topUpDone"></top-up>
|
|
|
<!-- 表单填写容器 -->
|
|
|
- <div class="body-content" v-show="showComType != 'topUp'">
|
|
|
+ <div class="body-content" v-if="showComType != 'topUp'">
|
|
|
<!-- 货币列表 -->
|
|
|
<div class="currency-pop" v-show="showCurrencyPop">
|
|
|
<currency-list
|
|
|
+ ref="currencyListDom"
|
|
|
@selectCurrency="selectCurrency"
|
|
|
@setCurrencyList="setCurrentCurrencyInfo"></currency-list>
|
|
|
</div>
|
|
@@ -125,8 +133,10 @@
|
|
|
Balance
|
|
|
</div>
|
|
|
<div class="amount">
|
|
|
- 218
|
|
|
+ {{currentCurrencyInfo.balance}}
|
|
|
<img
|
|
|
+ :class="{ 'icon-refresh-rotate': refreshRotate }"
|
|
|
+ @click="updateCurrencyBanlce"
|
|
|
:src="
|
|
|
require('../../assets/svg/icon-form-refresh.svg')
|
|
|
"
|
|
@@ -252,7 +262,9 @@
|
|
|
:finalAmountData="finalAmountData"
|
|
|
:payConfig="{
|
|
|
paypalClientId,
|
|
|
+ feeDesc: payConfig.feeDesc,
|
|
|
paypalHtml,
|
|
|
+ amount: baseFormData.amountValue
|
|
|
}"
|
|
|
:currentCurrencyInfo="currentCurrencyInfo"
|
|
|
:postData="publishRes"
|
|
@@ -276,7 +288,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, watch, reactive, defineProps, defineEmits, onMounted } from "vue";
|
|
|
-import { postPublish, verifyPaypalResult } from "../../http/publishApi";
|
|
|
+import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord } from "../../http/publishApi";
|
|
|
import { payCalcFee, getPayConfig } from "../../http/pay";
|
|
|
import { getFrontConfig } from "../../http/account";
|
|
|
import { ElMessage, ElLoading } from "element-plus";
|
|
@@ -290,6 +302,7 @@ import currencyList from "./currency-list.vue";
|
|
|
import topUp from "./top-up.vue"
|
|
|
|
|
|
let paypalClientId = ref("");
|
|
|
+let payConfig = ref({})
|
|
|
let paypalHtml = ref("");
|
|
|
|
|
|
let publishRes = reactive({});
|
|
@@ -322,6 +335,12 @@ let showMessageBox = ref(false);
|
|
|
// 展示货币列表pop
|
|
|
let showCurrencyPop = ref(false);
|
|
|
|
|
|
+let showMoreOption = ref(false);
|
|
|
+
|
|
|
+let currencyListDom = ref(null);
|
|
|
+
|
|
|
+let refreshRotate = ref(false);
|
|
|
+
|
|
|
let messageBoxData = ref({
|
|
|
title: "",
|
|
|
content: "",
|
|
@@ -436,7 +455,8 @@ const getPayAmount = async (amountValue) => {
|
|
|
},
|
|
|
});
|
|
|
if (res.code == 0) {
|
|
|
- let { finalAmountValue } = res.data;
|
|
|
+ let { finalAmountValue, feeDesc } = res.data;
|
|
|
+ payConfig.value.feeDesc = feeDesc;
|
|
|
if (finalAmountValue > 0) {
|
|
|
finalAmountData.value = res.data;
|
|
|
}
|
|
@@ -459,18 +479,17 @@ const confirm = () => {
|
|
|
};
|
|
|
|
|
|
const selectCurrency = (params) => {
|
|
|
-
|
|
|
- // if(params.currencyCode != "USD" && params.balance < params.minAmount) {
|
|
|
- // let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
|
|
|
- // messageBoxBlock({
|
|
|
- // title: `是否要充值 ${tokenSymbol}`,
|
|
|
- // content: `${tokenSymbol} 可用余额为${params.balance},是否要去充值?`,
|
|
|
- // });
|
|
|
- // } else {
|
|
|
+ currentCurrencyInfo.value = params;
|
|
|
+ if(params.currencyCode != "USD" && params.balance < params.minAmount) {
|
|
|
+ let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
|
|
|
+ messageBoxBlock({
|
|
|
+ title: `是否要充值 ${tokenSymbol}`,
|
|
|
+ content: `${tokenSymbol} 可用余额为${params.balance},是否要去充值?`,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
showCurrencyPop.value = false;
|
|
|
- currentCurrencyInfo.value = params;
|
|
|
finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
|
|
|
- // }
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -507,6 +526,48 @@ const goTopUp = () => {
|
|
|
showComType.value = 'topUp';
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 充值done事件
|
|
|
+ * 更新货币列表
|
|
|
+ */
|
|
|
+const topUpDone = () => {
|
|
|
+ asyncTokenRechRecord(() => {
|
|
|
+ showComType.value = 'default';
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const updateCurrencyBanlce = () => {
|
|
|
+ if(!refreshRotate.value) {
|
|
|
+ refreshRotate.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ refreshRotate.value = false;
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ asyncTokenRechRecord((data) => {
|
|
|
+ if(data && data.length) {
|
|
|
+ let currencyInfo = data[0];
|
|
|
+ if(currencyInfo.currencyCode && currentCurrencyInfo.value.currencyCode) {
|
|
|
+ currentCurrencyInfo.value.balance = currencyInfo.balance;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 同步链上交易
|
|
|
+ */
|
|
|
+const asyncTokenRechRecord = (cb) => {
|
|
|
+ syncChainTokenRechargeRecord({
|
|
|
+ params: {
|
|
|
+ currencyCode: currentCurrencyInfo.currencyCode
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 0) {
|
|
|
+ cb && cb(res.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 提交表单请求
|
|
|
*/
|
|
@@ -762,6 +823,7 @@ const setPayConfig = () => {
|
|
|
params: {},
|
|
|
}).then((res) => {
|
|
|
if (res.code == 0) {
|
|
|
+ payConfig.value = res.data;
|
|
|
paypalClientId.value = res.data.paypalClientId;
|
|
|
}
|
|
|
});
|
|
@@ -780,6 +842,10 @@ const setFrontConfig = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const goTransactionsList = () => {
|
|
|
+ window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
setFrontConfig();
|
|
|
setPayConfig();
|
|
@@ -858,15 +924,56 @@ onMounted(() => {
|
|
|
}
|
|
|
|
|
|
.right {
|
|
|
- .transactions {
|
|
|
- color: #a0a0a0;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 13px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
+ .more {
|
|
|
cursor: pointer;
|
|
|
- img {
|
|
|
- margin-right: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .area-option {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ z-index: 111;
|
|
|
+
|
|
|
+ .option {
|
|
|
+ position: absolute;
|
|
|
+ top: 43px;
|
|
|
+ right: 15px;
|
|
|
+ background: #fff;
|
|
|
+ filter: drop-shadow(0px 3px 20px rgba(0, 0, 0, 0.2));
|
|
|
+ width: 240px;
|
|
|
+ border-radius: 15px;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .item {
|
|
|
+ width: 100%;
|
|
|
+ height: 50px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+ border-top: 1px solid #E9E9E9;
|
|
|
+
|
|
|
+ img {
|
|
|
+ margin-left: 15px;
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ margin-right: 6px;
|
|
|
+ }
|
|
|
+
|
|
|
+ span {
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .item:first-child {
|
|
|
+ border-top: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .item:hover {
|
|
|
+ background: #F5F5F5;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -989,6 +1096,11 @@ onMounted(() => {
|
|
|
color: #ff9839;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+
|
|
|
+ .icon-refresh-rotate {
|
|
|
+ transform: rotate(360deg);
|
|
|
+ transition-duration: 1s;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.msg {
|