kakapay后台管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

438 lines
15 KiB

<template>
<div class="app-container">
<div class="flexBet searchTop">
<!-- <div class="title flex m20">
<div class="bar"></div>
<div class="text">通道列表</div>
</div> -->
</div>
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="76px"
class="flex form" style="position: relative">
<el-form-item label="通道名称" prop="channelName">
<el-input size="medium" v-model="queryParams.channelName" placeholder="请输入通道名称"
@keyup.enter.native="handleQuery" style="width: 180px; border-color: #e6f1ff" />
</el-form-item>
<!-- <el-form-item label="创建时间">
<el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :unlink-panels="true"></el-date-picker>
</el-form-item> -->
<el-form-item>
<div class="searchTop flexBet" style="align-items: center">
<el-row :gutter="10" class="mb8">
<el-button type="primary" icon="" size="medium" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="medium" @click="resetQuery">重置</el-button>
<el-button type="primary" plain icon="" size="medium" @click="handleAdd()"
v-hasPermi="['platform:platformChannel:add']"
>添加通道</el-button>
</el-row>
</div>
</el-form-item>
</el-form>
<!-- <div class="searchTop flexBet">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="" size="medium" @click="handleAdd()">添加通道</el-button>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</div> -->
<div class="bg">
<el-table stripe :data="infoList" v-loading="loading">
<el-table-column label="通道名称" align="center" prop="channelName" />
<el-table-column label="通道代码" align="center" prop="channelCode" />
<el-table-column label="通道描述" align="center" prop="channelDesc" />
<el-table-column :label="'通道类型'" align="center" prop="channelType">
<template slot-scope="scope">
{{ scope.row.channelType == 2 ? '代付' : '代收' }}
</template>
</el-table-column>
<el-table-column :label="'最小金额'" align="center" prop="amountIntervalMin">
<template slot-scope="scope">
{{ parseFloat(NumberDiv(scope.row.amountIntervalMin, 100)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column :label="'最大金额'" align="center" prop="amountIntervalMax">
<template slot-scope="scope">
{{ parseFloat(NumberDiv(scope.row.amountIntervalMax, 100)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column :label="'费率'" align="center" prop="channelRate">
<template slot-scope="scope">
{{ scope.row.channelRate }}%
</template>
</el-table-column>
<el-table-column :label="'单笔手续费'" align="center" prop="channelSingleFee">
<template slot-scope="scope">
{{ parseFloat(NumberDiv(scope.row.channelSingleFee, 100)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" min-width="180" />
<!-- <el-table-column label="更新时间" align="center" prop="updateTime" min-width="180" /> -->
<el-table-column label="状态" align="center" prop="status" width="140px">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-text="开" inactive-text="关" :active-value="1" :inactive-value="2"
@change="switchStatusChange(scope.row)"
v-hasPermi="['platform:platformChannel:edit']"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" min-width="200">
<template slot-scope="scope">
<el-button size="small" type="text" @click="handleUpdate(scope.row)" style="color: #006eff"
v-hasPermi="['platform:platformChannel:edit']"
>编辑</el-button>
<el-button size="small" type="text" @click="handleOpera(scope.row)" style="color: #006eff"
v-hasPermi="['platform:platformChannel:edit']"
>配置</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">
</pagination>
</div>
<!-- 添加或修改商户对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="通道名称" prop="channelName">
<el-input v-model="form.channelName" placeholder="请输入通道名称" />
</el-form-item>
<el-form-item label="通道代码" prop="channelCode">
<el-input v-model="form.channelCode" placeholder="请输入通道代码" />
</el-form-item>
<el-form-item label="通道描述" prop="channelDesc">
<el-input v-model="form.channelDesc" placeholder="请输入通道描述" type="textarea" />
</el-form-item>
<el-form-item label="类型" prop="channelType">
<el-select v-model="form.channelType" placeholder="请选择类型" clearable size="medium">
<el-option v-for="(item, i) in types" :key="i" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('form')">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 通道配置 -->
<el-dialog :title="title" :visible.sync="openOpera" width="500px" append-to-body>
<el-form ref="formOpera" :model="form" :rules="rules" label-width="80px">
<el-form-item label="金额区间" prop="amountIntervalMin">
<el-input v-model="form.amountIntervalMin" placeholder="最小金额" style="width:180px"
@input="getValue('amountIntervalMin')" /> -
<el-input v-model="form.amountIntervalMax" placeholder="最大金额" style="width:180px"
@input="getValue('amountIntervalMax')" />
</el-form-item>
<el-form-item label="系统费率" prop="">
<el-form-item label="比例" prop="channelRate" style="margin-bottom:20px">
<el-input v-model="form.channelRate" placeholder="请输入比例" />
</el-form-item>
<el-form-item label="单笔" prop="channelSingleFee">
<el-input v-model="form.channelSingleFee" placeholder="请输入单笔" @input="getValue('channelSingleFee')" />
</el-form-item>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('formOpera')">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPlatformChannel, getPlatformChannel, delPlatformChannel, addPlatformChannel, updatePlatformChannel, exportPlatformChannel } from "@/api/platform/platformChannel";
export default {
name: "PlatformChannel",
components: {
},
data() {
return {
types: [
{
label: '代付',
value: 2,
},
{
label: '代收',
value: 1,
},
],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 平台通道表格数据
infoList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openOpera: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
channelName: null,
channelCode: null,
channelDesc: null,
channelType: null,
status: null,
amountIntervalMin: null,
amountIntervalMax: null,
channelRate: null,
channelSingleFee: null
},
// 表单参数
form: {},
// 表单校验
rules: {
channelName: [
{ required: true, message: "通道名称不能为空", trigger: "blur" }
],
channelCode: [
{ required: true, message: "通道代码不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
// channelDesc: [
// { required: true, message: "通道描述不能为空", trigger: "blur" }
// ],
channelType: [
{ required: true, message: "通道类型:1-代收, 2-代付不能为空", trigger: "change" }
],
updateTime: [
{ required: true, message: "更新时间不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "状态: 1-启用, 2-禁用不能为空", trigger: "blur" }
],
amountIntervalMin: [
{ required: true, message: "金额区间—最小不能为空", trigger: "blur" }
],
amountIntervalMax: [
{ required: true, message: "金额区间—最大不能为空", trigger: "blur" }
],
channelRate: [
{ required: true, message: "费率不能为空", trigger: "blur" }
],
channelSingleFee: [
{ required: true, message: "单笔手续费不能为空", trigger: "blur" }
]
},
num: {
amountIntervalMin: null,
amountIntervalMax: null,
channelSingleFee: null,
}
};
},
$autoRefresh: {
// 刷新间隔时间
interval: 3000 * 10,
// 立即执行一次
immediate: false,
// 被回调的函数, 不保证顺序执行
handles: ["getList"],
/**
* 调用 handles 后的回调函数
* 这个字段为数组类型, 数组中的每个元素都是一个函数, 在对应索引的 handle 执行后被调用
*/
callbacks: [],
// 是否启用调试模式
debug: true,
},
created() {
this.getList();
},
methods: {
// 变换不同的值
getValue(t) {
if (t == 'amountIntervalMin') {
this.num.amountIntervalMin = this.NumberMul(this.form.amountIntervalMin, 100)
}
if (t == 'amountIntervalMax') {
this.num.amountIntervalMax = this.NumberMul(this.form.amountIntervalMax, 100)
}
if (t == 'channelSingleFee') {
this.num.channelSingleFee = this.NumberMul(this.form.channelSingleFee, 100)
}
},
/** 查询平台通道列表 */
getList() {
this.loading = true;
listPlatformChannel(this.queryParams).then(response => {
this.infoList = response.rows;
this.total = Number(response.total);
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.openOpera = false
this.reset();
},
// 表单重置
reset() {
this.form = {
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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
},
/** 配置按钮操作 */
handleOpera(row) {
this.reset();
const id = row.id || this.ids
getPlatformChannel(id).then(response => {
this.form = response.data;
this.form.channelSingleFee = this.NumberDiv(this.form.channelSingleFee, 100)
this.form.amountIntervalMin = this.NumberDiv(this.form.amountIntervalMin, 100)
this.form.amountIntervalMax = this.NumberDiv(this.form.amountIntervalMax, 100)
this.openOpera = true;
this.title = "通道配置";
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加平台通道";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getPlatformChannel(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改平台通道";
});
},
// 状态有效无效
switchStatusChange(row) {
const id = row.id || this.ids;
this.form = row;
this.form.status = row.status;
updatePlatformChannel(this.form).then((res) => {
if (res.code === 200) {
this.$message.success("编辑成功");
}
});
},
/** 提交按钮 */
submitForm(val) {
this.$refs[val].validate(valid => {
if (valid) {
if (val == 'form') {
if (this.form.id != null) {
updatePlatformChannel(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPlatformChannel(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
} else {
updatePlatformChannel({
amountIntervalMax:this.num.amountIntervalMax,
amountIntervalMin:this.num.amountIntervalMin,
channelSingleFee:this.num.channelSingleFee,
channelRate:this.form.channelRate,
id:this.form.id,
}).then(response => {
this.msgSuccess("修改成功");
this.openOpera = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除平台通道编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delPlatformChannel(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有平台通道数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportPlatformChannel(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>