liu_lake 5 месяцев назад
Родитель
Сommit
559e808a30

+ 2 - 2
admin-ui/src/api/agent/index.ts

@@ -42,6 +42,6 @@ export function update<T>(id: string, data: any): Promise<Result<T>> {
  * @param userIds .
  * @returns  .
  */
-export function del<T>(userIds: string[]): Promise<Result<T>> {
-  return deleteRequest(`/sys/pay/agent/remove`, {}, userIds);
+export function del<T>(userIds: string): Promise<Result<T>> {
+  return deleteRequest(`/sys/pay/agent/remove/` + userIds, {});
 }

+ 59 - 54
admin-ui/src/views/agent/modules/edit.vue

@@ -1,13 +1,13 @@
 <script setup lang="ts">
-import { reactive, ref } from "vue";
+import {reactive, ref} from "vue";
 import * as $api from "@/api/agent/index";
-import { message } from "@/utils/message";
-import type { FormInstance } from "element-plus";
-import { cloneDeep } from "@pureadmin/utils";
+import {message} from "@/utils/message";
+import type {FormInstance} from "element-plus";
+import {cloneDeep} from "@pureadmin/utils";
 import {enableOptions} from "@/constants/constants";
 
 const title = "";
-defineOptions({ name: "templateEdit" });
+defineOptions({name: "templateEdit"});
 const isDetail = ref(false);
 const formRef = ref<FormInstance>();
 // 初始化数据
@@ -17,8 +17,6 @@ const initData = {
   status: 1
 };
 
-// 表单校验规则
-const formRules = {};
 
 // 页面数据
 const pageData: any = reactive({
@@ -29,7 +27,12 @@ const pageData: any = reactive({
   isUpdate: false,
   // 表单数据
   formData: initData,
-  formRules: formRules
+  formRules: {
+    userName: [{ required: true, message: "账号不能为空", trigger: "blur" }],
+    password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
+    status: [{ required: true, message: "账号不能为空", trigger: "blur" }]
+
+  }
 });
 // 暴露给父级调用
 const emits = defineEmits(["ok", "close"]);
@@ -59,14 +62,14 @@ const handleClose = () => {
 const handleConfirm = () => {
   formRef.value!.validate((isValid: boolean) => {
     if (isValid) {
-      const { id } = pageData.formData;
+      const {id} = pageData.formData;
       if (id) {
         _update();
       } else {
         _save();
       }
     } else {
-      message("表单校验失败", { type: "warning" });
+      message("表单校验失败", {type: "warning"});
     }
   });
 };
@@ -74,74 +77,75 @@ const _save = () => {
   pageData.formLoading = true;
   const _data = cloneDeep(pageData.formData);
   $api
-    .save(_data)
-    .then((res: any) => {
-      if (res.success) {
-        _confirm();
-      } else {
-        message(res.message, { type: "warning" });
-      }
-    })
-    .finally(() => {
-      pageData.formLoading = false;
-    });
+      .save(_data)
+      .then((res: any) => {
+        if (res.success) {
+          _confirm();
+        } else {
+          message(res.message, {type: "warning"});
+        }
+      })
+      .finally(() => {
+        pageData.formLoading = false;
+      });
 };
 const _update = () => {
   pageData.formLoading = true;
   const _data = cloneDeep(pageData.formData);
   $api
-    .update(pageData.formData.id, _data)
-    .then((res: any) => {
-      if (res.success) {
-        _confirm();
-      } else {
-        message(res.message, { type: "warning" });
-      }
-    })
-    .finally(() => {
-      pageData.formLoading = false;
-    });
+      .update(pageData.formData.id, _data)
+      .then((res: any) => {
+        if (res.success) {
+          _confirm();
+        } else {
+          message(res.message, {type: "warning"});
+        }
+      })
+      .finally(() => {
+        pageData.formLoading = false;
+      });
 };
 const _confirm = () => {
   pageData.dialogVisible = false;
   emits("ok");
 };
-defineExpose({ open });
+defineExpose({open});
 </script>
 
 <template>
   <el-dialog v-model="pageData.dialogVisible" destroy-on-close :width="500">
     <template #header>
       <el-text class="mx-1" type="primary" size="large">{{
-        pageData.title
-      }}</el-text>
+          pageData.title
+        }}
+      </el-text>
     </template>
     <div class="el-dialog-content">
       <el-form
-        ref="formRef"
-        :model="pageData.formData"
-        style="width: 90%; margin: 20px auto 0"
-        label-width="auto"
-        :rules="pageData.formRules"
-        :loading="pageData.formLoading"
+          ref="formRef"
+          :model="pageData.formData"
+          style="width: 90%; margin: 20px auto 0"
+          label-width="auto"
+          :rules="pageData.formRules"
+          :loading="pageData.formLoading"
       >
-        <el-form-item label="代理名称" prop="userName">
+        <el-form-item label="代理账号" prop="userName">
           <el-input
-            v-model="pageData.formData.userName"
-            clearable
-            placeholder="请输入名称"
-            size="small"
-            :readonly="isDetail"
+              v-model="pageData.formData.userName"
+              clearable
+              placeholder="请输入名称"
+              size="small"
+              :readonly="pageData.formData.id != null"
           />
         </el-form-item>
         <el-form-item label="密码" prop="password">
           <el-input
-            v-model="pageData.formData.password"
-            type="password"
-            clearable
-            placeholder="请输入密码"
-            size="small"
-            :readonly="isDetail"
+              v-model="pageData.formData.password"
+              type="password"
+              clearable
+              placeholder="请输入密码"
+              size="small"
+              :readonly="isDetail"
           />
         </el-form-item>
 
@@ -164,7 +168,8 @@ defineExpose({ open });
     <template #footer>
       <el-button v-if="!isDetail" @click="handleClose">取消</el-button>
       <el-button v-if="!isDetail" type="primary" @click="handleConfirm"
-        >确认</el-button
+      >确认
+      </el-button
       >
     </template>
   </el-dialog>

+ 9 - 10
admin-ui/src/views/agent/modules/list.vue

@@ -58,10 +58,6 @@ const searchFormFields = computed((): FormField[] => {
 const pageData: any = reactive({
   mode: "table",
   permission: {
-    query: ["user:query"],
-    save: ["user:save"],
-    update: ["user:update"],
-    del: ["user:del"]
   },
   searchParam: {
     searchState: true,
@@ -80,8 +76,7 @@ const pageData: any = reactive({
         label: "新增",
         type: "primary",
         icon: "ep:plus",
-        state: true,
-        permission: ["user:save"]
+        state: true
       }
     ],
     rightBtns: [
@@ -271,7 +266,14 @@ const handleEdit = (row: any) => {
  */
 const handleDel = (row: any) => {
   message.confirm(`确认删除 id 为 (${row.id}) 的数据?`).then(() => {
-    batchDel([row.id]);
+    $api.del(row.id).then((res: any) => {
+      if (res.success) {
+        message.success("删除成功");
+        _loadData();
+      } else {
+        message.warning(res.message);
+      }
+    });
   });
 };
 /**
@@ -353,17 +355,14 @@ onMounted(() => {
       <template #operation="{ row }">
         <div class="flex justify-center items-center">
           <el-link
-            v-show="hasAuth(pageData.permission.update)"
             type="primary"
             @click="handleEdit(row)"
             >编辑
           </el-link>
           <el-divider
-            v-show="hasAuth(pageData.permission.del)"
             direction="vertical"
           />
           <el-link
-            v-show="hasAuth(pageData.permission.del)"
             type="primary"
             @click="handleDel(row)"
             >删除

+ 1 - 1
admin-ui/src/views/merchant/modules/edit.vue

@@ -124,7 +124,7 @@ defineExpose({ open });
         :rules="pageData.formRules"
         :loading="pageData.formLoading"
       >
-        <el-form-item label="代理名称" prop="userName">
+        <el-form-item label="代理账号" prop="userName">
           <el-input
             v-model="pageData.formData.userName"
             clearable

+ 1 - 1
admin-ui/src/views/order/edit.vue

@@ -124,7 +124,7 @@ defineExpose({ open });
         :rules="pageData.formRules"
         :loading="pageData.formLoading"
       >
-        <el-form-item label="代理名称" prop="userName">
+        <el-form-item label="代理账号" prop="userName">
           <el-input
             v-model="pageData.formData.userName"
             clearable

+ 1 - 1
agent-ui/src/api/channel/index.ts

@@ -43,5 +43,5 @@ export function update<T>(id: string, data: any): Promise<Result<T>> {
  * @returns  .
  */
 export function del<T>(channelId: string): Promise<Result<T>> {
-  return deleteRequest(`/agent/pay/channel/remove/`+ channelId);
+  return deleteRequest(`/agent/pay/channel/remove/` + channelId);
 }

+ 11 - 7
agent-ui/src/views/merchant/modules/edit.vue

@@ -16,8 +16,6 @@ const initData = {
   status: 1
 };
 
-// 表单校验规则
-const formRules = {};
 
 // 页面数据
 const pageData: any = reactive({
@@ -28,7 +26,13 @@ const pageData: any = reactive({
   isUpdate: false,
   // 表单数据
   formData: initData,
-  formRules: formRules
+  formRules: {
+    userName: [{ required: true, message: "账号不能为空", trigger: "blur" }],
+    password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
+    rate: [{ required: true, message: "费率不能为空", trigger: "blur" }],
+    status: [{ required: true, message: "账号不能为空", trigger: "blur" }]
+
+  }
 });
 // 暴露给父级调用
 const emits = defineEmits(["ok", "close"]);
@@ -124,16 +128,16 @@ defineExpose({ open });
         :rules="pageData.formRules"
         :loading="pageData.formLoading"
       >
-        <el-form-item label="商户名称" prop="userName">
+        <el-form-item label="商户账号" prop="userName">
           <el-input
             v-model="pageData.formData.userName"
             clearable
-            placeholder="请输入名称"
+            placeholder="请输入商户账号"
             size="small"
-            :readonly="isDetail"
+            :readonly="pageData.formData.id != null"
           />
         </el-form-item>
-        <el-form-item label="费率" prop="userName">
+        <el-form-item label="费率" prop="rate">
           <el-input-number style="width: 355px"
             v-model="pageData.formData.rate"
             clearable

+ 2 - 2
agent-ui/src/views/merchant/modules/list.vue

@@ -28,9 +28,9 @@ const searchFormFields = computed((): FormField[] => {
   const fields: FormField[] = [
     {
       type: "input",
-      label: "商户名称",
+      label: "代理账号",
       prop: "userName",
-      placeholder: "请输入商户名称模糊查询"
+      placeholder: "请输入代理账号模糊查询"
     },
     {
       type: "select",

+ 1 - 1
agent-ui/src/views/order/edit.vue

@@ -124,7 +124,7 @@ defineExpose({ open });
         :rules="pageData.formRules"
         :loading="pageData.formLoading"
       >
-        <el-form-item label="代理名称" prop="userName">
+        <el-form-item label="代理账号" prop="userName">
           <el-input
             v-model="pageData.formData.userName"
             clearable

+ 1 - 1
merchant-ui/src/views/order/edit.vue

@@ -124,7 +124,7 @@ defineExpose({ open });
         :rules="pageData.formRules"
         :loading="pageData.formLoading"
       >
-        <el-form-item label="代理名称" prop="userName">
+        <el-form-item label="代理账号" prop="userName">
           <el-input
             v-model="pageData.formData.userName"
             clearable