fix: product list to children page layout on tablet
This commit is contained in:
@@ -25,42 +25,46 @@
|
||||
</div>
|
||||
</section>
|
||||
<div class="chart-list">
|
||||
<product-stock-calendar :key="calendarVersion" :store-id="storeId" />
|
||||
<product-stock-movement-chart
|
||||
<product-stock-calendar
|
||||
:key="calendarVersion"
|
||||
:store-id="storeId"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<product-stock-movement-chart
|
||||
:date-text-list="dateTextList"
|
||||
:list="stockMovementList"
|
||||
:loading="isLoading"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<product-sales-trend-chart
|
||||
v-entrance-transition
|
||||
:date-text-list="dateTextList"
|
||||
:list="salesDailyList"
|
||||
:loading="isLoading"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<div class="two-columns">
|
||||
<product-sales-rank-chart
|
||||
v-entrance-transition
|
||||
:list="salesRankList"
|
||||
:loading="isLoading"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<product-fulfillment-rank-chart
|
||||
v-entrance-transition
|
||||
:list="fulfillmentRankList"
|
||||
:loading="isLoading"
|
||||
v-entrance-transition
|
||||
/>
|
||||
</div>
|
||||
<product-fulfillment-trend-chart
|
||||
v-entrance-transition
|
||||
:date-text-list="dateTextList"
|
||||
:list="fulfillmentDailyList"
|
||||
:loading="isLoading"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<product-stock-health-table
|
||||
v-entrance-transition
|
||||
:list="stockHealthList"
|
||||
:sku-health-list="skuHealthList"
|
||||
:loading="isLoading"
|
||||
v-entrance-transition
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -577,6 +577,7 @@ async function toCreateFulfillment(): Promise<void> {
|
||||
}
|
||||
|
||||
async function toPayment(): Promise<void> {
|
||||
if (order.value?.id && openSub("payment")) return;
|
||||
if (order.value?.id) await router.push(`/product/sales-orders/${order.value.id}/payment`);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,14 +103,23 @@
|
||||
</t-pull-down-refresh>
|
||||
</template>
|
||||
<template #detail>
|
||||
<sales-order-cancel v-if="directAction.kind === 'cancel'" :key="selectedId" :order-id="directAction.id" embedded />
|
||||
<sales-order-payment v-else-if="directAction.kind === 'payment'" :key="selectedId" :order-id="directAction.id" embedded />
|
||||
<order-fulfillment-create
|
||||
v-else-if="directAction.kind === 'fulfillment-create'"
|
||||
:key="selectedId"
|
||||
:sales-order-id="directAction.id"
|
||||
embedded
|
||||
@saved="handleFulfillmentSaved"
|
||||
/>
|
||||
<recycle-exchange-create
|
||||
v-if="selectedId === recycleCreatePaneId"
|
||||
v-else-if="selectedId === recycleCreatePaneId"
|
||||
@created="handleRecycleCreated"
|
||||
/>
|
||||
<sales-order-detail
|
||||
v-else
|
||||
ref="salesOrderDetailRef"
|
||||
:key="`detail-${selectedId}`"
|
||||
:key="`detail-${selectedId}-${detailVersion}`"
|
||||
:order-id="selectedId"
|
||||
/>
|
||||
</template>
|
||||
@@ -143,6 +152,7 @@
|
||||
<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>
|
||||
</master-detail-page>
|
||||
|
||||
@@ -171,6 +181,7 @@ 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 SalesOrderPayment from "@/pages/salesOrder/SalesOrderPayment.vue";
|
||||
import OrderFulfillmentCreate from "@/pages/fulfillment/OrderFulfillmentCreate.vue";
|
||||
import OrderFulfillmentDetail from "@/pages/fulfillment/OrderFulfillmentDetail.vue";
|
||||
import OrderFulfillmentList from "@/pages/fulfillment/OrderFulfillmentList.vue";
|
||||
@@ -218,11 +229,21 @@ const route = useRoute();
|
||||
|
||||
// 选中项、切换方向、关闭逻辑、转屏、query 同步都在这里;订单没有内联编辑视图
|
||||
const recycleCreatePaneId = "__recycle_create__";
|
||||
const { selectedId, subView, paneDirection, isWide, openDetail } = useMasterDetailPane({
|
||||
const { selectedId, subView, paneDirection, isWide, openDetail, detailVersion } = useMasterDetailPane({
|
||||
path: "/product/sales-orders",
|
||||
detail: id => id === recycleCreatePaneId
|
||||
? "/product/recycle-exchanges/create?source=sales-orders"
|
||||
: `/product/sales-orders/${id}`
|
||||
detail: id => {
|
||||
const [kind, orderId] = id.split(":");
|
||||
if (kind === "cancel" || kind === "payment") return `/product/sales-orders/${orderId}/${kind}`;
|
||||
if (kind === "fulfillment-create") return `/product/order-fulfillments/create?salesOrderId=${encodeURIComponent(orderId)}`;
|
||||
return id === recycleCreatePaneId
|
||||
? "/product/recycle-exchanges/create?source=sales-orders"
|
||||
: `/product/sales-orders/${id}`;
|
||||
}
|
||||
});
|
||||
|
||||
const directAction = computed(() => {
|
||||
const [kind, id] = (selectedId.value || "").split(":");
|
||||
return { kind, id: id || "" };
|
||||
});
|
||||
|
||||
/** 子页标识形如 `recycle-rule:698f`,冒号前是类型,后面是参数。 */
|
||||
@@ -257,6 +278,10 @@ async function handleRecyclePaymentSaved(paymentId?: string): Promise<void> {
|
||||
}
|
||||
|
||||
async function handleFulfillmentSaved(fulfillmentId?: string): Promise<void> {
|
||||
if (directAction.value.kind === "fulfillment-create") {
|
||||
openDetail(directAction.value.id);
|
||||
return;
|
||||
}
|
||||
if (fulfillmentId) {
|
||||
paneDirection.value = "forward";
|
||||
subView.value = `fulfillment-detail:${fulfillmentId}`;
|
||||
@@ -730,11 +755,19 @@ function handleRecycleCreated(orderId: string): void {
|
||||
openDetail(orderId);
|
||||
}
|
||||
|
||||
function openOrderAction(item: SalesOrder, view: string): boolean {
|
||||
if (!isWide.value || !item.id) return false;
|
||||
openDetail(`${view}:${item.id}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
async function toPayment(item: SalesOrder): Promise<void> {
|
||||
if (openOrderAction(item, "payment")) return;
|
||||
if (item.id) await router.push(`/product/sales-orders/${item.id}/payment`);
|
||||
}
|
||||
|
||||
async function toCancel(item: SalesOrder): Promise<void> {
|
||||
if (openOrderAction(item, "cancel")) return;
|
||||
if (item.id) await router.push(`/product/sales-orders/${item.id}/cancel`);
|
||||
}
|
||||
|
||||
@@ -747,6 +780,7 @@ async function toNoRefund(item: SalesOrder): Promise<void> {
|
||||
}
|
||||
|
||||
async function toFulfillment(item: SalesOrder): Promise<void> {
|
||||
if (openOrderAction(item, "fulfillment-create")) return;
|
||||
if (item.id) await router.push({ path: "/product/order-fulfillments/create", query: { salesOrderId: item.id } });
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:z-index="20"
|
||||
title="登记收款"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
@left-click="exit"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
@@ -90,6 +90,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { usePane } from "timi-tdesign-mobile";
|
||||
import DateTimeNowPicker from "@/components/DateTimeNowPicker.vue";
|
||||
import { useUserStore, type Attachment } from "timi-web-api";
|
||||
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
||||
@@ -109,6 +110,8 @@ import { uploadPhotoList } from "@/utils/photo";
|
||||
import type { SalesOrder } from "@/types/SalesOrder";
|
||||
|
||||
defineOptions({ name: "SalesOrderPayment" });
|
||||
const props = withDefaults(defineProps<{ orderId?: string; embedded?: boolean }>(), { orderId: "", embedded: false });
|
||||
const pane = usePane();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
@@ -125,6 +128,14 @@ const canDirectVerify = computed(() => userStore.hasRoles(gaoRoleCodes.storeMana
|
||||
&& userStore.hasPermissions(permissionCodes.fundReceive.create)
|
||||
&& userStore.hasPermissions(permissionCodes.fundReceive.verify));
|
||||
|
||||
function exit(): void {
|
||||
if (props.embedded && pane) {
|
||||
pane.close();
|
||||
return;
|
||||
}
|
||||
router.back();
|
||||
}
|
||||
|
||||
function fillUnpaidAmount(): void {
|
||||
amountText.value = formatPackageAmountInput(order.value?.unpaidAmount);
|
||||
}
|
||||
@@ -143,7 +154,7 @@ function buildAttachments(): Partial<Attachment>[] {
|
||||
}
|
||||
|
||||
async function loadData(): Promise<void> {
|
||||
const id = String(route.params.id || "");
|
||||
const id = props.orderId || String(route.params.id || "");
|
||||
if (!id) return;
|
||||
loading.value = true;
|
||||
try {
|
||||
@@ -187,6 +198,10 @@ async function save(): Promise<void> {
|
||||
: await SalesOrderAPI.receivePayment(request);
|
||||
emitListDataChanged(listDataEventKeys.salesOrderChanged, order.value.id);
|
||||
Message.success(directVerify.value ? "收款登记并核销成功" : "收款登记已提交");
|
||||
if (props.embedded && pane) {
|
||||
pane.close(true);
|
||||
return;
|
||||
}
|
||||
await router.replace(record.id && userStore.hasPermissions(permissionCodes.fundReceive.create)
|
||||
? `/product/fund-records/${record.id}`
|
||||
: `/product/sales-orders/${order.value.id}`);
|
||||
|
||||
Reference in New Issue
Block a user