<template>
|
<div class="menuPage">
|
<div class="selectMenu">
|
<el-form :inline="true"
|
:model="searchData"
|
class="form-inline">
|
<el-form-item label="支付公司">
|
<el-select v-model="searchData.companyId"
|
placeholder="请选择"
|
clearable>
|
<el-option v-for="item in companyList"
|
:key="item.companyId"
|
:label="item.payCompany"
|
:value="item.companyId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="银行名称">
|
<el-select v-model="searchData.bankId" filterable
|
placeholder="请选择"
|
clearable>
|
<el-option v-for="item in bankList"
|
:key="item.bankId"
|
:label="item.bankName"
|
:value="item.bankId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="交易类型">
|
<el-select v-model="searchData.transType"
|
placeholder="请选择"
|
clearable>
|
<el-option v-for="item in transTypeList"
|
:key="item.id"
|
:label="item.value"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item class="search">
|
<el-button @click="search"
|
type="primary">查询</el-button>
|
<el-button @click="reset">重置</el-button>
|
</el-form-item>
|
</el-form>
|
<div class="channelMenu">
|
<div class="add">
|
<el-button @click="add">新增</el-button>
|
</div>
|
<el-table :data="menuItems"
|
v-loading="loading"
|
border>
|
<el-table-column prop="payCompany"
|
align="center"
|
label="支付公司">
|
</el-table-column>
|
<el-table-column prop="transType"
|
align="center"
|
label="交易类型">
|
<template slot-scope="scope">
|
<span>{{enumerMap(scope.row.transType,'transType')}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="bankName"
|
align="center"
|
label="银行名称">
|
</el-table-column>
|
<el-table-column prop="status"
|
align="center"
|
label="状态">
|
<template slot-scope="scope">
|
<span>{{enumerMap(scope.row.status,'status')}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="offStart"
|
align="center"
|
label="开始时间">
|
</el-table-column>
|
<el-table-column prop="offEnd"
|
align="center"
|
label="结束时间">
|
</el-table-column>
|
<el-table-column align="center"
|
label="操作" width="150">
|
<template slot-scope="scope">
|
<el-button size="mini"
|
@click="edit(scope.row.bankTransId)">编辑</el-button>
|
<el-button size="mini" type="danger"
|
@click="deleteConfirm(scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-pagination @current-change="handleCurrentChange" :current-page="currentPage"
|
layout="total,prev, pager, next, jumper"
|
background
|
style="margin-top: 10px;"
|
:total.sync="totalPage">
|
</el-pagination>
|
</div>
|
</div>
|
<my-mask v-model="maskShow"
|
v-on:hide="hideMask"
|
:DarkData="maskData"
|
:maskBankList="bankList"
|
:maskCompanyList="companyList"
|
:clickType="type"></my-mask>
|
</div>
|
</template>
|
|
<script>
|
import { mapGetters, mapMutations } from "vuex";
|
import MyMask from "./Mask";
|
|
export default {
|
data() {
|
return {
|
maskShow: false,
|
menuItems: [],
|
trueMenuItems: [],
|
searchData: {
|
transType: "",
|
companyId: "",
|
bankId: ""
|
},
|
type: "",
|
companyList: [],
|
bankList: [],
|
transTypeList: [
|
{ value: "鉴权", id: "100" },
|
{ value: "单笔代扣", id: "301" },
|
{ value: "代付", id: "200" },
|
{ value: "协议代扣", id: "303" },
|
{ value: "批量代扣", id: "302" }
|
],
|
maskData: {},
|
trueMenuItems: "",
|
totalPage: 1,
|
currentPage: 1,
|
loading: false
|
};
|
},
|
props: ["queryChannelRespDto"],
|
components: {
|
MyMask
|
},
|
created() {
|
this.getAllData();
|
},
|
|
computed: {
|
...mapGetters(["getMenu"])
|
},
|
|
watch: {
|
getMenu: function (now, old) {
|
this.getMenuData();
|
},
|
maskShow: function (n) {
|
if (n) return;
|
this.getMenuData()
|
}
|
},
|
methods: {
|
// 获取银行数据
|
getBankData() {
|
return this.$http.get("manage/getBankCodes");
|
},
|
// 获取公司数据
|
getCompanyData() {
|
return this.$http.get("manage/getCompanys");
|
},
|
// 获取菜单数据
|
getMenuData() {
|
return this.$http.post("darkness/getBankTransList", this.searchData);
|
},
|
// axios并发请求
|
getAllData() {
|
const that = this;
|
this.loading = true
|
this.Axios.all([
|
this.getBankData(),
|
this.getCompanyData(),
|
this.getMenuData()
|
])
|
.then(
|
this.Axios.spread(function (bank, Company, Menu) {
|
that.companyList = Company.data;
|
that.bankList = bank.data;
|
that.trueMenuItems = Menu.data.retBody;
|
if (that.trueMenuItems.length >= 10) {
|
that.menuItems = that.trueMenuItems.slice(0, 10);
|
} else {
|
that.menuItems = that.trueMenuItems;
|
}
|
that.loading = false
|
that.totalPage = parseInt(Menu.data.retBody.length);
|
})
|
)
|
.catch(err => {
|
console.log(err);
|
});
|
},
|
// 编辑
|
edit(id) {
|
this.mapData(id);
|
this.maskShow = true;
|
this.type = "edit";
|
},
|
// 新增
|
add() {
|
this.maskShow = true;
|
this.type = "add";
|
},
|
// 查询
|
search() {
|
const that = this;
|
this.getMenuData()
|
.then(Menu => {
|
if(Menu.data.retHeader.retCode==="0000"){
|
that.trueMenuItems = Menu.data.retBody;
|
if (that.trueMenuItems.length >= 10) {
|
that.menuItems = that.trueMenuItems.slice(0, 10);
|
} else {
|
that.menuItems = that.trueMenuItems;
|
}
|
that.totalPage = parseInt(Menu.data.retBody.length);
|
}else{
|
this.$emit("hide");
|
that.totalPage = 0
|
that.menuItems = []
|
this.$message.error(Menu.data.retHeader.retMessage)
|
}
|
})
|
.catch(err => {
|
console.log(err);
|
});
|
},
|
// 重置
|
reset() {
|
this.searchData = {
|
transType: "",
|
companyId: "",
|
bankId: ""
|
};
|
this.currentPage = 1
|
this.getMenuData()
|
},
|
// 隐藏蒙版
|
hideMask() {
|
this.maskShow = false;
|
this.currentPage = 1
|
this.search()
|
},
|
// 点击对应数据传递
|
mapData(id) {
|
for (var i = 0; i < this.trueMenuItems.length; i++) {
|
if (id == this.trueMenuItems[i].bankTransId) {
|
this.maskData = this.trueMenuItems[i];
|
}
|
}
|
},
|
// 点击分页
|
handleCurrentChange(val) {
|
this.currentPage = val;
|
const start = (val - 1) * 10;
|
if (parseInt(start) + 10 <= this.trueMenuItems.length) {
|
const end = parseInt(start) + 10;
|
this.menuItems = this.trueMenuItems.slice(start, end);
|
} else {
|
this.menuItems = this.trueMenuItems.slice(start);
|
}
|
},
|
|
// 删除
|
deleteConfirm(row){
|
this.$confirm('是否确定删除该数据?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.$http.post(`darkness/deleteBankTrans`,{bankTransId:row.bankTransId}).then(response => {
|
if (response.data.retHeader.retCode === '0000') {
|
this.$message.success(response.data.retHeader.retMessage)
|
} else {
|
this.$message.error(response.data.retHeader.retMessage)
|
}
|
})
|
}).catch(() => {
|
});
|
},
|
}
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.menuPage {
|
width: 100%;
|
padding: 0px 0px;
|
overflow: hidden;
|
.selectMenu {
|
width: 100%;
|
overflow: hidden;
|
.selectOptions {
|
width: 60%;
|
overflow: hidden;
|
border-bottom: 1px solid #eee;
|
.subMenuItem {
|
width: 50%;
|
float: left;
|
padding: 8px 0px;
|
color: black;
|
> span {
|
display: inline-block;
|
font-size: 14px;
|
width: 26%;
|
height: 100%;
|
text-align: right;
|
}
|
}
|
}
|
.selectBtn {
|
width: 60%;
|
height: 100%;
|
padding: 10px 0px;
|
.center {
|
margin-left: 50%;
|
transform: translateX(-50%);
|
> button {
|
padding: 8px 23px;
|
margin-right: 20px;
|
}
|
}
|
}
|
.channelMenu {
|
width: 100%;
|
margin-top: 20px;
|
.channelMenuTitle {
|
width: 100%;
|
height: 30px;
|
> div {
|
height: 100%;
|
float: left;
|
background-color: #333333;
|
border: 1px solid #999;
|
line-height: 30px;
|
text-align: center;
|
color: white;
|
font-size: 14px;
|
width: 12.5%;
|
margin-right: -1px;
|
}
|
}
|
.add {
|
margin: 20px 0px;
|
}
|
.channelMenuContent {
|
width: 100%;
|
.contentItem {
|
width: 100%;
|
height: 36px;
|
> .contentValue {
|
float: left;
|
width: 12.5%;
|
height: 36px;
|
border: 1px solid #797979;
|
border-top: none;
|
text-align: center;
|
line-height: 36px;
|
background-color: #fff;
|
margin-right: -1px;
|
> a {
|
display: inline-block;
|
border: 1px solid #eee;
|
background-color: #66b1ff;
|
width: 50px;
|
height: 30px;
|
border-radius: 6px;
|
outline: none;
|
font-size: 14px;
|
line-height: 30px;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|