请输入续费价格

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;
$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');

View File

@ -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;

View File

@ -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;

View File

@ -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] = "";
}
}