diff --git a/app/Domains/Virtual/Http/Controllers/PackageController.php b/app/Domains/Virtual/Http/Controllers/PackageController.php
index 68cd1577..d063aca2 100644
--- a/app/Domains/Virtual/Http/Controllers/PackageController.php
+++ b/app/Domains/Virtual/Http/Controllers/PackageController.php
@@ -28,7 +28,7 @@ class PackageController extends Controller
*/
public function index()
{
- $conditions = [];
+ $conditions = $this->request->all();
$conditions['limit'] = $this->request->get('limit', 20);
$packages = $this->packageService->index($conditions);
diff --git a/app/Domains/Virtual/Repositories/PackageRepository.php b/app/Domains/Virtual/Repositories/PackageRepository.php
index 207dedf1..3d7e0165 100644
--- a/app/Domains/Virtual/Repositories/PackageRepository.php
+++ b/app/Domains/Virtual/Repositories/PackageRepository.php
@@ -25,9 +25,11 @@ class PackageRepository extends Repository
* @var array
*/
protected $fieldSearchable = [
- 'id' => '=',
- 'name' => 'like',
- 'created_at' => 'like',
+ 'id' => '=',
+ 'type' => '=',
+ 'sn' => 'like',
+ 'name' => 'like',
+ 'carrier_operator' => '=',
];
public function model()
@@ -59,6 +61,22 @@ class PackageRepository extends Repository
$this->model = $this->model->whereIn('id', $conditions['id']);
}
+ if (isset($conditions['type'])) {
+ $this->model = $this->model->where('type', $conditions['type']);
+ }
+
+ if (isset($conditions['sn'])) {
+ $this->model = $this->model->where('sn', "%{$conditions['sn']}%");
+ }
+
+ if (isset($conditions['name'])) {
+ $this->model = $this->model->where('name', "%{$conditions['name']}%");
+ }
+
+ if (isset($conditions['carrier_operator'])) {
+ $this->model = $this->model->where('carrier_operator', $conditions['carrier_operator']);
+ }
+
return $this;
}
}
diff --git a/app/Models/Virtual/Package.php b/app/Models/Virtual/Package.php
index 3dbbaca3..1bf60f30 100644
--- a/app/Models/Virtual/Package.php
+++ b/app/Models/Virtual/Package.php
@@ -11,6 +11,29 @@ class Package extends PackageBase
public $incrementing = false;
+ protected $fillable = [
+ 'id',
+ 'parent_id',
+ 'sn',
+ 'name',
+ 'type',
+ 'carrier_operator',
+ 'cost_price',
+ 'guide_price',
+ 'renewal_cost_price',
+ 'renewal_guide_price',
+ 'flows',
+ 'voices',
+ 'messages',
+ 'has_messages',
+ 'has_lbs',
+ 'reset_months',
+ 'service_months',
+ 'effect_months',
+ 'delay_months',
+ 'description',
+ ];
+
public function cards()
{
return $this->hasMany(Card::class, 'virtual_package_id', 'id');
diff --git a/frontend/package.json b/frontend/package.json
index 4fc2d751..e52e221c 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -30,6 +30,7 @@
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-standard": "^3.0.0-beta.10",
"chai": "^4.1.2",
+ "iview-loader": "^1.2.2",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"lint-staged": "^6.0.0",
diff --git a/frontend/src/views/virtual/companies/index.vue b/frontend/src/views/virtual/companies/index.vue
index 117906d6..66059e9d 100644
--- a/frontend/src/views/virtual/companies/index.vue
+++ b/frontend/src/views/virtual/companies/index.vue
@@ -58,14 +58,7 @@
diff --git a/frontend/src/views/virtual/companies/js/index.js b/frontend/src/views/virtual/companies/js/index.js
index 383af8b0..591a2e24 100644
--- a/frontend/src/views/virtual/companies/js/index.js
+++ b/frontend/src/views/virtual/companies/js/index.js
@@ -10,7 +10,7 @@ export default {
params: {
name: ''
},
- trashed: '',
+ trashed: null,
list_data: null,
editObj: {
show: false,
@@ -192,7 +192,7 @@ export default {
for (let k in this.params) {
this.params[k] = '';
}
- this.trashed = '';
+ this.trashed = null;
this.index(1);
}
}
diff --git a/frontend/src/views/virtual/company_accounts/index.vue b/frontend/src/views/virtual/company_accounts/index.vue
index eaef9531..cceaa468 100644
--- a/frontend/src/views/virtual/company_accounts/index.vue
+++ b/frontend/src/views/virtual/company_accounts/index.vue
@@ -51,23 +51,10 @@
-
+
diff --git a/frontend/src/views/virtual/company_accounts/js/index.js b/frontend/src/views/virtual/company_accounts/js/index.js
index 28913776..8e675a5e 100644
--- a/frontend/src/views/virtual/company_accounts/js/index.js
+++ b/frontend/src/views/virtual/company_accounts/js/index.js
@@ -14,7 +14,6 @@ export default {
username: ''
}
},
- trashed: '',
list_data: null,
editObj: {
show: false,
@@ -221,7 +220,6 @@ export default {
for (let k in this.params) {
this.params[k] = '';
}
- this.trashed = '';
this.index(1);
}
}
diff --git a/frontend/src/views/virtual/orders/index.vue b/frontend/src/views/virtual/orders/index.vue
index d4d8f051..3cac1ab3 100644
--- a/frontend/src/views/virtual/orders/index.vue
+++ b/frontend/src/views/virtual/orders/index.vue
@@ -67,9 +67,9 @@
@@ -90,14 +90,7 @@
diff --git a/frontend/src/views/virtual/packages/edit.vue b/frontend/src/views/virtual/packages/edit.vue
index ccdc3021..b7a6d143 100644
--- a/frontend/src/views/virtual/packages/edit.vue
+++ b/frontend/src/views/virtual/packages/edit.vue
@@ -1,18 +1,16 @@
-
-
+
+
-
套餐编号:
@@ -21,9 +19,7 @@
*套餐名称:
-
-
-
+
套餐成本价:
套餐指导价:
+
+
+
+ 续费成本价:
+
+ 元
+
+
+
+
+ 续费指导价:
+
+ 元
套餐流量
套餐语音
套餐短信
短信服务
LBS服务
- 备注:
+ 重置周期
+
+
+
+ 套餐周期
+
+ 月
+
+
+
+
+ 生效延迟
+
+ 月
+
+
+
+
+ 服务延长
+
+ 月
+
+
+
+
+ 说明:
+
+
-
diff --git a/frontend/src/views/virtual/packages/index.vue b/frontend/src/views/virtual/packages/index.vue
index fc8d34e5..4692a0fb 100644
--- a/frontend/src/views/virtual/packages/index.vue
+++ b/frontend/src/views/virtual/packages/index.vue
@@ -28,9 +28,9 @@
-
diff --git a/frontend/src/views/virtual/packages/js/edit.js b/frontend/src/views/virtual/packages/js/edit.js
index 62cc2f0b..3874030a 100644
--- a/frontend/src/views/virtual/packages/js/edit.js
+++ b/frontend/src/views/virtual/packages/js/edit.js
@@ -1,4 +1,4 @@
-import * as API from 'api/virtual/companies';
+import * as API from 'api/virtual/packages';
export default {
props: {
@@ -8,7 +8,7 @@ export default {
},
data: {
type: Object,
- default () {
+ default() {
return null;
}
}
@@ -21,14 +21,21 @@ export default {
params: {
sn: '',
name: '',
- carrier_operator: '',
+ carrier_operator: 255,
cost_price: 0,
guide_price: 0,
+ renewal_cost_price: 0,
+ renewal_guide_price: 0,
flows: 0,
voices: 0,
messages: 0,
has_messages: 0,
- has_lbs: 0
+ has_lbs: 0,
+ reset_months: 0,
+ service_months: 0,
+ effect_months: 0,
+ delay_months: 0,
+ description: ''
}
};
},
@@ -49,15 +56,29 @@ export default {
methods: {
ok() {
if (!this.params.name) {
- this.$Message.info('请填写企业名称');
+ this.$Message.info('请填写套餐名称');
return;
}
- if (!(/[\s\S]{2,32}/.test(this.params.contacts))) {
- this.$Message.info('联系人长度在2-32之间');
+ if (this.params.sn && !/^[A-Z0-9_]{2,32}$/.test(this.params.sn)) {
+ this.$Message.info('套餐编码为大写字母、数字、下划线的2-32位字符');
return;
}
+ if (this.params.carrier_operator === 255) {
+ this.$Message.info('请选择运营商');
+ return;
+ }
+
+ let type = this.$route.query.type;
+
+ if (typeof (type) === 'undefined') {
+ this.$Message.error('非法请求');
+ return;
+ }
+
+ this.params.type = type;
+
if (this.data) {
// 编辑
API.update(this.params, this.data.id).then(res => {
@@ -92,14 +113,19 @@ export default {
},
clear() {
+ let strKeys = ['sn', 'name', 'carrier_operator', 'description'];
for (let k in this.params) {
- this.params[k] = '';
+ if (strKeys.indexOf(k) === -1) {
+ this.params[k] = 0;
+ } else {
+ this.params[k] = '';
+ }
}
this.my_show = false;
},
switchChange(status) {
- console.log(status);
+ console.log(this.params);
}
}
};
diff --git a/frontend/src/views/virtual/packages/js/index.js b/frontend/src/views/virtual/packages/js/index.js
index fca027c9..7b157429 100644
--- a/frontend/src/views/virtual/packages/js/index.js
+++ b/frontend/src/views/virtual/packages/js/index.js
@@ -9,7 +9,7 @@ export default {
params: {
name: ''
},
- trashed: '',
+ trashed: null,
list_data: null,
editObj: {
show: false,
@@ -54,23 +54,31 @@ export default {
{
title: '套餐编号',
key: 'sn',
- width: 300
+ width: 200
},
{
title: '套餐名称',
- key: 'name'
+ key: 'name',
+ width: 120
},
{
title: '运营商',
- key: 'carrier_operator_name'
+ key: 'carrier_operator_name',
+ width: 100
},
{
title: '流量值(M)',
- key: 'flows'
+ key: 'flows',
+ width: 120
},
{
title: '套餐周期(月)',
- key: 'service_months'
+ key: 'service_months',
+ width: 120
+ },
+ {
+ title: '说明',
+ key: 'description'
},
{
title: '创建时间',
@@ -80,6 +88,7 @@ export default {
{
title: '操作',
key: 'action',
+ width: 170,
render: (h, {
row,
column,
@@ -167,13 +176,7 @@ export default {
};
},
created() {
- let type = this.$route.query.type;
-
- if (typeof(type) === 'undefined') {
- return this.$Message.error('非法请求');
- }
-
- this.index(1, type);
+ this.index(1);
},
methods: {
/**
@@ -181,8 +184,15 @@ export default {
* @param {Number} page [description]
* @return {[type]} [description]
*/
- index(page = 1, type = 0) {
- let data = this.searchDataHandle(this.params, { page }, { 'trashed': this.trashed, 'orderBy': 'id', 'sortedBy': 'asc' });
+ index(page = 1) {
+ let type = this.$route.query.type;
+
+ if (typeof(type) === 'undefined') {
+ this.$Message.error('非法请求');
+ return;
+ }
+
+ let data = this.searchDataHandle(this.params, { page }, { 'type': type, 'trashed': this.trashed, 'orderBy': 'id', 'sortedBy': 'asc' });
this.isShowLoading(true);
API.index(data).then(res => {
this.isShowLoading(false);
@@ -224,7 +234,7 @@ export default {
for (let k in this.params) {
this.params[k] = '';
}
- this.trashed = '';
+ this.trashed = null;
this.index(1);
}
}
diff --git a/frontend/src/views/virtual/products/index.vue b/frontend/src/views/virtual/products/index.vue
index d4d514f6..a2fc7561 100644
--- a/frontend/src/views/virtual/products/index.vue
+++ b/frontend/src/views/virtual/products/index.vue
@@ -39,9 +39,9 @@
-
diff --git a/frontend/src/views/virtual/products/js/index.js b/frontend/src/views/virtual/products/js/index.js
index e8b66a52..43ebdcab 100644
--- a/frontend/src/views/virtual/products/js/index.js
+++ b/frontend/src/views/virtual/products/js/index.js
@@ -13,7 +13,6 @@ export default {
name: null,
package_name: null
},
- trashed: '',
editObj: {
show: false,
isUpdate: false,
diff --git a/frontend/vue.config.js b/frontend/vue.config.js
index 849ee8ef..09efd1a2 100644
--- a/frontend/vue.config.js
+++ b/frontend/vue.config.js
@@ -24,9 +24,19 @@ module.exports = {
.set('service', resolve('src/service'))
.set('util', resolve('src/service/util'))
.set('validate', resolve('src/service/validate'));
- },
- runtimeCompiler: true,
- productionSourceMap: true
+
+ config.module
+ .rule('vue')
+ .use('iview-loader')
+ .loader('iview-loader')
+ .tap(options => {
+ options = {
+ prefix: true
+ };
+ return options;
+ });
+ }
+
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
// devServer: {
// proxy: 'localhost:3000'