zhangyujun пре 2 година
родитељ
комит
e5a0b05d4d
2 измењених фајлова са 36 додато и 4 уклоњено
  1. 8 0
      src/api/system/user.js
  2. 28 4
      src/views/system/user/index.vue

+ 8 - 0
src/api/system/user.js

@@ -125,3 +125,11 @@ export function importTemplate() {
     method: 'get'
   })
 }
+//用户的充值
+export function recharge(params) {
+  return request({
+    url: '/system/user/recharge',
+    method: 'PUT',
+    params
+  })
+}

+ 28 - 4
src/views/system/user/index.vue

@@ -129,6 +129,7 @@
               >删除</el-button
             >
           </el-col>
+
           <el-col :span="1.5">
             <el-button
               type="info"
@@ -238,6 +239,14 @@
                 v-hasPermi="['system:user:resetPwd']"
                 >重置</el-button
               >
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-key"
+                @click="handleRecharge(scope.row)"
+                v-hasPermi="['system:user:recharge']"
+                >充值</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -499,6 +508,7 @@ import {
   resetUserPwd,
   changeUserStatus,
   importTemplate,
+  recharge,
 } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
 import { treeselect } from "@/api/system/dept";
@@ -546,8 +556,7 @@ export default {
       roleOptions: [],
       // 表单参数
       form: {
-        agentType:"1"
-       
+        agentType: "1",
       },
       defaultProps: {
         children: "children",
@@ -599,7 +608,6 @@ export default {
           },
         ],
         phonenumber: [
-        
           {
             pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
             message: "请输入正确的手机号码",
@@ -629,6 +637,22 @@ export default {
     });
   },
   methods: {
+    handleRecharge(row) {
+      this.$prompt("对" + row.userName + "账户进行充值", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        inputPattern:/^-?[1-9]+[0-9]*$/,
+        inputErrorMessage:"必需是整数"
+      })
+        .then(({ value }) => {
+          recharge({ userId: row.userId, rechargeNumber: value }).then(
+            (response) => {
+              this.msgSuccess("充值成功:" + value);
+            }
+          );
+        })
+        .catch(() => {});
+    },
     /** 查询用户列表 */
     getList() {
       this.loading = true;
@@ -686,7 +710,7 @@ export default {
     // 表单重置
     reset() {
       this.form = {
-        agentType:'1',
+        agentType: "1",
         userId: undefined,
         deptId: undefined,
         userName: undefined,