feat: recycle system
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import type { RouteRecordRaw } from "vue-router";
|
||||
import RecycleAPI from "@/api/RecycleAPI";
|
||||
import { getErrorMessage } from "@/utils/error";
|
||||
import { Message } from "@/utils/message";
|
||||
|
||||
function meta(depth = 3): RouteRecordRaw["meta"] {
|
||||
return { depth, tabBarVisible: false, bodyBackground: "#F5F5F8", darkBodyBackground: "#10161f" };
|
||||
@@ -6,61 +9,129 @@ function meta(depth = 3): RouteRecordRaw["meta"] {
|
||||
|
||||
export default [
|
||||
{
|
||||
path: "/management/recycle-exchanges",
|
||||
name: "RecycleExchangeList",
|
||||
component: () => import("@/pages/recycle/RecycleExchangeList.vue"),
|
||||
path: "/product/recycle-payments",
|
||||
name: "RecyclePaymentAll",
|
||||
component: () => import("@/pages/recycle/RecyclePaymentList.vue"),
|
||||
meta: meta()
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-exchanges/create",
|
||||
path: "/product/recycle-exchanges",
|
||||
name: "RecycleExchangeList",
|
||||
redirect: to => {
|
||||
const detail = typeof to.query.detail === "string" ? to.query.detail : "";
|
||||
if (detail) {
|
||||
return { name: "RecycleExchangeDetail", params: { id: detail } };
|
||||
}
|
||||
return { name: "SalesOrderList", query: { orderType: "RECYCLE", customerId: to.query.customerId } };
|
||||
},
|
||||
meta: meta()
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-exchanges/create",
|
||||
name: "RecycleExchangeCreate",
|
||||
component: () => import("@/pages/recycle/RecycleExchangeCreate.vue"),
|
||||
meta: meta(4)
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-exchanges/:id",
|
||||
path: "/product/recycle-exchanges/:id/payments/create",
|
||||
name: "RecyclePaymentCreate",
|
||||
component: () => import("@/pages/recycle/RecyclePaymentCreate.vue"),
|
||||
meta: meta(6)
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-exchanges/:id/payments/:paymentId/revoke",
|
||||
name: "RecyclePaymentRevoke",
|
||||
component: () => import("@/pages/recycle/RecyclePaymentRevoke.vue"),
|
||||
meta: meta(7)
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-exchanges/:id/payments/:paymentId",
|
||||
name: "RecyclePaymentDetail",
|
||||
component: () => import("@/pages/recycle/RecyclePaymentDetail.vue"),
|
||||
meta: meta(6)
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-exchanges/:id/payments",
|
||||
name: "RecyclePaymentList",
|
||||
component: () => import("@/pages/recycle/RecyclePaymentList.vue"),
|
||||
meta: meta(5)
|
||||
},
|
||||
{
|
||||
// 兑换单详情已并入交易订单详情,这里保留旧路径与名称,按销售订单 ID 转发
|
||||
path: "/product/recycle-exchanges/:id",
|
||||
name: "RecycleExchangeDetail",
|
||||
component: () => import("@/pages/recycle/RecycleExchangeDetail.vue"),
|
||||
beforeEnter: async to => {
|
||||
const id = String(to.params.id || "");
|
||||
if (id) {
|
||||
try {
|
||||
const result = await RecycleAPI.detail(id);
|
||||
if (result.exchange?.salesOrderId) {
|
||||
return { name: "SalesOrderDetail", params: { id: result.exchange.salesOrderId }, replace: true };
|
||||
}
|
||||
} catch (error) {
|
||||
Message.error(getErrorMessage(error, "兑换单加载失败"));
|
||||
}
|
||||
}
|
||||
return { name: "SalesOrderList", query: { orderType: "RECYCLE" }, replace: true };
|
||||
},
|
||||
meta: meta(4)
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-items",
|
||||
path: "/management/recycle-accounts",
|
||||
name: "RecycleAccount",
|
||||
component: () => import("@/pages/recycle/RecycleAccount.vue"),
|
||||
meta: meta()
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-items",
|
||||
name: "RecycleItemList",
|
||||
component: () => import("@/pages/recycle/RecycleItemList.vue"),
|
||||
meta: meta()
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-items/create",
|
||||
path: "/product/recycle-items/create",
|
||||
name: "RecycleItemCreate",
|
||||
component: () => import("@/pages/recycle/RecycleItemEdit.vue"),
|
||||
meta: meta(4)
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-items/:id",
|
||||
name: "RecycleItemEdit",
|
||||
component: () => import("@/pages/recycle/RecycleItemEdit.vue"),
|
||||
path: "/product/recycle-items/:id",
|
||||
name: "RecycleItemDetail",
|
||||
component: () => import("@/pages/recycle/RecycleItemDetail.vue"),
|
||||
meta: meta(4)
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-rules",
|
||||
path: "/product/recycle-items/:id/edit",
|
||||
name: "RecycleItemEdit",
|
||||
component: () => import("@/pages/recycle/RecycleItemEdit.vue"),
|
||||
meta: meta(5)
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-rules",
|
||||
name: "RecycleRuleList",
|
||||
component: () => import("@/pages/recycle/RecycleRuleList.vue"),
|
||||
meta: meta()
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-rules/create",
|
||||
path: "/product/recycle-rules/create",
|
||||
name: "RecycleRuleCreate",
|
||||
component: () => import("@/pages/recycle/RecycleRuleEdit.vue"),
|
||||
meta: meta(4)
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-rules/:id",
|
||||
name: "RecycleRuleEdit",
|
||||
component: () => import("@/pages/recycle/RecycleRuleEdit.vue"),
|
||||
path: "/product/recycle-rules/:id",
|
||||
name: "RecycleRuleDetail",
|
||||
component: () => import("@/pages/recycle/RecycleRuleDetail.vue"),
|
||||
meta: meta(4)
|
||||
},
|
||||
{
|
||||
path: "/management/recycle-stats",
|
||||
path: "/product/recycle-rules/:id/edit",
|
||||
name: "RecycleRuleEdit",
|
||||
component: () => import("@/pages/recycle/RecycleRuleEdit.vue"),
|
||||
meta: meta(5)
|
||||
},
|
||||
{
|
||||
path: "/product/recycle-stats",
|
||||
name: "RecycleStat",
|
||||
component: () => import("@/pages/recycle/RecycleStat.vue"),
|
||||
meta: meta()
|
||||
|
||||
Reference in New Issue
Block a user