init
This commit is contained in:
@@ -1,62 +1,6 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="wxMcid">
|
||||
<el-input
|
||||
v-model="queryParams.wxMcid"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="wxKey">
|
||||
<el-input
|
||||
v-model="queryParams.wxKey"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="appid">
|
||||
<el-input
|
||||
v-model="queryParams.appid"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="privateKey">
|
||||
<el-input
|
||||
v-model="queryParams.privateKey"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="publicKey">
|
||||
<el-input
|
||||
v-model="queryParams.publicKey"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="notifyUrl">
|
||||
<el-input
|
||||
v-model="queryParams.notifyUrl"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<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>
|
||||
@@ -85,44 +29,32 @@
|
||||
v-hasPermi="['cai:payConfig: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:payConfig:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['cai:payConfig:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="payConfigList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="" align="center" prop="id" v-if="true"/>
|
||||
<el-table-column label="1支付宝2微信" align="center" prop="payType" />
|
||||
<el-table-column label="" align="center" prop="name" />
|
||||
<el-table-column label="" align="center" prop="wxMcid" />
|
||||
<el-table-column label="" align="center" prop="wxKey" />
|
||||
<el-table-column label="" align="center" prop="appid" />
|
||||
<el-table-column label="" align="center" prop="privateKey" />
|
||||
<el-table-column label="" align="center" prop="publicKey" />
|
||||
<el-table-column label="" align="center" prop="notifyUrl" />
|
||||
<el-table-column label="" align="center" prop="enableStatus" />
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="支付方式" align="center" prop="payType" >
|
||||
<template v-slot="scope">
|
||||
<cai-dict-tag :options="payConfigTypeList" :value="scope.row.payType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付宝AppId" align="center" prop="appid" />
|
||||
<el-table-column label="微信商户号" align="center" prop="wxMcid" />
|
||||
<el-table-column label="回调地址" align="center" prop="notifyUrl" show-overflow-tooltip/>
|
||||
<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="handleEnableStatusChange(scope.row)"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -149,48 +81,24 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改支付配置对话框 -->
|
||||
<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="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="wxMcid">
|
||||
<el-input v-model="form.wxMcid" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="wxKey">
|
||||
<el-input v-model="form.wxKey" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="appid">
|
||||
<el-input v-model="form.appid" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="privateKey">
|
||||
<el-input v-model="form.privateKey" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="publicKey">
|
||||
<el-input v-model="form.publicKey" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="notifyUrl">
|
||||
<el-input v-model="form.notifyUrl" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<pay-config-add-or-update-dialog v-if="payConfigAddOrUpdateDialogVisible" ref="payConfigAddOrUpdateDialog" @refreshDataList="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPayConfig, getPayConfig, delPayConfig, addPayConfig, updatePayConfig } from "@/api/cai/payConfig";
|
||||
import {delPayConfig, listPayConfig, updatePayConfig} from "@/api/cai/payConfig";
|
||||
import {payConfigTypeList} from "@/constant/statusMap";
|
||||
import PayConfigAddOrUpdateDialog from "@/views/cai/payConfig/pay-config-add-or-update-dialog";
|
||||
|
||||
export default {
|
||||
name: "PayConfig",
|
||||
components: {
|
||||
PayConfigAddOrUpdateDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
payConfigTypeList,
|
||||
payConfigAddOrUpdateDialogVisible: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -205,62 +113,11 @@ export default {
|
||||
total: 0,
|
||||
// 支付配置表格数据
|
||||
payConfigList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
payType: undefined,
|
||||
name: undefined,
|
||||
wxMcid: undefined,
|
||||
wxKey: undefined,
|
||||
appid: undefined,
|
||||
privateKey: undefined,
|
||||
publicKey: undefined,
|
||||
notifyUrl: undefined,
|
||||
enableStatus: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
payType: [
|
||||
{ required: true, message: "1支付宝2微信不能为空", trigger: "change" }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
wxMcid: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
wxKey: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
appid: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
privateKey: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
publicKey: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
notifyUrl: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
enableStatus: [
|
||||
{ required: true, message: "不能为空", trigger: "change" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -276,28 +133,6 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
payType: undefined,
|
||||
name: undefined,
|
||||
wxMcid: undefined,
|
||||
wxKey: undefined,
|
||||
appid: undefined,
|
||||
privateKey: undefined,
|
||||
publicKey: undefined,
|
||||
notifyUrl: undefined,
|
||||
enableStatus: undefined,
|
||||
createTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
@@ -316,53 +151,37 @@ export default {
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加支付配置";
|
||||
this.payConfigAddOrUpdateDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.payConfigAddOrUpdateDialog.init()
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getPayConfig(id).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改支付配置";
|
||||
});
|
||||
this.payConfigAddOrUpdateDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.payConfigAddOrUpdateDialog.init(row.id)
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.id != null) {
|
||||
updatePayConfig(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addPayConfig(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
handleEnableStatusChange(row){
|
||||
let text = row.enableStatus === 0 ? '关闭' : '开启'
|
||||
this.$confirm('确认要' + text + '[' + row.name + ']的支付配置吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
return updatePayConfig({ id: row.id, enableStatus: row.enableStatus })
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + '成功')
|
||||
}).catch(function() {
|
||||
row.enableStatus = row.enableStatus === 0 ? 1 : 0
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除支付配置编号为"' + ids + '"的数据项?').then(() => {
|
||||
this.$modal.confirm('是否确认删除支付配置名称为"' + row.name + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delPayConfig(ids);
|
||||
return delPayConfig(row.id);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
@@ -372,12 +191,6 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('cai/payConfig/export', {
|
||||
...this.queryParams
|
||||
}, `payConfig_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user