This commit is contained in:
邓皓元 2019-04-04 18:28:53 +08:00
parent cd75300bc5
commit 3c4c0ec67c
8 changed files with 97 additions and 86 deletions

View File

@ -8,7 +8,7 @@ CREATE OR REPLACE VIEW real_virtual_relations AS
COUNT(*) as times,
MAX(v.created_at) as updated_at
FROM real_order_cards_partition as r
JOIN virtual_order_cards as v ON v.id = r.virtual_order_id
JOIN virtual_orders as v ON v.id = r.virtual_order_id
WHERE r.virtual_order_id <> 0
GROUP BY r.type,r.company_id,r.package_id,v.company_id,v.package_id;

View File

@ -124,7 +124,7 @@ const actions = {
},
getRelations(context, params) {
return new Promise((resolve, reject) => {
if (JSON.stringify(context.state.relationParams) == JSON.stringify(params)) {
if (JSON.stringify(context.state.relationParams) == JSON.stringify(params) && context.state.relations.length) {
return resolve(context.state.relations);
}

View File

@ -81,10 +81,7 @@ export default {
}
}
if (
this.selectedMapped.length &&
!Object.keys(this.order_group).length
) {
if (this.selectedMapped.length && !Object.keys(this.order_group).length) {
this.setParamsByReal(this.selected);
}
@ -93,18 +90,6 @@ export default {
this.selectGroup(this.order_group[key], key);
}
}
},
counts(value) {
if (value) {
if (
this.selectedMapped.length &&
!Object.keys(this.order_group).length
) {
this.setParamsByReal(this.selected);
}
this.params.counts = value;
}
}
},
methods: {
@ -291,6 +276,8 @@ export default {
this.setParamsByReal(item);
},
setParamsByReal(array) {
this.params.counts = this.counts;
let tmp = array.map(el => {
return el.company_id + "_" + el.package_id;
}).filter((v, i, a) => {
@ -330,12 +317,12 @@ export default {
case "支付宝":
this.params.pay_channel = "alipay";
break;
// case '余额支付':
// this.params.pay_channel = 'account';
// break;
// case '天猫续费':
// this.params.pay_channel = 'tmall';
// break;
// case '余额支付':
// this.params.pay_channel = 'account';
// break;
// case '天猫续费':
// this.params.pay_channel = 'tmall';
// break;
default:
break;
}
@ -374,68 +361,73 @@ export default {
}
}
let relations = this.relations.filter(el => {
return (
array.findIndex(e => {
return (
e.company_id === el.real_company_id &&
e.package_id === el.real_package_id
);
}) !== -1
);
this.$store.dispatch("getRelations").then(res => {
let relations = res.filter(el => {
return orders.findIndex(e => {
return (e.company_id === el.real_company_id && e.package_id === el.real_package_id);
}) !== -1;
});
if (relations.length) {
let mappedCompany = this.companies.map((el, i) => {
return { index: i, company_id: el.id };
});
mappedCompany.map(el => {
el.display = '0';
let relation = relations.find(e => {
return e.virtual_company_id === el.company_id;
});
if (relation) {
el.display = relation.updated_at;
}
return el;
});
mappedCompany = mappedCompany.sort((a, b) => {
return a.display > b.display ? -1 : a.display < b.display ? 1 : 0;
});
this.companies = mappedCompany.map(el => {
return this.companies[el.index];
});
if (this.companies.length) {
this.params.company_id = this.companies[0].id;
}
let mappedPackage = this.completePackagesFilter.map((el, i) => {
return { index: i, package_id: el.id };
});
mappedPackage = mappedPackage.map(el => {
el.display = '0';
let relation = relations.find(e => {
return e.virtual_package_id === el.package_id;
});
if (relation) {
el.display = relation.updated_at;
}
return el;
});
mappedPackage.sort((a, b) => {
return a.display > b.display ? -1 : a.display < b.display ? 1 : 0;
});
this.completePackagesFilter = mappedPackage.map(el => {
return this.completePackagesFilter[el.index];
});
if (this.completePackagesFilter.length) {
this.params.package_id = this.completePackagesFilter[0].id;
}
}
});
if (relations.length) {
let mappedCompany = this.companies.map(el, i => {
return { index: i, company_id: el.id };
});
mappedCompany = mappedCompany.map(el => {
el.display = 0;
let relation = relations.find(e => {
return e.virtual_company_id === el.id;
});
if (relation) {
el.display = relation.updated_at;
}
});
mappedCompany.sort((a, b) => {
return a.display > b.display ? 1 : a.display < b.display ? -1 : 0;
});
this.companies = mappedCompany.map(el => {
return this.companies[el.index];
});
this.params.company_id = this.companies[0].company_id;
let mappedPackage = this.completePackagesFilter.map(el, i => {
return { index: i, package_id: el.id };
});
mappedPackage = mappedPackage.map(el => {
el.display = 0;
let relation = relations.find(e => {
return e.virtual_package_id === el.id;
});
if (relation) {
el.display = relation.updated_at;
}
});
mappedPackage.sort((a, b) => {
return a.display > b.display ? 1 : a.display < b.display ? -1 : 0;
});
this.completePackagesFilter = mappedPackage.map(el => {
return this.completePackagesFilter[el.index];
});
this.params.package_id = this.completePackagesFilter[0].package_id;
}
},
handelSuccess() {
if (Object.keys(this.order_group).length >= 1) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6d96644c.e151cd00.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.c3ad5dec.js rel=prefetch><link href=/js/chunk-6d96644c.347f439e.js rel=prefetch><link href=/js/chunk-996b1e80.d3b45e46.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.456c05b7.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.d71a8195.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.456c05b7.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6d96644c.e151cd00.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.c3ad5dec.js rel=prefetch><link href=/js/chunk-6d96644c.aac85e3c.js rel=prefetch><link href=/js/chunk-996b1e80.d3b45e46.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.fb2ddb4b.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.d71a8195.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.fb2ddb4b.js></script></body></html>