GivenSir 4 anni fa
parent
commit
110ff7ee5e
4 ha cambiato i file con 58 aggiunte e 34 eliminazioni
  1. 2 2
      .env.development
  2. 23 20
      README.zh-CN.md
  3. 1 1
      mock/common.js
  4. 32 11
      src/views/recharge/index.vue

+ 2 - 2
.env.development

@@ -3,6 +3,6 @@ ENV = 'development'
 
 # base api
 VUE_APP_BASE_API = ''
-VUE_APP_BASE_URL = 'https://api.youxi9.com/'
-# VUE_APP_BASE_URL = 'http://devapi.youxi9.com/'
+VUE_APP_BASE_URL = 'http://devapi.youxi9.com/'
+# VUE_APP_BASE_URL = 'https://api.youxi9.com/'
 VUE_APP_IMG_URL = 'https://cdn.youxi9.com/'

+ 23 - 20
README.zh-CN.md

@@ -54,16 +54,19 @@ server
 
 
 ## 修改记录
-### v1.5
-> 2021.11.16
-1. [x] 账户余额显示(个人信息里有)
-2. [x] 字体颜色可以看清
-3. [x] 默认选中游戏 热血江湖
-4. [x] 清除默认充值显示的账号
-5. [x] 充值时添加充值状态和计数
-6. [x] 账号为空时不能充值
-7. [ ] 本地浏览器记录历史充值记录信息。(非必要)
-8. [ ] 充值账户的 textarea 显示行号,并把状态显示到这里。(非必要)
+## v1.9
+> 2021.12.06
+1. [x] 添加展示MM渠道余额与充值判断。
+
+## v1.8
+> 2021.11.26
+1. [x] 账户检测单独做成功能(拆分检测和充值功能:检测不充值、充值不检测、检测并充值)。
+
+## v1.7
+> 2021.11.23
+1. [x] 添加账号检测(针对有些渠道账户充值不存在,但充值成功的问题)。
+2. [x] 添加账户余额与总充值金额判断。
+3. [x] 优化添加账户检测后的请求逻辑,减少一定的总体请求时间。
 
 ### v1.6
 > 2021.11.17
@@ -74,16 +77,16 @@ server
 5. [x] 账户提交失败统计展示完善。 
 6. [x] 添加显示 处理开始和结束时间。
 
-## v1.7
-> 2021.11.23
-1. [x] 添加账号检测(针对有些渠道账户充值不存在,但充值成功的问题)。
-2. [x] 添加账户余额与总充值金额判断。
-3. [x] 优化添加账户检测后的请求逻辑,减少一定的总体请求时间。
-
-## v1.8
-> 2021.11.26
-1. [x] 账户检测单独做成功能(拆分检测和充值功能:检测不充值、充值不检测、检测并充值)。
-
+### v1.5
+> 2021.11.16
+1. [x] 账户余额显示(个人信息里有)
+2. [x] 字体颜色可以看清
+3. [x] 默认选中游戏 热血江湖
+4. [x] 清除默认充值显示的账号
+5. [x] 充值时添加充值状态和计数
+6. [x] 账号为空时不能充值
+7. [ ] 本地浏览器记录历史充值记录信息。(非必要)
+8. [ ] 充值账户的 textarea 显示行号,并把状态显示到这里。(非必要)
 # 测试模拟数据
 ```json
 17719118763

+ 1 - 1
mock/common.js

@@ -46,7 +46,7 @@ module.exports = [
         code: 200,
         status: true,
         data: {
-          data: 8816
+          data: 9999
         },
         message: '成功'
       }

+ 32 - 11
src/views/recharge/index.vue

@@ -45,6 +45,9 @@
           <el-form-item label="账户余额">
             <span>{{ user_money }}元</span>
           </el-form-item>
+          <el-form-item label="当前渠道余额">
+            <span>{{ balanceMoney }}元</span>
+          </el-form-item>
         </el-col>
 
         <el-col :span="3">
@@ -179,7 +182,7 @@ export default {
           'length': 2
         }
       ],
-      // balanceMoney: 0, // 渠道余额
+      balanceMoney: 0, // 渠道余额
       user_money: 0, // 账户余额
       maxMoney: 0, // 最大充值金额
       rechargeChannelPlatform: [], // 渠道账号
@@ -213,7 +216,7 @@ export default {
     }
   },
   created() {
-    // this.getBalanceMoney(this.dataForm.pid)
+    this.getBalanceMoney()
     this.getRechargePlatform(this.dataForm.pid)
     this.getRechargeGame(this.dataForm.pid)
     this.updateUserMoney()
@@ -229,11 +232,11 @@ export default {
     // 判断充值金额
     checkMoney(money) {
       this.rechargeMoney = this.accountNum * money
-      if ((this.user_money - this.rechargeMoney) < 0) {
+      if ((this.balanceMoney - this.rechargeMoney) < 0) {
         // this.rechargeMoney = this.accountNum * oldVal
         return Message({
           type: 'warning',
-          message: '账户余额不足以充值!'
+          message: '渠道余额不足以充值!'
         })
       }
     },
@@ -242,11 +245,7 @@ export default {
       this.$store.dispatch('user/getInfo').then((res) => {
         const { data } = res
         this.user_money = Math.floor(data.user_money)
-        if (this.accountNum > 0) {
-          this.maxMoney = Math.floor(data.user_money / this.accountNum)
-        } else {
-          this.maxMoney = Math.floor(data.user_money)
-        }
+
         return Message({
           type: 'success',
           message: '账户余额已更新'
@@ -284,7 +283,7 @@ export default {
       this.repeatNumList = this.repeatNumList.join().replace(new RegExp(',', 'g'), '\n')
       this.dataForm.username = newList.join().replace(new RegExp(',', 'g'), '\n')
       this.rechargeMoney = this.accountNum * this.dataForm.money
-      this.maxMoney = Math.floor(this.user_money / this.accountNum)
+      this.maxMoney = Math.floor(this.balanceMoney / this.accountNum)
     },
     /**
      * 发起提交 游戏账号检测/提交充值 数据
@@ -329,7 +328,7 @@ export default {
       }
 
       // 需要充值则检测余额
-      if ((this.user_money - this.rechargeMoney) < 0) {
+      if ((this.balanceMoney - this.rechargeMoney) < 0) {
         return Message({
           type: 'warning',
           message: '账户余额不足以充值!'
@@ -559,6 +558,7 @@ export default {
       this.loading.close()
       if (onMoney) {
         this.updateUserMoney()
+        this.getBalanceMoney()
       }
       this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
     },
@@ -742,6 +742,27 @@ export default {
           duration: 5 * 1000
         })
       })
+    },
+    // 账户余额 -- 弃用
+    getBalanceMoney() {
+      this.$store.dispatch('common/getMainChannelMoney', this.dataForm.pid).then((res) => {
+        this.balanceMoney = res
+        if (this.accountNum > 0) {
+          this.maxMoney = Math.floor(res / this.accountNum)
+        } else {
+          this.maxMoney = Math.floor(res)
+        }
+        return Message({
+          type: 'success',
+          message: '渠道余额已更新'
+        })
+      }).catch((res) => {
+        return Message({
+          message: res,
+          type: 'error',
+          duration: 5 * 1000
+        })
+      })
     }
   }
 }