请输入续费价格

This commit is contained in:
邓皓元 2019-04-12 15:21:04 +08:00
parent 8011981e0c
commit 99914c2533
4 changed files with 50 additions and 32 deletions

View File

@ -39,7 +39,7 @@ class CardController extends Controller
$limit = $conditions['limit'] ?? 20; $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') $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'); ->whereIn('sim', $cards->pluck('sim')->toArray())->groupBy('sim')->get()->keyBy('sim');

View File

@ -67,6 +67,7 @@ export default {
this.$emit('update-success'); this.$emit('update-success');
this.$Message.success('更新成功'); this.$Message.success('更新成功');
this.clear(); this.clear();
this.completeCompanyInitialized = false;
} }
}).catch(err => { }).catch(err => {
this.loading = false; this.loading = false;
@ -79,6 +80,7 @@ export default {
this.$emit('add-success'); this.$emit('add-success');
this.$Message.success('添加成功'); this.$Message.success('添加成功');
this.clear(); this.clear();
this.completeCompanyInitialized = false;
} }
}).catch(err => { }).catch(err => {
this.loading = false; this.loading = false;

View File

@ -104,6 +104,7 @@ export default {
this.$emit('update-success'); this.$emit('update-success');
this.$Message.success('更新成功'); this.$Message.success('更新成功');
this.clear(); this.clear();
this.completePackageInitialized = false;
} }
}).catch(err => { }).catch(err => {
this.loading = false; this.loading = false;
@ -116,6 +117,7 @@ export default {
this.$emit('add-success'); this.$emit('add-success');
this.$Message.success('添加成功'); this.$Message.success('添加成功');
this.clear(); this.clear();
this.completePackageInitialized = false;
} }
}).catch(err => { }).catch(err => {
this.loading = false; this.loading = false;

View File

@ -1,4 +1,4 @@
import * as API from 'api/virtual/products'; import * as API from "api/virtual/products";
export default { export default {
props: { props: {
@ -27,12 +27,12 @@ export default {
loading: false, loading: false,
params: { params: {
type: 0, type: 0,
name: '', name: "",
company_id: '', company_id: "",
package_id: '', package_id: "",
price: 0, price: 0,
renew_price: 0, renew_price: 0,
remark: '', remark: "",
status: 0 status: 0
}, },
completePackagesFilter: [] completePackagesFilter: []
@ -61,16 +61,26 @@ export default {
methods: { methods: {
ok() { ok() {
if (!this.params.company_id) { if (!this.params.company_id) {
this.$Message.info('非法请求'); this.$Message.info("非法请求");
} }
if (!this.params.name) { if (!this.params.name) {
this.$Message.info('请输入定价名称'); this.$Message.info("请输入定价名称");
return; return;
} }
if (!this.params.package_id) { 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; return;
} }
@ -78,42 +88,46 @@ export default {
if (this.isUpdate) { if (this.isUpdate) {
// 编辑 // 编辑
API.update(this.params, this.data.id).then(res => { API.update(this.params, this.data.id)
this.loading = false; .then(res => {
if (res.code == 0) { this.loading = false;
this.$emit('update-success'); if (res.code == 0) {
this.$Message.success('更新成功'); this.$emit("update-success");
this.clear(); this.$Message.success("更新成功");
} this.clear();
}).catch(err => { }
this.loading = false; })
}); .catch(err => {
this.loading = false;
});
} else { } else {
// 添加 // 添加
API.create(this.params).then(res => { API.create(this.params)
this.loading = false; .then(res => {
if (res.code == 0) { this.loading = false;
this.$emit('add-success'); if (res.code == 0) {
this.$Message.success('添加成功'); this.$emit("add-success");
this.clear(); this.$Message.success("添加成功");
} this.clear();
}).catch(err => { }
this.loading = false; })
}); .catch(err => {
this.loading = false;
});
} }
}, },
visibleChange(bool) { visibleChange(bool) {
if (!bool) { if (!bool) {
this.$emit('update:show', false); this.$emit("update:show", false);
} }
}, },
clear() { clear() {
for (let k in this.params) { 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; this.params[k] = 0;
} else { } else {
this.params[k] = ''; this.params[k] = "";
} }
} }