|
@@ -42,8 +42,10 @@
|
|
|
<!-- 表单填写容器 -->
|
|
|
<div class="body-content" v-show="showComType != 'topUp'">
|
|
|
<!-- 货币列表 -->
|
|
|
- <div class="currency-pop" v-if="showCurrencyPop">
|
|
|
- <currency-list @selectCurrency="selectCurrency"></currency-list>
|
|
|
+ <div class="currency-pop" v-show="showCurrencyPop">
|
|
|
+ <currency-list
|
|
|
+ @selectCurrency="selectCurrency"
|
|
|
+ @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
|
|
|
</div>
|
|
|
|
|
|
<div class="left" @click.self="showCurrencyPop = false">
|
|
@@ -60,206 +62,186 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="right">
|
|
|
- <template v-if="showComType == 'default'">
|
|
|
- <div class="form-wrapper">
|
|
|
- <img
|
|
|
- @click.stop="showCurrencyPop = false"
|
|
|
- class="img-mode"
|
|
|
- src="../../assets/img/img-mode.png"
|
|
|
- />
|
|
|
- <!-- 金额、数量 -->
|
|
|
- <div class="form-base">
|
|
|
- <div class="item currency-select-wrapper">
|
|
|
- <div
|
|
|
- class="label currency-select"
|
|
|
- @click="showCurrencyPop = true"
|
|
|
- >
|
|
|
- <img
|
|
|
- class="icon"
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-usd.svg')
|
|
|
- "
|
|
|
- />
|
|
|
- USD
|
|
|
- <img
|
|
|
- class="arrow"
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-form-arrow-down.svg')
|
|
|
- "
|
|
|
- />
|
|
|
- </div>
|
|
|
- <el-input
|
|
|
- v-model="baseFormData.amountValue"
|
|
|
- placeholder="0"
|
|
|
- autofocus
|
|
|
- @input="onUsdInput"
|
|
|
- @blur="onUsdBlur"
|
|
|
- :input-style="{
|
|
|
- 'box-shadow': 'none',
|
|
|
- padding: '1px',
|
|
|
- width: '110px',
|
|
|
- 'text-align': 'right',
|
|
|
- 'font-size': '15px',
|
|
|
- color: '#000',
|
|
|
- 'margin-right': '14px',
|
|
|
- }"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="item" @click.stop="showCurrencyPop = false">
|
|
|
- <div class="label">
|
|
|
- <img
|
|
|
- class="icon"
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-winners.svg')
|
|
|
- "
|
|
|
- />
|
|
|
- Winners
|
|
|
- </div>
|
|
|
- <el-input
|
|
|
- v-model="baseFormData.totalCount"
|
|
|
- placeholder="0"
|
|
|
- @input="onCountInput"
|
|
|
- @blur="onCountBlur"
|
|
|
- :input-style="{
|
|
|
- 'box-shadow': 'none',
|
|
|
- padding: '1px',
|
|
|
- width: '120px',
|
|
|
- 'text-align': 'right',
|
|
|
- 'font-size': '15px',
|
|
|
- color: '#000',
|
|
|
- }"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- 刷新按钮、充值 -->
|
|
|
- <div class="form-base-help" @click.stop="showCurrencyPop = false">
|
|
|
- <div class="currency-operation">
|
|
|
- <div class="balance">
|
|
|
- <img
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-balance.svg')
|
|
|
- "
|
|
|
- />
|
|
|
- Balance
|
|
|
- </div>
|
|
|
- <div class="amount">
|
|
|
- 218
|
|
|
- <img
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-form-refresh.svg')
|
|
|
- "
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="top-up" @click="goTopUp">Top UP</div>
|
|
|
- </div>
|
|
|
- <div class="msg">
|
|
|
- Recommend quantity 100~10000
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="form-label">Tasks</div>
|
|
|
- <!-- 转推、like、关注 -->
|
|
|
- <div class="form-require" @click.stop="showCurrencyPop = false">
|
|
|
+ <div class="form-wrapper" v-if="showComType == 'default'">
|
|
|
+ <img
|
|
|
+ @click.stop="showCurrencyPop = false"
|
|
|
+ class="img-mode"
|
|
|
+ src="../../assets/img/img-mode.png"
|
|
|
+ />
|
|
|
+ <!-- 金额、数量 -->
|
|
|
+ <div class="form-base">
|
|
|
+ <div class="item currency-select-wrapper">
|
|
|
<div
|
|
|
- class="form-item"
|
|
|
- v-for="(item, index) in formList"
|
|
|
- :key="index"
|
|
|
+ class="label currency-select"
|
|
|
+ @click="showCurrencyPop = true"
|
|
|
>
|
|
|
- <div class="label">
|
|
|
- <img
|
|
|
- class="icon"
|
|
|
- :src="item.icon"
|
|
|
- />
|
|
|
- {{ item.label }}
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="control"
|
|
|
- v-if="item.nodeType == 'textarea'"
|
|
|
- >
|
|
|
- <follow-input
|
|
|
- :isAddSelf="!isBack"
|
|
|
- :atUserList="atUserList"
|
|
|
- @addUser="addFollowUser"
|
|
|
- @setUser="setFollowUser"
|
|
|
- @delUser="delFollowUser"
|
|
|
- ></follow-input>
|
|
|
- </div>
|
|
|
- <el-switch
|
|
|
- v-if="item.type == 2"
|
|
|
- v-model="item.checked"
|
|
|
+ <img
|
|
|
+ class="icon"
|
|
|
+ :src="currentCurrencyInfo.iconPath || require('../../assets/svg/icon-currency.svg')"
|
|
|
/>
|
|
|
+ {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Currency'}}
|
|
|
<img
|
|
|
- v-if="item.type == 3"
|
|
|
+ class="arrow"
|
|
|
:src="
|
|
|
- require('../../assets/svg/icon-option-checked.svg')
|
|
|
+ require('../../assets/svg/icon-form-arrow-down.svg')
|
|
|
"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <input
|
|
|
+ v-model="baseFormData.amountValue"
|
|
|
+ placeholder="0"
|
|
|
+ autofocus
|
|
|
+ @input="onAmountInput"
|
|
|
+ @blur="onAmountBlur"
|
|
|
+ />
|
|
|
</div>
|
|
|
- <!-- 机器人 -->
|
|
|
- <div class="anti-bot-wrapper">
|
|
|
+ <div class="item" @click.stop="showCurrencyPop = false">
|
|
|
<div class="label">
|
|
|
<img
|
|
|
+ class="icon"
|
|
|
:src="
|
|
|
- require('../../assets/svg/icon-anti-bot.svg')
|
|
|
+ require('../../assets/svg/icon-winners.svg')
|
|
|
"
|
|
|
- class="icon-bot"
|
|
|
/>
|
|
|
- Anti Bot
|
|
|
+ Winners
|
|
|
+ </div>
|
|
|
+ <input
|
|
|
+ v-model="baseFormData.totalCount"
|
|
|
+ placeholder="0"
|
|
|
+ @input="onCountInput"
|
|
|
+ @blur="onCountBlur"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 刷新按钮、充值 -->
|
|
|
+ <div class="form-base-help" @click.stop="showCurrencyPop = false">
|
|
|
+ <div class="currency-operation">
|
|
|
+ <div class="balance">
|
|
|
<img
|
|
|
:src="
|
|
|
- require('../../assets/svg/icon-beta.svg')
|
|
|
+ require('../../assets/svg/icon-balance.svg')
|
|
|
"
|
|
|
- class="icon-beta"
|
|
|
/>
|
|
|
+ Balance
|
|
|
+ </div>
|
|
|
+ <div class="amount">
|
|
|
+ 218
|
|
|
<img
|
|
|
:src="
|
|
|
- require('../../assets/svg/icon-question.svg')
|
|
|
+ require('../../assets/svg/icon-form-refresh.svg')
|
|
|
"
|
|
|
- class="icon-question"
|
|
|
/>
|
|
|
</div>
|
|
|
- <el-switch v-model="openAntiBot" />
|
|
|
+ <div class="top-up" @click="goTopUp">Top UP</div>
|
|
|
</div>
|
|
|
- <!-- 提示 -->
|
|
|
- <div class="tips-wrapper">
|
|
|
- <div class="title">TIPS</div>
|
|
|
- <div class="row">
|
|
|
- 1. Only after the user completes the
|
|
|
- tasks you set, they can claim your red
|
|
|
- envelopes
|
|
|
- </div>
|
|
|
- <div class="row">
|
|
|
- 2. Each user can only receive one red
|
|
|
- envelope
|
|
|
- </div>
|
|
|
- <div class="row">
|
|
|
- 3. The red envelope issued is valid for
|
|
|
- 7 days. Please promote your red envelope
|
|
|
- as much as possible within the validity
|
|
|
- period. After the red envelope expires,
|
|
|
- the red envelope will be returned to
|
|
|
- your DeNet wallet.
|
|
|
- </div>
|
|
|
- <div class="more">More</div>
|
|
|
+ <div class="msg">
|
|
|
+ Recommend quantity 100~10000
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="submit-btn-wrapper">
|
|
|
- <div class="submit-btn" @click="confirm">
|
|
|
+ </div>
|
|
|
+ <div class="form-label">Tasks</div>
|
|
|
+ <!-- 转推、like、关注 -->
|
|
|
+ <div class="form-require" @click.stop="showCurrencyPop = false">
|
|
|
+ <div
|
|
|
+ class="form-item"
|
|
|
+ v-for="(item, index) in formList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div class="label">
|
|
|
<img
|
|
|
- class="icon-loading"
|
|
|
- v-if="submitIng"
|
|
|
- :src="
|
|
|
- require('../../assets/svg/icon-btn-loading.svg')
|
|
|
- "
|
|
|
+ class="icon"
|
|
|
+ :src="item.icon"
|
|
|
/>
|
|
|
- NEXT
|
|
|
+ {{ item.label }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="control"
|
|
|
+ v-if="item.nodeType == 'textarea'"
|
|
|
+ >
|
|
|
+ <follow-input
|
|
|
+ :isAddSelf="!isBack"
|
|
|
+ :atUserList="atUserList"
|
|
|
+ @addUser="addFollowUser"
|
|
|
+ @setUser="setFollowUser"
|
|
|
+ @delUser="delFollowUser"
|
|
|
+ ></follow-input>
|
|
|
</div>
|
|
|
+ <el-switch
|
|
|
+ v-if="item.type == 2"
|
|
|
+ v-model="item.checked"
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ v-if="item.type == 3"
|
|
|
+ :src="
|
|
|
+ require('../../assets/svg/icon-option-checked.svg')
|
|
|
+ "
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
- </template>
|
|
|
+ <!-- 机器人 -->
|
|
|
+ <div class="anti-bot-wrapper">
|
|
|
+ <div class="label">
|
|
|
+ <img
|
|
|
+ :src="
|
|
|
+ require('../../assets/svg/icon-anti-bot.svg')
|
|
|
+ "
|
|
|
+ class="icon-bot"
|
|
|
+ />
|
|
|
+ Anti Bot
|
|
|
+ <img
|
|
|
+ :src="
|
|
|
+ require('../../assets/svg/icon-beta.svg')
|
|
|
+ "
|
|
|
+ class="icon-beta"
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ :src="
|
|
|
+ require('../../assets/svg/icon-question.svg')
|
|
|
+ "
|
|
|
+ class="icon-question"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <el-switch v-model="openAntiBot" />
|
|
|
+ </div>
|
|
|
+ <!-- 提示 -->
|
|
|
+ <div class="tips-wrapper">
|
|
|
+ <div class="title">TIPS</div>
|
|
|
+ <div class="row">
|
|
|
+ 1. Only after the user completes the
|
|
|
+ tasks you set, they can claim your red
|
|
|
+ envelopes
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ 2. Each user can only receive one red
|
|
|
+ envelope
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ 3. The red envelope issued is valid for
|
|
|
+ 7 days. Please promote your red envelope
|
|
|
+ as much as possible within the validity
|
|
|
+ period. After the red envelope expires,
|
|
|
+ the red envelope will be returned to
|
|
|
+ your DeNet wallet.
|
|
|
+ </div>
|
|
|
+ <div class="more">More</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="submit-btn-wrapper">
|
|
|
+ <div class="submit-btn" @click="confirm">
|
|
|
+ <img
|
|
|
+ class="icon-loading"
|
|
|
+ v-if="submitIng"
|
|
|
+ :src="
|
|
|
+ require('../../assets/svg/icon-btn-loading.svg')
|
|
|
+ "
|
|
|
+ />
|
|
|
+ NEXT
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<!-- 预览 -->
|
|
|
<template v-else-if="showComType == 'preview'">
|
|
|
<preview-card
|
|
|
+ :currentCurrencyInfo="currentCurrencyInfo"
|
|
|
:postData="publishRes"
|
|
|
:baseFormData="baseFormData"
|
|
|
></preview-card>
|
|
@@ -272,6 +254,8 @@
|
|
|
paypalClientId,
|
|
|
paypalHtml,
|
|
|
}"
|
|
|
+ :currentCurrencyInfo="currentCurrencyInfo"
|
|
|
+ :postData="publishRes"
|
|
|
@payPalFinsh="payPalFinsh"
|
|
|
></paypal-button>
|
|
|
</div>
|
|
@@ -303,7 +287,7 @@ import paypalButton from "./paypal-button";
|
|
|
import followInput from "./follow-input";
|
|
|
import messageBox from "./message-box.vue";
|
|
|
import currencyList from "./currency-list.vue";
|
|
|
-import topUp from "./top-up.vue";
|
|
|
+import topUp from "./top-up.vue"
|
|
|
|
|
|
let paypalClientId = ref("");
|
|
|
let paypalHtml = ref("");
|
|
@@ -326,11 +310,16 @@ let visible = ref(false);
|
|
|
let showComType = ref("default"); // default(表单) preview(预览) topUp(充值)
|
|
|
let openAntiBot = ref(false);
|
|
|
let dialogHeight = ref(680);
|
|
|
+// 是否正在提交
|
|
|
let submitIng = ref(false);
|
|
|
+// 艾特关注人列表
|
|
|
let atUserList = ref([]);
|
|
|
let iptErrMsgTxt = ref("");
|
|
|
+// 是否返回
|
|
|
let isBack = ref(false);
|
|
|
+// 展示消息提示
|
|
|
let showMessageBox = ref(false);
|
|
|
+// 展示货币列表pop
|
|
|
let showCurrencyPop = ref(false);
|
|
|
|
|
|
let messageBoxData = ref({
|
|
@@ -338,19 +327,34 @@ let messageBoxData = ref({
|
|
|
content: "",
|
|
|
});
|
|
|
|
|
|
+// 真实支付金额数据
|
|
|
let finalAmountData = ref({
|
|
|
- currencyCode: "USD",
|
|
|
+ currencyCode: '',
|
|
|
feeAmountValue: 0,
|
|
|
finalAmountValue: 0,
|
|
|
requestAmountValue: 0,
|
|
|
});
|
|
|
|
|
|
+// 表单数据
|
|
|
let baseFormData = reactive({
|
|
|
- amountCurrencyCode: "USD",
|
|
|
+ amountCurrencyCode: '',
|
|
|
amountValue: "",
|
|
|
totalCount: "",
|
|
|
});
|
|
|
|
|
|
+// 当前选择的货币信息
|
|
|
+let currentCurrencyInfo = ref({
|
|
|
+ currencyCode: "",
|
|
|
+ currencyName: "",
|
|
|
+ balance: "",
|
|
|
+ currencyType: "",
|
|
|
+ iconPath: "",
|
|
|
+ minAmount: "",
|
|
|
+ tokenChain: "",
|
|
|
+ tokenSymbol: "",
|
|
|
+ usdEstimateBalance: ""
|
|
|
+});
|
|
|
+
|
|
|
let formList = reactive([
|
|
|
{
|
|
|
label: "Follow",
|
|
@@ -423,23 +427,21 @@ const setDialogHeight = () => {
|
|
|
/**
|
|
|
* 获取实际支付金额
|
|
|
*/
|
|
|
-const getPayAmount = (amountValue, cb) => {
|
|
|
- payCalcFee({
|
|
|
+const getPayAmount = async (amountValue) => {
|
|
|
+ let res = await payCalcFee({
|
|
|
params: {
|
|
|
amountValue,
|
|
|
- currencyCode: "USD",
|
|
|
- payChannel: 1,
|
|
|
+ currencyCode: currentCurrencyInfo.value.currencyCode,
|
|
|
+ payNetwork: 'paypal',
|
|
|
},
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 0) {
|
|
|
- cb && cb(res.data);
|
|
|
- let { finalAmountValue } = res.data;
|
|
|
- if (finalAmountValue >= 100) {
|
|
|
- res.data.finalAmountValue = finalAmountValue / 100;
|
|
|
- finalAmountData.value = res.data;
|
|
|
- }
|
|
|
- }
|
|
|
});
|
|
|
+ if (res.code == 0) {
|
|
|
+ let { finalAmountValue } = res.data;
|
|
|
+ if (finalAmountValue > 0) {
|
|
|
+ finalAmountData.value = res.data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res.data;
|
|
|
};
|
|
|
|
|
|
const confirm = () => {
|
|
@@ -457,13 +459,32 @@ const confirm = () => {
|
|
|
};
|
|
|
|
|
|
const selectCurrency = (params) => {
|
|
|
- console.log(params);
|
|
|
- messageBoxBlock({
|
|
|
- title: "是否要充值 USDT",
|
|
|
- content: "USDT 可用余额为0,是否要去充值?",
|
|
|
- });
|
|
|
+
|
|
|
+ // 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;
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 设置默认使用货币
|
|
|
+ */
|
|
|
+
|
|
|
+const setCurrentCurrencyInfo = (params) => {
|
|
|
+ let {list} = params;
|
|
|
+ if(list && list.length && list[0].data && list[0].data.length) {
|
|
|
+ currentCurrencyInfo.value = list[0].data[0];
|
|
|
+ finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const messageBoxBlock = ({ title = "", content = "" }) => {
|
|
|
showMessageBox.value = true;
|
|
|
messageBoxData.value.title = title;
|
|
@@ -476,7 +497,6 @@ const messageBoxCancel = () => {
|
|
|
|
|
|
const messageBoxConfirm = () => {
|
|
|
showMessageBox.value = false;
|
|
|
- // showCurrencyPop.value = false;
|
|
|
showComType.value = "topUp";
|
|
|
};
|
|
|
|
|
@@ -490,10 +510,11 @@ const goTopUp = () => {
|
|
|
/**
|
|
|
* 提交表单请求
|
|
|
*/
|
|
|
-const submitRequest = () => {
|
|
|
- let { amountValue = 0, totalCount = 0, amountCurrencyCode } = baseFormData;
|
|
|
+const submitRequest = async () => {
|
|
|
+ let { amountValue = 0, totalCount = 0 } = baseFormData;
|
|
|
+ baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
|
|
|
+ // 组装提交参数
|
|
|
formList[0]["text"] = atUserList.value;
|
|
|
- amountValue = amountValue * 100; // 元转分
|
|
|
|
|
|
let finishConditions = [];
|
|
|
for (let i = 0; i < formList.length; i++) {
|
|
@@ -509,38 +530,43 @@ const submitRequest = () => {
|
|
|
}
|
|
|
}
|
|
|
let receiveConditions = openAntiBot.value ? "" : [];
|
|
|
+
|
|
|
+ // 提交参数
|
|
|
let formData = {
|
|
|
- amountCurrencyCode,
|
|
|
+ amountCurrencyCode: baseFormData.amountCurrencyCode,
|
|
|
amountValue,
|
|
|
totalCount,
|
|
|
finishConditions,
|
|
|
receiveConditions,
|
|
|
+ payAmountValue: amountValue
|
|
|
};
|
|
|
submitIng.value = true;
|
|
|
- getPayAmount(amountValue, (res) => {
|
|
|
- formData["payAmountValue"] = res.finalAmountValue;
|
|
|
- let data = {
|
|
|
- params: {
|
|
|
- postBizData: JSON.stringify(formData),
|
|
|
- postSrc: 1, //1 twitter
|
|
|
- postType: 1, //1 红包
|
|
|
- },
|
|
|
- };
|
|
|
- postPublish(data)
|
|
|
- .then((res) => {
|
|
|
- submitIng.value = false;
|
|
|
- if (res.code == 0) {
|
|
|
- publishRes = res.data;
|
|
|
- // setPreviewDialogHeight();
|
|
|
- showComType.value = "preview";
|
|
|
- isBack.value = false;
|
|
|
- } else {
|
|
|
- console.log(res);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
+
|
|
|
+ // 法币支付需要计算费率
|
|
|
+ if(formData.amountCurrencyCode == "USD") {
|
|
|
+ let payAmountRes = await getPayAmount(amountValue);
|
|
|
+ formData["payAmountValue"] = payAmountRes.finalAmountValue;
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ params: {
|
|
|
+ postBizData: JSON.stringify(formData),
|
|
|
+ postSrc: 1, //1 twitter
|
|
|
+ postType: 1, //1 红包
|
|
|
+ },
|
|
|
+ };
|
|
|
+ postPublish(data).then((res) => {
|
|
|
+ submitIng.value = false;
|
|
|
+ if (res.code == 0) {
|
|
|
+ publishRes = res.data;
|
|
|
+ // setPreviewDialogHeight();
|
|
|
+ showComType.value = "preview";
|
|
|
+ isBack.value = false;
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -580,57 +606,65 @@ const initParams = () => {
|
|
|
* 支付完成回调
|
|
|
*/
|
|
|
const payPalFinsh = (params) => {
|
|
|
- let transaction = params.transaction;
|
|
|
- console.log("transaction", transaction);
|
|
|
- let loadingInstance = ElLoading.service({
|
|
|
- background: "rgba(0,0,0,.3)",
|
|
|
- });
|
|
|
- verifyPaypalResult({
|
|
|
- params: {
|
|
|
- paypalTransactionId: transaction.id,
|
|
|
- postId: publishRes.postId,
|
|
|
- paypalClientId: paypalClientId.value,
|
|
|
- },
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
+ let {payNetwork, payStatus} = params;
|
|
|
+ // token 支付
|
|
|
+ if(payNetwork == 'bsc') {
|
|
|
+ payStatusHandle(payStatus);
|
|
|
+ } else {
|
|
|
+ // 法币支付
|
|
|
+ let transaction = params.transaction;
|
|
|
+ let loadingInstance = ElLoading.service({
|
|
|
+ background: "rgba(0,0,0,.3)",
|
|
|
+ });
|
|
|
+ verifyPaypalResult({
|
|
|
+ params: {
|
|
|
+ paypalTransactionId: transaction.id,
|
|
|
+ postId: publishRes.postId,
|
|
|
+ paypalClientId: paypalClientId.value,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
loadingInstance.close();
|
|
|
if (res.code == 0) {
|
|
|
- //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
|
|
|
if (res.data) {
|
|
|
- let payStatus = res.data.payStatus;
|
|
|
- switch (payStatus) {
|
|
|
- case 1:
|
|
|
- emits("payPalFinsh", { publishRes });
|
|
|
- showComType.value = "default";
|
|
|
- initParams();
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- ElMessage({
|
|
|
- message: "Pay Fail",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- ElMessage({
|
|
|
- message: "Pay Exceptions",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- ElMessage({
|
|
|
- message: "Pay Exceptions",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- break;
|
|
|
- }
|
|
|
+ payStatusHandle(res.data.payStatus)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
loadingInstance.close();
|
|
|
});
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
+const payStatusHandle = (payStatus) => {
|
|
|
+ //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
|
|
|
+ switch (payStatus) {
|
|
|
+ case 1:
|
|
|
+ emits("payPalFinsh", { publishRes });
|
|
|
+ showComType.value = "default";
|
|
|
+ initParams();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ ElMessage({
|
|
|
+ message: "Pay Fail",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ ElMessage({
|
|
|
+ message: "Pay Exceptions",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ ElMessage({
|
|
|
+ message: "Pay Exceptions",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* follow组件触发新增关注人
|
|
|
*/
|
|
@@ -646,20 +680,23 @@ const delFollowUser = (params) => {
|
|
|
atUserList.value.splice(params.index, 1);
|
|
|
};
|
|
|
|
|
|
-const onUsdInput = (val) => {
|
|
|
- val = val.replace(/[^\d]/g, "");
|
|
|
+const onAmountInput = () => {
|
|
|
+ let val = baseFormData.amountValue;
|
|
|
+ // val = val.replace(/[^\d^\.]+/g, "");
|
|
|
+ val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
|
|
|
baseFormData.amountValue = val;
|
|
|
-
|
|
|
setIptAmountErrorMsg();
|
|
|
|
|
|
return val;
|
|
|
};
|
|
|
|
|
|
-const onCountInput = (val) => {
|
|
|
+const onCountInput = () => {
|
|
|
+ let val = baseFormData.totalCount;
|
|
|
if (val == 0) {
|
|
|
val = "";
|
|
|
}
|
|
|
- val = val.replace(/[^\d]/g, "");
|
|
|
+ // val = val.replace(/[^\d]/g, "");
|
|
|
+ val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
|
|
|
if (val > 9999) {
|
|
|
val = 9999;
|
|
|
}
|
|
@@ -671,7 +708,7 @@ const onCountInput = (val) => {
|
|
|
/**
|
|
|
* 金额输入失焦
|
|
|
*/
|
|
|
-const onUsdBlur = () => {
|
|
|
+const onAmountBlur = () => {
|
|
|
if (!baseFormData.amountValue) {
|
|
|
iptErrMsgTxt.value =
|
|
|
"Please enter the giveaways amount in USD input box.";
|
|
@@ -978,6 +1015,15 @@ onMounted(() => {
|
|
|
padding: 16px 14px;
|
|
|
box-shadow: 0px 3px 27px 0px #0000001a;
|
|
|
|
|
|
+ input {
|
|
|
+ width: 102px;
|
|
|
+ text-align: right;
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 18px;
|
|
|
+ border: none;
|
|
|
+ outline: none;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
.label {
|
|
|
font-weight: 500;
|
|
|
font-size: 15px;
|
|
@@ -994,6 +1040,9 @@ onMounted(() => {
|
|
|
|
|
|
.currency-select-wrapper {
|
|
|
padding: 0 !important;
|
|
|
+ input {
|
|
|
+ padding-right: 14px;
|
|
|
+ }
|
|
|
.currency-select {
|
|
|
box-shadow: 3px 0 10px 2px #ececec;
|
|
|
padding: 16px 14px;
|