|  | @@ -236,7 +236,9 @@
 | 
	
		
			
				|  |  |                              </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                              <div class="submit-btn-wrapper">
 | 
	
		
			
				|  |  | -                                <div class="submit-btn" @click="confirm">
 | 
	
		
			
				|  |  | +                                <div class="submit-btn"
 | 
	
		
			
				|  |  | +                                    :class="{ 'disabled-submit': iptErrMsgTxt != '' }"
 | 
	
		
			
				|  |  | +                                    @click="confirm">
 | 
	
		
			
				|  |  |                                      <img
 | 
	
		
			
				|  |  |                                          class="icon-loading"
 | 
	
		
			
				|  |  |                                          v-if="submitIng"
 | 
	
	
		
			
				|  | @@ -244,7 +246,7 @@
 | 
	
		
			
				|  |  |                                              require('../../assets/svg/icon-btn-loading.svg')
 | 
	
		
			
				|  |  |                                          "
 | 
	
		
			
				|  |  |                                      />
 | 
	
		
			
				|  |  | -                                    NEXT
 | 
	
		
			
				|  |  | +                                    {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
 | 
	
		
			
				|  |  |                                  </div>
 | 
	
		
			
				|  |  |                              </div>
 | 
	
		
			
				|  |  |                          </div>
 | 
	
	
		
			
				|  | @@ -291,6 +293,7 @@ import { ref, watch, reactive, defineProps, defineEmits, onMounted } from "vue";
 | 
	
		
			
				|  |  |  import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord } from "../../http/publishApi";
 | 
	
		
			
				|  |  |  import { payCalcFee, getPayConfig } from "../../http/pay";
 | 
	
		
			
				|  |  |  import { getFrontConfig } from "../../http/account";
 | 
	
		
			
				|  |  | +import { scaleNumber } from "../../uilts/help"
 | 
	
		
			
				|  |  |  import { ElMessage, ElLoading } from "element-plus";
 | 
	
		
			
				|  |  |  import "element-plus/es/components/message/style/css";
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -327,7 +330,8 @@ let dialogHeight = ref(680);
 | 
	
		
			
				|  |  |  let submitIng = ref(false);
 | 
	
		
			
				|  |  |  // 艾特关注人列表
 | 
	
		
			
				|  |  |  let atUserList = ref([]);
 | 
	
		
			
				|  |  | -let iptErrMsgTxt = ref("");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +let iptErrMsgTxt = ref("Please enter the ‘reward’ amount");
 | 
	
		
			
				|  |  |  // 是否返回
 | 
	
		
			
				|  |  |  let isBack = ref(false);
 | 
	
		
			
				|  |  |  // 展示消息提示 
 | 
	
	
		
			
				|  | @@ -451,7 +455,7 @@ const getPayAmount = async (amountValue) => {
 | 
	
		
			
				|  |  |          params: {
 | 
	
		
			
				|  |  |              amountValue,
 | 
	
		
			
				|  |  |              currencyCode: currentCurrencyInfo.value.currencyCode,
 | 
	
		
			
				|  |  | -            payNetwork: 'paypal',
 | 
	
		
			
				|  |  | +            payChannel: 'paypal',
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      if (res.code == 0) {
 | 
	
	
		
			
				|  | @@ -465,16 +469,13 @@ const getPayAmount = async (amountValue) => {
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const confirm = () => {
 | 
	
		
			
				|  |  | -    if (submitIng.value) {
 | 
	
		
			
				|  |  | +    if (submitIng.value || iptErrMsgTxt) {
 | 
	
		
			
				|  |  |          return;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      let { totalCount = 0 } = baseFormData;
 | 
	
		
			
				|  |  |      if (!totalCount) {
 | 
	
		
			
				|  |  |          return;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    if (!calcIptValue()) {
 | 
	
		
			
				|  |  | -        return;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |      submitRequest();
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -631,26 +632,6 @@ const submitRequest = async () => {
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -/**
 | 
	
		
			
				|  |  | - * 输入结果计算、校验
 | 
	
		
			
				|  |  | - */
 | 
	
		
			
				|  |  | -const calcIptValue = (cb) => {
 | 
	
		
			
				|  |  | -    let amountValue = baseFormData.amountValue;
 | 
	
		
			
				|  |  | -    let totalCount = baseFormData.totalCount;
 | 
	
		
			
				|  |  | -    let flag = true;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    if (!amountValue || !totalCount) {
 | 
	
		
			
				|  |  | -        return flag;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    //每人平均要分到大于 0.01美元(1美分)
 | 
	
		
			
				|  |  | -    if ((amountValue * 100) / totalCount < 1) {
 | 
	
		
			
				|  |  | -        flag = false;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    cb && cb(flag);
 | 
	
		
			
				|  |  | -    return flag;
 | 
	
		
			
				|  |  | -};
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 初始化提交参数
 | 
	
		
			
				|  |  |   */
 | 
	
	
		
			
				|  | @@ -772,11 +753,15 @@ const onCountInput = () => {
 | 
	
		
			
				|  |  |  const onAmountBlur = () => {
 | 
	
		
			
				|  |  |      if (!baseFormData.amountValue) {
 | 
	
		
			
				|  |  |          iptErrMsgTxt.value =
 | 
	
		
			
				|  |  | -            "Please enter the giveaways amount in USD input box.";
 | 
	
		
			
				|  |  | +            "Please enter the ‘reward’ amount";
 | 
	
		
			
				|  |  |      } else {
 | 
	
		
			
				|  |  |          setIptAmountErrorMsg((res) => {
 | 
	
		
			
				|  |  | -            if (res) {
 | 
	
		
			
				|  |  | -                iptErrMsgTxt.value = "";
 | 
	
		
			
				|  |  | +            if (res.flag) {
 | 
	
		
			
				|  |  | +                if(!baseFormData.totalCount) {
 | 
	
		
			
				|  |  | +                    iptErrMsgTxt.value = "Please enter the ‘winners' amount";
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    iptErrMsgTxt.value = "";
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -788,31 +773,80 @@ const onAmountBlur = () => {
 | 
	
		
			
				|  |  |  const onCountBlur = () => {
 | 
	
		
			
				|  |  |      if (!baseFormData.totalCount) {
 | 
	
		
			
				|  |  |          iptErrMsgTxt.value =
 | 
	
		
			
				|  |  | -            "Please enter the number of giveaways in Quantity input box.";
 | 
	
		
			
				|  |  | +            "Please enter the ‘winners' amount";
 | 
	
		
			
				|  |  |      } else {
 | 
	
		
			
				|  |  |          setIptAmountErrorMsg((res) => {
 | 
	
		
			
				|  |  | -            if (res) {
 | 
	
		
			
				|  |  | +            if (res.flag) {
 | 
	
		
			
				|  |  |                  iptErrMsgTxt.value = "";
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 输入结果计算、校验
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +const calcIptValue = (cb) => {
 | 
	
		
			
				|  |  | +    let amountValue = baseFormData.amountValue;
 | 
	
		
			
				|  |  | +    let totalCount = baseFormData.totalCount;
 | 
	
		
			
				|  |  | +    let flag = true;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (!amountValue || !totalCount) {
 | 
	
		
			
				|  |  | +        return {
 | 
	
		
			
				|  |  | +            flag
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    let num = amountValue, scale = 1;
 | 
	
		
			
				|  |  | +    if(amountValue.indexOf('.') > -1) {
 | 
	
		
			
				|  |  | +        num = amountValue.toString();
 | 
	
		
			
				|  |  | +        let obj = scaleNumber(num);
 | 
	
		
			
				|  |  | +        num = obj.val;
 | 
	
		
			
				|  |  | +        scale = obj.scale;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let minAmount = currentCurrencyInfo.value.minAmount;
 | 
	
		
			
				|  |  | +    // 输入的token数量或者法币金额,平均分到每个红包,是否小于最小单位
 | 
	
		
			
				|  |  | +    if (num / totalCount  < minAmount * scale) {
 | 
	
		
			
				|  |  | +        flag = false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    console.log('minAmount')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    cb && cb(flag);
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +        flag,
 | 
	
		
			
				|  |  | +        count: math.floor((num / minAmount * scale)/ (scale * scale))
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 输入金额提示语
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  const setIptAmountErrorMsg = (cb) => {
 | 
	
		
			
				|  |  | -    let res = calcIptValue();
 | 
	
		
			
				|  |  | -    if (!res) {
 | 
	
		
			
				|  |  | -        iptErrMsgTxt.value = `If you wish to send ${
 | 
	
		
			
				|  |  | -            baseFormData.totalCount
 | 
	
		
			
				|  |  | -        } red packets, please send USD amount > $${
 | 
	
		
			
				|  |  | -            baseFormData.totalCount * 0.01
 | 
	
		
			
				|  |  | -        }`;
 | 
	
		
			
				|  |  | -    } else {
 | 
	
		
			
				|  |  | -        iptErrMsgTxt.value = "";
 | 
	
		
			
				|  |  | +    let amountValue = baseFormData.amountValue;
 | 
	
		
			
				|  |  | +    let num = amountValue, scale = 1;
 | 
	
		
			
				|  |  | +    if(amountValue.indexOf('.') > -1) {
 | 
	
		
			
				|  |  | +        num = amountValue.toString();
 | 
	
		
			
				|  |  | +        let obj = scaleNumber(num);
 | 
	
		
			
				|  |  | +        num = obj.val;
 | 
	
		
			
				|  |  | +        scale = obj.scale;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    cb && cb(res);
 | 
	
		
			
				|  |  | +    if(num < currentCurrencyInfo.value.balance * scale) {
 | 
	
		
			
				|  |  | +        let res = calcIptValue();
 | 
	
		
			
				|  |  | +        if (!res.flag) {
 | 
	
		
			
				|  |  | +            iptErrMsgTxt.value = `Please reduce the 'winners' amount to ${res.count}`;
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            if(!baseFormData.totalCount) {
 | 
	
		
			
				|  |  | +                iptErrMsgTxt.value = "Please enter the ‘winners' amount";
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                iptErrMsgTxt.value = "";
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        cb && cb(res);
 | 
	
		
			
				|  |  | +    } else if(currentCurrencyInfo.value.currencyCode != 'USD') {
 | 
	
		
			
				|  |  | +        iptErrMsgTxt.value = `Insufficient ${currentCurrencyInfo.value.currencyName} balance, please recharge`;
 | 
	
		
			
				|  |  | +    } 
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -1297,6 +1331,10 @@ onMounted(() => {
 | 
	
		
			
				|  |  |                              margin-right: 3px;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    .disabled-submit {
 | 
	
		
			
				|  |  | +                        background-color: #D9D9D9; 
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 |