orderListNavigation.js
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
export const ORDER_LIST_DETAIL_TAG_PATHS = {
orderDetail: "/orderDetail",
carDamageDetail: "/carDamageDetail",
crowdfundDetail: "/crowdfundDetail",
configUpgradationDetail: "/configUpgradationDetail",
};
/**
* 从订单列表相关详情返回列表(保留 keep-alive 缓存,不关闭列表 Tab)
* @param {import('vue-router').default} router
* @param {Function} close - d2admin/page/close
* @param {{ detailTagPath?: string }} [options]
*/
export function navigateBackToOrderList(router, close, options = {}) {
const { detailTagPath = ORDER_LIST_DETAIL_TAG_PATHS.orderDetail } = options;
close({ tagName: detailTagPath });
router.push({ name: "orderList" });
}
/**
* 从 orderDetail / carDamageDetail 返回
* @param {import('vue-router').default} router
* @param {Function} close
* @param {{ fromSupplement?: boolean, detailTagPath?: string }} [options]
*/
export function navigateBackFromOrderDetail(router, close, options = {}) {
const {
fromSupplement = false,
detailTagPath = ORDER_LIST_DETAIL_TAG_PATHS.orderDetail,
} = options;
if (fromSupplement) {
close({ tagName: "/orderSupplement" });
router.push({ name: "orderSupplement" });
} else {
router.push({ name: "orderList" });
}
close({ tagName: detailTagPath });
}