|
@@ -72,8 +72,20 @@
|
|
|
<div class="currency-pop" v-show="showCurrencyPop">
|
|
|
<currency-list
|
|
|
ref="currencyListDom"
|
|
|
+ :showGeneralLottery="true"
|
|
|
@selectCurrency="selectCurrency"
|
|
|
- @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
|
|
|
+ @setCurrencyList="setCurrentCurrencyInfo"
|
|
|
+ @addGeneralLottery="addCustomizedRewardHandle"></currency-list>
|
|
|
+ </div>
|
|
|
+ <!-- 通用奖品编辑弹窗 -->
|
|
|
+ <div class="customized-reward-edit-popup" v-if="showCustomizedRewardEditPopup">
|
|
|
+ <customized-reward-edit-popup
|
|
|
+ ref="rewardEditDom"
|
|
|
+ :customizedReward="baseFormData.customizedReward"
|
|
|
+ :rewardType="baseFormData.rewardType"
|
|
|
+ @closeRewardPopup="closeRewardPopup"
|
|
|
+ @removeReward="removeReward"
|
|
|
+ @submitReward="submitReward"></customized-reward-edit-popup>
|
|
|
</div>
|
|
|
<div class="currency-pop-select" v-show="showCurrencySelect">
|
|
|
<currency-select
|
|
@@ -111,17 +123,16 @@
|
|
|
<div class="item currency-select-wrapper">
|
|
|
<div>
|
|
|
<div class="label currency-select"
|
|
|
- :class="{'selected': currentCurrencyInfo.currencyCode}"
|
|
|
+ :class="{'selected': currencySelectCpd}"
|
|
|
@click="selectCurrencyPopHandle">
|
|
|
<img class="icon"
|
|
|
- v-if="currentCurrencyInfo.iconPath"
|
|
|
- :src="currentCurrencyInfo.iconPath"/>
|
|
|
+ v-if="currentIconCpd"
|
|
|
+ :src="currentIconCpd"/>
|
|
|
<div class="text">
|
|
|
- {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Select a reward'}}
|
|
|
+ {{currentPrizeCpd}}
|
|
|
</div>
|
|
|
<img class="arrow"
|
|
|
- :src="currentCurrencyInfo.currencyCode ?
|
|
|
- require('@/assets/svg/icon-form-arrow-down.svg') : require('@/assets/svg/icon-form-white-arrow-down.svg')"/>
|
|
|
+ :src="currentArrowCpd"/>
|
|
|
</div>
|
|
|
|
|
|
<!-- 刷新按钮、充值 -->
|
|
@@ -159,6 +170,7 @@
|
|
|
</div>
|
|
|
<input v-model="baseFormData.totalCount"
|
|
|
placeholder="0"
|
|
|
+ :disabled="baseFormData.rewardType === RewardType.custom"
|
|
|
@input="onCountInput"
|
|
|
@blur="onCountBlur"/>
|
|
|
</div>
|
|
@@ -291,10 +303,10 @@
|
|
|
<template v-else-if="showComType == 'preview'">
|
|
|
<div class="preview">
|
|
|
<div class="card"
|
|
|
- :class="{ center: Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) }">
|
|
|
+ :class="{ center: !isMoneyRewardCpd || Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) }">
|
|
|
<div class="card-title">
|
|
|
<img class="img"
|
|
|
- v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)"
|
|
|
+ v-if="isMoneyRewardCpd && Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)"
|
|
|
:src=" require('@/assets/subject/top-01.svg') " />
|
|
|
<div class="font">
|
|
|
Preview: <span>{{installStatus ? 'After' : 'Before' }}</span> DeNet Installed
|
|
@@ -311,7 +323,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 需充值 -->
|
|
|
- <div class="card-content" v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)">
|
|
|
+ <div class="card-content" v-if="isMoneyRewardCpd && Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)">
|
|
|
<template v-if="currentCurrencyInfo.currencyCode === 'USD'">
|
|
|
<div class="card-title">
|
|
|
<img class="img" :src=" require('@/assets/subject/top-02.svg') " />
|
|
@@ -371,6 +383,7 @@
|
|
|
<!-- paypal支付按钮 -->
|
|
|
<div class="payment" v-show="showComType == 'preview'">
|
|
|
<paypal-button
|
|
|
+ v-if="isMoneyRewardCpd"
|
|
|
:finalAmountData="finalAmountData"
|
|
|
:payConfig="{
|
|
|
paypalClientId,
|
|
@@ -395,6 +408,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</paypal-button>
|
|
|
+ <div v-else class="btn-wrap" @click="payStatusHandle(1)"><div class="custom-submit">Confirm</div></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -446,7 +460,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, getCurrentInstance } from "vue";
|
|
|
+import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, getCurrentInstance, computed } from "vue";
|
|
|
import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
|
|
|
import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
|
|
|
import { payCalcFee, getPayConfig } from "@/http/pay";
|
|
@@ -454,6 +468,7 @@ import { getFrontConfig } from "@/http/account";
|
|
|
import { uploadSignature, uploadFile } from '@/http/media';
|
|
|
import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
|
|
|
import { debounce, getBit } from "@/uilts/help"
|
|
|
+import { PlayType, RewardType } from '@/types';
|
|
|
import Report from "@/log-center/log"
|
|
|
import { ElMessage, ElLoading } from "element-plus";
|
|
|
import "element-plus/es/components/message/style/css";
|
|
@@ -475,6 +490,8 @@ import customCardCover from '@/view/components/custom-card-cover.vue'
|
|
|
|
|
|
const currentInstance = getCurrentInstance();
|
|
|
|
|
|
+import CustomizedRewardEditPopup from '@/view/iframe/publish/components/customized-reward-edit';
|
|
|
+
|
|
|
const config = {
|
|
|
number: 'BigNumber',
|
|
|
}
|
|
@@ -605,11 +622,12 @@ let baseFormData = reactive({
|
|
|
amountValue: "",
|
|
|
totalCount: "",
|
|
|
validityDuration: "",
|
|
|
- type: selectModeInfo.type
|
|
|
+ type: selectModeInfo.type,
|
|
|
+ rewardType: RewardType.money,
|
|
|
+ customizedReward: ""
|
|
|
});
|
|
|
|
|
|
-// 当前选择的货币信息
|
|
|
-let currentCurrencyInfo = ref({
|
|
|
+const defaultCurrentCurrencyInfo = {
|
|
|
currencyCode: "",
|
|
|
currencyName: "",
|
|
|
balance: "",
|
|
@@ -619,7 +637,10 @@ let currentCurrencyInfo = ref({
|
|
|
tokenChain: "",
|
|
|
tokenSymbol: "",
|
|
|
usdEstimateBalance: ""
|
|
|
-});
|
|
|
+}
|
|
|
+
|
|
|
+// 当前选择的货币信息
|
|
|
+let currentCurrencyInfo = ref(defaultCurrentCurrencyInfo);
|
|
|
|
|
|
const discordIptErrTxt = 'Discord invite link is wrong';
|
|
|
const discordIptEmptyErrTxt = 'Enter discord invite link';
|
|
@@ -695,6 +716,7 @@ let publishModeList = reactive([
|
|
|
|
|
|
let discordInviteInfo = ref({});
|
|
|
let showDiscordInvitePop = ref(false);
|
|
|
+let showCustomizedRewardEditPopup = ref(false);
|
|
|
|
|
|
let lotteryMaxHourDuration = 168;
|
|
|
|
|
@@ -705,6 +727,41 @@ const props = defineProps({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+//selected prize icon cpd
|
|
|
+let currentIconCpd = computed(() => {
|
|
|
+ if(baseFormData.rewardType === RewardType.custom) {
|
|
|
+ return require("@/assets/svg/icon-gift.svg");
|
|
|
+ } else {
|
|
|
+ return currentCurrencyInfo.value.iconPath;
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// selected prize cpd
|
|
|
+let currentPrizeCpd = computed(() => {
|
|
|
+ const {currencyCode, tokenSymbol} = currentCurrencyInfo.value
|
|
|
+ if(baseFormData.rewardType === RewardType.custom) {
|
|
|
+ return baseFormData.customizedReward;
|
|
|
+ } else if(currencyCode == "USD") {
|
|
|
+ return "USD";
|
|
|
+ } else {
|
|
|
+ return tokenSymbol || "Select a reward";
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+let currencySelectCpd = computed(() => {
|
|
|
+ return baseFormData.customizedReward || currentCurrencyInfo.value.currencyCode;
|
|
|
+})
|
|
|
+
|
|
|
+let currentArrowCpd = computed(() => {
|
|
|
+ if(baseFormData.rewardType === RewardType.custom) {
|
|
|
+ return require("@/assets/svg/icon-cell-arrow-right.svg");
|
|
|
+ } else {
|
|
|
+ return currentCurrencyInfo.value.currencyCode ? require("@/assets/svg/icon-form-arrow-down.svg") : require("@/assets/svg/icon-form-white-arrow-down.svg");
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+let isMoneyRewardCpd =computed(() => baseFormData.rewardType === RewardType.money);
|
|
|
+
|
|
|
watch(
|
|
|
() => props.dialogVisible,
|
|
|
(newVal) => {
|
|
@@ -776,12 +833,16 @@ const selectCurrencyPopHandle = () => {
|
|
|
pageSource: Report.pageSource.currencySelectorPage,
|
|
|
businessType: Report.businessType.pageView,
|
|
|
});
|
|
|
- showCurrencyPop.value = true;
|
|
|
- nextTick(() => {
|
|
|
- if(currencyListDom.value) {
|
|
|
- currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
|
|
|
- }
|
|
|
- })
|
|
|
+ if(baseFormData.rewardType === RewardType.custom) {
|
|
|
+ showCustomizedRewardEditPopup.value = true
|
|
|
+ } else {
|
|
|
+ showCurrencyPop.value = true;
|
|
|
+ nextTick(() => {
|
|
|
+ if(currencyListDom.value) {
|
|
|
+ currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -875,12 +936,16 @@ const selectCurrencyAfter = (params, openWindow = true) => {
|
|
|
resetFormIpt(false);
|
|
|
onIptSetErrorTxt();
|
|
|
}
|
|
|
+ baseFormData.customizedReward = "";
|
|
|
+ baseFormData.rewardType = RewardType.money;
|
|
|
}
|
|
|
|
|
|
const resetFormIpt = (clearMode = true) => {
|
|
|
baseFormData.amountValue = "";
|
|
|
baseFormData.totalCount = "";
|
|
|
baseFormData.validityDuration = "";
|
|
|
+ baseFormData.rewardType = RewardType.money;
|
|
|
+ baseFormData.customizedReward = "";
|
|
|
|
|
|
if(clearMode) {
|
|
|
selectModeInfo.index = 0;
|
|
@@ -1016,7 +1081,12 @@ const asyncTokenRechRecord = (cb) => {
|
|
|
* 提交表单请求
|
|
|
*/
|
|
|
const submitRequest = async () => {
|
|
|
- let { amountValue = 0, totalCount = 0 } = baseFormData;
|
|
|
+ let {
|
|
|
+ amountValue = 0,
|
|
|
+ totalCount = 0,
|
|
|
+ rewardType = RewardType.money,
|
|
|
+ customizedReward = ""
|
|
|
+ } = baseFormData;
|
|
|
baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
|
|
|
// 组装提交参数
|
|
|
|
|
@@ -1043,7 +1113,7 @@ const submitRequest = async () => {
|
|
|
let receiveConditions = openAntiBot.value ? "" : [];
|
|
|
|
|
|
let validityDuration = '';
|
|
|
- if(baseFormData.type == 2) {
|
|
|
+ if(baseFormData.type == PlayType.lottery) {
|
|
|
//小时转毫秒
|
|
|
let unit = process.env.NODE_ENV != 'production' ? 60 * 1000 : 60 * 60 * 1000;
|
|
|
// let unit = 60 * 60 * 1000
|
|
@@ -1054,16 +1124,23 @@ const submitRequest = async () => {
|
|
|
|
|
|
// 提交参数
|
|
|
let formData = {
|
|
|
- amountCurrencyCode: baseFormData.amountCurrencyCode,
|
|
|
amountValue,
|
|
|
totalCount,
|
|
|
finishConditions,
|
|
|
receiveConditions,
|
|
|
- payAmountValue: amountValue,
|
|
|
type: baseFormData.type,
|
|
|
posterType: 1,
|
|
|
- validityDuration
|
|
|
+ validityDuration,
|
|
|
+ rewardType
|
|
|
};
|
|
|
+ if(rewardType === RewardType.custom) {
|
|
|
+ // 通用奖品 类型的活动,添加奖品名称
|
|
|
+ formData.customizedReward = customizedReward;
|
|
|
+ } else {
|
|
|
+ // 货币类型 添加货币code
|
|
|
+ formData.amountCurrencyCode = baseFormData.amountCurrencyCode;
|
|
|
+ formData.payAmountValue = baseFormData.payAmountValue;
|
|
|
+ }
|
|
|
submitIng.value = true;
|
|
|
|
|
|
// 自定义封面
|
|
@@ -1242,6 +1319,11 @@ const onAmountInput = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(baseFormData.rewardType === RewardType.custom) {
|
|
|
+ val = val.replace(/^(0)*/, '').replace(/\./, ''); // 通用奖品类型 过滤掉起始位的0和小数点符号
|
|
|
+ baseFormData.totalCount = val;
|
|
|
+ }
|
|
|
+
|
|
|
baseFormData.amountValue = val;
|
|
|
setInputErrorMsg({from: 'amount', type:'input'});
|
|
|
|
|
@@ -1343,13 +1425,14 @@ const setInputErrorMsg = () => {
|
|
|
* 输入时 检测设置错误信息
|
|
|
*/
|
|
|
const onIptSetErrorTxt = (params = {}) => {
|
|
|
- if(!currentCurrencyInfo.value.currencyCode) {
|
|
|
+ if((baseFormData.rewardType === RewardType.money && !currentCurrencyInfo.value.currencyCode)
|
|
|
+ || (baseFormData.rewardType === RewardType.custom && !baseFormData.customizedReward)) {
|
|
|
iptErrMsgTxt.value = "Select a reward"
|
|
|
} else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
|
|
|
iptErrMsgTxt.value = "Enter an amount";
|
|
|
} else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
|
|
|
iptErrMsgTxt.value = "Enter the number of winners";
|
|
|
- } else if(+baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
|
|
|
+ } else if(baseFormData.rewardType === RewardType.money && +baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
|
|
|
// 输入金额 小于 余额
|
|
|
let res = calcIptValue();
|
|
|
if (!res.flag) {
|
|
@@ -1796,6 +1879,37 @@ const confirmData = (data) => {
|
|
|
close()
|
|
|
customPosterData.value = customPosterInfo.value;
|
|
|
}
|
|
|
+/**
|
|
|
+ * 显示通用奖品名称编辑框
|
|
|
+ */
|
|
|
+const addCustomizedRewardHandle = () => {
|
|
|
+ showCurrencyPop.value = false;
|
|
|
+ showCustomizedRewardEditPopup.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+const closeRewardPopup = () => {
|
|
|
+ showCustomizedRewardEditPopup.value = false;
|
|
|
+}
|
|
|
+
|
|
|
+const removeReward = () => {
|
|
|
+ showCustomizedRewardEditPopup.value = false;
|
|
|
+ resetFormIpt(false);
|
|
|
+ onIptSetErrorTxt();
|
|
|
+}
|
|
|
+
|
|
|
+// 提交通用奖品
|
|
|
+const submitReward = (reward) => {
|
|
|
+ if(baseFormData.customizedReward !== reward) {
|
|
|
+ // 有修改时,重置之前已提交的数据
|
|
|
+ resetFormIpt(false);
|
|
|
+ }
|
|
|
+ baseFormData.rewardType = RewardType.custom;
|
|
|
+ baseFormData.customizedReward = reward;
|
|
|
+ showCustomizedRewardEditPopup.value = false;
|
|
|
+ currentCurrencyInfo.value = defaultCurrentCurrencyInfo;
|
|
|
+ setLocalSelectCurrencyInfo(defaultCurrentCurrencyInfo);
|
|
|
+ onIptSetErrorTxt();
|
|
|
+}
|
|
|
|
|
|
onMounted(() => {
|
|
|
setFrontConfig();
|
|
@@ -2103,6 +2217,12 @@ onMounted(() => {
|
|
|
input::placeholder {
|
|
|
color: #c5c5c5;
|
|
|
}
|
|
|
+
|
|
|
+ input:disabled {
|
|
|
+ color: #c5c5c5;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
input {
|
|
|
padding-right: 16px;
|
|
|
}
|
|
@@ -2540,6 +2660,37 @@ onMounted(() => {
|
|
|
margin-left: -5px;
|
|
|
}
|
|
|
}
|
|
|
+ .btn-wrap {
|
|
|
+ width: 100%;
|
|
|
+ height: 80px;
|
|
|
+ background-color: #fff;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ box-shadow: 0px -1px 0px #ececec;
|
|
|
+ border-bottom-right-radius: 16px;
|
|
|
+ padding: 12px 30px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ border-bottom-left-radius: 16px;
|
|
|
+ z-index: 999;
|
|
|
+ .custom-submit {
|
|
|
+ width: 200px;
|
|
|
+ height: 50px;
|
|
|
+ background: #1D9BF0;
|
|
|
+ border-radius: 50px;
|
|
|
+ font-weight: 700;
|
|
|
+ font-size: 18px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ letter-spacing: 0.3px;
|
|
|
+ color: #FFFFFF;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
.dialog {
|