chore(UI): better layout for fund record
This commit is contained in:
Vendored
-2
@@ -6,9 +6,7 @@
|
|||||||
// biome-ignore lint: disable
|
// biome-ignore lint: disable
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
const DialogPlugin: typeof import('tdesign-mobile-vue')['DialogPlugin']
|
|
||||||
const EffectScope: typeof import('vue')['EffectScope']
|
const EffectScope: typeof import('vue')['EffectScope']
|
||||||
const THUMBNAIL_WIDTH_PARAM: typeof import('tdesign-mobile-vue')['HUMBNAIL_WIDTH_PARAM']
|
|
||||||
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
||||||
const computed: typeof import('vue')['computed']
|
const computed: typeof import('vue')['computed']
|
||||||
const createApp: typeof import('vue')['createApp']
|
const createApp: typeof import('vue')['createApp']
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
"less": "^4.3.0",
|
"less": "^4.3.0",
|
||||||
"pinia": "^3.0.2",
|
"pinia": "^3.0.2",
|
||||||
"tdesign-mobile-vue": "^1.17.1",
|
"tdesign-mobile-vue": "^1.17.1",
|
||||||
"timi-tdesign-mobile": "^1.3.1",
|
"timi-tdesign-mobile": "^1.4.0",
|
||||||
"timi-ts": "^1.0.0",
|
"timi-ts": "^1.0.0",
|
||||||
"timi-web": "^1.0.2",
|
"timi-web": "^1.0.2",
|
||||||
"timi-web-api": "^1.0.2",
|
"timi-web-api": "^1.0.2",
|
||||||
|
|||||||
Generated
+5
-5
@@ -44,8 +44,8 @@ importers:
|
|||||||
specifier: ^1.17.1
|
specifier: ^1.17.1
|
||||||
version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
|
version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
|
||||||
timi-tdesign-mobile:
|
timi-tdesign-mobile:
|
||||||
specifier: ^1.3.1
|
specifier: ^1.4.0
|
||||||
version: 1.3.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3))
|
version: 1.4.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3))
|
||||||
timi-ts:
|
timi-ts:
|
||||||
specifier: ^1.0.0
|
specifier: ^1.0.0
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
@@ -2742,8 +2742,8 @@ packages:
|
|||||||
through2@4.0.2:
|
through2@4.0.2:
|
||||||
resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==}
|
resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==}
|
||||||
|
|
||||||
timi-tdesign-mobile@1.3.1:
|
timi-tdesign-mobile@1.4.0:
|
||||||
resolution: {integrity: sha512-6hz7MSqseCUyyJzRiyQjymMDfSZ3kJrFP6J5DxHpE1pJ8xeByCzKgELS4CnO4187mqPEx46TtF03qB9XS4Mpuw==}
|
resolution: {integrity: sha512-d7HQIW0MqXjPv8hkNWwBlv9UviXesvEG42z7qNemJcSOWSUVg1b59O+DbuEajgmnJGeZ9DqMdbm+x0eHd9l11A==}
|
||||||
engines: {node: '>=20.0.0'}
|
engines: {node: '>=20.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
vue: ^3.5.0
|
vue: ^3.5.0
|
||||||
@@ -5836,7 +5836,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
readable-stream: 3.6.2
|
readable-stream: 3.6.2
|
||||||
|
|
||||||
timi-tdesign-mobile@1.3.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)):
|
timi-tdesign-mobile@1.4.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)):
|
||||||
dependencies:
|
dependencies:
|
||||||
tdesign-mobile-vue: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
|
tdesign-mobile-vue: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
|
||||||
timi-web: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
|
timi-web: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ import { TimeLabel, Text } from "timi-web";
|
|||||||
import { useUserStore } from "timi-web-api";
|
import { useUserStore } from "timi-web-api";
|
||||||
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
||||||
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
||||||
|
import { buildOrderPaneView } from "@/pages/salesOrder/component/orderPane";
|
||||||
import type { PhotoItem } from "@/types/Photo";
|
import type { PhotoItem } from "@/types/Photo";
|
||||||
import { getAttachmentReadURL } from "@/utils/attachment";
|
import { getAttachmentReadURL } from "@/utils/attachment";
|
||||||
import { getErrorMessage } from "@/utils/error";
|
import { getErrorMessage } from "@/utils/error";
|
||||||
@@ -231,6 +232,10 @@ async function toSalesOrder(): Promise<void> {
|
|||||||
if (!record.value?.bizId || !canReadSalesOrder.value) {
|
if (!record.value?.bizId || !canReadSalesOrder.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 分栏时订单页叠在右栏里,资金流水列表保持可见
|
||||||
|
if (pane?.openSub(buildOrderPaneView(record.value.bizId))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
await router.push({
|
await router.push({
|
||||||
path: `/product/sales-orders/${record.value.bizId}`,
|
path: `/product/sales-orders/${record.value.bizId}`,
|
||||||
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
:split="isWide"
|
:split="isWide"
|
||||||
:selected="!!selectedId"
|
:selected="!!selectedId"
|
||||||
:direction="paneDirection"
|
:direction="paneDirection"
|
||||||
|
:sub="!!orderPane?.view"
|
||||||
>
|
>
|
||||||
<template #master>
|
<template #master>
|
||||||
<t-pull-down-refresh
|
<t-pull-down-refresh
|
||||||
@@ -102,12 +103,35 @@
|
|||||||
<center-tips :content="loadStateText" />
|
<center-tips :content="loadStateText" />
|
||||||
</t-pull-down-refresh>
|
</t-pull-down-refresh>
|
||||||
</template>
|
</template>
|
||||||
|
<!--
|
||||||
|
右栏两层:资金记录详情,或从它点进的订单详情。订单是另一个模块的整页,
|
||||||
|
因此直接顶掉详情槽的内容(而不是叠第三层),资金流水列表保持原位。
|
||||||
|
-->
|
||||||
<template #detail>
|
<template #detail>
|
||||||
|
<sales-order-detail
|
||||||
|
v-if="orderPane"
|
||||||
|
:key="`order-${orderPane.orderId}`"
|
||||||
|
:order-id="orderPane.orderId"
|
||||||
|
/>
|
||||||
<fund-record-detail
|
<fund-record-detail
|
||||||
|
v-else
|
||||||
:key="`detail-${selectedId}`"
|
:key="`detail-${selectedId}`"
|
||||||
:record-id="selectedId"
|
:record-id="selectedId"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<!--
|
||||||
|
只有订单自己的子页才算第三层:订单详情退到主栏,子页占右栏,
|
||||||
|
与交易订单列表里「订单详情 + 履约单」的走法一致。
|
||||||
|
-->
|
||||||
|
<template #sub>
|
||||||
|
<sales-order-sub-view
|
||||||
|
v-if="orderPane?.view"
|
||||||
|
:key="`sub-${orderPane.view}`"
|
||||||
|
:view="orderPane.view"
|
||||||
|
:order-id="orderPane.orderId"
|
||||||
|
@saved="handleOrderSubSaved"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</master-detail-page>
|
</master-detail-page>
|
||||||
<customer-selector
|
<customer-selector
|
||||||
v-model="customerId"
|
v-model="customerId"
|
||||||
@@ -142,10 +166,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
|
import { MasterDetailPage, providePane, useMasterDetailPane } from "timi-tdesign-mobile";
|
||||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||||
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
|
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
|
||||||
|
import SalesOrderDetail from "@/pages/salesOrder/SalesOrderDetail.vue";
|
||||||
import FundRecordListCell from "@/pages/salesOrder/component/FundRecordListCell.vue";
|
import FundRecordListCell from "@/pages/salesOrder/component/FundRecordListCell.vue";
|
||||||
|
import SalesOrderSubView from "@/pages/salesOrder/component/SalesOrderSubView.vue";
|
||||||
|
import { buildOrderPaneView, getOrderPaneRoute, parseOrderPaneView } from "@/pages/salesOrder/component/orderPane";
|
||||||
import { Time } from "timi-web";
|
import { Time } from "timi-web";
|
||||||
import { useUserStore } from "timi-web-api";
|
import { useUserStore } from "timi-web-api";
|
||||||
import CustomerAPI from "@/api/CustomerAPI";
|
import CustomerAPI from "@/api/CustomerAPI";
|
||||||
@@ -166,10 +193,54 @@ const route = useRoute();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
// 选中项、切换方向、关闭逻辑、转屏、query 同步都在这里;资金流水没有内联编辑视图
|
// 选中项、切换方向、关闭逻辑、转屏、query 同步都在这里;资金流水没有内联编辑视图
|
||||||
const { selectedId, paneDirection, isWide, openDetail } = useMasterDetailPane({
|
const { selectedId, subView, paneDirection, isWide, openDetail, openSub, close } = useMasterDetailPane({
|
||||||
path: "/product/fund-records",
|
path: "/product/fund-records",
|
||||||
detail: id => `/product/fund-records/${id}`
|
detail: detailRoute
|
||||||
});
|
});
|
||||||
|
/** 右栏叠加的订单页;为空说明右栏还是资金记录详情。 */
|
||||||
|
const orderPane = computed(() => parseOrderPaneView(subView.value || ""));
|
||||||
|
|
||||||
|
// 右栏里既有资金记录详情,也有订单页:给整棵子树换一套"子页标识带订单 id"的上下文,
|
||||||
|
// 订单详情里的 openSub("payment") 才不会丢掉它叠在哪一单上
|
||||||
|
providePane({
|
||||||
|
close: saved => close(saved),
|
||||||
|
openSub: view => openSub(withOrderPrefix(view))
|
||||||
|
});
|
||||||
|
|
||||||
|
function withOrderPrefix(view: string): string {
|
||||||
|
const order = orderPane.value;
|
||||||
|
return order && !parseOrderPaneView(view) ? buildOrderPaneView(order.orderId, view) : view;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单子页退回订单详情是同级替换(层级没变),反向同步给的是 none,这里补成 back
|
||||||
|
watch(orderPane, (next, previous) => {
|
||||||
|
if (previous?.view && !next?.view) {
|
||||||
|
paneDirection.value = "back";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 订单子页保存完成:新建了履约单或回收支付,接着打开它刚建出来的详情。 */
|
||||||
|
async function handleOrderSubSaved(kind: string, id: string): Promise<void> {
|
||||||
|
const order = orderPane.value;
|
||||||
|
if (!order || !id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kind === "fulfillment-create") {
|
||||||
|
openSub(buildOrderPaneView(order.orderId, `fulfillment-detail:${id}`));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kind === "recycle-register") {
|
||||||
|
openSub(buildOrderPaneView(order.orderId, `recycle-payment-detail:${order.view.split(":")[1] || ""}:${id}`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 转屏变窄时右栏不再渲染,按右栏当前那一层落到整页路由。 */
|
||||||
|
function detailRoute(id: string): string {
|
||||||
|
const order = parseOrderPaneView(subView.value || "");
|
||||||
|
return order ? getOrderPaneRoute(order) : `/product/fund-records/${id}`;
|
||||||
|
}
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const recordList = ref<FundRecord[]>([]);
|
const recordList = ref<FundRecord[]>([]);
|
||||||
const operationType = ref(route.query.operationType === "RECEIVE" ? "RECEIVE" : "ALL");
|
const operationType = ref(route.query.operationType === "RECEIVE" ? "RECEIVE" : "ALL");
|
||||||
|
|||||||
@@ -546,7 +546,14 @@ async function toRecycleRegister(id: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toFundRecords(): Promise<void> {
|
async function toFundRecords(): Promise<void> {
|
||||||
if (order.value?.id) await router.push({
|
if (!order.value?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 分栏时本单流水叠在右栏里,订单详情留在旁边,不跳去整页的资金流水列表
|
||||||
|
if (openSub("fund-records")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await router.push({
|
||||||
path: "/product/fund-records",
|
path: "/product/fund-records",
|
||||||
query: {
|
query: {
|
||||||
salesOrderId: order.value.id,
|
salesOrderId: order.value.id,
|
||||||
@@ -594,11 +601,13 @@ async function toPayment(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toRefund(): Promise<void> {
|
async function toRefund(): Promise<void> {
|
||||||
if (order.value?.id) await router.push(`/product/sales-orders/${order.value.id}/refund`);
|
if (!order.value?.id || openSub("refund")) return;
|
||||||
|
await router.push(`/product/sales-orders/${order.value.id}/refund`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toNoRefund(): Promise<void> {
|
async function toNoRefund(): Promise<void> {
|
||||||
if (order.value?.id) await router.push(`/product/sales-orders/${order.value.id}/no-refund`);
|
if (!order.value?.id || openSub("no-refund")) return;
|
||||||
|
await router.push(`/product/sales-orders/${order.value.id}/no-refund`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toCancel(): Promise<void> {
|
async function toCancel(): Promise<void> {
|
||||||
|
|||||||
@@ -125,34 +125,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<!--
|
<!--
|
||||||
第三层:订单详情跳到从属页面时,订单留在主栏、右栏换成这一层。
|
第三层:订单详情跳到从属页面时,订单留在主栏、右栏换成这一层。
|
||||||
子页标识由详情页的 openSub() 发起,格式 `kind:arg`。
|
子页标识由详情页的 openSub() 发起,格式 `kind:arg`;换一层就换 :key,交给外层过渡。
|
||||||
-->
|
-->
|
||||||
<template #sub>
|
<template #sub>
|
||||||
<recycle-rule-detail
|
<sales-order-sub-view
|
||||||
v-if="subKind === 'recycle-rule'"
|
:key="subView"
|
||||||
:key="`rule-${subArg}`"
|
:view="subView || ''"
|
||||||
:rule-id="subArg"
|
:order-id="selectedId"
|
||||||
|
@refresh="refreshRecycleDetail"
|
||||||
|
@saved="handleSubSaved"
|
||||||
/>
|
/>
|
||||||
<order-fulfillment-list
|
|
||||||
v-else-if="subKind === 'fulfillments'"
|
|
||||||
key="fulfillments"
|
|
||||||
:sales-order-id="selectedId"
|
|
||||||
embedded
|
|
||||||
/>
|
|
||||||
<order-fulfillment-detail v-else-if="subKind === 'fulfillment-detail'" :fulfillment-id="subArg" />
|
|
||||||
<order-fulfillment-create
|
|
||||||
v-else-if="subKind === 'fulfillment-create'"
|
|
||||||
key="fulfillment-create"
|
|
||||||
:sales-order-id="selectedId"
|
|
||||||
embedded
|
|
||||||
@saved="handleFulfillmentSaved"
|
|
||||||
/>
|
|
||||||
<recycle-payment-list v-else-if="subKind === 'recycle-payments'" :exchange-id="subArg" />
|
|
||||||
<recycle-payment-detail v-else-if="subKind === 'recycle-payment-detail'" :exchange-id="subArg" :payment-id="subView?.split(':')[2] || ''" @changed="refreshRecycleDetail" />
|
|
||||||
<recycle-payment-revoke v-else-if="subKind === 'recycle-payment-revoke'" :exchange-id="subArg" :payment-id="subView?.split(':')[2] || ''" @changed="refreshRecycleDetail" />
|
|
||||||
<recycle-payment-create v-else-if="subKind === 'recycle-register'" :exchange-id="subArg" embedded @saved="handleRecyclePaymentSaved" />
|
|
||||||
<sales-order-cancel v-else-if="subKind === 'cancel'" :order-id="selectedId" embedded />
|
|
||||||
<sales-order-payment v-else-if="subKind === 'payment'" :order-id="selectedId" embedded />
|
|
||||||
</template>
|
</template>
|
||||||
</master-detail-page>
|
</master-detail-page>
|
||||||
|
|
||||||
@@ -175,16 +157,9 @@ import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
|
|||||||
import { Toolkit } from "timi-web";
|
import { Toolkit } from "timi-web";
|
||||||
import SalesOrderDetail from "@/pages/salesOrder/SalesOrderDetail.vue";
|
import SalesOrderDetail from "@/pages/salesOrder/SalesOrderDetail.vue";
|
||||||
import RecycleExchangeCreate from "@/pages/recycle/RecycleExchangeCreate.vue";
|
import RecycleExchangeCreate from "@/pages/recycle/RecycleExchangeCreate.vue";
|
||||||
import RecycleRuleDetail from "@/pages/recycle/RecycleRuleDetail.vue";
|
|
||||||
import RecyclePaymentList from "@/pages/recycle/RecyclePaymentList.vue";
|
|
||||||
import RecyclePaymentDetail from "@/pages/recycle/RecyclePaymentDetail.vue";
|
|
||||||
import RecyclePaymentRevoke from "@/pages/recycle/RecyclePaymentRevoke.vue";
|
|
||||||
import RecyclePaymentCreate from "@/pages/recycle/RecyclePaymentCreate.vue";
|
|
||||||
import SalesOrderCancel from "@/pages/salesOrder/SalesOrderCancel.vue";
|
import SalesOrderCancel from "@/pages/salesOrder/SalesOrderCancel.vue";
|
||||||
import SalesOrderPayment from "@/pages/salesOrder/SalesOrderPayment.vue";
|
import SalesOrderPayment from "@/pages/salesOrder/SalesOrderPayment.vue";
|
||||||
import OrderFulfillmentCreate from "@/pages/fulfillment/OrderFulfillmentCreate.vue";
|
import OrderFulfillmentCreate from "@/pages/fulfillment/OrderFulfillmentCreate.vue";
|
||||||
import OrderFulfillmentDetail from "@/pages/fulfillment/OrderFulfillmentDetail.vue";
|
|
||||||
import OrderFulfillmentList from "@/pages/fulfillment/OrderFulfillmentList.vue";
|
|
||||||
import { useUserStore } from "timi-web-api";
|
import { useUserStore } from "timi-web-api";
|
||||||
import { onBeforeRouteLeave } from "vue-router";
|
import { onBeforeRouteLeave } from "vue-router";
|
||||||
import CustomerAPI from "@/api/CustomerAPI";
|
import CustomerAPI from "@/api/CustomerAPI";
|
||||||
@@ -193,6 +168,7 @@ import SalesOrderAPI from "@/api/SalesOrderAPI";
|
|||||||
import CustomerSelector from "@/components/CustomerSelector.vue";
|
import CustomerSelector from "@/components/CustomerSelector.vue";
|
||||||
import SalesOrderFilterSummary from "@/pages/salesOrder/component/SalesOrderFilterSummary.vue";
|
import SalesOrderFilterSummary from "@/pages/salesOrder/component/SalesOrderFilterSummary.vue";
|
||||||
import SalesOrderListCell from "@/pages/salesOrder/component/SalesOrderListCell.vue";
|
import SalesOrderListCell from "@/pages/salesOrder/component/SalesOrderListCell.vue";
|
||||||
|
import SalesOrderSubView from "@/pages/salesOrder/component/SalesOrderSubView.vue";
|
||||||
import SalesOrderSummary from "@/pages/salesOrder/component/SalesOrderSummary.vue";
|
import SalesOrderSummary from "@/pages/salesOrder/component/SalesOrderSummary.vue";
|
||||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||||
import type { GaoPackageConfig } from "@/types/Package";
|
import type { GaoPackageConfig } from "@/types/Package";
|
||||||
@@ -247,7 +223,6 @@ const directAction = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 子页标识形如 `recycle-rule:698f`,冒号前是类型,后面是参数。 */
|
/** 子页标识形如 `recycle-rule:698f`,冒号前是类型,后面是参数。 */
|
||||||
const subKind = computed(() => subView.value?.split(":")[0] || "");
|
|
||||||
const subArg = computed(() => subView.value?.split(":")[1] || "");
|
const subArg = computed(() => subView.value?.split(":")[1] || "");
|
||||||
watch(subView, (next, previous) => {
|
watch(subView, (next, previous) => {
|
||||||
if (previous?.startsWith("fulfillment-detail:") && next === "fulfillments") {
|
if (previous?.startsWith("fulfillment-detail:") && next === "fulfillments") {
|
||||||
@@ -288,6 +263,17 @@ async function handleFulfillmentSaved(fulfillmentId?: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
await salesOrderDetailRef.value?.refreshOrder();
|
await salesOrderDetailRef.value?.refreshOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 子页保存完成:新建了履约单或回收支付时,接着打开它刚建出来的详情。 */
|
||||||
|
async function handleSubSaved(kind: string, id: string): Promise<void> {
|
||||||
|
if (kind === "fulfillment-create") {
|
||||||
|
await handleFulfillmentSaved(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (kind === "recycle-register") {
|
||||||
|
await handleRecyclePaymentSaved(id || undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
const currentStoreStore = useCurrentStoreStore();
|
const currentStoreStore = useCurrentStoreStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.salesOrder.create));
|
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.salesOrder.create));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:z-index="20"
|
:z-index="20"
|
||||||
title="确认无需退款"
|
title="确认无需退款"
|
||||||
left-arrow
|
left-arrow
|
||||||
@left-click="$router.back()"
|
@left-click="exit"
|
||||||
>
|
>
|
||||||
<template #right>
|
<template #right>
|
||||||
<t-button
|
<t-button
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useUserStore } from "timi-web-api";
|
import { useUserStore } from "timi-web-api";
|
||||||
|
import { usePane } from "timi-tdesign-mobile";
|
||||||
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
||||||
import { getErrorMessage } from "@/utils/error";
|
import { getErrorMessage } from "@/utils/error";
|
||||||
import { emitListDataChanged, listDataEventKeys } from "@/utils/listDataEvents";
|
import { emitListDataChanged, listDataEventKeys } from "@/utils/listDataEvents";
|
||||||
@@ -73,8 +74,19 @@ import { getSalesRefundStatusText } from "@/utils/salesOrder";
|
|||||||
import type { SalesOrder } from "@/types/SalesOrder";
|
import type { SalesOrder } from "@/types/SalesOrder";
|
||||||
|
|
||||||
defineOptions({ name: "SalesOrderNoRefund" });
|
defineOptions({ name: "SalesOrderNoRefund" });
|
||||||
|
const props = withDefaults(defineProps<{ orderId?: string; embedded?: boolean }>(), { orderId: "", embedded: false });
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const pane = usePane();
|
||||||
|
|
||||||
|
function exit(): void {
|
||||||
|
if (props.embedded && pane) {
|
||||||
|
pane.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const order = ref<SalesOrder>();
|
const order = ref<SalesOrder>();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -104,7 +116,7 @@ function confirmNoRefundReason(value: Array<string | number>): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadData(): Promise<void> {
|
async function loadData(): Promise<void> {
|
||||||
const id = String(route.params.id || "");
|
const id = props.orderId || String(route.params.id || "");
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
@@ -127,6 +139,10 @@ async function save(): Promise<void> {
|
|||||||
await SalesOrderAPI.confirmNoRefund({ salesOrderId: order.value.id, reason: reason.value.trim() });
|
await SalesOrderAPI.confirmNoRefund({ salesOrderId: order.value.id, reason: reason.value.trim() });
|
||||||
emitListDataChanged(listDataEventKeys.salesOrderChanged, order.value.id);
|
emitListDataChanged(listDataEventKeys.salesOrderChanged, order.value.id);
|
||||||
Message.success("已确认无需退款");
|
Message.success("已确认无需退款");
|
||||||
|
if (props.embedded && pane) {
|
||||||
|
pane.close(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
await router.replace(`/product/sales-orders/${order.value.id}`);
|
await router.replace(`/product/sales-orders/${order.value.id}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Message.error(getErrorMessage(error, "确认失败,请刷新后重试"));
|
Message.error(getErrorMessage(error, "确认失败,请刷新后重试"));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:z-index="20"
|
:z-index="20"
|
||||||
title="登记退款"
|
title="登记退款"
|
||||||
left-arrow
|
left-arrow
|
||||||
@left-click="$router.back()"
|
@left-click="exit"
|
||||||
>
|
>
|
||||||
<template #right>
|
<template #right>
|
||||||
<t-button
|
<t-button
|
||||||
@@ -110,6 +110,7 @@ import DateTimeNowPicker from "@/components/DateTimeNowPicker.vue";
|
|||||||
import { type Attachment, useUserStore } from "timi-web-api";
|
import { type Attachment, useUserStore } from "timi-web-api";
|
||||||
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
||||||
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
||||||
|
import { usePane } from "timi-tdesign-mobile";
|
||||||
import type { PhotoItem } from "@/types/Photo";
|
import type { PhotoItem } from "@/types/Photo";
|
||||||
import {
|
import {
|
||||||
createPackageRequestNo,
|
createPackageRequestNo,
|
||||||
@@ -127,8 +128,19 @@ import { uploadPhotoList } from "@/utils/photo";
|
|||||||
import type { SalesOrder } from "@/types/SalesOrder";
|
import type { SalesOrder } from "@/types/SalesOrder";
|
||||||
|
|
||||||
defineOptions({ name: "SalesOrderRefund" });
|
defineOptions({ name: "SalesOrderRefund" });
|
||||||
|
const props = withDefaults(defineProps<{ orderId?: string; embedded?: boolean }>(), { orderId: "", embedded: false });
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const pane = usePane();
|
||||||
|
|
||||||
|
function exit(): void {
|
||||||
|
if (props.embedded && pane) {
|
||||||
|
pane.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const order = ref<SalesOrder>();
|
const order = ref<SalesOrder>();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -183,7 +195,7 @@ function buildAttachments(): Partial<Attachment>[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadData(): Promise<void> {
|
async function loadData(): Promise<void> {
|
||||||
const id = String(route.params.id || "");
|
const id = props.orderId || String(route.params.id || "");
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
@@ -221,6 +233,10 @@ async function save(): Promise<void> {
|
|||||||
});
|
});
|
||||||
emitListDataChanged(listDataEventKeys.salesOrderChanged, order.value.id);
|
emitListDataChanged(listDataEventKeys.salesOrderChanged, order.value.id);
|
||||||
Message.success("退款登记已提交");
|
Message.success("退款登记已提交");
|
||||||
|
if (props.embedded && pane) {
|
||||||
|
pane.close(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
await router.replace(`/product/sales-orders/${order.value.id}`);
|
await router.replace(`/product/sales-orders/${order.value.id}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Message.error(getErrorMessage(error, "退款登记失败,重试会复用同一请求号"));
|
Message.error(getErrorMessage(error, "退款登记失败,重试会复用同一请求号"));
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<t-divider />
|
<t-divider />
|
||||||
<div class="amounts">
|
<div class="amounts">
|
||||||
<span>订单总价 <strong v-text="`¥${formatPackageAmount(item.salesOrderAmount)}`" /></span>
|
<span>订单总价 <strong v-text="`¥${formatPackageAmount(item.salesOrderAmount)}`" /></span>
|
||||||
<span>剩余待收 <strong v-text="`¥${formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)}`" /></span>
|
<span>剩余待收(快照) <strong v-text="`¥${formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)}`" /></span>
|
||||||
</div>
|
</div>
|
||||||
<t-divider />
|
<t-divider />
|
||||||
<div class="people-actions">
|
<div class="people-actions">
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tui-page-layout tui-navbar sales-order-fund-list">
|
||||||
|
<t-navbar
|
||||||
|
fixed
|
||||||
|
:z-index="20"
|
||||||
|
title="资金流水"
|
||||||
|
left-arrow
|
||||||
|
@left-click="exit"
|
||||||
|
/>
|
||||||
|
<main v-can="pageAccess" class="tui-page-content list">
|
||||||
|
<t-pull-down-refresh
|
||||||
|
class="pull-refresh"
|
||||||
|
v-model="refreshing"
|
||||||
|
:refresh-timeout="30000"
|
||||||
|
@refresh="reload"
|
||||||
|
@scrolltolower="loadMore"
|
||||||
|
>
|
||||||
|
<div v-if="recordList.length" class="records">
|
||||||
|
<fund-record-list-cell
|
||||||
|
v-for="item in recordList"
|
||||||
|
:key="item.id"
|
||||||
|
:item="item"
|
||||||
|
@detail="toDetail(item)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<center-tips v-else :content="loading ? '正在加载资金流水' : '本单暂无资金流水'" />
|
||||||
|
<center-tips :content="loadStateText" />
|
||||||
|
</t-pull-down-refresh>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { usePane } from "timi-tdesign-mobile";
|
||||||
|
import { useUserStore } from "timi-web-api";
|
||||||
|
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
||||||
|
import FundRecordListCell from "@/pages/salesOrder/component/FundRecordListCell.vue";
|
||||||
|
import type { FundRecord } from "@/types/SalesOrder";
|
||||||
|
import { getErrorMessage } from "@/utils/error";
|
||||||
|
import { Message } from "@/utils/message";
|
||||||
|
import { permissionCodes } from "@/utils/permission";
|
||||||
|
|
||||||
|
defineOptions({ name: "SalesOrderFundList" });
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
/** 订单 id:只列这条订单产生的资金流水。 */
|
||||||
|
salesOrderId?: string;
|
||||||
|
}>(), {
|
||||||
|
salesOrderId: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const pane = usePane();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const recordList = ref<FundRecord[]>([]);
|
||||||
|
const total = ref(0);
|
||||||
|
const pageIndex = ref(0);
|
||||||
|
const loading = ref(false);
|
||||||
|
const refreshing = ref(false);
|
||||||
|
const noMore = ref(false);
|
||||||
|
const pageAccess = computed(() => [permissionCodes.fundRecord.read, permissionCodes.fundReceive.create]);
|
||||||
|
/** 没有流水查看权限、只有收款权限的账号,只能看到自己的收款申请。 */
|
||||||
|
const isSelfReceiveOnly = computed(() => !userStore.hasPermissions(permissionCodes.fundRecord.read)
|
||||||
|
&& userStore.hasPermissions(permissionCodes.fundReceive.create));
|
||||||
|
const loadStateText = computed(() => loading.value ? "正在加载" : noMore.value ? "已经到底了" : "上拉加载更多");
|
||||||
|
|
||||||
|
function exit(): void {
|
||||||
|
if (pane) {
|
||||||
|
pane.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void router.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadMore(): Promise<void> {
|
||||||
|
if (loading.value || noMore.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const page = {
|
||||||
|
index: pageIndex.value,
|
||||||
|
size: 15,
|
||||||
|
salesOrderId: props.salesOrderId || undefined
|
||||||
|
};
|
||||||
|
const result = isSelfReceiveOnly.value
|
||||||
|
? await SalesOrderAPI.myReceiveRecordList(page)
|
||||||
|
: await SalesOrderAPI.fundRecordList(page);
|
||||||
|
const list = result.list || [];
|
||||||
|
recordList.value = recordList.value.concat(list);
|
||||||
|
total.value = result.total || 0;
|
||||||
|
pageIndex.value += 1;
|
||||||
|
noMore.value = list.length < 15 || total.value <= recordList.value.length;
|
||||||
|
} catch (error) {
|
||||||
|
Message.error(getErrorMessage(error, "资金流水加载失败"));
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reload(): Promise<void> {
|
||||||
|
if (loading.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pageIndex.value = 0;
|
||||||
|
recordList.value = [];
|
||||||
|
total.value = 0;
|
||||||
|
noMore.value = false;
|
||||||
|
await loadMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 再往下钻一条流水:仍然叠在右栏里,返回回到这份列表。 */
|
||||||
|
function toDetail(item: FundRecord): void {
|
||||||
|
if (item.id) {
|
||||||
|
pane?.openSub(`fund-record:${item.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(loadMore);
|
||||||
|
watch(() => props.salesOrderId, reload);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.sales-order-fund-list {
|
||||||
|
|
||||||
|
.records {
|
||||||
|
gap: .5rem;
|
||||||
|
margin: 0 1rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<recycle-rule-detail
|
||||||
|
v-if="kind === 'recycle-rule'"
|
||||||
|
:rule-id="arg"
|
||||||
|
/>
|
||||||
|
<order-fulfillment-list
|
||||||
|
v-else-if="kind === 'fulfillments'"
|
||||||
|
:sales-order-id="orderId"
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
<order-fulfillment-detail
|
||||||
|
v-else-if="kind === 'fulfillment-detail'"
|
||||||
|
:fulfillment-id="arg"
|
||||||
|
/>
|
||||||
|
<order-fulfillment-create
|
||||||
|
v-else-if="kind === 'fulfillment-create'"
|
||||||
|
:sales-order-id="orderId"
|
||||||
|
embedded
|
||||||
|
@saved="id => emit('saved', kind, id || '')"
|
||||||
|
/>
|
||||||
|
<recycle-payment-list
|
||||||
|
v-else-if="kind === 'recycle-payments'"
|
||||||
|
:exchange-id="arg"
|
||||||
|
/>
|
||||||
|
<recycle-payment-detail
|
||||||
|
v-else-if="kind === 'recycle-payment-detail'"
|
||||||
|
:exchange-id="arg"
|
||||||
|
:payment-id="segments[2] || ''"
|
||||||
|
@changed="emit('refresh')"
|
||||||
|
/>
|
||||||
|
<recycle-payment-revoke
|
||||||
|
v-else-if="kind === 'recycle-payment-revoke'"
|
||||||
|
:exchange-id="arg"
|
||||||
|
:payment-id="segments[2] || ''"
|
||||||
|
@changed="emit('refresh')"
|
||||||
|
/>
|
||||||
|
<recycle-payment-create
|
||||||
|
v-else-if="kind === 'recycle-register'"
|
||||||
|
:exchange-id="arg"
|
||||||
|
embedded
|
||||||
|
@saved="id => emit('saved', kind, id || '')"
|
||||||
|
/>
|
||||||
|
<sales-order-cancel
|
||||||
|
v-else-if="kind === 'cancel'"
|
||||||
|
:order-id="orderId"
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
<sales-order-payment
|
||||||
|
v-else-if="kind === 'payment'"
|
||||||
|
:order-id="orderId"
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
<sales-order-refund
|
||||||
|
v-else-if="kind === 'refund'"
|
||||||
|
:order-id="orderId"
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
<sales-order-no-refund
|
||||||
|
v-else-if="kind === 'no-refund'"
|
||||||
|
:order-id="orderId"
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
<sales-order-fund-list
|
||||||
|
v-else-if="kind === 'fund-records'"
|
||||||
|
:sales-order-id="orderId"
|
||||||
|
/>
|
||||||
|
<fund-record-detail
|
||||||
|
v-else-if="kind === 'fund-record'"
|
||||||
|
:record-id="arg"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import RecycleRuleDetail from "@/pages/recycle/RecycleRuleDetail.vue";
|
||||||
|
import RecyclePaymentList from "@/pages/recycle/RecyclePaymentList.vue";
|
||||||
|
import RecyclePaymentDetail from "@/pages/recycle/RecyclePaymentDetail.vue";
|
||||||
|
import RecyclePaymentRevoke from "@/pages/recycle/RecyclePaymentRevoke.vue";
|
||||||
|
import RecyclePaymentCreate from "@/pages/recycle/RecyclePaymentCreate.vue";
|
||||||
|
import OrderFulfillmentList from "@/pages/fulfillment/OrderFulfillmentList.vue";
|
||||||
|
import OrderFulfillmentDetail from "@/pages/fulfillment/OrderFulfillmentDetail.vue";
|
||||||
|
import OrderFulfillmentCreate from "@/pages/fulfillment/OrderFulfillmentCreate.vue";
|
||||||
|
import SalesOrderCancel from "@/pages/salesOrder/SalesOrderCancel.vue";
|
||||||
|
import SalesOrderPayment from "@/pages/salesOrder/SalesOrderPayment.vue";
|
||||||
|
import SalesOrderRefund from "@/pages/salesOrder/SalesOrderRefund.vue";
|
||||||
|
import SalesOrderNoRefund from "@/pages/salesOrder/SalesOrderNoRefund.vue";
|
||||||
|
import SalesOrderFundList from "@/pages/salesOrder/component/SalesOrderFundList.vue";
|
||||||
|
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
|
||||||
|
|
||||||
|
defineOptions({ name: "SalesOrderSubView" });
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
/** 子页标识,形如 `payment`、`fulfillment-detail:698f`。 */
|
||||||
|
view?: string;
|
||||||
|
/** 所属订单 id。 */
|
||||||
|
orderId?: string;
|
||||||
|
}>(), {
|
||||||
|
view: "",
|
||||||
|
orderId: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
/** 子页改了订单数据,宿主应刷新订单详情。 */
|
||||||
|
refresh: [];
|
||||||
|
/** 子页保存完成,宿主可据子页类型决定跳到哪一层。 */
|
||||||
|
saved: [kind: string, id: string];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const segments = computed(() => props.view.split(":"));
|
||||||
|
const kind = computed(() => segments.value[0] || "");
|
||||||
|
const arg = computed(() => segments.value[1] || "");
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
* 右栏内联订单页的标识约定:`sales-order:<订单 id>[:<子页标识>]`。
|
||||||
|
*
|
||||||
|
* 资金流水列表这类宿主页把「订单详情及其子页」叠在自己的右栏里,
|
||||||
|
* 标识借 `useMasterDetailPane` 的 `subView` 传递,宿主负责解析后渲染。
|
||||||
|
*/
|
||||||
|
const ORDER_PANE_PREFIX = "sales-order";
|
||||||
|
|
||||||
|
/** 拼接右栏订单页标识;`view` 为空表示订单详情本身。 */
|
||||||
|
export function buildOrderPaneView(orderId: string, view = ""): string {
|
||||||
|
return view ? `${ORDER_PANE_PREFIX}:${orderId}:${view}` : `${ORDER_PANE_PREFIX}:${orderId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 解析右栏订单页标识;不是订单页时返回 null。 */
|
||||||
|
export function parseOrderPaneView(value: string): { orderId: string; view: string } | null {
|
||||||
|
const [prefix, orderId, ...rest] = value.split(":");
|
||||||
|
if (prefix !== ORDER_PANE_PREFIX || !orderId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { orderId, view: rest.join(":") };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 右栏订单页对应的整页路由。
|
||||||
|
*
|
||||||
|
* 转屏变窄后右栏不再渲染,靠它把用户留在原来看的那一层;
|
||||||
|
* 没有对应整页路由的子页回落到订单详情。
|
||||||
|
*/
|
||||||
|
export function getOrderPaneRoute(pane: { orderId: string; view: string }): string {
|
||||||
|
const { orderId, view } = pane;
|
||||||
|
const [kind, arg] = view.split(":");
|
||||||
|
switch (kind) {
|
||||||
|
case "payment": return `/product/sales-orders/${orderId}/payment`;
|
||||||
|
case "cancel": return `/product/sales-orders/${orderId}/cancel`;
|
||||||
|
case "refund": return `/product/sales-orders/${orderId}/refund`;
|
||||||
|
case "no-refund": return `/product/sales-orders/${orderId}/no-refund`;
|
||||||
|
case "fulfillments": return `/product/order-fulfillments?salesOrderId=${encodeURIComponent(orderId)}`;
|
||||||
|
case "fulfillment-create": return `/product/order-fulfillments/create?salesOrderId=${encodeURIComponent(orderId)}`;
|
||||||
|
case "fulfillment-detail": return arg ? `/product/order-fulfillments/${arg}` : `/product/sales-orders/${orderId}`;
|
||||||
|
default: return `/product/sales-orders/${orderId}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user