Explorar o código

```
feat(wallet): 添加余额不足验证提示

- 在中英文语言包中添加"余额不足,无法转换"翻译文本
- 修复钱包页面输入框最大值为undefined时的默认值问题
- 添加转换前余额不足的验证逻辑并显示相应提示
- 验证暴米币转换时pointsBalance余额是否充足
- 验证米币转换时baoMiBalance余额是否充足
```

zhangningning hai 1 semana
pai
achega
97462e5749
Modificáronse 3 ficheiros con 14 adicións e 2 borrados
  1. 1 0
      src/locales/en.js
  2. 1 0
      src/locales/zh-CN.js
  3. 12 2
      src/pages/Personal/Wallet.vue

+ 1 - 0
src/locales/en.js

@@ -123,6 +123,7 @@ export default {
     mibiShopPaypSuccessMsg:"Pay Success, Please wait for the seller to ship your order",
     fileTypeNotAllow:"File type not allowed, only support upload",
     personalNotes:"Personal Notes",
+    balanceNotEnough:"Balance not enough, cannot convert ",
   },
   login: {
     smsLogin: 'Captcha Login',

+ 1 - 0
src/locales/zh-CN.js

@@ -128,6 +128,7 @@ export default {
     mibiShopPaypSuccessMsg:"支付成功,请等待商家发货。",
     fileTypeNotAllow:"文件类型不允许,仅支持上传",
     personalNotes:"个人笔记",
+    balanceNotEnough:"余额不足,无法转换",
   },
   login: {
     smsLogin: '验证码登录',

+ 12 - 2
src/pages/Personal/Wallet.vue

@@ -89,7 +89,7 @@
           <el-col :span="24">
             <div class="input">
               <el-form-item :label="$t('common.use') + $t('common.baomibi')" v-if="transformationIndex" prop="orderAmt">
-                <el-input-number v-model="walletForm.orderAmt" :min="1" :max="appStore?.userInfo?.baoMiBalance"
+                <el-input-number v-model="walletForm.orderAmt" :min="1" :max="appStore?.userInfo?.baoMiBalance || 1"
                   controls-position="right" size="large" @change="handleChange" style="width: 100%;"
                   :placeholder="$t('common.placeholderInput')" align="left" :input-style="{ fontSize: '28px' }"
                   class="inputStyle" step-strictly />
@@ -97,7 +97,7 @@
 
               <el-form-item :label="$t('common.use') + $t('common.mibi')" v-else prop="orderAmt">
                 <el-input-number v-model="walletForm.orderAmt" :min="1"
-                  :max="appStore?.userInfo?.pointsBalance" :step="Number(configTxt.configValue)"
+                  :max="appStore?.userInfo?.pointsBalance || 1" :step="Number(configTxt.configValue)"
                   controls-position="right" size="large" @change="handleChange" style="width: 100%;"
                   :placeholder="$t('common.placeholderInput')" align="left" :input-style="{ fontSize: '28px' }"
                   class="inputStyle" step-strictly />
@@ -230,6 +230,7 @@ import { useAppStore } from '@/pinia/appStore'
 import DGTMessage from '@/utils/message'
 
 import { useI18n } from 'vue-i18n'
+import { el } from 'element-plus/es/locale'
 
 const { t } = useI18n()
 
@@ -418,6 +419,8 @@ const confirmTransformation = async (formEl) => {
 
 // 米币暴米币转换
 const changeTransformation = async (index: any) => {
+  
+
   transformationIndex.value = index;
   walletForm.value.payMethod = index ? 'BMI' : 'MI';
   walletForm.value.orderType = index ? 'exchange_mi' : 'exchange_bmi';
@@ -428,6 +431,13 @@ const changeTransformation = async (index: any) => {
     configTxt.value = result[0]
   }
   walletForm.value.orderAmt = index == 0 ? Number(configTxt.value.configValue) : 1
+  if(index==0 && appStore?.userInfo?.pointsBalance < Number(configTxt.value.configValue)){
+    DGTMessage.warning(`${t('common.balanceNotEnough')}${t('common.baomibi')}`);
+    return;
+  }else if(index==1 && appStore?.userInfo?.baoMiBalance < 1){
+    DGTMessage.warning(`${t('common.balanceNotEnough')}${t('common.mibi')}`);
+    return;
+  }
   handleChange()
   dialogVisible.value = true;
 }