This commit is contained in:
邓皓元 2019-09-20 11:56:11 +08:00
parent a20d845cc6
commit 3463456a70
11 changed files with 649 additions and 407 deletions

View File

@ -279,17 +279,58 @@ class PermissionSeeder extends Seeder
'type' => 0,
'open' => 3,
'children' => [
['name' => 'stats.company-index', 'title' => '企业统计', 'path' => '/stats/company-count', 'icon' => 'md-git-merge', 'type' => 0, 'open' => 3],
['name' => 'stats.order.0', 'title' => '销售订单统计', 'path' => '/stats/order/0', 'icon' => 'md-card', 'type' => 0, 'open' => 3],
['name' => 'stats.order.1', 'title' => '续费订单统计', 'path' => '/stats/order/1', 'icon' => 'md-medal', 'type' => 0, 'open' => 3],
['name' => 'stats.order.2', 'title' => '续费包订单统计', 'path' => '/stats/order/2', 'icon' => 'md-bonfire', 'type' => 0, 'open' => 3],
['name' => 'stats.order.3', 'title' => '加油包订单统计', 'path' => '/stats/order/3', 'icon' => 'md-color-fill', 'type' => 0, 'open' => 3],
['name' => 'stats.company-report.1', 'title' => '用户月报表', 'path' => '/stats/company-report/1', 'icon' => 'ios-contacts', 'type' => 0, 'open' => 3],
['name' => 'stats.company-report.2', 'title' => '增值包月报表', 'path' => '/stats/company-report/2', 'icon' => 'md-bonfire', 'type' => 0, 'open' => 3],
['name' => 'stats.sold-activated', 'title' => '销售激活统计', 'path' => '/stats/sold-activated', 'icon' => 'md-timer', 'type' => 0, 'open' => 3],
['name' => 'stats.company-index', 'title' => '企业统计', 'path' => '/stats/company-count', 'icon' => 'md-git-merge', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.company-index.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.company-index.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.order.0', 'title' => '销售订单统计', 'path' => '/stats/order/0', 'icon' => 'md-card', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.order.0.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.order.0.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.order.1', 'title' => '续费订单统计', 'path' => '/stats/order/1', 'icon' => 'md-medal', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.order.1.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.order.1.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.order.2', 'title' => '续费包订单统计', 'path' => '/stats/order/2', 'icon' => 'md-bonfire', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.order.2.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.order.2.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.order.3', 'title' => '加油包订单统计', 'path' => '/stats/order/3', 'icon' => 'md-color-fill', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.order.3.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.order.3.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.company-report.1', 'title' => '用户月报表', 'path' => '/stats/company-report/1', 'icon' => 'ios-contacts', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.company-report.1.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.company-report.1.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.company-report.2', 'title' => '增值包月报表', 'path' => '/stats/company-report/2', 'icon' => 'md-bonfire', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.company-report.2.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.company-report.2.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
['name' => 'stats.sold-activated', 'title' => '销售激活统计', 'path' => '/stats/sold-activated', 'icon' => 'md-timer', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.sold-activated.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.sold-activated.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],
[
'name' => 'stats.flow-pools', 'title' => '流量池统计', 'path' => '/flow-pools', 'icon' => 'md-swap', 'type' => 0, 'open' => 3,
'children' => [
['name' => 'stats.flow-pools.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.flow-pools.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
]
],

View File

@ -1,20 +1,21 @@
export default {
name: 'RealSync',
name: "RealSync",
components: {
UiEdit: resolve => require(['views/artisan/real-sync/edit'], resolve),
UiRefund: resolve => require(['views/artisan/real-sync/refund'], resolve),
UiCancelled: resolve => require(['views/artisan/real-sync/cancelled'], resolve)
UiEdit: resolve => require(["views/artisan/real-sync/edit"], resolve),
UiRefund: resolve => require(["views/artisan/real-sync/refund"], resolve),
UiCancelled: resolve =>
require(["views/artisan/real-sync/cancelled"], resolve)
},
data() {
return {
commands: {
'real:sync-added-order': '同步RD企业订单数据',
'real:sync-company': '同步RD企业数据',
'real:sync-mongo': '同步卡基础信息数据',
'real:sync-order': '同步RD基础订单数据',
'real:sync-package': '同步RD套餐数据',
'real:sync-refund': '同步RD退货数据',
'real:sync-cancelled': '同步RD注销数据'
"real:sync-added-order": "同步RD企业订单数据",
"real:sync-company": "同步RD企业数据",
"real:sync-mongo": "同步卡基础信息数据",
"real:sync-order": "同步RD基础订单数据",
"real:sync-package": "同步RD套餐数据",
"real:sync-refund": "同步RD退货数据",
"real:sync-cancelled": "同步RD注销数据"
},
options: {
command: null,
@ -35,26 +36,26 @@ export default {
},
table_titles: [
{
title: 'ID',
key: 'id',
title: "ID",
key: "id",
width: 80
},
{
title: '名称',
key: 'command_name',
title: "名称",
key: "command_name",
width: 300
},
{
title: '命令',
key: 'command'
title: "命令",
key: "command"
},
{
title: '参数',
key: 'parameters'
title: "参数",
key: "parameters"
},
{
title: '执行时间',
key: 'created_at',
title: "执行时间",
key: "created_at",
width: 170
}
]
@ -72,18 +73,23 @@ export default {
index(page = 1) {
let params = this.searchDataHandle({}, { page }, this.options);
params.command = params.command ? params.command : Object.keys(this.commands);
params.command = params.command
? params.command
: Object.keys(this.commands);
this.isShowLoading(true);
service.get('/api/artisan', { params }).then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
}).catch(() => {
this.isShowLoading(false);
});
service
.get("/api/artisan", { params })
.then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
})
.catch(() => {
this.isShowLoading(false);
});
},
/**
@ -125,7 +131,11 @@ export default {
let page = result.current_page;
if (this.list_data.data.length == 1) {
page = this.returnPage(result.total, result.current_page, result.per_page);
page = this.returnPage(
result.total,
result.current_page,
result.per_page
);
}
this.index(page);

View File

@ -1,5 +1,5 @@
export default {
name: 'StatsCompanyReportDetail',
name: "StatsCompanyReportDetail",
props: {
show: {
type: Boolean,
@ -34,32 +34,32 @@ export default {
list_data: null,
columns: [
{
title: 'SIM',
key: 'sim',
title: "SIM",
key: "sim",
width: 150
},
{
title: '运营商',
key: 'carrier_operator_name',
title: "运营商",
key: "carrier_operator_name",
width: 120
},
{
title: '企业名称',
key: 'company_name',
title: "企业名称",
key: "company_name",
width: 300
},
{
title: '套餐名称',
key: 'package_name'
title: "套餐名称",
key: "package_name"
},
{
title: '数量',
key: 'counts',
title: "数量",
key: "counts",
width: 75
},
{
title: '套餐单价(元/月)',
key: 'month_price',
title: "套餐单价(元/月)",
key: "month_price",
width: 150
}
]
@ -67,7 +67,7 @@ export default {
},
methods: {
visibleChange(bool) {
this.$emit('update:show', bool);
this.$emit("update:show", bool);
},
/**
* [index 列表]
@ -79,35 +79,42 @@ export default {
let params = this.options;
params.page = page;
service.get('api/stats/company-report/detail', { params }).then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
}).catch(() => {
this.isShowLoading(false);
});
service
.get("api/stats/company-report/detail", { params })
.then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
})
.catch(() => {
this.isShowLoading(false);
});
},
exportExcel() {
this.isShowLoading(true);
let params = this.options;
service.get('api/stats/company-report/detail/export', { params }).then((res) => {
if (res.code === 0) {
if (res.data) {
this.downloadFile(res.data);
} else {
this.$Modal.success({
title: '提示',
content: '当前导出数据量大,已进入后台队列导出模式,请稍后至导出列表查看下载。'
});
service
.get("api/stats/company-report/detail/export", { params })
.then(res => {
if (res.code === 0) {
if (res.data) {
this.downloadFile(res.data);
} else {
this.$Modal.success({
title: "提示",
content:
"当前导出数据量大,已进入后台队列导出模式,请稍后至导出列表查看下载。"
});
}
}
}
this.isShowLoading(false);
}).catch(() => {
this.isShowLoading(false);
});
this.isShowLoading(false);
})
.catch(() => {
this.isShowLoading(false);
});
}
}
};

View File

@ -1,5 +1,11 @@
<template>
<Drawer :mask-closable="true" @on-visible-change="visibleChange" title="客户详情" v-model="my_show" width="500">
<Drawer
:mask-closable="true"
@on-visible-change="visibleChange"
title="客户详情"
v-model="my_show"
width="500"
>
<div class="page-detail-wrap" v-if="data">
<Divider>基础资料</Divider>
<ul>
@ -38,15 +44,15 @@
<div class="ui-list-content">{{data.status_name}}</div>
</li>
<li class="ui-list">
<div class="ui-list">
<div class="ui-list-title">创建时间:</div>
<div class="ui-list-content">{{data.created_at}}</div>
</li>
<div class="ui-list-content">{{moment(data.created_at).format("YYYY-MM-DD")}}</div>
</div>
<!-- <li class="ui-list">
<div class="ui-list-title">更新时间:</div>
<div class="ui-list-content">{{data.updated_at}}</div>
</li> -->
</li>-->
</ul>
<Divider>服务时间段</Divider>

View File

@ -67,6 +67,9 @@ export default {
{
title: "创建时间",
key: "created_at",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.created_at).format("YYYY-MM-DD"));
},
width: 170
},
{

View File

@ -1,5 +1,12 @@
<template>
<Modal :footer-hide="true" :mask-closable="false" @on-visible-change="visibleChange" title="企业详情" v-model="my_show" width="900">
<Modal
:footer-hide="true"
:mask-closable="false"
@on-visible-change="visibleChange"
title="企业详情"
v-model="my_show"
width="900"
>
<div class="page-detail-wrap" v-if="data">
<Row :gutter="16">
<Col span="12">
@ -59,12 +66,12 @@
<li class="ui-list">
<div class="ui-list-title">创建时间:</div>
<div class="ui-list-content">{{data.created_at}}</div>
<div class="ui-list-content">{{moment(data.created_at).format("YYYY-MM-DD")}}</div>
</li>
<li class="ui-list">
<div class="ui-list-title">更新时间:</div>
<div class="ui-list-content">{{data.updated_at}}</div>
<div class="ui-list-content">{{moment(data.updated_at).format("YYYY-MM-DD")}}</div>
</li>
</ul>
</Col>

View File

@ -1,15 +1,15 @@
import * as API from 'api/virtual/companies';
import * as API from "api/virtual/companies";
export default {
name: 'Companies',
name: "Companies",
components: {
UiEdit: resolve => require(['views/virtual/companies/edit'], resolve),
UiDetail: resolve => require(['views/virtual/companies/detail'], resolve)
UiEdit: resolve => require(["views/virtual/companies/edit"], resolve),
UiDetail: resolve => require(["views/virtual/companies/detail"], resolve)
},
data() {
return {
params: {
name: '',
status: ''
name: "",
status: ""
},
trashed: null,
list_data: null,
@ -26,131 +26,155 @@ export default {
},
table_titles: [
{
title: 'ID',
key: 'id',
title: "ID",
key: "id",
width: 80
},
{
title: '企业名称',
key: 'name',
title: "企业名称",
key: "name",
width: 300
},
{
title: '联系人',
key: 'contacts'
title: "联系人",
key: "contacts"
},
{
title: '电话',
key: 'mobile'
title: "电话",
key: "mobile"
},
{
title: '地址',
key: 'address'
title: "地址",
key: "address"
},
{
title: '状态',
key: '',
title: "状态",
key: "",
width: 100,
render: (h, { row, column, index }) => {
let type = ['primary', 'warning', 'error'];
let text = ['已启用', '已禁用', '已删除'];
let type = ["primary", "warning", "error"];
let text = ["已启用", "已禁用", "已删除"];
return h('Button', {
props: {
type: type[row.status],
size: 'small'
}
}, text[row.status]);
return h(
"Button",
{
props: {
type: type[row.status],
size: "small"
}
},
text[row.status]
);
}
},
{
title: '创建时间',
key: 'created_at',
title: "创建时间",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.created_at).format("YYYY-MM-DD"));
},
width: 170
},
{
title: '操作',
key: 'action',
render: (h, {
row,
column,
index
}) => {
title: "操作",
key: "action",
render: (h, { row, column, index }) => {
let html = [];
if (row.deleted_at) {
return h('Tag', { props: { color: 'default' } }, '该企业已被删除');
return h(
"Tag",
{ props: { color: "default" } },
"该企业已被删除"
);
}
if (this.haveJurisdiction('show')) {
html.push(h('Button', {
props: {
type: 'success',
size: 'small',
disabled: false,
icon: 'md-eye'
},
class: ['btn'],
on: {
click: (event) => {
this.detailObj = {
show: true,
data: row
};
}
}
}, '查看'));
if (this.haveJurisdiction("show")) {
html.push(
h(
"Button",
{
props: {
type: "success",
size: "small",
disabled: false,
icon: "md-eye"
},
class: ["btn"],
on: {
click: event => {
this.detailObj = {
show: true,
data: row
};
}
}
},
"查看"
)
);
}
if (this.haveJurisdiction('update')) {
html.push(h('Button', {
props: {
type: 'primary',
size: 'small',
disabled: false,
icon: 'md-create'
},
class: ['btn'],
on: {
click: (event) => {
this.openEdit(true, row);
}
}
}, '编辑'));
if (this.haveJurisdiction("update")) {
html.push(
h(
"Button",
{
props: {
type: "primary",
size: "small",
disabled: false,
icon: "md-create"
},
class: ["btn"],
on: {
click: event => {
this.openEdit(true, row);
}
}
},
"编辑"
)
);
}
if (this.haveJurisdiction('destroy')) {
html.push(h('Button', {
props: {
type: 'error',
size: 'small',
disabled: false,
icon: 'md-trash'
},
class: ['btn'],
on: {
click: () => {
this.$Modal.confirm({
title: '提示',
content: '删除后该企业不可使用,请谨慎操作',
onOk: () => {
API.destroy({
ids: row.id
}).then(res => {
if (res.code == 0) {
this.$Message.success('删除成功');
this.request();
if (this.haveJurisdiction("destroy")) {
html.push(
h(
"Button",
{
props: {
type: "error",
size: "small",
disabled: false,
icon: "md-trash"
},
class: ["btn"],
on: {
click: () => {
this.$Modal.confirm({
title: "提示",
content: "删除后该企业不可使用,请谨慎操作",
onOk: () => {
API.destroy({
ids: row.id
}).then(res => {
if (res.code == 0) {
this.$Message.success("删除成功");
this.request();
}
});
}
});
}
});
}
}
}, '删除'));
}
},
"删除"
)
);
}
if (html.length) {
return h('div', html);
return h("div", html);
}
}
}
@ -167,26 +191,31 @@ export default {
* @return {[type]} [description]
*/
index(page = 1) {
let params = Object.assign(this.params, { 'orderBy': 'id', 'sortedBy': 'asc' });
let params = Object.assign(this.params, {
orderBy: "id",
sortedBy: "asc"
});
if (params.status === 2) {
params.status = undefined;
params.trashed = 'only';
params.trashed = "only";
} else {
params.trashed = 'without';
params.trashed = "without";
}
let data = this.searchDataHandle({}, { page }, params);
this.isShowLoading(true);
API.index(data).then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
}).catch(() => {
this.isShowLoading(false);
});
API.index(data)
.then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
})
.catch(() => {
this.isShowLoading(false);
});
},
/**
@ -209,7 +238,11 @@ export default {
let page = result.current_page;
if (this.list_data.data.length == 1) {
page = this.returnPage(result.total, result.current_page, result.per_page);
page = this.returnPage(
result.total,
result.current_page,
result.per_page
);
}
this.index(page);
@ -217,7 +250,7 @@ export default {
resetSearch() {
for (let k in this.params) {
this.params[k] = '';
this.params[k] = "";
}
this.trashed = null;
this.index(1);

View File

@ -1,17 +1,17 @@
import * as API from 'api/virtual/companies';
import * as AccountAPI from 'api/virtual/company_accounts';
import * as API from "api/virtual/companies";
import * as AccountAPI from "api/virtual/company_accounts";
export default {
name: 'Companies',
name: "Companies",
components: {
UiEdit: resolve => require(['views/virtual/company_accounts/edit'], resolve)
UiEdit: resolve => require(["views/virtual/company_accounts/edit"], resolve)
},
data() {
return {
params: {
name: '',
name: "",
accounts: {
username: ''
username: ""
}
},
list_data: null,
@ -24,129 +24,146 @@ export default {
},
table_titles: [
{
title: 'ID',
key: 'id',
title: "ID",
key: "id",
width: 80
},
{
title: '企业名称',
key: 'name',
title: "企业名称",
key: "name",
width: 300
},
{
title: '用户名',
key: '',
title: "用户名",
key: "",
render: (h, { row, column, index }) => {
if (row.accounts && row.accounts.length) {
return h('span', row.accounts[0].username);
return h("span", row.accounts[0].username);
}
}
},
{
title: '电话',
key: '',
title: "电话",
key: "",
render: (h, { row, column, index }) => {
if (row.accounts && row.accounts.length) {
return h('span', row.accounts[0].mobile);
return h("span", row.accounts[0].mobile);
}
}
},
{
title: '昵称',
key: '',
title: "昵称",
key: "",
render: (h, { row, column, index }) => {
if (row.accounts && row.accounts.length) {
return h('span', row.accounts[0].nickname);
return h("span", row.accounts[0].nickname);
}
}
},
{
title: '创建时间',
key: 'created_at',
title: "创建时间",
key: "created_at",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.created_at).format("YYYY-MM-DD"));
},
width: 170
},
{
title: '操作',
key: 'action',
render: (h, {
row,
column,
index
}) => {
title: "操作",
key: "action",
render: (h, { row, column, index }) => {
let html = [];
if (this.haveJurisdiction('create')) {
if (this.haveJurisdiction("create")) {
if (!row.accounts || !row.accounts.length) {
html.push(h('Button', {
props: {
type: 'primary',
size: 'small',
disabled: false,
icon: 'md-add'
},
class: ['btn'],
on: {
click: (event) => {
this.openEdit(true, row);
}
}
}, '创建'));
html.push(
h(
"Button",
{
props: {
type: "primary",
size: "small",
disabled: false,
icon: "md-add"
},
class: ["btn"],
on: {
click: event => {
this.openEdit(true, row);
}
}
},
"创建"
)
);
}
}
if (this.haveJurisdiction('update')) {
if (this.haveJurisdiction("update")) {
if (row.accounts && row.accounts.length) {
html.push(h('Button', {
props: {
type: 'primary',
size: 'small',
disabled: false,
icon: 'md-create'
},
class: ['btn'],
on: {
click: (event) => {
this.openEdit(true, row);
}
}
}, '编辑'));
html.push(
h(
"Button",
{
props: {
type: "primary",
size: "small",
disabled: false,
icon: "md-create"
},
class: ["btn"],
on: {
click: event => {
this.openEdit(true, row);
}
}
},
"编辑"
)
);
}
}
if (this.haveJurisdiction('destroy')) {
if (this.haveJurisdiction("destroy")) {
if (row.accounts && row.accounts.length) {
html.push(h('Button', {
props: {
type: 'error',
size: 'small',
disabled: false,
icon: 'md-trash'
},
class: ['btn'],
on: {
click: () => {
this.$Modal.confirm({
title: '提示',
content: '删除后该账号不可使用,请谨慎操作',
onOk: () => {
AccountAPI.destroy({
ids: row.accounts[0].id
}).then(res => {
if (res.code == 0) {
this.$Message.success('删除成功');
this.request();
html.push(
h(
"Button",
{
props: {
type: "error",
size: "small",
disabled: false,
icon: "md-trash"
},
class: ["btn"],
on: {
click: () => {
this.$Modal.confirm({
title: "提示",
content: "删除后该账号不可使用,请谨慎操作",
onOk: () => {
AccountAPI.destroy({
ids: row.accounts[0].id
}).then(res => {
if (res.code == 0) {
this.$Message.success("删除成功");
this.request();
}
});
}
});
}
});
}
}
}, '删除'));
}
},
"删除"
)
);
}
}
if (html.length) {
return h('div', html);
return h("div", html);
}
}
}
@ -163,17 +180,23 @@ export default {
* @return {[type]} [description]
*/
index(page = 1) {
let data = this.searchDataHandle(this.params, { page }, { 'with': 'accounts', 'orderBy': 'id', 'sortedBy': 'asc' });
let data = this.searchDataHandle(
this.params,
{ page },
{ with: "accounts", orderBy: "id", sortedBy: "asc" }
);
this.isShowLoading(true);
API.index(data).then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
}).catch(() => {
this.isShowLoading(false);
});
API.index(data)
.then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
})
.catch(() => {
this.isShowLoading(false);
});
},
/**
@ -208,15 +231,19 @@ export default {
let page = result.current_page;
if (this.list_data.data.length == 1) {
page = this.returnPage(result.total, result.current_page, result.per_page);
page = this.returnPage(
result.total,
result.current_page,
result.per_page
);
}
this.index(page);
},
resetSearch() {
this.params.name = '';
this.params.accounts.username = '';
this.params.name = "";
this.params.accounts.username = "";
this.index(1);
}
}

View File

@ -1,17 +1,17 @@
import * as API from 'api/virtual/packages';
import * as API from "api/virtual/packages";
export default {
name: 'Companies',
name: "Companies",
components: {
UiEdit: resolve => require(['views/virtual/packages/edit'], resolve)
UiEdit: resolve => require(["views/virtual/packages/edit"], resolve)
},
data() {
return {
params: {
name: '',
carrier_operator: '',
sn: '',
status: '',
flowed: ''
name: "",
carrier_operator: "",
sn: "",
status: "",
flowed: ""
},
type: 0,
trashed: null,
@ -25,153 +25,238 @@ export default {
},
table_titles: [
{
type: 'expand',
type: "expand",
width: 50,
render: (h, params) => {
let row = params.row;
let Col = [];
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '成本价(元): ' + Number(row['cost_price']).toFixed(2)));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '指导价(元): ' + Number(row['guide_price']).toFixed(2)));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '语音分钟数: ' + row['voices']));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '短信条数: ' + row['messages']));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '短信功能: ' + (row['has_messages'] ? '有' : '无')));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, 'LBS功能: ' + (row['has_lbs'] ? '有' : '无')));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '重置周期(月): ' + row['reset_months']));
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"成本价(元): " + Number(row["cost_price"]).toFixed(2)
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"指导价(元): " + Number(row["guide_price"]).toFixed(2)
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"语音分钟数: " + row["voices"]
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"短信条数: " + row["messages"]
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"短信功能: " + (row["has_messages"] ? "有" : "无")
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"LBS功能: " + (row["has_lbs"] ? "有" : "无")
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"重置周期(月): " + row["reset_months"]
)
);
if (row['type']) {
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '立即生效: ' + (row['effect_months'] ? '否' : '是')));
if (row["type"]) {
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"立即生效: " + (row["effect_months"] ? "否" : "是")
)
);
}
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '套餐说明: ' + row['description']));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '创建时间: ' + row['created_at']));
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '更新时间: ' + row['updated_at']));
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"套餐说明: " + row["description"]
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"创建时间: " + row["created_at"]
)
);
Col.push(
h(
"Col",
{ props: { span: 6 }, class: ["fz-12"] },
"更新时间: " + row["updated_at"]
)
);
return h('Row', {}, Col);
return h("Row", {}, Col);
}
},
{
title: 'ID',
key: 'id',
title: "ID",
key: "id",
width: 120
},
{
title: '套餐编号',
key: 'sn',
title: "套餐编号",
key: "sn",
width: 200
},
{
title: '套餐名称',
key: 'name',
title: "套餐名称",
key: "name",
width: 120
},
{
title: '运营商',
key: 'carrier_operator_name',
title: "运营商",
key: "carrier_operator_name",
width: 100
},
{
title: '流量值M',
key: 'flows',
title: "流量值M",
key: "flows",
width: 120
},
{
title: '套餐周期(月)',
key: 'service_months',
title: "套餐周期(月)",
key: "service_months",
width: 120
},
{
title: '说明',
key: 'description',
title: "说明",
key: "description",
minWidth: 100
},
{
title: '状态',
key: '',
title: "状态",
key: "",
width: 100,
render: (h, { row, column, index }) => {
let type = ['primary', 'warning', 'error'];
let text = ['已启用', '已禁用', '已删除'];
let type = ["primary", "warning", "error"];
let text = ["已启用", "已禁用", "已删除"];
return h('Button', {
props: {
type: type[row.status],
size: 'small'
}
}, text[row.status]);
return h(
"Button",
{
props: {
type: type[row.status],
size: "small"
}
},
text[row.status]
);
}
},
{
title: '创建时间',
key: 'created_at',
title: "创建时间",
key: "created_at",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.created_at).format("YYYY-MM-DD"));
},
width: 170
},
{
title: '操作',
key: 'action',
title: "操作",
key: "action",
width: 170,
render: (h, {
row,
column,
index
}) => {
render: (h, { row, column, index }) => {
row.cost_price = Number(row.cost_price);
row.guide_price = Number(row.guide_price);
let html = [];
if (row.deleted_at) {
return h('Tag', { props: { color: 'default' } }, '该套餐已被删除');
return h(
"Tag",
{ props: { color: "default" } },
"该套餐已被删除"
);
}
if (this.haveJurisdiction('update')) {
html.push(h('Button', {
props: {
type: 'primary',
size: 'small',
disabled: false,
icon: 'md-create'
},
class: ['btn'],
on: {
click: (event) => {
this.openEdit(true, row);
}
}
}, '编辑'));
if (this.haveJurisdiction("update")) {
html.push(
h(
"Button",
{
props: {
type: "primary",
size: "small",
disabled: false,
icon: "md-create"
},
class: ["btn"],
on: {
click: event => {
this.openEdit(true, row);
}
}
},
"编辑"
)
);
}
if (this.haveJurisdiction('destroy')) {
html.push(h('Button', {
props: {
type: 'error',
size: 'small',
disabled: false,
icon: 'md-trash'
},
class: ['btn'],
on: {
click: () => {
this.$Modal.confirm({
title: '提示',
content: '删除后该企业不可使用,请谨慎操作',
onOk: () => {
API.destroy({
ids: row.id
}).then(res => {
if (res.code == 0) {
this.$Message.success('删除成功');
this.request();
if (this.haveJurisdiction("destroy")) {
html.push(
h(
"Button",
{
props: {
type: "error",
size: "small",
disabled: false,
icon: "md-trash"
},
class: ["btn"],
on: {
click: () => {
this.$Modal.confirm({
title: "提示",
content: "删除后该企业不可使用,请谨慎操作",
onOk: () => {
API.destroy({
ids: row.id
}).then(res => {
if (res.code == 0) {
this.$Message.success("删除成功");
this.request();
}
});
}
});
}
});
}
}
}, '删除'));
}
},
"删除"
)
);
}
if (html.length) {
return h('div', html);
return h("div", html);
}
}
}
@ -185,19 +270,23 @@ export default {
mounted() {
if (this.type !== 3) {
this.table_titles.splice(7, 0, {
title: '套餐类型',
key: '',
title: "套餐类型",
key: "",
width: 100,
render: (h, { row, column, index }) => {
let type = ['primary', 'warning'];
let text = ['正向套餐', '后向套餐'];
let type = ["primary", "warning"];
let text = ["正向套餐", "后向套餐"];
return h('Button', {
props: {
type: type[row.flowed],
size: 'small'
}
}, text[row.flowed]);
return h(
"Button",
{
props: {
type: type[row.flowed],
size: "small"
}
},
text[row.flowed]
);
}
});
}
@ -209,25 +298,31 @@ export default {
* @return {[type]} [description]
*/
index(page = 1) {
let params = Object.assign(this.params, { 'type': this.type, 'orderBy': 'id', 'sortedBy': 'desc' });
let params = Object.assign(this.params, {
type: this.type,
orderBy: "id",
sortedBy: "desc"
});
if (params.status === 2) {
params.status = undefined;
params.trashed = 'only';
params.trashed = "only";
} else {
params.trashed = 'without';
params.trashed = "without";
}
let data = this.searchDataHandle({}, { page }, params);
this.isShowLoading(true);
API.index(data).then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
}).catch(() => {
this.isShowLoading(false);
});
API.index(data)
.then(res => {
this.isShowLoading(false);
if (res.code == 0) {
this.list_data = res.data;
}
})
.catch(() => {
this.isShowLoading(false);
});
},
/**
@ -250,7 +345,11 @@ export default {
let page = result.current_page;
if (this.list_data.data.length == 1) {
page = this.returnPage(result.total, result.current_page, result.per_page);
page = this.returnPage(
result.total,
result.current_page,
result.per_page
);
}
this.index(page);
@ -258,7 +357,7 @@ export default {
resetSearch() {
for (let k in this.params) {
this.params[k] = '';
this.params[k] = "";
}
this.trashed = null;
this.index(1);

View File

@ -97,11 +97,17 @@ export default {
{
title: "创建时间",
key: "created_at",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.created_at).format("YYYY-MM-DD"));
},
width: 170
},
{
title: "更新时间",
key: "updated_at",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.updated_at).format("YYYY-MM-DD"));
},
width: 170
},
{

View File

@ -58,6 +58,9 @@ export default {
{
title: "订单时间",
key: "created_at",
render: (h, { row, column, index }) => {
return h("span", this.moment(row.created_at).format("YYYY-MM-DD"));
},
width: 170
},
{