This commit is contained in:
77
2024-11-27 17:29:51 +08:00
parent 23e6fe3535
commit 71df000f28
3 changed files with 386 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询四方支付配置列表
export function listPayTrdConfig(query) {
return request({
url: '/cai/payTrdConfig/list',
method: 'get',
params: query
})
}
// 查询四方支付配置详细
export function getPayTrdConfig(id) {
return request({
url: '/cai/payTrdConfig/' + id,
method: 'get'
})
}
// 新增四方支付配置
export function addPayTrdConfig(data) {
return request({
url: '/cai/payTrdConfig',
method: 'post',
data: data
})
}
// 修改四方支付配置
export function updatePayTrdConfig(data) {
return request({
url: '/cai/payTrdConfig',
method: 'put',
data: data
})
}
export function updateEnableStatusPayTrdConfig(data) {
return request({
url: '/cai/payTrdConfig/enableStatus',
method: 'post',
data: data
})
}
// 删除四方支付配置
export function delPayTrdConfig(id) {
return request({
url: '/cai/payTrdConfig/' + id,
method: 'delete'
})
}

View File

@@ -0,0 +1,209 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['cai:payTrdConfig:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['cai:payTrdConfig:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['cai:payTrdConfig:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="payTrdConfigList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="启用" align="center" prop="enableStatus" >
<template v-slot="scope">
<el-switch
v-model="scope.row.enableStatus"
:active-value="1"
:inactive-value="0"
@change="handleOpenStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="支付类型" align="center" prop="type" />
<el-table-column label="支付名称" align="center" prop="name" />
<el-table-column label="商户ID" align="center" prop="mchId" />
<el-table-column label="支付宝产品ID" align="center" prop="aliProductId" />
<el-table-column label="请求域名" align="center" prop="gatewayUrl" />
<el-table-column label="回调域名" align="center" prop="notifyUrl" />
<el-table-column label="秘钥" align="center" prop="sign" show-overflow-tooltip />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['cai:payTrdConfig:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['cai:payTrdConfig:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pay-trd-config-add-or-update-dialog v-if="payTrdConfigAddOrUpdateVisible" ref="payTrdConfigAddOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import {
delPayTrdConfig,
listPayTrdConfig,
updateEnableStatusPayTrdConfig,
updatePayTrdConfig
} from "@/api/cai/payTrdConfig";
import PayTrdConfigAddOrUpdateDialog from "@/views/cai/payTrdConfig/pay-trd-config-add-or-update-dialog.vue";
import {updateAnchor} from "@/api/cai/anchor";
export default {
name: "PayTrdConfig",
components: {PayTrdConfigAddOrUpdateDialog},
data() {
return {
payTrdConfigAddOrUpdateVisible: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 四方支付配置表格数据
payTrdConfigList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
}
};
},
created() {
this.getList();
},
methods: {
/** 查询四方支付配置列表 */
getList() {
this.loading = true;
listPayTrdConfig(this.queryParams).then(response => {
this.payTrdConfigList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.payTrdConfigAddOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.payTrdConfigAddOrUpdate.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.payTrdConfigAddOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.payTrdConfigAddOrUpdate.init(row.id)
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除四方支付配置编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delPayTrdConfig(ids);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
handleOpenStatusChange(row){
let text = row.enableStatus === 0 ? '关闭' : '启用'
this.$confirm('确认要' + text + '该配置吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return updateEnableStatusPayTrdConfig({ id: row.id, enableStatus: row.enableStatus })
}).then(() => {
this.$modal.msgSuccess(text + '成功')
this.getList()
}).catch(function() {
row.enableStatus = row.enableStatus === 1 ? 0 : 1
})
}
}
};
</script>

View File

@@ -0,0 +1,125 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="支付类型" prop="type">
<el-select v-model="form.type" placeholder="支付类型" size="small">
<el-option key="V1" label="V1" value="V1" />
<el-option key="V2" label="V2" value="V2" />
</el-select>
</el-form-item>
<el-form-item label="支付名称" prop="name">
<el-input v-model="form.name" placeholder="请输入支付名称" />
</el-form-item>
<el-form-item label="商户ID" prop="mchId">
<el-input v-model="form.mchId" placeholder="请输入商户ID" />
</el-form-item>
<el-form-item label="支付宝产品ID" prop="aliProductId">
<el-input v-model="form.aliProductId" placeholder="请输入支付宝产品ID" />
</el-form-item>
<el-form-item label="请求域名" prop="gatewayUrl">
<el-input v-model="form.gatewayUrl" placeholder="请输入请求域名" />
</el-form-item>
<el-form-item label="回调域名" prop="notifyUrl">
<el-input v-model="form.notifyUrl" placeholder="请输入回调域名" />
</el-form-item>
<el-form-item label="秘钥" prop="sign">
<el-input v-model="form.sign" placeholder="请输入秘钥" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {addPayTrdConfig, getPayTrdConfig, updatePayTrdConfig} from "@/api/cai/payTrdConfig";
export default {
components: {
},
data () {
return {
open: false,
title: '',
form:{
id: undefined,
type: undefined,
name: undefined,
mchId: undefined,
aliProductId: undefined,
gatewayUrl: undefined,
notifyUrl: undefined,
sign: undefined,
},
// 表单校验
rules: {
type: [
{ required: true, message: "支付类型不能为空", trigger: "change" }
],
name: [
{ required: true, message: "支付名称不能为空", trigger: "blur" }
],
notifyUrl: [
{ required: true, message: "回调域名不能为空", trigger: "blur" }
],
mchId: [
{ required: true, message: "商户ID不能为空", trigger: "blur" }
],
aliProductId: [
{ required: true, message: "支付宝产品ID不能为空", trigger: "blur" }
],
sign: [
{ required: true, message: "秘钥不能为空", trigger: "blur" }
]
},
buttonLoading: false,
}
},
created() {
},
methods: {
init (id) {
this.form.id = id || undefined;
this.title = (id ? "修改" : "新增") + "四方支付配置";
this.open = true;
this.$nextTick(() => {
this.$refs['form'].resetFields();
if(this.form.id){
getPayTrdConfig(id).then(response => {
this.form = response.data;
});
}
})
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
if (this.form.id != null) {
updatePayTrdConfig(this.form).then(data => {
this.$modal.msgSuccess("修改成功");
this.$modal.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}else{
addPayTrdConfig(this.form).then(data => {
this.$modal.msgSuccess("新增成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
}
})
},
}
}
</script>