|
@@ -165,7 +165,6 @@
|
|
class="top-up"
|
|
class="top-up"
|
|
@click="goTopUp">Deposit</div>
|
|
@click="goTopUp">Deposit</div>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
<div class="usd-min-message" v-show="isShowUsdMinMessage" v-html="checkUsdMinNumber('inTemplate')"></div>
|
|
<div class="usd-min-message" v-show="isShowUsdMinMessage" v-html="checkUsdMinNumber('inTemplate')"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -217,6 +216,11 @@
|
|
@blur="onUsdEstimateFansUnitAmountInput"/>
|
|
@blur="onUsdEstimateFansUnitAmountInput"/>
|
|
</template>
|
|
</template>
|
|
</form-input>
|
|
</form-input>
|
|
|
|
+ <div style="color: #7E7E7E;font-weight: 400;
|
|
|
|
+font-size: 12px;margin-left: 10px;" v-if="treasureFormData.addFans">
|
|
|
|
+ <div>Approximately</div>
|
|
|
|
+ {{treasureFormData.addFans}} New Follower
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -760,6 +764,7 @@ let toolBoxPageData = reactive({
|
|
let treasureFormData = reactive({
|
|
let treasureFormData = reactive({
|
|
usdEstimateOrderAmount: '',
|
|
usdEstimateOrderAmount: '',
|
|
usdEstimateFansUnitAmount: '',
|
|
usdEstimateFansUnitAmount: '',
|
|
|
|
+ addFans: ''
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
@@ -1405,6 +1410,14 @@ const calcUsd2TokenEstimate = (params) => {
|
|
return val;
|
|
return val;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const calcAddFans = (params = {}) => {
|
|
|
|
+ let {totalAmount, unitPrice} = params;
|
|
|
|
+ if (totalAmount > 0 && unitPrice > 0) {
|
|
|
|
+ let count = Math.floor(totalAmount / unitPrice);
|
|
|
|
+ return count;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
const onUsdEstimateOrderAmountInput = () => {
|
|
const onUsdEstimateOrderAmountInput = () => {
|
|
let val = treasureFormData.usdEstimateOrderAmount;
|
|
let val = treasureFormData.usdEstimateOrderAmount;
|
|
val = val.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
|
|
val = val.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
|
|
@@ -1423,8 +1436,16 @@ const onUsdEstimateFansUnitAmountInput = () => {
|
|
if(val == '00') {
|
|
if(val == '00') {
|
|
val = '0'
|
|
val = '0'
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(val > treasureFormData.usdEstimateOrderAmount) {
|
|
|
|
+ val = treasureFormData.usdEstimateOrderAmount
|
|
|
|
+ }
|
|
|
|
+
|
|
treasureFormData.usdEstimateFansUnitAmount = val;
|
|
treasureFormData.usdEstimateFansUnitAmount = val;
|
|
calcTokenEstimate({type: 'FANS_AMOUNT'});
|
|
calcTokenEstimate({type: 'FANS_AMOUNT'});
|
|
|
|
+
|
|
|
|
+ treasureFormData.addFans = calcAddFans({totalAmount: treasureFormData.usdEstimateOrderAmount, unitPrice: val});
|
|
|
|
+
|
|
onIptSetErrorTxt();
|
|
onIptSetErrorTxt();
|
|
return val;
|
|
return val;
|
|
}
|
|
}
|
|
@@ -1435,8 +1456,16 @@ const onFansUnitAmountInput = () => {
|
|
if(val == '00') {
|
|
if(val == '00') {
|
|
val = '0'
|
|
val = '0'
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(+val > +baseFormData.amountValue) {
|
|
|
|
+ val = baseFormData.amountValue
|
|
|
|
+ }
|
|
|
|
+
|
|
baseFormData.fansUnitAmountValue = val;
|
|
baseFormData.fansUnitAmountValue = val;
|
|
calcUsdEstimate({type: 'FANS_AMOUNT'});
|
|
calcUsdEstimate({type: 'FANS_AMOUNT'});
|
|
|
|
+
|
|
|
|
+ treasureFormData.addFans = calcAddFans({totalAmount: baseFormData.amountValue, unitPrice: val});
|
|
|
|
+
|
|
onIptSetErrorTxt();
|
|
onIptSetErrorTxt();
|
|
return val;
|
|
return val;
|
|
};
|
|
};
|
|
@@ -1574,8 +1603,7 @@ const checkUsdMinNumber = (isInTemplate) => {
|
|
const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? math.format(math.evaluate(amountValue * usdPrice)) < currentLuckDropConfig.minTotalUsdAmount : false;
|
|
const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? math.format(math.evaluate(amountValue * usdPrice)) < currentLuckDropConfig.minTotalUsdAmount : false;
|
|
const isAvgForbidden = currentLuckDropConfig?.minAvgUsdAmount ? math.format(math.evaluate(amountValue / totalCount * usdPrice)) < currentLuckDropConfig.minAvgUsdAmount : false;
|
|
const isAvgForbidden = currentLuckDropConfig?.minAvgUsdAmount ? math.format(math.evaluate(amountValue / totalCount * usdPrice)) < currentLuckDropConfig.minAvgUsdAmount : false;
|
|
forbiddenText = isAmountForbidden && isAvgForbidden ?
|
|
forbiddenText = isAmountForbidden && isAvgForbidden ?
|
|
- `The prize pool must be above
|
|
|
|
- ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
|
|
|
|
|
|
+ `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
|
|
or the average prize must be above
|
|
or the average prize must be above
|
|
${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
|
|
${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
|
|
: '';
|
|
: '';
|
|
@@ -1584,11 +1612,45 @@ const checkUsdMinNumber = (isInTemplate) => {
|
|
return forbiddenText;
|
|
return forbiddenText;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const checkTreasureAmountRange = (params = {}) => {
|
|
|
|
+ let {type, amount, maxAmount} = params;
|
|
|
|
+ let forbiddenText = '';
|
|
|
|
+
|
|
|
|
+ const { usdPrice, minAmount, luckdropPostConfig = [] } = currentCurrencyInfo.value;
|
|
|
|
+ let currentLuckDropConfig = luckdropPostConfig.find(item => item.luckdropType === selectModeInfo.type);
|
|
|
|
+
|
|
|
|
+ if (currentLuckDropConfig?.usdLimitEnable === 1) {
|
|
|
|
+ if (currentLuckDropConfig?.minTotalUsdAmount === 0 || currentLuckDropConfig?.minAvgUsdAmount === 0) {
|
|
|
|
+ // 当前token允许的usd最小金额为0 或单个红包最小金额为0,则无限制
|
|
|
|
+ return forbiddenText;
|
|
|
|
+ } else {
|
|
|
|
+ let amount2Usd = +math.format(math.evaluate(amount * usdPrice));
|
|
|
|
+ switch (type) {
|
|
|
|
+ case 'TOTAL_AMOUNT':
|
|
|
|
+ forbiddenText = amount2Usd > currentLuckDropConfig?.minTotalUsdAmount ? '' : `要大于${currentLuckDropConfig?.minTotalUsdAmount}最小总金额`;
|
|
|
|
+ break;
|
|
|
|
+ case 'FANS_UNIT_AMOUNT':
|
|
|
|
+ forbiddenText = amount > minAmount && amount2Usd > currentLuckDropConfig?.minAvgUsdAmount ? '' : `要大于${currentLuckDropConfig?.minAvgUsdAmount}最小平均金额`;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return forbiddenText;
|
|
|
|
+};
|
|
|
|
+
|
|
const treasureFormValidata = () => {
|
|
const treasureFormValidata = () => {
|
|
if(!currentCurrencyInfo.value.currencyCode) {
|
|
if(!currentCurrencyInfo.value.currencyCode) {
|
|
iptErrMsgTxt.value = "Select a reward"
|
|
iptErrMsgTxt.value = "Select a reward"
|
|
} else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
|
|
} else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
|
|
iptErrMsgTxt.value = "Enter an amount";
|
|
iptErrMsgTxt.value = "Enter an amount";
|
|
|
|
+ } else if (iptErrMsgTxt.value = checkTreasureAmountRange({type: 'TOTAL_AMOUNT', amount: baseFormData.amountValue})) {
|
|
|
|
+ //amount 是否大于 最小总金额
|
|
|
|
+
|
|
|
|
+ } else if (!baseFormData.fansUnitAmountValue) {
|
|
|
|
+ // 输入粉丝单价
|
|
|
|
+ iptErrMsgTxt.value = '请输入粉丝单价';
|
|
|
|
+ } else if(iptErrMsgTxt.value = checkTreasureAmountRange({type: 'FANS_UNIT_AMOUNT', amount: baseFormData.fansUnitAmountValue, maxAmount: baseFormData.amountValue})) {
|
|
|
|
+ // 粉丝单价是否 小于总金额规则 大于最小粉丝单价 、大于币种最小精度
|
|
} else {
|
|
} else {
|
|
iptErrMsgTxt.value = "";
|
|
iptErrMsgTxt.value = "";
|
|
}
|
|
}
|