Jelajahi Sumber

[edit ] ach pay

wenliming 2 tahun lalu
induk
melakukan
2805a15bda

+ 2 - 2
src/view/components/message-box.vue

@@ -29,11 +29,11 @@ const props = defineProps({
     },
     cancelTxt: {
         type: String,
-        default: 'Not yet',
+        default: 'Cancel',
     },
     confirmTxt: {
         type: String,
-        default: 'Deposit',
+        default: 'Completed',
     }
 });
 

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

@@ -26,7 +26,7 @@
 </template>
 
 <script setup>
-import { onMounted, ref, defineProps, defineEmits, watch } from "vue";
+import { onMounted, ref, defineProps, defineEmits, watch, defineExpose } from "vue";
 
 import {payTaskLuckdropWithBalance} from "@/http/publishApi"
 import Report from "@/log-center/log"
@@ -137,6 +137,10 @@ onMounted(() => {
     // });
 });
 
+defineExpose({
+    balancePay
+})
+
 </script>
 
 <style lang="scss" scoped>

+ 47 - 19
src/view/iframe/publish/give-dialog.vue

@@ -407,6 +407,7 @@
                         <!-- paypal支付按钮 -->
                         <div class="payment" v-show="showComType == 'preview'">
                             <pay-button
+                                ref="payButtonDom"
                                 v-if="isMoneyRewardCpd"
                                 :finalAmountData="finalAmountData"
                                 :payConfig="{
@@ -443,14 +444,16 @@
             :dialogVisible="showMessageBox"
             :title="messageBoxData.title"
             :content="messageBoxData.content"
+            cancelTxt="Not yet"
+            confirmTxt="Deposit"
             @cancel="messageBoxCancel"
             @confirm="messageBoxConfirm"></message-box>
 
         <message-box
             :dialogVisible="showDepositMessageBox"
             title="Is the Deposit Completed?"
-            @cancel="depositCancel"
-            @confirm="depositConfirm"></message-box>
+            @cancel="depositAchCancel"
+            @confirm="depositAchConfirm"></message-box>
 
         <!-- 裁剪 -->
         <div class="dialog" v-if="cropperDialog">
@@ -504,6 +507,7 @@ import "element-plus/es/components/loading/style/css";
 import 'vue-cropper/dist/index.css'
 import { VueCropper }  from "vue-cropper";
 import {create, all} from "mathjs";
+import { message } from 'ant-design-vue';
 
 import messageBox from "@/view/components/message-box.vue";
 import currencyList from "@/view/components/currency-list.vue";
@@ -615,7 +619,9 @@ let showCurrencySelect = ref(false);
 let showMoreOption = ref(false);
 
 // 货币列表的dom
-let currencyListDom = ref('');
+let currencyListDom = ref(null);
+
+let payButtonDom = ref(null);
 
 // 刷新按钮旋转
 let refreshRotate = ref(false);
@@ -1820,23 +1826,18 @@ const getCurrencyInfo = async (_params) => {
     let { loop = false} = _params || {};
     let {accessToken = ''} = await getChromeStorage('userInfo') || {};
     if (accessToken) {
-        getChromeStorage('selectCurrencyInfo', (res) => {
-            if(res && res.currencyCode) {
-                getCurrencyInfoByCode({
-                    params: {
-                        currencyCode: res.currencyCode
-                    }
-                }).then(res => {
-                    if(res.code == 0 && res.data) {
-                        currentCurrencyInfo.value = res.data;
-                        tempCurrentCurrencyInfo.value = res.data;
-                        if(!loop) {
-                            onIptSetErrorTxt();
-                        }
-                    }
-                });
+        let {currencyCode = ''} = await getChromeStorage('selectCurrencyInfo') || {};
+
+        if(currencyCode) {
+            let currencyInfoRes = await getCurrencyByCode({currencyCode});
+            if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
+                currentCurrencyInfo.value = currencyInfoRes.data;
+                tempCurrentCurrencyInfo.value = currencyInfoRes.data;
+                if(!loop) {
+                    onIptSetErrorTxt();
+                }
             }
-        })
+        }
 
         getChromeStorage('selectCurrencyList', (res) => {
             if (showCurrencySelect.value === false) {
@@ -1846,6 +1847,15 @@ const getCurrencyInfo = async (_params) => {
     }
 }
 
+const getCurrencyByCode = async (params) => {
+    let res = await getCurrencyInfoByCode({
+        params: {
+            currencyCode: params.currencyCode
+        }
+    })
+    return res || {};
+}
+
 const selectPublishMode = (params, index) => {
     selectModeInfo.index = index;
     selectModeInfo.type = params.type;
@@ -1973,6 +1983,24 @@ const submitReward = (reward) => {
     onIptSetErrorTxt();
 }
 
+const depositAchCancel = () => {
+    showDepositMessageBox.value = false;
+}
+
+const depositAchConfirm = async () => {
+    showDepositMessageBox.value = false;
+    let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
+
+    if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
+        let {balance} = currencyInfoRes.data;
+        if(balance > finalAmountData.value.orderAmountValue) {
+            payButtonDom.value && payButtonDom.value.balancePay();
+        } else {
+            message.info('Deposit failed, please try again later');
+        }
+    }
+}
+
 onMounted(() => {
     setFrontConfig();
     setPayConfig();