|
@@ -12,7 +12,7 @@
|
|
|
Giveaways
|
|
|
</div>
|
|
|
</div>
|
|
|
- <img class="icon-question" :src="require('../../assets/svg/icon-question.svg')">
|
|
|
+ <!-- <img class="icon-question" :src="require('../../assets/svg/icon-question.svg')"> -->
|
|
|
</div>
|
|
|
<div class="body">
|
|
|
<div class="left">
|
|
@@ -27,6 +27,9 @@
|
|
|
<div class="right">
|
|
|
<template v-if="!showPreview">
|
|
|
<div class="form-wrapper">
|
|
|
+ <div class="error-msg">
|
|
|
+ {{iptErrMsgTxt}}
|
|
|
+ </div>
|
|
|
<div class="form-base">
|
|
|
<div class="item">
|
|
|
<div class="label">
|
|
@@ -39,6 +42,7 @@
|
|
|
placeholder="Amount entered"
|
|
|
autofocus
|
|
|
@input = "onUsdInput"
|
|
|
+ @blur = "onUsdBlur"
|
|
|
:input-style="{ 'box-shadow': 'none','padding': '1px', 'width': '110px', 'text-align': 'right', 'font-size' : '15px', 'color': '#000' }"/>
|
|
|
</div>
|
|
|
<div class="item">
|
|
@@ -51,6 +55,7 @@
|
|
|
v-model="baseFormData.totalCount"
|
|
|
placeholder="Quantity entered"
|
|
|
@input = "onCountInput"
|
|
|
+ @blur = "onCountBlur"
|
|
|
:input-style="{ 'box-shadow': 'none','padding': '1px', 'width': '120px',
|
|
|
'text-align': 'right', 'font-size' : '15px', 'color': '#000'}"/>
|
|
|
</div>
|
|
@@ -70,6 +75,7 @@
|
|
|
</div>
|
|
|
<div class="control" v-if="item.nodeType == 'textarea'">
|
|
|
<follow-input
|
|
|
+ :isAddSelf="!isBack"
|
|
|
:atUserList="atUserList"
|
|
|
@addUser="addFollowUser" @setUser="setFollowUser"
|
|
|
@delUser="delFollowUser"></follow-input>
|
|
@@ -91,13 +97,13 @@
|
|
|
TIPS
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
- 1. 用户完成你的任务后,即可自动领取你的Giveaways
|
|
|
+ 1. Only after the user completes the tasks you set, they can claim your red envelopes
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
- 2. Paypal charges 4.4% + $0.3 fee
|
|
|
+ 2. Each user can only receive one red envelope
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
- 3. Giveaways 有效期是7天,过期后余额将自动返回到你的钱包账户
|
|
|
+ 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
|
|
@@ -128,10 +134,12 @@
|
|
|
import { ref, watch, reactive, defineProps, defineEmits, onMounted } from "vue";
|
|
|
import {postPublish, verifyPaypalResult} from "../../http/publishApi"
|
|
|
import {payCalcFee} from "../../http/pay"
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import 'element-plus/es/components/message/style/css'
|
|
|
|
|
|
import previewCard from "./preview-card";
|
|
|
import paypalButton from "./paypal-button";
|
|
|
-import followInput from "./followInput";
|
|
|
+import followInput from "./follow-input";
|
|
|
|
|
|
const paypalClientId = 'ASn7k0zqyS5AWYikVSfmamR-RFpjyU_QFJWSxOHHoWE04-RgHNO6nahn0GyHUaUAEBxj-aKgtSrq4O4G';
|
|
|
|
|
@@ -144,6 +152,9 @@ let dialogHeight = ref(680);
|
|
|
let previewDialogHeight = ref(680);
|
|
|
let submitIng = ref(false);
|
|
|
let atUserList = ref([]);
|
|
|
+let iptErrMsgTxt = ref('');
|
|
|
+let isBack = ref(false);
|
|
|
+
|
|
|
let finalAmountData = ref({
|
|
|
currencyCode: "USD",
|
|
|
feeAmountValue: 0,
|
|
@@ -202,6 +213,7 @@ const emits = defineEmits(["close", "confirm", "payPalFinsh"]);
|
|
|
const close = () => {
|
|
|
if (showPreview.value) {
|
|
|
showPreview.value = false;
|
|
|
+ isBack.value = true;
|
|
|
} else {
|
|
|
initParams();
|
|
|
emits("close", false);
|
|
@@ -269,8 +281,7 @@ const confirm = () => {
|
|
|
receiveConditions
|
|
|
}
|
|
|
|
|
|
- //每人平均要分到大于 0.01美元(1美分),需要提示语
|
|
|
- if(amountValue / totalCount < 1) {
|
|
|
+ if(!calcIptValue()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -290,6 +301,7 @@ const confirm = () => {
|
|
|
publishRes = res.data;
|
|
|
// setPreviewDialogHeight();
|
|
|
showPreview.value = true;
|
|
|
+ isBack.value = false;
|
|
|
} else {
|
|
|
console.log(res);
|
|
|
}
|
|
@@ -299,6 +311,23 @@ const confirm = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const calcIptValue = (cb) => {
|
|
|
+ let amountValue = baseFormData.amountValue;
|
|
|
+ let totalCount = baseFormData.totalCount;
|
|
|
+ let flag = true;
|
|
|
+
|
|
|
+ if(!amountValue || !totalCount) {
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ //每人平均要分到大于 0.01美元(1美分)
|
|
|
+ if(amountValue / totalCount < 1) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ cb && cb(flag);
|
|
|
+ return flag
|
|
|
+}
|
|
|
+
|
|
|
const initParams = () => {
|
|
|
baseFormData.amountValue = '';
|
|
|
baseFormData.totalCount = '';
|
|
@@ -322,6 +351,11 @@ const payPalFinsh = (params) => {
|
|
|
emits("payPalFinsh", {publishRes});
|
|
|
showPreview.value = false;
|
|
|
initParams();
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ message: 'pay error',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -342,6 +376,9 @@ const delFollowUser = (params) => {
|
|
|
const onUsdInput = (val) => {
|
|
|
val = val.replace(/[^\d]/g,'');
|
|
|
baseFormData.amountValue = val;
|
|
|
+
|
|
|
+ setIptAmountErrorMsg();
|
|
|
+
|
|
|
return val;
|
|
|
}
|
|
|
|
|
@@ -354,9 +391,44 @@ const onCountInput = (val) => {
|
|
|
val = 9999;
|
|
|
}
|
|
|
baseFormData.totalCount = val;
|
|
|
+ setIptAmountErrorMsg();
|
|
|
return val;
|
|
|
}
|
|
|
|
|
|
+const onUsdBlur = () => {
|
|
|
+ if(!baseFormData.amountValue) {
|
|
|
+ iptErrMsgTxt.value = 'Please enter the giveaways amount in USD input box.';
|
|
|
+ } else {
|
|
|
+ setIptAmountErrorMsg((res) => {
|
|
|
+ if(res) {
|
|
|
+ iptErrMsgTxt.value = '';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const onCountBlur = () => {
|
|
|
+ if(!baseFormData.amountValue) {
|
|
|
+ iptErrMsgTxt.value = 'Please enter the number of giveaways in Quantity input box.';
|
|
|
+ } else {
|
|
|
+ setIptAmountErrorMsg((res) => {
|
|
|
+ if(res) {
|
|
|
+ iptErrMsgTxt.value = '';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const setIptAmountErrorMsg = (cb) => {
|
|
|
+ let res = calcIptValue();
|
|
|
+ if(!res) {
|
|
|
+ iptErrMsgTxt.value = 'If you wish to send {100} red packets, please send USD amount > {$1.00}';
|
|
|
+ } else {
|
|
|
+ iptErrMsgTxt.value = '';
|
|
|
+ }
|
|
|
+ cb && cb(res);
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
setPreviewDialogHeight();
|
|
|
document.onkeydown = function(e){
|
|
@@ -471,11 +543,18 @@ onMounted(() => {
|
|
|
border-left: 1px solid #ececec;
|
|
|
|
|
|
.form-wrapper {
|
|
|
- padding: 26px 18px;
|
|
|
+ padding: 8px 18px 26px 18px;
|
|
|
height: calc(100% - 80px);
|
|
|
overflow-y: scroll;
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
+ .error-msg {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #FF0000;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ height: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
.form-base {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|