|
@@ -5,8 +5,9 @@
|
|
|
<div class="pay-btn">
|
|
|
<div class="iframe-pay"
|
|
|
v-show="currentCurrencyInfo.currencyCode == 'USD'">
|
|
|
- <div class="ach-pay" style="background: blue" @click="jumpAchPay">
|
|
|
- ACH Pay
|
|
|
+ <div class="token-pay"
|
|
|
+ @click="clickPayUSD">
|
|
|
+ Pay {{finalAmountData.rechargeAmountValue > 0 ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}} {{currentCurrencyInfo.tokenSymbol}}
|
|
|
</div>
|
|
|
|
|
|
<!-- <iframe
|
|
@@ -17,7 +18,7 @@
|
|
|
<div class="token-pay"
|
|
|
:class="{ disabled: Number(currentCurrencyInfo.balance) < Number(payConfig.amount) }"
|
|
|
v-if="currentCurrencyInfo.currencyCode != 'USD'"
|
|
|
- @click="tokenPay">
|
|
|
+ @click="balancePay">
|
|
|
Pay {{payConfig.amount || 0}} {{currentCurrencyInfo.tokenSymbol}}
|
|
|
</div>
|
|
|
</div>
|
|
@@ -36,10 +37,11 @@ const props = defineProps({
|
|
|
type: Object,
|
|
|
default: () => {
|
|
|
return {
|
|
|
- currencyCode: "",
|
|
|
+ balance: "",
|
|
|
feeAmountValue: 0,
|
|
|
- finalAmountValue: 0,
|
|
|
- requestAmountValue: 0
|
|
|
+ feeDesc: 0,
|
|
|
+ orderAmountValue: 0,
|
|
|
+ rechargeAmountValue: 0
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -66,11 +68,11 @@ let payIng = false;
|
|
|
watch(
|
|
|
() => props.finalAmountData.finalAmountValue,
|
|
|
(newVal) => {
|
|
|
- iframe.value.contentWindow.postMessage({
|
|
|
- actionType: "setAmount", amount: newVal
|
|
|
- },
|
|
|
- "*"
|
|
|
- );
|
|
|
+ // iframe.value.contentWindow.postMessage({
|
|
|
+ // actionType: "setAmount", amount: newVal
|
|
|
+ // },
|
|
|
+ // "*"
|
|
|
+ // );
|
|
|
},
|
|
|
{
|
|
|
deep: true
|
|
@@ -79,7 +81,7 @@ watch(
|
|
|
|
|
|
const emits = defineEmits(["payFinish"]);
|
|
|
|
|
|
-const tokenPay = () => {
|
|
|
+const balancePay = () => {
|
|
|
Report.reportLog({
|
|
|
pageSource: Report.pageSource.previewPage,
|
|
|
businessType: Report.businessType.buttonClick,
|
|
@@ -98,7 +100,7 @@ const tokenPay = () => {
|
|
|
}
|
|
|
}).then(res => {
|
|
|
if(res.code == 0) {
|
|
|
- emits("payFinish", {...res.data, payNetwork: 'token'});
|
|
|
+ emits("payFinish", {...res.data});
|
|
|
}
|
|
|
payIng = false;
|
|
|
}).catch(() => {
|
|
@@ -106,29 +108,33 @@ const tokenPay = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const jumpAchPay = () => {
|
|
|
- let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
|
|
|
- setChromeStorage({ achPayInfo : JSON.stringify({'amountValue': 1})})
|
|
|
- chrome.tabs.create({
|
|
|
- url: guideUrl
|
|
|
- });
|
|
|
+const clickPayUSD = () => {
|
|
|
+ if(finalAmountData.rechargeAmountValue > 0) {
|
|
|
+ let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
|
|
|
+ setChromeStorage({ achPayInfo : JSON.stringify({'amountValue': props.finalAmountData.rechargeAmountValue})})
|
|
|
+ chrome.tabs.create({
|
|
|
+ url: guideUrl
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ balancePay();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- window.addEventListener("message", function (event) {
|
|
|
- if (event.data && event.data.actionType) {
|
|
|
- switch (event.data.actionType) {
|
|
|
- case "payCallBack":
|
|
|
- console.log(
|
|
|
- "payCallBack",
|
|
|
- event.data.orderData,
|
|
|
- event.data.transaction
|
|
|
- );
|
|
|
- emits("payFinish", {...event.data, payNetwork: 'pay'});
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ // window.addEventListener("message", function (event) {
|
|
|
+ // if (event.data && event.data.actionType) {
|
|
|
+ // switch (event.data.actionType) {
|
|
|
+ // case "payCallBack":
|
|
|
+ // console.log(
|
|
|
+ // "payCallBack",
|
|
|
+ // event.data.orderData,
|
|
|
+ // event.data.transaction
|
|
|
+ // );
|
|
|
+ // emits("payFinish", {...event.data, payNetwork: 'pay'});
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
});
|
|
|
|
|
|
</script>
|