wenliming 2 лет назад
Родитель
Сommit
26edcca02b

+ 9 - 0
src/http/treasureApi.js

@@ -0,0 +1,9 @@
+import { service } from "./request";
+
+export function upGainCalculate(params) {
+    return service({
+        url: `/post/treasure/upGainCalculate`,
+        method: 'post',
+        data: params
+    })
+}

+ 3 - 2
src/view/components/custom-card-cover.vue

@@ -80,11 +80,11 @@
             </div>
 
             <div class="treasure-row-2">
-                Your Gain Up to $ <div class="amount">1</div>
+                Your Gain Up to $ <div class="amount">{{data.upGainAmountUsdValue}}</div>
             </div>
 
             <div class="treasure-row-3" :style="{'visibility': data.currencyCode? 'visible' : 'hidden'}">
-                <img class="img" :src="data.currencyIconUrl" /> <span class="txt"> SHIB equivalent (Crypto)</span>
+                <img class="img" :src="data.currencyIconUrl" /> <span class="txt"> {{data.tokenSymbol}} equivalent (Crypto)</span>
             </div>
 
             <img class="img-treasure-big" :src="require('@/assets/img/icon-card-cover-treasure-big.png')">
@@ -162,6 +162,7 @@ const props = defineProps({
                 },
                 rewardType: RewardType.money,
                 customizedReward: "",
+                upGainAmountUsdValue: ""
             };
         },
     },

+ 1 - 1
src/view/components/custom-card-horizontal-cover.vue

@@ -75,7 +75,7 @@
                         <div class="item">
                             <img class="icon" 
                                 :src="require('@/assets/svg/icon-preview-trophy.svg')" />
-                            5000 Winners
+                            {{data.addFans}} Winners
                         </div>
                         <div class="item">
                             <img class="icon" :src="data.currencyIconUrl">

+ 6 - 0
src/view/iframe/publish/components/preview-card.vue

@@ -33,6 +33,7 @@
                             },
                             rewardType: baseFormData.rewardType,
                             customizedReward: baseFormData.customizedReward,
+                            upGainAmountUsdValue: upGainAmountUsdValue
                         }"></custom-card-cover>
                     </div>
                 </div>
@@ -68,6 +69,7 @@
                             type: baseFormData.type,
                             validityDuration: baseFormData.validityDuration,
                             customPosterUrl: customPosterInfo && customPosterInfo.before && customPosterInfo.before.imagePath || '',
+                            addFans: baseFormData.addFans,
                             userInfo: {
                                 nickName: userInfo.name,
                                 avatarUrl: userInfo.avatarUrl
@@ -134,6 +136,10 @@ defineProps({
             }
         }
     },
+    upGainAmountUsdValue: {
+        type: String,
+        default: ''
+    }
 })
 
 const getUserInfo = (cb) => {

+ 8 - 2
src/view/iframe/publish/components/preview-sheet.vue

@@ -23,7 +23,8 @@
                     :postData="publishRes"
                     :baseFormData="baseFormData" 
                     :amountFontSize="previewFontSize" 
-                    :customPosterInfo="customPosterData">
+                    :customPosterInfo="customPosterData"
+                    :upGainAmountUsdValue="upGainAmountUsdValue">
                 </preview-card>
             </div>
         </div>
@@ -118,7 +119,8 @@ const props = defineProps({
                 validityDuration: "",
                 type: selectModeInfo.type,
                 rewardType: RewardType.money,
-                customizedReward: ""
+                customizedReward: "",
+                addFans: ''
             }
         },
     },
@@ -160,6 +162,10 @@ const props = defineProps({
                 requestAmountValue: 0,
             }
         }
+    },
+    upGainAmountUsdValue: {
+        type: String, 
+        default: ''
     }
 });
 

+ 29 - 2
src/view/iframe/publish/give-dialog.vue

@@ -333,6 +333,7 @@
                                         ...baseFormData,
                                         ...currentCurrencyInfo,
                                         usdEstimateOrderAmount: treasureFormData.usdEstimateOrderAmount,
+                                        upGainAmountUsdValue: treasureFormData.upGainAmountUsdValue,
                                         currencyIconUrl: currentCurrencyInfo.iconPath,
                                         customPosterUrl: customPosterInfo && customPosterInfo.after && customPosterInfo.after.imagePath || '',
                                         userInfo: {
@@ -362,7 +363,12 @@
 
                         <!-- 预览 -->
                         <template v-else-if="showComType == 'preview'">
-                            <preview-sheet :baseFormData="baseFormData"
+                            <preview-sheet 
+                                :baseFormData="{
+                                    ...baseFormData,
+                                    addFans: treasureFormData.addFans,
+                                }"
+                                :upGainAmountUsdValue="treasureFormData.upGainAmountUsdValue"
                                 :currentCurrencyInfo="currentCurrencyInfo"
                                 :tempCurrentCurrencyInfo="tempCurrentCurrencyInfo"
                                 :publishRes="publishRes"
@@ -475,6 +481,7 @@ import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, pr
 import { postPublish, syncChainTokenRechargeRecord, getCurrencyInfoByCode, getUser } from "@/http/publishApi";
 import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
 import { payCalcFee, getPayConfig } from "@/http/pay";
+import { upGainCalculate } from "@/http/treasureApi";
 import { getFrontConfig, calcRechargePayAmount } from "@/http/account";
 import { uploadSignature, uploadFile } from '@/http/media';
 import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
@@ -773,7 +780,8 @@ let toolBoxPageData = reactive({
 let treasureFormData = reactive({
     usdEstimateOrderAmount: '',
     usdEstimateFansUnitAmount: '',
-    addFans: ''
+    addFans: '',
+    upGainAmountUsdValue: 0,
 })
 
 
@@ -1487,11 +1495,30 @@ const calcUsd2TokenEstimate = (params) => {
 const calcAddFans = (params = {}) => {
     let {totalAmount, unitPrice} = params;
     if (totalAmount > 0 && unitPrice > 0) {
+        setUpGainAmountUsdValue(params);
+
         let count = Math.floor(totalAmount / unitPrice);
         return count;
     }
 };
 
+const setUpGainAmountUsdValue = (params) => {
+    const { usdPrice, currencyCode } = currentCurrencyInfo.value;
+    let {totalAmount, unitPrice} = params;
+    if(!currencyCode) return;
+    upGainCalculate({
+        params: {
+            amountValue: totalAmount,
+            currencyUsdPrice: usdPrice,
+            fansUnitAmountValue: unitPrice
+        }
+    }).then(res => {
+        if(res.code == 0 && res.data) {
+            treasureFormData.upGainAmountUsdValue = res.data.upGainAmountUsdValue
+        }
+    })
+}
+
 /**
  * 奖励总金额 美元估值
  */