|
@@ -5,15 +5,23 @@ import { getMap } from '@src/services/Tools';
|
|
|
|
|
|
import { ServiceParamMap, OrderInfoMap, ServiceKey } from '../../Constant';
|
|
|
|
|
|
-const ServiceParamRelation = getMap(Object.keys(ServiceParamMap).map(key => {
|
|
|
- return {
|
|
|
- map: getMap(ServiceParamMap[key].map((row, index) => {
|
|
|
- row.index = index;
|
|
|
- return row;
|
|
|
- }), 'value', 'index'),
|
|
|
- key,
|
|
|
- };
|
|
|
-}), 'key', 'map');
|
|
|
+const ServiceParamRelation = getMap(
|
|
|
+ Object.keys(ServiceParamMap).map(key => {
|
|
|
+ return {
|
|
|
+ map: getMap(
|
|
|
+ ServiceParamMap[key].map((row, index) => {
|
|
|
+ row.index = index;
|
|
|
+ return row;
|
|
|
+ }),
|
|
|
+ 'value',
|
|
|
+ 'index',
|
|
|
+ ),
|
|
|
+ key,
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ 'key',
|
|
|
+ 'map',
|
|
|
+);
|
|
|
function formatTitle(record) {
|
|
|
if (record.productType === 'course_package') {
|
|
|
return (record.coursePackage || {}).title;
|
|
@@ -27,7 +35,7 @@ function formatTitle(record) {
|
|
|
return (record.data || {}).title;
|
|
|
}
|
|
|
if (record.productType === 'service') {
|
|
|
- return record.info.label || ((record.serviceInfo || {}).title);
|
|
|
+ return record.info.label || (record.serviceInfo || {}).title;
|
|
|
}
|
|
|
return '';
|
|
|
}
|
|
@@ -52,7 +60,8 @@ function formatCheckout(checkouts) {
|
|
|
checkout.key = checkout.id;
|
|
|
checkout.info = OrderInfoMap[checkout.productType];
|
|
|
if (checkout.productType === 'service') {
|
|
|
- const index = (ServiceParamRelation[checkout.service] && ServiceParamRelation[checkout.service][checkout.param]) || 0;
|
|
|
+ const index =
|
|
|
+ (ServiceParamRelation[checkout.service] && ServiceParamRelation[checkout.service][checkout.param]) || 0;
|
|
|
checkout.info = Object.assign({}, checkout.info[checkout.service], checkout.serviceInfo.package[index]);
|
|
|
}
|
|
|
checkout.title = formatTitle(checkout);
|
|
@@ -76,11 +85,13 @@ export default class UserStore extends BaseStore {
|
|
|
}
|
|
|
|
|
|
initAfter() {
|
|
|
- this.refreshToken().then(() => {
|
|
|
- if (this.adminLogin) {
|
|
|
- window.location.href = window.location.href.replace(`token=${this.adminLogin}`, '').replace('&&', '&');
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.getToken()) {
|
|
|
+ this.refreshToken().then(() => {
|
|
|
+ if (this.adminLogin) {
|
|
|
+ window.location.href = window.location.href.replace(`token=${this.adminLogin}`, '').replace('&&', '&');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
needPay(order) {
|