Commit 7f2db37e by liuchenxi

update: 短信分权

parent 83b0ab7b
......@@ -57,6 +57,9 @@ export const downloadTrafficCostListExcel = config.api + 'api-mall/' + 'download
// 计费部门分页查询
export const getDepartList = params => requests(PREFIX + 'list-account-department-by-page', params);
// 计费部门单条总部数据
export const getDepartSum = params => requests(PREFIX + 'get-enterprise-account', params);
// 保存计费规则
export const saveAccountRule = params => requests(PREFIX + 'save-account-rule', params);
......@@ -71,3 +74,6 @@ export const addAccountDepart = params => requests(PREFIX + 'add-account-departm
// 获取部门列表
export const getAllDepart = params => requests('api-admin/' + 'list-clerk-department', params);
// 获取门店列表
export const getStoreList = params => requests('api-admin/' + 'depart-store-list', params);
<template>
<div>
<div class="tip"></div>
<div class="dm-wrap">
<div class="top">
<div class="left">
<el-input v-model="search.departName" placeholder="请输入部门名称" prefix-icon="el-icon-search" style="width: 260px" clearable @change="getTableData" @clear="getTableData" />
<el-select v-model="search.status" placeholder="全部状态" class="w160" @change="getTableData">
<el-input v-model="search.departName" placeholder="请输入部门名称" prefix-icon="el-icon-search" style="width: 260px" clearable @change="onSearch" />
<el-select v-model="search.status" placeholder="全部状态" class="w160" @change="onSearch" clearable>
<el-option v-for="item in statusList" :key="item.value" :value="item.value" :label="item.label" />
</el-select>
</div>
......@@ -14,7 +13,7 @@
</div>
</div>
<div class="content mt20">
<el-table :data="tableData.data" element-loading-text="拼命加载中">
<el-table :data="tableData.data" v-loading="loading" :row-style="rowStyle">
<el-table-column v-for="(v, i) in tableData.header" :key="i" :prop="v.prop" :min-width="v.minWidth" :label="v.label" :formatter="v.formatter" :fixed="v.fixed" show-overflow-tooltip :render-header="onRender">
<template slot-scope="scope">
<span v-if="v.formatter" v-html="v.formatter(scope.row)"></span>
......@@ -23,28 +22,32 @@
</el-table-column>
<el-table-column label="操作" min-width="130">
<template slot-scope="{ row }">
<el-button type="text">查看门店</el-button>
<el-button type="text">记录</el-button>
<el-button type="text">启用</el-button>
<el-button type="text" @click="showStore(row)">查看门店</el-button>
<el-button type="text" @click="toRecord(row)">记录</el-button>
<template v-if="row.accountDepartId != 1">
<el-button type="text" v-if="row.status == 0" @click="updateStatus(row, 'open')">启用</el-button>
<el-button type="text" v-if="row.status == 1" @click="updateStatus(row, 'freeze')">停用</el-button>
</template>
</template>
</el-table-column>
</el-table>
<dm-pagination background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="tableData.currentPage" :page-sizes="tableData.pageSizeList" :page-size="tableData.pageSize" layout="total, sizes, prev, pager, next" :total="tableData.total" hide-on-single-page />
</div>
</div>
<add-depart :visible.sync="addDepartDialog.visible" />
<add-depart :visible.sync="addDepartDialog.visible" @saved="getTableData" />
<view-store :visible.sync="viewStoreDialog.visible" :depart-id="viewStoreDialog.departId" />
</div>
</template>
<script>
import { formatDateTimeByType } from '@/utils/index.js';
import { getDepartList } from '@/service/api/rechargeApi.js';
import { getDepartList, updateDepartStatus, getDepartSum } from '@/service/api/rechargeApi.js';
import tip from '@/components/tip';
import viewStore from './components/view-store.vue';
import AddDepart from './components/add-depart.vue';
export default {
name: 'detail-table',
components: { tip, AddDepart },
prop: {},
components: { tip, AddDepart, viewStore },
data() {
return {
search: {
......@@ -57,19 +60,26 @@ export default {
pageSizeList: [20, 40, 60, 80],
pageSize: 20,
header: [],
total: 0
total: 0,
sum: {}
},
loading: false,
addDepartDialog: {
visible: false
},
viewStoreDialog: {
visible: false,
departId: ''
},
statusList: [
{ label: '启用', value: 1 },
{ label: '停用', value: 0 }
]
};
},
created() {
async created() {
this.getTableHeader();
await this.getSumData();
this.getTableData();
this.$store.commit('mutations_breadcrumb', [
{ name: '企业管理', path: '' },
......@@ -96,16 +106,24 @@ export default {
},
methods: {
// table-methods
async getSumData() {
const { result } = await getDepartSum();
this.tableData.sum = result;
return true;
},
async getTableData() {
this.loading = true;
const para = {
searchParams: this.search.departName,
status: this.search.status,
status: [0, 1].includes(this.search.status) ? this.search.status : -1,
pageSize: this.tableData.pageSize,
currentPage: this.tableData.currentPage
};
const { result } = await getDepartList(para);
this.tableData.data = result.result || [];
this.tableData.data.unshift(this.tableData.sum);
this.tableData.total = result.totalCount;
this.loading = false;
},
getTableHeader() {
this.tableData.header = [
......@@ -121,7 +139,7 @@ export default {
},
{
label: { name: '计费门店数', tipText: '由此“独立计费部门”统一核算费用的门店数,若当前部门的某下级部门被设置为了独立计费部门并且为启用状态,则此处将不包含下级部门的门店数' },
prop: '',
prop: 'storeCount',
minWidth: 120,
formatter: row => row.storeCount || 0
},
......@@ -129,13 +147,13 @@ export default {
label: { name: '账户余额(元)' },
prop: 'accountFunds',
minWidth: 120,
formatter: row => (row.storeCount ? parseFloat(row.storeCount).toFixed(2) : '0.00')
formatter: row => (row.accountFunds ? parseFloat(row.accountFunds).toFixed(2) : '0.00')
},
{
label: { labnameel: '添加时间' },
label: { name: '添加时间' },
prop: 'createTime',
minWidth: 120,
formatter: row => (row.createTime ? formatDateTimeByType(row.createTime, 'yyyy-MM-dd hh-mm-ss') : '--')
formatter: row => (row.createTime ? formatDateTimeByType(row.createTime, 'yyyy-MM-dd HH-mm-ss') : '--')
}
];
},
......@@ -157,6 +175,35 @@ export default {
props: { text: column.label.tipText }
})
]);
},
async updateStatus(row, type) {
const open = { successBtn: '确认启用', title: '确认启用吗?', info: '启用后,该部门下的管理员或门店所产生的通讯费用将由该部门承担(启用前已产生的通讯费用归属不会变更)', status: 1, successMsg: '启用成功' };
const freeze = { successBtn: '确认停用', title: '确认停用吗?', info: '停用后,该部门将不再独立计费(历史已产生的费用归属不会变更)。后续新产生的费用系统将依次向其上级部门查询是否被设置为独立计费部门,查询不到则记录到“企业总部”账上', status: 0, successMsg: '停用成功' };
const opt = type == 'open' ? open : freeze;
try {
const options = { confirmButtonText: opt['successBtn'], cancelButtonText: '取消', type: 'warning' };
await this.$confirm(opt['info'], opt['title'], options);
await updateDepartStatus({ status: opt['status'], accountDepartId: row.accountDepartId });
this.$message.success(opt['successMsg']);
this.getTableData();
} catch (e) {
return false;
}
},
showStore(row) {
console.log(row);
this.viewStoreDialog.departId = row.departmemtId;
this.viewStoreDialog.visible = true;
},
toRecord(row) {
this.$router.push(`/recharge/record?id=${row.accountDepartId}`);
},
rowStyle({ row, rowIndex }) {
return rowIndex == 0 && { background: '#eef4ff' };
},
onSearch() {
this.tableData.currentPage = 1;
this.getTableData();
}
},
computed: {
......
......@@ -14,16 +14,19 @@
</div>
<div class="money_wrap">
<div class="current">
<div class="sub_title">账户余额(元)</div>
<div class="sub_title">
账户余额(元)
<span v-if="config.isMoreAccount">(当前所在计费部门:{{ config.departmentName }})</span>
</div>
<p class="fz22 vertical-middle money" @click="$router.push('/recharge/record')">{{ (recharge.balance / 100) | amount }}<i class="el-icon-arrow-right arrow" /></p>
<el-button class="vertical-middle pl20 pr20" type="primary" @click="$router.push('/recharge/do')">充值</el-button>
<el-button class="vertical-middle pl20 pr20" @click="$router.push('/recharge/record')">记录</el-button>
</div>
<div class="all" v-if="isMoreAccount">
<div class="all" v-if="config.isMoreAccount && config.showAllDepartment">
<div class="sub_title">
所有账户余额(元)<span class="tip"><i class="iconfont icon-anquanbaozhang" />已开启多账户计费模式</span>
</div>
<p class="fz22 vertical-middle money" @click="$router.push('/recharge/accountDetail')">{{ (recharge.balance / 100) | amount }}<i class="el-icon-arrow-right arrow" /></p>
<p class="fz22 vertical-middle money" @click="$router.push('/recharge/accountDetail')">{{ (config.allDepartmentTotal / 100) | amount }}<i class="el-icon-arrow-right arrow" /></p>
<!--该按钮待埋点-->
<!-- <el-button v-if="getCodeAuth('marketingAccountDetail')" :limit-code="getCode('marketingAccountDetail')" class="vertical-middle" @click="$router.push('/recharge/accountDetail')">账户明细</el-button> -->
<el-button class="vertical-middle" @click="$router.push('/recharge/accountDetail')">账户明细</el-button>
......@@ -32,7 +35,7 @@
</div>
<div class="dm-wrap">
<h3 class="title">今日消费</h3>
<select-depart v-if="isMoreAccount" :data="deparment1" class="mb20" @load="() => load('one')" @getDepartId="id => getDepartId(id, 'one')" @remote-search="val => remoteSearch(val, 'one')" :loading="deparment1.loading" />
<select-depart v-if="config.isMoreAccount && config.showAllDepartment" :data="deparment1" class="mb20" @load="() => load('one')" @getDepartId="id => getDepartId(id, 'one')" @remote-search="val => remoteSearch(val, 'one')" :loading="deparment1.loading" />
<el-row class="recharge-today" :gutter="20">
<el-col :span="6">
<div class="recharge-today-item border2 flex_between">
......@@ -116,7 +119,7 @@
<div class="pb22">
<div slot="header" class="clearfix">
<el-date-picker :pickerOptions="pickerOptions" v-model="dateTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="consumeRecord"></el-date-picker>
<select-depart v-if="isMoreAccount" :data="deparment2" @load="() => load('two')" @getDepartId="id => getDepartId(id, 'two')" @remote-search="val => remoteSearch(val, 'two')" :loading="deparment2.loading" />
<select-depart v-if="config.isMoreAccount && config.showAllDepartment" :data="deparment2" @load="() => load('two')" @getDepartId="id => getDepartId(id, 'two')" @remote-search="val => remoteSearch(val, 'two')" :loading="deparment2.loading" />
<span class="fz12 gray">* 此处仅支持筛选近半年的统计数据</span>
</div>
</div>
......@@ -219,18 +222,24 @@ export default {
zbFlag: 1
},
accountRule: {},
isMoreAccount: false,
setRuleVisible: false
setRuleVisible: false,
config: {
isMoreAccount: false, // 是否多账户
showAllDepartment: false, // 是否超管或部门权限为可见所有的用户
departmentName: '', // 当前账户名称
accountDepartId: '', // 普通商户(不是超管也不是部门权限为可见所有)进来时自身得账号部门Id,仅在单商户和多商户且不是超管且不是部门权限为所有时使用
allDepartmentTotal: '' // 多商户时所有账账户余额
}
};
},
created() {
async created() {
this.$store.commit('aside_handler', false);
this.rechargeCenter();
this.consumeRecord();
// this.getTodayVideoTraffic();
this.getDepartmentList();
this.getRule();
this.$store.commit('mutations_breadcrumb', [{ name: '企业管理', path: '' }, { name: '计费中心', path: '' }]); // eslint-disable-line
await this.rechargeCenter(); // 该接口返回权限字段需要控制下面接口内容
await this.getRule();
this.consumeRecord();
},
filters: {
// 金额处理 保留2位小数
......@@ -251,25 +260,33 @@ export default {
}
},
async rechargeCenter() {
const id = this.deparment1.departId;
try {
let res = await rechargeCenter({ accountDepartId: this.deparment1.departId });
let res = await rechargeCenter(id && { accountDepartId: id });
this.recharge = res.result.account;
this.extend(this.config, this.recharge);
return true;
} catch (err) {
console.log(err);
}
},
async consumeRecord() {
const para = this.listParams;
this.loading = true;
if (this.dateTime) {
this.listParams.beginTime = formatDateTimeByType(this.dateTime[0], 'yyyy-MM-dd');
this.listParams.endTime = formatDateTimeByType(this.dateTime[1], 'yyyy-MM-dd');
para.beginTime = formatDateTimeByType(this.dateTime[0], 'yyyy-MM-dd');
para.endTime = formatDateTimeByType(this.dateTime[1], 'yyyy-MM-dd');
} else {
this.listParams.beginTime = '';
this.listParams.endTime = '';
para.beginTime = '';
para.endTime = '';
}
const id = this.setAccountDepartId(this.deparment2.departId);
if (id) para.accountDepartId = id;
else {
delete para.accountDepartId;
}
this.listParams.accountDepartId = this.deparment2.departId;
try {
let res = await consumeRecord(this.listParams);
let res = await consumeRecord(para);
const result = res.result;
// , { name: '视频流量', type: 'video', fee: result.allTraffic, count: result.allTrafficCost }
this.tableList = [{ name: '短信营销', type: 'marketing', fee: result.messageFee, count: result.messageCount }, { name: '短信验证码', type: 'sms', fee: result.smsFee, count: result.smsCount }, { name: '双向呼叫', type: 'call', fee: result.callFee, count: result.callTime }, { name: '通话录音', type: 'record', fee: result.recordCallfee, count: result.recordCallTime }]; // eslint-disable-line
......@@ -335,7 +352,20 @@ export default {
async getRule() {
const result = await getAccountRule();
this.accountRule = result.result || {};
this.isMoreAccount = !!this.accountRule.status;
this.config.isMoreAccount = !!this.accountRule.status;
return true;
},
extend(to, from) {
for (let key in to) {
if (!from.hasOwnProperty(key)) continue;
to[key] = from[key];
}
}
},
computed: {
setAccountDepartId() {
const { isMoreAccount, showAllDepartment, accountDepartId: defaultAccountId } = this.config;
return id => (isMoreAccount ? (showAllDepartment ? id : defaultAccountId) : defaultAccountId);
}
}
};
......@@ -441,6 +471,7 @@ export default {
.tip {
color: #606266;
line-height: 20px;
font-size: 12px;
i {
color: #1890ff;
margin-right: 5px;
......
......@@ -6,21 +6,25 @@
<el-input class="mb10" v-model="search" prefix-icon="el-icon-search" placeholder="请输入部门名称" @change="onSearchTree"></el-input>
<el-tree ref="tree" class="tree" default-expand-all :data="treeData" check-strictly node-key="departId" :props="props" show-checkbox @check-change="handleCheckChange" :filter-node-method="filterNode">
<span slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<el-tooltip :content="node.label" v-if="node.label.length > 10" placement="right">
<span>{{ limitLenth(node.label) }}</span>
</el-tooltip>
<span v-else @click="test(node, data)">{{ node.label }}</span>
<span v-if="node.disabled" class="disabled">已设置</span>
</span>
</el-tree>
</div>
</div>
<div class="text-right mt20">
<el-button plain>取消</el-button>
<el-button type="primary">确认</el-button>
<el-button plain @click="onClose">取消</el-button>
<el-button type="primary" @click="save">确认增加</el-button>
</div>
</el-dialog>
</template>
<script>
// addAccountDepart
import { getAllDepart } from '@/service/api/rechargeApi.js';
import { getAllDepart, addAccountDepart } from '@/service/api/rechargeApi.js';
export default {
name: 'addDepartment',
props: {
......@@ -28,7 +32,7 @@ export default {
},
data() {
return {
departId: [],
depart: [],
search: '',
treeData: [],
props: {
......@@ -37,12 +41,18 @@ export default {
}
};
},
computed: {
limitLenth() {
return label => label.slice(0, 10) + '...';
}
},
methods: {
onClose() {
this.$emit('update:visible', false);
},
async getDepart() {
const { result } = await getAllDepart();
if (result) result.disabled = 1;
this.treeData = [result] || [];
},
onSearchTree() {
......@@ -50,7 +60,22 @@ export default {
},
filterNode(value, data) {
if (!value) return true;
return data.departName.indexOf(value) !== -1;
return data.departName.indexOf(value) !== -1 && !data.disabled;
},
handleCheckChange(data, status) {
const { departId, departName } = data;
if (status) this.depart.push({ id: departId, name: departName });
else this.depart = this.depart.filter(el => el.id != departId);
},
async save() {
if (!this.depart.length) return this.$message.warning('请先选择要独立计费的部门');
await addAccountDepart({ departmentJson: JSON.stringify(this.depart) });
this.$message.success('保存成功');
this.onClose();
this.$emit('saved');
},
test(a, b) {
console.log(a, b);
}
},
watch: {
......@@ -71,23 +96,37 @@ export default {
.dialog {
height: 463px;
position: relative;
.label {
display: inline-block;
width: 100px;
}
.border {
width: 100%;
width: 308px;
height: 100%;
padding: 12px;
box-sizing: border-box;
border: 1px solid #e4e7ed;
}
.content {
display: flex;
align-items: flex-start;
.label {
display: inline-block;
width: 70px;
margin-top: 8px;
}
.tree {
height: 245px;
overflow-y: auto;
}
}
.tree {
height: 245px;
overflow-y: auto;
.disabled {
display: inline-block;
width: 48px;
background: #f0f5ff;
border-radius: 2px;
border: 1px solid #adc6ff;
color: #1890ff;
text-align: center;
line-height: 18px;
font-size: 12px;
margin-left: 5px;
}
}
</style>
<template>
<el-select v-model="departId" placeholder="请选择计费部门" class="select_more" ref="select" @change="handleChange" filterable remote :remote-method="remoteMethod" suffix-icon="el-icon-search">
<el-select v-model="departId" placeholder="请选择计费部门" clearable class="select_more" ref="select" @change="handleChange" filterable remote :remote-method="remoteMethod" suffix-icon="el-icon-search">
<div class="infinite-list" ref="infinite-list" v-infinite-scroll="load" style="overflow:auto;max-height:260px">
<el-option v-for="item in data.list" :key="item.accountDepartId" :value="item.accountDepartId" :label="item.accountDepartName">{{ item.accountDepartName }}</el-option>
<p style="text-align: center" :hidden="!loading"><i class="el-icon-loading"></i></p>
......@@ -18,6 +18,7 @@ export default {
loading: Boolean
},
mounted() {
this.departId = this.data.departId;
this.$refs['select'].$el.querySelector('.el-select-dropdown__wrap').style.overflow = 'inherit';
},
data() {
......@@ -30,6 +31,7 @@ export default {
this.$emit('load');
},
handleChange() {
console.log(this.departId);
this.$emit('getDepartId', this.departId);
},
remoteMethod(val) {
......
<template>
<el-dialog title="查看门店" :visible.sync="visible" width="740px" custom-class="store" @close="onClose">
<div class="alert">
<i class="iconfont icon-warning-circle-fill"></i>
<span class="ml10">若要修改门店请前往【企业管理-权限管理-用户列表】进行修改</span>
</div>
<el-input class="mt20 mb20 w260" v-model="search" clearable prefix-icon="el-icon-search" placeholder="请输入门店名称或code" @change="onSearch" />
<el-table :data="tableData.data" element-loading-text="拼命加载中" max-height="288">
<el-table-column v-for="(v, i) in tableData.header" :key="i" :prop="v.prop" :min-width="v.minWidth" :label="v.label" :formatter="v.formatter" :fixed="v.fixed" show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="v.formatter" v-html="v.formatter(scope.row)"></span>
<span v-else>{{ scope.row[v.prop] || '--' }}</span>
</template>
</el-table-column>
</el-table>
<dm-pagination small class="dm-pagination" @current-change="handleCurrentChange" :current-page="tableData.currentPage" :page-size="tableData.pageSize" layout="prev, pager, next" :total="tableData.total" hide-on-single-page />
</el-dialog>
</template>
<script>
import { getStoreList } from '@/service/api/rechargeApi.js';
export default {
name: 'view-store',
components: {},
props: {
visible: Boolean,
departId: String
},
data() {
return {
search: '',
tableData: {
data: [],
currentPage: 1,
pageSize: 10,
header: [],
total: 0,
loading: false
}
};
},
created() {
// create hook
},
mounted() {
// mounted hook
},
methods: {
// table-methods
async getTableData() {
this.tableData.loading = true;
const para = {
search: this.search,
pageSize: this.tableData.pageSize,
pageNum: this.tableData.currentPage,
departId: this.departId
};
const { result } = await getStoreList(para);
this.tableData.data = result.result || [];
this.tableData.total = result.totalCount;
this.tableData.loading = false;
},
getTableHeader() {
this.tableData.header = [
{ label: '门店名称', prop: 'storeName', minWidth: 120 },
{ label: '门店code', prop: 'storeCode', minWidth: 120 },
{ label: '所属部门', prop: 'departName', minWidth: 120 }
];
},
handleCurrentChange(val) {
this.tableData.currentPage = val;
this.getTableData();
},
onSearch() {
this.tableData.currentPage = 1;
this.getTableData();
},
onClose() {
this.$emit('update:visible', false);
this.search = '';
this.tableData.currentPage = 1;
}
},
computed: {
// do something
},
watch: {
visible: {
handler: function(newVal) {
if (newVal) {
this.getTableData();
this.getTableHeader();
}
},
immediate: true
}
}
};
</script>
<style scoped lang="scss">
.store {
height: 513px;
.alert {
display: flex;
align-items: center;
background: #f7f8fa;
width: 475px;
height: 32px;
padding: 0 16px;
box-sizing: border-box;
i {
color: #1890ff;
}
}
}
.w260 {
width: 260px;
}
</style>
import { rechargeCenter, getAccountRule } from '@/service/api/rechargeApi.js';
/*
该混入在 消费详情和记录页中用到, 主要混入了isMoreAccount和config两个属性
和对该属性的一些配置
*/
export default {
data() {
return {
isMoreAccount: false, // 是否多账户
config: {
showAllDepartment: false, // 是否超管或部门权限为可见所有的用户
accountDepartId: '' // 普通商户(不是超管也不是部门权限为可见所有)进来时自身得账号部门Id,仅在单商户和多商户且不是超管且不是部门权限为所有时使用
}
};
},
methods: {
extend(to, from) {
for (let key in to) {
if (!from.hasOwnProperty(key)) continue;
to[key] = from[key];
}
},
// 获取超管、部门权限为所有的权限值
async getAuth() {
try {
let res = await rechargeCenter();
this.extend(this.config, res.result.account || {});
// this.config.showAllDepartment = false;
return true;
} catch (err) {
console.log(err);
}
},
// 获取计费规则-是否为多商户
async getRule() {
const result = await getAccountRule();
const res = result.result || {};
this.isMoreAccount = !!res.status;
return true;
}
},
computed: {
setAccountDepartId() {
return (id, config) => {
const isMoreAccount = this.isMoreAccount;
const { showAllDepartment, accountDepartId: defaultAccountId } = config;
return isMoreAccount ? (showAllDepartment ? id : defaultAccountId) : defaultAccountId;
};
}
}
};
......@@ -10,7 +10,7 @@
<el-select v-if="listParams.feeType == 2" style="width:180px" clearable v-model="listParams.deductType" placeholder="全部扣款类型" @change="onSearch">
<el-option v-for="(value, key) in deductTypeList" :key="key" :label="value" :value="key"></el-option>
</el-select>
<select-depart v-if="isMoreAccount" :data="deparment" @load="load" @getDepartId="getDepartId" @remote-search="remoteSearch" :loading="deparment.loading" />
<select-depart v-if="isMoreAccount && config.showAllDepartment" :data="deparment" @load="load" @getDepartId="getDepartId" @remote-search="remoteSearch" :loading="deparment.loading" />
</div>
<el-table tooltipEffect="dark" :data="tableList" style="width: 100%">
<el-table-column align="left" prop="timeEnd" label="操作时间">
......@@ -44,19 +44,21 @@
</template>
</el-table-column>
</el-table>
<dm-pagination v-show="tableList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></dm-pagination>
<dm-pagination v-show="tableList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total" hide-on-single-page></dm-pagination>
</section>
</template>
<script>
import { rechargeRecord, getDepartList, getAccountRule } from '@/service/api/rechargeApi.js';
import { rechargeRecord, getDepartList } from '@/service/api/rechargeApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
import 'viewerjs/dist/viewer.css';
import { component as Viewer } from 'v-viewer';
import SelectDepart from './components/select-depart.vue';
import intel from './recharge_mixin';
export default {
name: 'recharge-record',
components: { Viewer, SelectDepart },
mixins: [intel],
data() {
return {
textMap: {
......@@ -74,7 +76,8 @@ export default {
beginTime: '',
endTime: '',
deductType: '',
feeType: ''
feeType: '',
accountDepartId: ''
},
deparment: {
list: [],
......@@ -88,15 +91,16 @@ export default {
zbFlag: 1
},
total: 0,
deductTypeList: {},
isMoreAccount: false
deductTypeList: {}
};
},
created() {
this.rechargeRecord();
async created() {
this.deparment.departId = this.$route.query.id || '';
this.getDepartmentList();
this.getRule();
this.$store.commit('mutations_breadcrumb', [{ name: '企业管理', path: '' }, { name: '计费中心', path: '/recharge' }, { name: '记录', path: '' }]); // eslint-disable-line
await this.getAuth();
await this.getRule();
this.rechargeRecord();
},
methods: {
getUrls(scope) {
......@@ -122,17 +126,22 @@ export default {
this.rechargeRecord();
},
async rechargeRecord() {
const para = this.listParams;
this.loading = true;
if (this.dateTime) {
this.listParams.beginTime = formatDateTimeByType(this.dateTime[0], 'yyyy-MM-dd');
this.listParams.endTime = formatDateTimeByType(this.dateTime[1], 'yyyy-MM-dd');
para.beginTime = formatDateTimeByType(this.dateTime[0], 'yyyy-MM-dd');
para.endTime = formatDateTimeByType(this.dateTime[1], 'yyyy-MM-dd');
} else {
this.listParams.beginTime = '';
this.listParams.endTime = '';
para.beginTime = '';
para.endTime = '';
}
const id = this.setAccountDepartId(this.deparment.departId, this.config);
if (id) para.accountDepartId = id;
else {
delete para.accountDepartId;
}
this.listParams.accountDepartId = this.deparment.departId;
try {
let res = await rechargeRecord(this.listParams);
let res = await rechargeRecord(para);
if (res.errorCode === 0 && res.result.result) {
this.tableList = res.result.result;
this.total = res.result.totalCount;
......@@ -192,13 +201,6 @@ export default {
depart['isLimit'] = false;
depart['list'] = [];
this.getDepartmentList();
},
// 获取计费规则
async getRule() {
const result = await getAccountRule();
const res = result.result || {};
console.log(res);
this.isMoreAccount = !!res.status;
}
},
filters: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment