|
@@ -1,13 +1,13 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { reactive, ref } from "vue";
|
|
|
+import {reactive, ref} from "vue";
|
|
|
import * as $api from "@/api/channel/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>();
|
|
|
// 初始化数据
|
|
@@ -19,19 +19,34 @@ const initData = {
|
|
|
};
|
|
|
|
|
|
// 表单校验规则
|
|
|
-const formRules = {};
|
|
|
+const formRules = {
|
|
|
+ sellerId: [{required: true, message: "商户ID不能为空", trigger: "blur"}],
|
|
|
+ dayMaxPayAmount: [
|
|
|
+ {required: true, message: "每日限额不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ onePayMaxAmount: [
|
|
|
+ {required: true, message: "单笔限额不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ name: [{required: true, message: "名称不能为空", trigger: "blur"}],
|
|
|
+ rate: [{required: true, message: "统一费率不能为空", trigger: "blur"}],
|
|
|
+ code: [{required: true, message: "编码不能为空", trigger: "blur"}]
|
|
|
+
|
|
|
+};
|
|
|
|
|
|
// 页面数据
|
|
|
const pageData: any = reactive({
|
|
|
- name: false,
|
|
|
- code: false,
|
|
|
- appId: false,
|
|
|
- privateKey: false,
|
|
|
- publicKey: false,
|
|
|
- astrictAmount: false,
|
|
|
- astrictTrade: false,
|
|
|
- rate: false,
|
|
|
- status: false,
|
|
|
+ name: "",
|
|
|
+ code: "",
|
|
|
+ appId: "",
|
|
|
+ privateKey: "",
|
|
|
+ publicKey: "",
|
|
|
+ astrictAmount: 0,
|
|
|
+ sellerId: "",
|
|
|
+ dayMaxPayAmount: 0,
|
|
|
+ onePayMaxAmount: 0,
|
|
|
+ astrictTrade: 0,
|
|
|
+ rate: 0,
|
|
|
+ status: 1,
|
|
|
title: "",
|
|
|
formLoading: false,
|
|
|
mode: "add",
|
|
@@ -68,14 +83,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"});
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -88,7 +103,7 @@ const _save = () => {
|
|
|
if (res.success) {
|
|
|
_confirm();
|
|
|
} else {
|
|
|
- message(res.message, { type: "warning" });
|
|
|
+ message(res.message, {type: "warning"});
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
@@ -104,7 +119,7 @@ const _update = () => {
|
|
|
if (res.success) {
|
|
|
_confirm();
|
|
|
} else {
|
|
|
- message(res.message, { type: "warning" });
|
|
|
+ message(res.message, {type: "warning"});
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
@@ -115,15 +130,16 @@ 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
|
|
@@ -134,7 +150,7 @@ defineExpose({ open });
|
|
|
:rules="pageData.formRules"
|
|
|
:loading="pageData.formLoading"
|
|
|
>
|
|
|
- <el-form-item label="名称" prop="userName">
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
<el-input
|
|
|
v-model="pageData.formData.name"
|
|
|
clearable
|
|
@@ -143,7 +159,7 @@ defineExpose({ open });
|
|
|
:readonly="isDetail"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="编码" prop="password">
|
|
|
+ <el-form-item label="编码" prop="code">
|
|
|
<el-input
|
|
|
v-model="pageData.formData.code"
|
|
|
clearable
|
|
@@ -152,50 +168,34 @@ defineExpose({ open });
|
|
|
:readonly="isDetail"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="appId" prop="password">
|
|
|
- <el-input
|
|
|
- v-model="pageData.formData.appId"
|
|
|
- clearable
|
|
|
- placeholder="请输入appId"
|
|
|
- size="small"
|
|
|
- :readonly="isDetail"
|
|
|
- />
|
|
|
- </el-form-item> <el-form-item label="密钥" prop="password">
|
|
|
+ <el-form-item label="商户ID" prop="sellerId">
|
|
|
<el-input
|
|
|
- v-model="pageData.formData.privateKey"
|
|
|
+ v-model="pageData.formData.sellerId"
|
|
|
clearable
|
|
|
- placeholder="请输入密钥"
|
|
|
+ placeholder="请输入商户ID"
|
|
|
size="small"
|
|
|
:readonly="isDetail"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="公钥" prop="password">
|
|
|
+ <el-form-item label="每日限额" prop="dayMaxPayAmount">
|
|
|
<el-input
|
|
|
- v-model="pageData.formData.publicKey"
|
|
|
+ v-model="pageData.formData.dayMaxPayAmount"
|
|
|
clearable
|
|
|
- placeholder="请输入公钥"
|
|
|
- size="small"
|
|
|
- :readonly="isDetail"
|
|
|
- />
|
|
|
- </el-form-item> <el-form-item label="单笔限制金额" prop="password">
|
|
|
- <el-input
|
|
|
- v-model="pageData.formData.astrictAmount"
|
|
|
- clearable
|
|
|
- placeholder="请输入单笔限制金额"
|
|
|
+ placeholder="请输入每日限额"
|
|
|
size="small"
|
|
|
:readonly="isDetail"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="限制流水" prop="password">
|
|
|
+ <el-form-item label="单笔限额" prop="onePayMaxAmount">
|
|
|
<el-input
|
|
|
- v-model="pageData.formData.astrictTrade"
|
|
|
+ v-model="pageData.formData.onePayMaxAmount"
|
|
|
clearable
|
|
|
- placeholder="请输入限制流水"
|
|
|
+ placeholder="请输入单笔限额"
|
|
|
size="small"
|
|
|
:readonly="isDetail"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="统一费率" prop="password">
|
|
|
+ <el-form-item label="统一费率" prop="rate">
|
|
|
<el-input
|
|
|
v-model="pageData.formData.rate"
|
|
|
clearable
|
|
@@ -206,15 +206,15 @@ defineExpose({ open });
|
|
|
</el-form-item>
|
|
|
<el-form-item label="状态" prop="password">
|
|
|
<el-select
|
|
|
- v-model="pageData.formData.status"
|
|
|
- clearable
|
|
|
- placeholder="请选择状态"
|
|
|
+ v-model="pageData.formData.status"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择状态"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in enableOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
+ v-for="item in enableOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -223,7 +223,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>
|