Browse Source

Merge branch 'dev_1.1.5-1' of https://git.yishihui.com/DeNet/de-net into dev_1.1.5-1

zhangwei 2 years ago
parent
commit
f0a50925fb

+ 29 - 6
src/view/components/input-action-sheet.vue

@@ -12,6 +12,9 @@
                     @input="onValueInput"
                     @input="onValueInput"
                     @blur="onValueBlur">
                     @blur="onValueBlur">
             </div>
             </div>
+            <div class="desc">
+                {{desc}}
+            </div>
             <div class="btn-wrapper">
             <div class="btn-wrapper">
                 <div class="btn cancel" @click="cancel">
                 <div class="btn cancel" @click="cancel">
                     {{cancelText}}
                     {{cancelText}}
@@ -25,7 +28,7 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import { ref, defineProps, defineEmits } from "vue";
+import { ref, defineProps, defineEmits, watch } from "vue";
 
 
 let inputVal = ref('');
 let inputVal = ref('');
 
 
@@ -50,16 +53,28 @@ const props = defineProps({
         type: String,
         type: String,
         default: 'Continue',
         default: 'Continue',
     },
     },
+    desc: {
+        type: String,
+        defautl: ''
+    }
 });
 });
 
 
-const emits = defineEmits(["cancel", "confirm"]);
+watch(() => props.visible, (newVal) => {
+    if(!newVal) {
+        inputVal.value = ''
+    }
+})
+
+const emits = defineEmits(["cancel", "confirm", "onInput"]);
 
 
 const onValueInput = () => {
 const onValueInput = () => {
-    inputValHandler();
+    let val = inputValHandler();
+    emits("onInput", { inputVal: val });
+    return val;
 }
 }
 
 
 const onValueBlur = () => {
 const onValueBlur = () => {
-    inputValHandler();
+    return inputValHandler();
 }
 }
 
 
 
 
@@ -79,6 +94,7 @@ const inputValHandler = () => {
     }
     }
 
 
     inputVal.value = val;
     inputVal.value = val;
+
     return val;
     return val;
 }
 }
 
 
@@ -127,7 +143,7 @@ const confirm = () => {
             border-radius: 5px;
             border-radius: 5px;
             box-sizing: border-box;
             box-sizing: border-box;
             height: 42px;
             height: 42px;
-            margin: 17px 0 23px 0;
+            margin: 17px 0 10px 0;
 
 
             .input {
             .input {
                 width: 100%;
                 width: 100%;
@@ -145,10 +161,17 @@ const confirm = () => {
                 color: #B3B3B3;
                 color: #B3B3B3;
             }
             }
         }
         }
-
+        
+        .desc {
+            font-weight: 500;
+            font-size: 13px;
+            color: #888888;
+            height: 40px;
+        }
         .btn-wrapper {
         .btn-wrapper {
             display: flex;
             display: flex;
             justify-content: space-between;
             justify-content: space-between;
+            margin-top: 20px;
 
 
             .btn {
             .btn {
                 width: 150px;
                 width: 150px;

+ 7 - 7
src/view/components/popup-withdraw.vue

@@ -33,8 +33,7 @@
                                 v-model="requestWithdrawParams.amountValue" 
                                 v-model="requestWithdrawParams.amountValue" 
                                 placeholder="$0"
                                 placeholder="$0"
                                 style="width: 220px"
                                 style="width: 220px"
-                                @input="onAmountInput" 
-                                @blur="onAmountBlur" />
+                                @input="onAmountInput"  />
                             <div @click="withdrawalAll" class="withdrawal-all-btn">
                             <div @click="withdrawalAll" class="withdrawal-all-btn">
                                 Withdrawal All
                                 Withdrawal All
                             </div>
                             </div>
@@ -188,12 +187,14 @@ const withdrawCalcAmount = () => {
         if (res.code == 0) {
         if (res.code == 0) {
             finalWithdrawalAmount.value = res.data.finalAmountValue;
             finalWithdrawalAmount.value = res.data.finalAmountValue;
         }
         }
+    }).catch(err => {
+        calcReq.value = false;
     })
     })
 }
 }
 
 
 const withdrawCalcAmountDebounce = debounce(function () {
 const withdrawCalcAmountDebounce = debounce(function () {
     withdrawCalcAmount();
     withdrawCalcAmount();
-}, 1000)
+}, 300)
 
 
 /**
 /**
  * 提现
  * 提现
@@ -233,10 +234,9 @@ const withdraw = () => {
         } else {
         } else {
             console.log(res);
             console.log(res);
         }
         }
-    })
-        .catch((err) => {
-            console.log(err);
-        });
+    }).catch((err) => {
+        console.log(err);
+    });
 };
 };
 
 
 const onAmountBlur = () => {
 const onAmountBlur = () => {

+ 5 - 1
src/view/iframe/publish/components/pay-button.vue

@@ -7,7 +7,7 @@
                 v-show="currentCurrencyInfo.currencyCode == 'USD'">
                 v-show="currentCurrencyInfo.currencyCode == 'USD'">
                 <div class="token-pay" 
                 <div class="token-pay" 
                     @click="clickPayUSD">
                     @click="clickPayUSD">
-                    Pay {{finalAmountData.rechargeAmountValue > 0 ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}} {{currentCurrencyInfo.tokenSymbol}}
+                    Pay {{finalAmountData.rechargeAmountValue > 0 && USDepositStatus != 'SUCCESS' ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}} {{currentCurrencyInfo.tokenSymbol}}
                 </div>
                 </div>
 
 
                 <!-- <iframe
                 <!-- <iframe
@@ -60,6 +60,10 @@ const props = defineProps({
 
 
         }
         }
     },
     },
+    USDepositStatus: {
+        type: String,
+        default: 'DEFAULT'
+    }
 });
 });
 
 
 let iframe = ref(null);
 let iframe = ref(null);

+ 15 - 24
src/view/iframe/publish/give-dialog.vue

@@ -312,6 +312,7 @@
                                     postId
                                     postId
                                 }"
                                 }"
                                 :currentCurrencyInfo="currentCurrencyInfo"
                                 :currentCurrencyInfo="currentCurrencyInfo"
+                                :USDepositStatus = "USDepositStatus"
                                 @showDepositMask="showDepositMessageBox = true"
                                 @showDepositMask="showDepositMessageBox = true"
                                 @payFinish="payFinish">
                                 @payFinish="payFinish">
                                 <template v-slot:balance>
                                 <template v-slot:balance>
@@ -448,6 +449,8 @@ let dialogStyle = reactive({
     dialogContentWidth: 1100
     dialogContentWidth: 1100
 })
 })
 
 
+let USDepositStatus = ref('DEFAULT');
+
 let cropperOption = ref({
 let cropperOption = ref({
     img: '',
     img: '',
     full: true,
     full: true,
@@ -813,27 +816,6 @@ const selectCurrencyPopHandle = () => {
     }
     }
 }
 }
 
 
-/**
- * 获取实际支付金额
- */
-const getPayAmount = async (amountValue) => {
-    let res = await payCalcFee({
-        params: {
-            amountValue,
-            currencyCode: currentCurrencyInfo.value.currencyCode,
-            payChannel: 'ach',
-        },
-    });
-    if (res.code == 0) {
-        let { finalAmountValue, feeDesc } = res.data;
-        payConfig.value.feeDesc = feeDesc;
-        if (finalAmountValue > 0) {
-            finalAmountData.value = res.data;
-        }
-    }
-    return res.data;
-};
-
 const saveDiscordGuildInfo = () => {
 const saveDiscordGuildInfo = () => {
     let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
     let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
     //保存服务器信息 
     //保存服务器信息 
@@ -1869,8 +1851,17 @@ const submitReward = (reward) => {
     onIptSetErrorTxt();
     onIptSetErrorTxt();
 }
 }
 
 
-const depositAchCancel = () => {
+const depositAchCancel = async () => {
     showDepositMessageBox.value = false;
     showDepositMessageBox.value = false;
+    let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
+
+    if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
+        currentCurrencyInfo.value = currencyInfoRes.data;
+        let {balance} = currencyInfoRes.data;
+        if(balance >= finalAmountData.value.orderAmountValue) {
+            USDepositStatus.value = 'SUCCESS';
+        }
+    }
 }
 }
 
 
 const depositAchConfirm = async () => {
 const depositAchConfirm = async () => {
@@ -1881,8 +1872,8 @@ const depositAchConfirm = async () => {
         currentCurrencyInfo.value = currencyInfoRes.data;
         currentCurrencyInfo.value = currencyInfoRes.data;
 
 
         let {balance} = currencyInfoRes.data;
         let {balance} = currencyInfoRes.data;
-        if(balance > finalAmountData.value.orderAmountValue) {
-            // payButtonDom.value && payButtonDom.value.balancePay();
+        if(balance >= finalAmountData.value.orderAmountValue) {
+            USDepositStatus.value = 'SUCCESS';
         } else {
         } else {
             message.info('Deposit failed, please try again later');
             message.info('Deposit failed, please try again later');
         }
         }

+ 39 - 12
src/view/popup/currency-detail.vue

@@ -62,7 +62,9 @@
     <input-action-sheet 
     <input-action-sheet 
       :visible="showDepositInput"
       :visible="showDepositInput"
       title="Enter the USD amount to be deposited"
       title="Enter the USD amount to be deposited"
+      :desc="depositDesc"
       position="absolute"
       position="absolute"
+      @onInput="onDepositAmountInput"
       @cancel="cancelDeposit"
       @cancel="cancelDeposit"
       @confirm="confirmDeposit"></input-action-sheet>
       @confirm="confirmDeposit"></input-action-sheet>
   </div>
   </div>
@@ -81,6 +83,7 @@ import VHead from '@/view/popup/components/head.vue'
 import currencySelect from "@/view/components/currency-select.vue";
 import currencySelect from "@/view/components/currency-select.vue";
 import inputActionSheet from "@/view/components/input-action-sheet.vue";
 import inputActionSheet from "@/view/components/input-action-sheet.vue";
 import { getBit } from "@/uilts/help";
 import { getBit } from "@/uilts/help";
+import { payCalcFee } from "@/http/pay";
 
 
 let currenciesData = ref([]);
 let currenciesData = ref([]);
 let currencyInfo = ref({
 let currencyInfo = ref({
@@ -98,6 +101,10 @@ let enableWithdraw = ref(1);
 
 
 let showDepositInput = ref(false);
 let showDepositInput = ref(false);
 
 
+let reqCalcIng = false;
+let depositDesc = ref('');
+let finalAmountData = ref({});
+
 
 
 
 
 const selectCurrency = (params) => {
 const selectCurrency = (params) => {
@@ -260,21 +267,40 @@ const cancelDeposit = () => {
 }
 }
 
 
 const confirmDeposit = (params) => {
 const confirmDeposit = (params) => {
-  let {inputVal} = params;
+  if(reqCalcIng) {
+    return;
+  }
+
   showDepositInput.value = false;
   showDepositInput.value = false;
+  depositDesc.value = '';
 
 
-  // chrome.tabs.getCurrent(tab =>{
-  //   console.log(tab);
-      let achPayInfo = {
-          amountValue: inputVal
-      };
-      let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
-      setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
+  let achPayInfo = {
+      amountValue: finalAmountData.value.finalAmountValue
+  };
+  let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
+  setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
 
 
-      chrome.tabs.create({
-          url: guideUrl
-      });
-  // })
+  chrome.tabs.create({
+      url: guideUrl
+  });
+}
+
+const onDepositAmountInput = async (params = {}) => {
+  let {inputVal} = params;
+  reqCalcIng = true;
+  let res = await payCalcFee({
+      params: {
+          amountValue: inputVal,
+          currencyCode: currencyInfo.value.currencyCode,
+          payChannel: 'ach',
+      },
+  });
+  reqCalcIng = false;
+  if(res.code == 0) {
+    let {feeAmountValue, feeDesc} = res.data;
+    finalAmountData.value = res.data;
+    depositDesc.value = `Charge Fee:${feeAmountValue} USD(${feeDesc})`;
+  }
 }
 }
 
 
 onMounted(() => {
 onMounted(() => {
@@ -301,6 +327,7 @@ onMounted(() => {
       showSendBtn.value = true;
       showSendBtn.value = true;
     }
     }
 })
 })
+
 </script>
 </script>