diff --git a/app/Domains/Company/Http/Controllers/CardController.php b/app/Domains/Company/Http/Controllers/CardController.php index 9234a02d..edd51896 100644 --- a/app/Domains/Company/Http/Controllers/CardController.php +++ b/app/Domains/Company/Http/Controllers/CardController.php @@ -39,7 +39,7 @@ class CardController extends Controller $limit = $conditions['limit'] ?? 20; - $cards = $this->orderCardPartitionRepository->selectRaw('distinct on (sim) sim')->withConditions($conditions)->paginate($limit); + $cards = $this->orderCardPartitionRepository->selectRaw('distinct on (sim) sim, company_id')->withConditions($conditions)->paginate($limit); $services = $this->orderCardPartitionRepository->selectRaw('sim,MIN(service_start_at) as service_start_at,MAX(service_end_at) as service_end_at') ->whereIn('sim', $cards->pluck('sim')->toArray())->groupBy('sim')->get()->keyBy('sim'); diff --git a/frontend/src/views/virtual/companies/js/edit.js b/frontend/src/views/virtual/companies/js/edit.js index 8ff4f03a..aa6170a8 100644 --- a/frontend/src/views/virtual/companies/js/edit.js +++ b/frontend/src/views/virtual/companies/js/edit.js @@ -67,6 +67,7 @@ export default { this.$emit('update-success'); this.$Message.success('更新成功'); this.clear(); + this.completeCompanyInitialized = false; } }).catch(err => { this.loading = false; @@ -79,6 +80,7 @@ export default { this.$emit('add-success'); this.$Message.success('添加成功'); this.clear(); + this.completeCompanyInitialized = false; } }).catch(err => { this.loading = false; diff --git a/frontend/src/views/virtual/packages/js/edit.js b/frontend/src/views/virtual/packages/js/edit.js index a6ae7728..15669e96 100644 --- a/frontend/src/views/virtual/packages/js/edit.js +++ b/frontend/src/views/virtual/packages/js/edit.js @@ -104,6 +104,7 @@ export default { this.$emit('update-success'); this.$Message.success('更新成功'); this.clear(); + this.completePackageInitialized = false; } }).catch(err => { this.loading = false; @@ -116,6 +117,7 @@ export default { this.$emit('add-success'); this.$Message.success('添加成功'); this.clear(); + this.completePackageInitialized = false; } }).catch(err => { this.loading = false; diff --git a/frontend/src/views/virtual/products/js/edit.js b/frontend/src/views/virtual/products/js/edit.js index 4fa4bc2a..b0360cad 100644 --- a/frontend/src/views/virtual/products/js/edit.js +++ b/frontend/src/views/virtual/products/js/edit.js @@ -1,4 +1,4 @@ -import * as API from 'api/virtual/products'; +import * as API from "api/virtual/products"; export default { props: { @@ -27,12 +27,12 @@ export default { loading: false, params: { type: 0, - name: '', - company_id: '', - package_id: '', + name: "", + company_id: "", + package_id: "", price: 0, renew_price: 0, - remark: '', + remark: "", status: 0 }, completePackagesFilter: [] @@ -61,16 +61,26 @@ export default { methods: { ok() { if (!this.params.company_id) { - this.$Message.info('非法请求'); + this.$Message.info("非法请求"); } if (!this.params.name) { - this.$Message.info('请输入定价名称'); + this.$Message.info("请输入定价名称"); return; } if (!this.params.package_id) { - this.$Message.info('请选择一个套餐'); + this.$Message.info("请选择一个套餐"); + return; + } + + if (this.params.price === null) { + this.$Message.info("请输入销售价格"); + return; + } + + if (this.params.renew_price === null) { + this.$Message.info("请输入续费价格"); return; } @@ -78,42 +88,46 @@ export default { if (this.isUpdate) { // 编辑 - API.update(this.params, this.data.id).then(res => { - this.loading = false; - if (res.code == 0) { - this.$emit('update-success'); - this.$Message.success('更新成功'); - this.clear(); - } - }).catch(err => { - this.loading = false; - }); + API.update(this.params, this.data.id) + .then(res => { + this.loading = false; + if (res.code == 0) { + this.$emit("update-success"); + this.$Message.success("更新成功"); + this.clear(); + } + }) + .catch(err => { + this.loading = false; + }); } else { // 添加 - API.create(this.params).then(res => { - this.loading = false; - if (res.code == 0) { - this.$emit('add-success'); - this.$Message.success('添加成功'); - this.clear(); - } - }).catch(err => { - this.loading = false; - }); + API.create(this.params) + .then(res => { + this.loading = false; + if (res.code == 0) { + this.$emit("add-success"); + this.$Message.success("添加成功"); + this.clear(); + } + }) + .catch(err => { + this.loading = false; + }); } }, visibleChange(bool) { if (!bool) { - this.$emit('update:show', false); + this.$emit("update:show", false); } }, clear() { for (let k in this.params) { - if (k === 'price' || k === 'status' || k === 'renew_price') { + if (k === "price" || k === "status" || k === "renew_price") { this.params[k] = 0; } else { - this.params[k] = ''; + this.params[k] = ""; } }