|
@@ -1,13 +1,13 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { reactive, ref } from "vue";
|
|
|
|
|
|
+import {reactive, ref} from "vue";
|
|
import * as $api from "@/api/channel/index";
|
|
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";
|
|
import {enableOptions} from "@/constants/constants";
|
|
|
|
|
|
const title = "";
|
|
const title = "";
|
|
-defineOptions({ name: "templateEdit" });
|
|
|
|
|
|
+defineOptions({name: "templateEdit"});
|
|
const isDetail = ref(false);
|
|
const isDetail = ref(false);
|
|
const formRef = ref<FormInstance>();
|
|
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({
|
|
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: "",
|
|
title: "",
|
|
formLoading: false,
|
|
formLoading: false,
|
|
mode: "add",
|
|
mode: "add",
|
|
@@ -68,14 +83,14 @@ const handleClose = () => {
|
|
const handleConfirm = () => {
|
|
const handleConfirm = () => {
|
|
formRef.value!.validate((isValid: boolean) => {
|
|
formRef.value!.validate((isValid: boolean) => {
|
|
if (isValid) {
|
|
if (isValid) {
|
|
- const { id } = pageData.formData;
|
|
|
|
|
|
+ const {id} = pageData.formData;
|
|
if (id) {
|
|
if (id) {
|
|
_update();
|
|
_update();
|
|
} else {
|
|
} else {
|
|
_save();
|
|
_save();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- message("表单校验失败", { type: "warning" });
|
|
|
|
|
|
+ message("表单校验失败", {type: "warning"});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -88,7 +103,7 @@ const _save = () => {
|
|
if (res.success) {
|
|
if (res.success) {
|
|
_confirm();
|
|
_confirm();
|
|
} else {
|
|
} else {
|
|
- message(res.message, { type: "warning" });
|
|
|
|
|
|
+ message(res.message, {type: "warning"});
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.finally(() => {
|
|
.finally(() => {
|
|
@@ -104,7 +119,7 @@ const _update = () => {
|
|
if (res.success) {
|
|
if (res.success) {
|
|
_confirm();
|
|
_confirm();
|
|
} else {
|
|
} else {
|
|
- message(res.message, { type: "warning" });
|
|
|
|
|
|
+ message(res.message, {type: "warning"});
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.finally(() => {
|
|
.finally(() => {
|
|
@@ -115,15 +130,16 @@ const _confirm = () => {
|
|
pageData.dialogVisible = false;
|
|
pageData.dialogVisible = false;
|
|
emits("ok");
|
|
emits("ok");
|
|
};
|
|
};
|
|
-defineExpose({ open });
|
|
|
|
|
|
+defineExpose({open});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
<el-dialog v-model="pageData.dialogVisible" destroy-on-close :width="500">
|
|
<el-dialog v-model="pageData.dialogVisible" destroy-on-close :width="500">
|
|
<template #header>
|
|
<template #header>
|
|
<el-text class="mx-1" type="primary" size="large">{{
|
|
<el-text class="mx-1" type="primary" size="large">{{
|
|
- pageData.title
|
|
|
|
- }}</el-text>
|
|
|
|
|
|
+ pageData.title
|
|
|
|
+ }}
|
|
|
|
+ </el-text>
|
|
</template>
|
|
</template>
|
|
<div class="el-dialog-content">
|
|
<div class="el-dialog-content">
|
|
<el-form
|
|
<el-form
|
|
@@ -134,7 +150,7 @@ defineExpose({ open });
|
|
:rules="pageData.formRules"
|
|
:rules="pageData.formRules"
|
|
:loading="pageData.formLoading"
|
|
:loading="pageData.formLoading"
|
|
>
|
|
>
|
|
- <el-form-item label="名称" prop="userName">
|
|
|
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
<el-input
|
|
<el-input
|
|
v-model="pageData.formData.name"
|
|
v-model="pageData.formData.name"
|
|
clearable
|
|
clearable
|
|
@@ -143,7 +159,7 @@ defineExpose({ open });
|
|
:readonly="isDetail"
|
|
:readonly="isDetail"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="编码" prop="password">
|
|
|
|
|
|
+ <el-form-item label="编码" prop="code">
|
|
<el-input
|
|
<el-input
|
|
v-model="pageData.formData.code"
|
|
v-model="pageData.formData.code"
|
|
clearable
|
|
clearable
|
|
@@ -152,50 +168,34 @@ defineExpose({ open });
|
|
:readonly="isDetail"
|
|
:readonly="isDetail"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</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
|
|
<el-input
|
|
- v-model="pageData.formData.privateKey"
|
|
|
|
|
|
+ v-model="pageData.formData.sellerId"
|
|
clearable
|
|
clearable
|
|
- placeholder="请输入密钥"
|
|
|
|
|
|
+ placeholder="请输入商户ID"
|
|
size="small"
|
|
size="small"
|
|
:readonly="isDetail"
|
|
:readonly="isDetail"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="公钥" prop="password">
|
|
|
|
|
|
+ <el-form-item label="每日限额" prop="dayMaxPayAmount">
|
|
<el-input
|
|
<el-input
|
|
- v-model="pageData.formData.publicKey"
|
|
|
|
|
|
+ v-model="pageData.formData.dayMaxPayAmount"
|
|
clearable
|
|
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"
|
|
size="small"
|
|
:readonly="isDetail"
|
|
:readonly="isDetail"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="限制流水" prop="password">
|
|
|
|
|
|
+ <el-form-item label="单笔限额" prop="onePayMaxAmount">
|
|
<el-input
|
|
<el-input
|
|
- v-model="pageData.formData.astrictTrade"
|
|
|
|
|
|
+ v-model="pageData.formData.onePayMaxAmount"
|
|
clearable
|
|
clearable
|
|
- placeholder="请输入限制流水"
|
|
|
|
|
|
+ placeholder="请输入单笔限额"
|
|
size="small"
|
|
size="small"
|
|
:readonly="isDetail"
|
|
:readonly="isDetail"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="统一费率" prop="password">
|
|
|
|
|
|
+ <el-form-item label="统一费率" prop="rate">
|
|
<el-input
|
|
<el-input
|
|
v-model="pageData.formData.rate"
|
|
v-model="pageData.formData.rate"
|
|
clearable
|
|
clearable
|
|
@@ -206,15 +206,15 @@ defineExpose({ open });
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="状态" prop="password">
|
|
<el-form-item label="状态" prop="password">
|
|
<el-select
|
|
<el-select
|
|
- v-model="pageData.formData.status"
|
|
|
|
- clearable
|
|
|
|
- placeholder="请选择状态"
|
|
|
|
|
|
+ v-model="pageData.formData.status"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择状态"
|
|
>
|
|
>
|
|
<el-option
|
|
<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-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -223,7 +223,8 @@ defineExpose({ open });
|
|
<template #footer>
|
|
<template #footer>
|
|
<el-button v-if="!isDetail" @click="handleClose">取消</el-button>
|
|
<el-button v-if="!isDetail" @click="handleClose">取消</el-button>
|
|
<el-button v-if="!isDetail" type="primary" @click="handleConfirm"
|
|
<el-button v-if="!isDetail" type="primary" @click="handleConfirm"
|
|
- >确认</el-button
|
|
|
|
|
|
+ >确认
|
|
|
|
+ </el-button
|
|
>
|
|
>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|