wen 3 سال پیش
والد
کامیت
6d3bb75abb
7فایلهای تغییر یافته به همراه406 افزوده شده و 117 حذف شده
  1. 5 2
      .env.development
  2. 5 1
      .env.production
  3. 1 0
      package.json
  4. 13 0
      src/router/index.js
  5. 310 102
      src/views/recharge/index.vue
  6. 58 0
      src/views/recharge/test.vue
  7. 14 12
      vue.config.js

+ 5 - 2
.env.development

@@ -3,6 +3,9 @@ ENV = 'development'
 
 # base api
 VUE_APP_BASE_API = ''
-VUE_APP_BASE_URL = 'http://devapi.youxi9.com/'
-# VUE_APP_BASE_URL = 'https://api.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/'

+ 5 - 1
.env.production

@@ -3,5 +3,9 @@ ENV = 'production'
 
 # base api
 VUE_APP_BASE_API = ''
-VUE_APP_BASE_URL = 'https://api.youxi9.com/'
+# 线上 游戏久 平台测试地址
+# VUE_APP_BASE_URL = 'http://devapi.youxi9.com'
+# 线上 MM 充值地址
+VUE_APP_BASE_URL = 'https://api.youxi9.com'
+# 图片地址
 VUE_APP_IMG_URL = 'https://cdn.youxi9.com/'

+ 1 - 0
package.json

@@ -61,6 +61,7 @@
     "chokidar": "2.1.5",
     "connect": "3.6.6",
     "eslint": "6.7.2",
+    "eslint-plugin-standard": "^5.0.0",
     "eslint-plugin-vue": "6.2.2",
     "html-webpack-plugin": "3.2.0",
     "http-proxy-middleware": "^2.0.1",

+ 13 - 0
src/router/index.js

@@ -90,6 +90,19 @@ export const constantRoutes = [
       }
     ]
   }
+  // {
+  //   path: '/test',
+  //   component: Layout,
+  //   redirect: '/test',
+  //   children: [
+  //     {
+  //       path: 'test',
+  //       component: () => import('@/views/recharge/test'),
+  //       name: 'test',
+  //       meta: { title: 'test', icon: 'shopping', noCache: true }
+  //     }
+  //   ]
+  // }
 ]
 
 /**

+ 310 - 102
src/views/recharge/index.vue

@@ -1,12 +1,26 @@
 <template>
-  <div
-    class="login-container"
-  >
+  <div>
+    <el-progress
+      v-show="progressInfo.percentageNum > 0"
+      :text-inside="true"
+      :stroke-width="26"
+      :percentage="progressInfo.percentageNum"
+      style="margin: 10px;"
+    />
     <!-- v-loading="loading"
     element-loading-text="Loading..."
     element-loading-svg-view-box="-10, -10, 50, 50"
     element-loading-background="rgba(0, 0, 0, 0.8)" -->
-    <el-form ref="dataForm" :model="dataForm" :rules="ruleForm">
+    <el-form
+      ref="dataForm"
+      v-loading="formLoading"
+      :model="dataForm"
+      :rules="ruleForm"
+      class="login-container"
+      element-loading-text="处理中..."
+      element-loading-svg-view-box="-10, -10, 50, 50"
+      element-loading-background="rgba(0, 0, 0, 0.2)"
+    >
       <el-row :gutter="30">
         <el-col :span="4">
           <el-form-item label="游戏平台" prop="pid">
@@ -152,7 +166,7 @@ export default {
   name: 'Recharge',
   data() {
     return {
-      loading: false,
+      formLoading: false, // 表单记载状态
       dataForm: {
         pid: 'd65aa6d7614589bffe62456b88e98811', // 游戏平台ID;默认魅族平台
         cid: '', // 渠道账号ID
@@ -204,8 +218,11 @@ export default {
       endTime: 0, // 结束时间
       onCheck: false, // 是否需要检测账号
       onRecharge: true, // 是否充值
-      rechargeMoney: 0 // 支付总金额
-
+      rechargeMoney: 0, // 支付总金额
+      progressInfo: {
+        percentageNum: 0, // 进度条百分比
+        num: 0 // 当前数
+      }
     }
   },
   watch: {
@@ -216,10 +233,11 @@ export default {
     }
   },
   created() {
-    this.getBalanceMoney()
     this.getRechargePlatform(this.dataForm.pid)
     this.getRechargeGame(this.dataForm.pid)
-    this.updateUserMoney()
+    // this.updateUserMoney()
+
+    this.updateMoney()
 
     this.$store.dispatch('user/getF5').then((res) => {
       if (!res) {
@@ -289,20 +307,25 @@ export default {
      * 发起提交 游戏账号检测/提交充值 数据
      */
     onSubmit() {
+      this.startLoading()
+      // this.formLoading = true
       // this.setAccountNum()
 
-      this.thenAccount = ''
-      this.thenAccountNum = 0
+      this.thenAccount = '' // 渠道余额
+      this.thenAccountNum = 0 // 成功个数
 
-      this.catchAccount = ''
-      this.catchAccountNum = 0
+      this.catchAccount = '' // 失败账户
+      this.catchAccountNum = 0 // 失败个数
 
-      this.noExistence = ''
-      this.noExistenceNum = 0
+      this.noExistence = '' // 不存在账户
+      this.noExistenceNum = 0 // 不存在账户个数
 
       this.startTime = ''
       this.endTime = ''
 
+      this.progressInfo.percentageNum = 0 // 进度条百分比
+      this.progressInfo.num = 0 // 进度条百分比
+
       // TODO: 正式服务器未上线,暂时不需要
       // if ((this.balanceMoney - this.dataForm.money) < 0) {
       //   return Message({
@@ -318,17 +341,22 @@ export default {
         })
       }
 
+      this.operation('time_start')
+
       // 截取账号
       var accountLists = this.dataForm.username.split('\n')
       // 检测不充值
       if (this.onCheck === true && this.onRecharge === false) {
-        this.startLoading()
+        // this.startLoading()
+        // this.formLoading = true
         this.sublmeRecharge(accountLists, 1)
         return false
       }
 
       // 需要充值则检测余额
       if ((this.balanceMoney - this.rechargeMoney) < 0) {
+        // this.formLoading = false
+        this.cloneLoading()
         return Message({
           type: 'warning',
           message: '账户余额不足以充值!'
@@ -340,18 +368,22 @@ export default {
             confirmButtonText: '确认',
             cancelButtonText: '取消'
           }).then(({ value }) => {
-            this.startLoading()
+            // this.startLoading()
             if (this.onRecharge === true && this.onCheck === false) { // 充值不检测
               this.sublmeRecharge(accountLists, 2, value)
             } else if (this.onRecharge === true && this.onCheck === true) { // 充值并检测
               this.sublmeRecharge(accountLists, 3, value)
             }
           }).catch(() => {
+            this.cloneLoading()
+            // this.formLoading = false
             return Message({
               message: '取消充值.'
             })
           })
         } else {
+          this.cloneLoading()
+          // this.formLoading = false
           return Message({
             type: 'error',
             message: '请完善提交内容.'
@@ -361,11 +393,12 @@ export default {
     },
     // 提交检测和充值
     async sublmeRecharge(accountLists, operationType, paypwd = '') {
-      this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
+      // this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
       // 提取第一条账号数据,进行提交测试
       const oneAccount = accountLists[0]
       const loadingNum = accountLists.length - 2
 
+      this.progressInfo.num++
       switch (operationType) {
         case 1: // 账号检测
           await this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
@@ -374,13 +407,23 @@ export default {
             if (code === 200 && status === true) {
               this.thenAccount = this.thenAccount + oneAccount + '\n'
               this.thenAccountNum++
-              Message({
-                type: 'success',
-                message: '检测成功 ' + oneAccount + ' : ' + message
+              // Message({
+              //   type: 'success',
+              //   message: '检测成功 ' + oneAccount + ' : ' + message
+              // })
+              this.$notify({
+                title: '检测成功',
+                message: oneAccount + ' : ' + message,
+                type: 'success'
               })
 
               // 成功后处理剩下账号数据
               accountLists = LodashArray.drop(accountLists) // 删除第一个账户
+              if (accountLists.length <= 0) {
+                this.cloneLoading()
+                return false
+              }
+
               accountLists.forEach(async(item, index) => {
                 await this.rechargePlayer(
                   { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
@@ -391,19 +434,33 @@ export default {
               this.noExistence = this.noExistence + oneAccount + '\n'
               this.noExistenceNum++
 
-              this.cloneLoading(false)
-              return Message({
-                message: '检测 ' + oneAccount + ' : ' + message
+              // this.cloneLoading(false)
+              // this.formLoading = false
+              this.cloneLoading()
+              // return Message({
+              //   message: '检测 ' + oneAccount + ' : ' + message
+              // })
+              return this.$notify({
+                title: '检测有误',
+                message: oneAccount + ' : ' + message,
+                type: 'info'
               })
             }
           }).catch((error) => {
             this.catchAccount = this.catchAccount + oneAccount + '\n'
             this.catchAccountNum++
 
-            this.cloneLoading(false)
-            return Message({
-              type: 'error',
-              message: '检测失败 ' + oneAccount + ' :' + error.message
+            // this.cloneLoading(false)
+            // this.formLoading = false
+            this.cloneLoading()
+            // return Message({
+            //   type: 'error',
+            //   message: '检测失败 ' + oneAccount + ' :' + error.message
+            // })
+            return this.$notify({
+              title: '检测失败',
+              message: oneAccount + ' : ' + error.message,
+              type: 'error'
             })
           })
           break
@@ -413,9 +470,14 @@ export default {
             if (code === 200 && status === true) {
               this.thenAccount = this.thenAccount + oneAccount + '\n'
               this.thenAccountNum++
-              Message({
-                type: 'success',
-                message: '充值成功 ' + oneAccount + ' : ' + message
+              // Message({
+              //   type: 'success',
+              //   message: '充值成功 ' + oneAccount + ' : ' + message
+              // })
+              this.$notify({
+                title: '充值成功',
+                message: oneAccount + ' : ' + message,
+                type: 'success'
               })
 
               // 成功后处理剩下账号数据
@@ -430,19 +492,33 @@ export default {
               this.catchAccount = this.catchAccount + oneAccount + '\n'
               this.catchAccountNum++
 
+              // this.cloneLoading()
+              // this.formLoading = false
               this.cloneLoading()
-              return Message({
-                message: '充值 ' + oneAccount + ' : ' + message
+              // return Message({
+              //   message: '充值 ' + oneAccount + ' : ' + message
+              // })
+              return this.$notify({
+                title: '充值有误',
+                message: oneAccount + ' : ' + message,
+                type: 'info'
               })
             }
           }).catch((error) => {
             this.catchAccount = this.catchAccount + oneAccount + '\n'
             this.catchAccountNum++
 
+            // this.cloneLoading()
+            // this.formLoading = false
             this.cloneLoading()
-            return Message({
-              type: 'error',
-              message: '充值失败 ' + oneAccount + ' : ' + error.message
+            // return Message({
+            //   type: 'error',
+            //   message: '充值失败 ' + oneAccount + ' : ' + error.message
+            // })
+            return this.$notify({
+              title: '充值失败',
+              message: oneAccount + ' : ' + error.message,
+              type: 'error'
             })
           })
           break
@@ -450,11 +526,15 @@ export default {
           // 账号检测
           this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
             const { code, status, message } = res
-
             if (code === 200 && status === true) {
-              Message({
-                type: 'success',
-                message: '检测成功 ' + oneAccount + ' : ' + message
+              // Message({
+              //   type: 'success',
+              //   message: '检测成功 ' + oneAccount + ' : ' + message
+              // })
+              this.$notify({
+                title: '检测成功',
+                message: oneAccount + ' : ' + message,
+                type: 'success'
               })
 
               // 充值
@@ -464,9 +544,14 @@ export default {
                 if (code === 200 && status === true) {
                   this.thenAccount = this.thenAccount + oneAccount + '\n'
                   this.thenAccountNum++
-                  Message({
-                    type: 'success',
-                    message: '充值成功 ' + oneAccount + ' : ' + message
+                  // Message({
+                  //   type: 'success',
+                  //   message: '充值成功 ' + oneAccount + ' : ' + message
+                  // })
+                  this.$notify({
+                    title: '充值成功',
+                    message: oneAccount + ' : ' + message,
+                    type: 'success'
                   })
 
                   // 成功后处理剩下账号数据
@@ -481,48 +566,83 @@ export default {
                   this.catchAccount = this.catchAccount + oneAccount + '\n'
                   this.catchAccountNum++
 
+                  // this.cloneLoading()
+                  // this.formLoading = false
                   this.cloneLoading()
-                  return Message({
-                    type: 'warning',
-                    message: '充值 ' + oneAccount + ' : ' + message
+                  // return Message({
+                  //   type: 'warning',
+                  //   message: '充值 ' + oneAccount + ' : ' + message
+                  // })
+                  return this.$notify({
+                    title: '充值有误',
+                    message: oneAccount + ' : ' + message,
+                    type: 'info'
                   })
                 }
               }).catch((error) => {
                 this.catchAccount = this.catchAccount + oneAccount + '\n'
                 this.catchAccountNum++
 
-                this.cloneLoading(false)
-                return Message({
-                  type: 'error',
-                  message: '充值失败 ' + oneAccount + ' : ' + error.message
+                // this.cloneLoading(false)
+                // this.formLoading = false
+                this.cloneLoading()
+                // return Message({
+                //   type: 'error',
+                //   message: '充值失败 ' + oneAccount + ' : ' + error.message
+                // })
+                return this.$notify({
+                  title: '充值失败',
+                  message: oneAccount + ' : ' + error.message,
+                  type: 'error'
                 })
               })
             } else {
               this.noExistence = this.noExistence + oneAccount + '\n'
               this.noExistenceNum++
 
-              this.cloneLoading(false)
-              return Message({
-                message: '检测 ' + oneAccount + ' : ' + message
+              // this.cloneLoading(false)
+              // this.formLoading = false
+              this.cloneLoading()
+              // return Message({
+              //   message: '检测 ' + oneAccount + ' : ' + message
+              // })
+              return this.$notify({
+                title: '检测失败',
+                message: oneAccount + ' : ' + message,
+                type: 'error'
               })
             }
           }).catch((error) => {
             this.catchAccount = this.catchAccount + oneAccount + '\n'
             this.catchAccountNum++
 
-            this.cloneLoading(false)
-            return Message({
-              type: 'error',
-              message: '检测失败 ' + oneAccount + ' : ' + error.message
+            // this.cloneLoading(false)
+            // this.formLoading = false
+            this.cloneLoading()
+            // return Message({
+            //   type: 'error',
+            //   message: '检测失败 ' + oneAccount + ' : ' + error.message
+            // })
+            return this.$notify({
+              title: '检测失败',
+              message: oneAccount + ' : ' + error.message,
+              type: 'error'
             })
           })
 
           break
         default:
-          Message({
-            type: 'error',
-            message: '操作有误!!!'
+          // Message({
+          //   type: 'error',
+          //   message: '操作有误!!!'
+          // })
+          this.$notify({
+            title: '操作有误',
+            message: '非法操作!',
+            type: 'error'
           })
+          // this.formLoading = false
+          this.cloneLoading()
           break
       }
 
@@ -550,25 +670,44 @@ export default {
       this.loading = Loading.service({
         lock: true,
         text: '处理中, 请稍等...',
-        background: 'rgba(0, 0, 0, 0.7)'
+        background: 'rgba(0, 0, 0, 0.3)'
       })
     },
     // 关闭遮屏
     cloneLoading(onMoney = true) {
       this.loading.close()
-      if (onMoney) {
-        this.updateUserMoney()
-        this.getBalanceMoney()
+    },
+    // 更新账户余额和渠道余额
+    updateMoney() {
+      this.updateUserMoney()
+      this.getBalanceMoney()
+    },
+    // 相关操作
+    operation(type) {
+      switch (type) {
+        case 'loading_clone': // 关闭加载窗口
+          this.formLoading = false
+          break
+        case 'time_start': // 开始时间
+          this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
+          break
+        case 'time_end': // 结束时间
+          this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
+          break
+        default:
+          break
       }
-      this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
     },
     // 异步进行账户检测与充值
     rechargePlayer(data, index, operationType, count) {
+      const that = this
       // 延迟一秒处理
-      setTimeout((data, new_index, new_operationType, new_count) => {
+      setTimeout((data, new_index, new_operationType, new_count, that) => {
         return new Promise((resolve, reject) => {
           // 继续延迟
           setTimeout((_data, _index, _operationType, _count) => {
+            that.progressInfo.num++
+            that.progressCheck()
             switch (_operationType) {
               case 1: // 检测账户
                 this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
@@ -576,9 +715,14 @@ export default {
                   if (code === 200 && status === true) {
                     this.thenAccount = this.thenAccount + _data.username + '\n'
                     this.thenAccountNum++
-                    Message({
-                      type: 'success',
-                      message: '检测成功 ' + _data.username + ' :' + message
+                    // Message({
+                    //   type: 'success',
+                    //   message: '检测成功 ' + _data.username + ' :' + message
+                    // })
+                    this.$notify({
+                      title: '检测成功',
+                      message: _data.username + ' :' + message,
+                      type: 'success'
                     })
                   } else {
                     if (code === 10001) {
@@ -588,17 +732,27 @@ export default {
                       this.noExistence = this.noExistence + _data.username + '\n'
                       this.noExistenceNum++
                     }
-                    Message({
-                      message: '检测 ' + _data.username + ' :' + message
+                    // Message({
+                    //   message: '检测 ' + _data.username + ' :' + message
+                    // })
+                    this.$notify({
+                      title: '检测失败',
+                      message: _data.username + ' :' + message,
+                      type: 'info'
                     })
                   }
                 }).catch((error) => {
                   this.catchAccount = this.catchAccount + _data.username + '\n'
                   this.catchAccountNum++
 
-                  Message({
-                    type: 'error',
-                    message: '检测失败 ' + _data.username + ' :' + error.message
+                  // Message({
+                  //   type: 'error',
+                  //   message: '检测失败 ' + _data.username + ' :' + error.message
+                  // })
+                  this.$notify({
+                    title: '检测失败',
+                    message: _data.username + ' :' + error.message,
+                    type: 'error'
                   })
                 })
                 break
@@ -610,25 +764,40 @@ export default {
                   if (code === 200 && status === true) {
                     this.thenAccount = this.thenAccount + _data.username + '\n'
                     this.thenAccountNum++
-                    Message({
-                      type: 'success',
-                      message: '充值成功 ' + _data.username + ':' + message
+                    // Message({
+                    //   type: 'success',
+                    //   message: '充值成功 ' + _data.username + ':' + message
+                    // })
+                    this.$notify({
+                      title: '充值成功',
+                      message: _data.username + ' :' + message,
+                      type: 'success'
                     })
                   } else {
                     this.catchAccount = this.catchAccount + _data.username + '\n'
                     this.catchAccountNum++
 
-                    Message({
-                      message: '充值 ' + _data.username + ':' + message
+                    // Message({
+                    //   message: '充值 ' + _data.username + ':' + message
+                    // })
+                    this.$notify({
+                      title: '充值失败',
+                      message: _data.username + ':' + message,
+                      type: 'info'
                     })
                   }
                 }).catch((error) => {
                   this.catchAccount = this.catchAccount + _data.username + '\n'
                   this.catchAccountNum++
 
-                  Message({
-                    type: 'error',
-                    message: '充值失败 ' + _data.username + ':' + error.message
+                  // Message({
+                  //   type: 'error',
+                  //   message: '充值失败 ' + _data.username + ':' + error.message
+                  // })
+                  this.$notify({
+                    title: '充值失败',
+                    message: _data.username + ':' + error.message,
+                    type: 'error'
                   })
                 })
                 break
@@ -637,9 +806,14 @@ export default {
                 this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
                   const { code, status, message } = res
                   if (code === 200 && status === true) {
-                    Message({
-                      type: 'success',
-                      message: '检测成功 ' + _data.username + ':' + message
+                    // Message({
+                    //   type: 'success',
+                    //   message: '检测成功 ' + _data.username + ':' + message
+                    // })
+                    this.$notify({
+                      title: '检测成功',
+                      message: _data.username + ':' + message,
+                      type: 'success'
                     })
 
                     // 充值
@@ -648,25 +822,40 @@ export default {
                       if (code === 200 && status === true) {
                         this.thenAccount = this.thenAccount + _data.username + '\n'
                         this.thenAccountNum++
-                        Message({
-                          type: 'success',
-                          message: '充值成功 ' + _data.username + ':' + message
+                        // Message({
+                        //   type: 'success',
+                        //   message: '充值成功 ' + _data.username + ':' + message
+                        // })
+                        this.$notify({
+                          title: '充值成功',
+                          message: _data.username + ' :' + message,
+                          type: 'success'
                         })
                       } else {
                         this.catchAccount = this.catchAccount + _data.username + '\n'
                         this.catchAccountNum++
 
-                        Message({
-                          message: '充值 ' + _data.username + ':' + message
+                        // Message({
+                        //   message: '充值 ' + _data.username + ':' + message
+                        // })
+                        this.$notify({
+                          title: '充值有误',
+                          message: _data.username + ' :' + message,
+                          type: 'info'
                         })
                       }
                     }).catch((error) => {
                       this.catchAccount = this.catchAccount + _data.username + '\n'
                       this.catchAccountNum++
 
-                      Message({
-                        type: 'error',
-                        message: '充值失败 ' + _data.username + ':' + error.message
+                      // Message({
+                      //   type: 'error',
+                      //   message: '充值失败 ' + _data.username + ':' + error.message
+                      // })
+                      this.$notify({
+                        title: '充值失败',
+                        message: _data.username + ' :' + error.message,
+                        type: 'error'
                       })
                     })
                   } else {
@@ -678,17 +867,27 @@ export default {
                       this.noExistenceNum++
                     }
 
-                    Message({
-                      message: '检测 ' + _data.username + ':' + message
+                    // Message({
+                    //   message: '检测 ' + _data.username + ':' + message
+                    // })
+                    this.$notify({
+                      title: '检测有误',
+                      message: _data.username + ' :' + message,
+                      type: 'info'
                     })
                   }
                 }).catch((error) => {
                   this.catchAccount = this.catchAccount + _data.username + '\n'
                   this.catchAccountNum++
 
-                  Message({
-                    type: 'error',
-                    message: '检测失败 ' + _data.username + ':' + error.message
+                  // Message({
+                  //   type: 'error',
+                  //   message: '检测失败 ' + _data.username + ':' + error.message
+                  // })
+                  this.$notify({
+                    title: '检测失败',
+                    message: _data.username + ' :' + error.message,
+                    type: 'error'
                   })
                 })
                 break
@@ -698,11 +897,15 @@ export default {
             if (_index !== null && _index === _count || _index > _count) {
               setTimeout(() => {
                 // 检测不更新账户余额
-                var onMoney = true
+                // var onMoney = true
+                // this.formLoading = false
+                this.cloneLoading()
+                this.operation('time_end')
                 if (new_operationType === 1) {
-                  onMoney = false
+                  // onMoney = false
+                  this.updateUserMoney()
                 }
-                this.cloneLoading(onMoney)
+                // this.cloneLoading(onMoney)
               }, 1500)
             }
             resolve()
@@ -710,7 +913,7 @@ export default {
           // }, (1600 + Math.round(Math.random() * 300)) * (index + 1), data, onCheck)
           // 1500 * (index + 1): +1的原因是,这里是从第二条数据开始处理的,异步处理之前单独处理了一个,所以时间久点。
         })
-      }, 1000, data, index, operationType, count)
+      }, 1000, data, index, operationType, count, that)
     },
     // 渠道账号列表
     getRechargePlatform(val) {
@@ -763,6 +966,11 @@ export default {
           duration: 5 * 1000
         })
       })
+    },
+    // 进度条统计
+    progressCheck() {
+      this.progressInfo.percentageNum = parseInt((this.progressInfo.num / this.accountNum) * 100)
+      console.log('# progressCheck: ', this.progressInfo.num, this.accountNum, this.progressInfo.percentageNum)
     }
   }
 }

+ 58 - 0
src/views/recharge/test.vue

@@ -0,0 +1,58 @@
+<template>
+  <div class="login-container">
+    测试异步
+    <button @click="test">aaa</button>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'Recharge',
+  data() {
+    return {
+
+    }
+  },
+  watch: {
+
+  },
+  created() {},
+  methods: {
+    async test() {
+      console.log('111')
+      this.test1().then(res => {
+        console.log(res)
+      })
+
+      console.log('555')
+    },
+    async test1() {
+      console.log('222')
+      const that = this
+      return new Promise((resolve, reject) => {
+        console.log('333')
+        setTimeout((resolve, that) => {
+          console.log('4444')
+          const res = that.test2()
+          resolve(res)
+        }, 2000, resolve, that)
+      })
+    },
+    async test2() {
+      return 'xxxxx'
+    }
+  }
+}
+</script>
+
+<style lang="scss">
+  .login-container{
+    margin: 20px;
+    background-color: #FFFFFF;
+
+    .el-bg-border{
+      border: 2px dashed #909399;
+      padding: 10px;
+    }
+  }
+</style>

+ 14 - 12
vue.config.js

@@ -15,6 +15,9 @@ const name = defaultSettings.title || 'vue Element Admin' // page title
 // port = 9527 npm run dev OR npm run dev --port = 9527
 const port = process.env.port || process.env.npm_config_port || 9527 // dev port
 
+// console.log(module.exports.devServer.proxy)
+console.log('# NODE_ENV:', process.env.NODE_ENV)
+
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
   /**
@@ -35,20 +38,20 @@ module.exports = {
     overlay: {
       warnings: true,
       errors: true
-    }
+    },
     // before: require('./mock/mock-server.js'),
 
     // 开启后可以访问线上域名进行测试
-    // proxy: {
-    //   [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
-    //     target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
-    //     changeOrigin: true, // 必须加上这个才能跨域请求
-    //     logLevel: 'debug',
-    //     pathRewrite: { // 重命名
-    //       ['^/' + process.env.VUE_APP_BASE_API]: ''
-    //     }
-    //   }
-    // }
+    proxy: {
+      [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
+        target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
+        changeOrigin: true, // 必须加上这个才能跨域请求
+        logLevel: 'debug',
+        pathRewrite: { // 重命名
+          ['^' + process.env.VUE_APP_BASE_API]: ''
+        }
+      }
+    }
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that
@@ -135,4 +138,3 @@ module.exports = {
   }
 }
 
-console.log(module.exports.devServer.proxy)