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, 'type' => 0,
'open' => 3, 'open' => 3,
'children' => [ 'children' => [
['name' => 'stats.company-index', 'title' => '企业统计', 'path' => '/stats/company-count', 'icon' => 'md-git-merge', 'type' => 0, 'open' => 3], ['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], 'children' => [
['name' => 'stats.order.1', 'title' => '续费订单统计', 'path' => '/stats/order/1', 'icon' => 'md-medal', 'type' => 0, 'open' => 3], ['name' => 'stats.company-index.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.order.2', 'title' => '续费包订单统计', 'path' => '/stats/order/2', 'icon' => 'md-bonfire', 'type' => 0, 'open' => 3], ['name' => 'stats.company-index.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
['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.order.0', 'title' => '销售订单统计', 'path' => '/stats/order/0', 'icon' => 'md-card', 'type' => 0, 'open' => 3,
['name' => 'stats.sold-activated', 'title' => '销售激活统计', 'path' => '/stats/sold-activated', 'icon' => 'md-timer', '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, 'name' => 'stats.flow-pools', 'title' => '流量池统计', 'path' => '/flow-pools', 'icon' => 'md-swap', 'type' => 0, 'open' => 3,
'children' => [ 'children' => [
['name' => 'stats.flow-pools.export', 'title' => '导出', 'description' => 'output', 'type' => 1],
['name' => 'stats.flow-pools.show', 'title' => '明细', 'description' => 'show', 'type' => 1], ['name' => 'stats.flow-pools.show', 'title' => '明细', 'description' => 'show', 'type' => 1],
] ]
], ],

View File

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

View File

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

View File

@ -1,5 +1,11 @@
<template> <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"> <div class="page-detail-wrap" v-if="data">
<Divider>基础资料</Divider> <Divider>基础资料</Divider>
<ul> <ul>
@ -38,10 +44,10 @@
<div class="ui-list-content">{{data.status_name}}</div> <div class="ui-list-content">{{data.status_name}}</div>
</li> </li>
<li class="ui-list"> <div class="ui-list">
<div class="ui-list-title">创建时间:</div> <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> </div>
<!-- <li class="ui-list"> <!-- <li class="ui-list">
<div class="ui-list-title">更新时间:</div> <div class="ui-list-title">更新时间:</div>

View File

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

View File

@ -1,5 +1,12 @@
<template> <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"> <div class="page-detail-wrap" v-if="data">
<Row :gutter="16"> <Row :gutter="16">
<Col span="12"> <Col span="12">
@ -59,12 +66,12 @@
<li class="ui-list"> <li class="ui-list">
<div class="ui-list-title">创建时间:</div> <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>
<li class="ui-list"> <li class="ui-list">
<div class="ui-list-title">更新时间:</div> <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> </li>
</ul> </ul>
</Col> </Col>

View File

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

View File

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

View File

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

View File

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