add openReservedRecordList
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell v-if="0 < Number(stock.reservedQuantity || 0)" title="查看预占流水" arrow @click="openReservedRecordList" />
|
||||
<t-cell title="查看该产品流水" arrow @click="openRecordList" />
|
||||
</t-cell-group>
|
||||
<card-container
|
||||
@@ -155,6 +156,20 @@ async function openRecordList(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function openReservedRecordList(): Promise<void> {
|
||||
if (product.value?.id) {
|
||||
await router.push({
|
||||
name: "ProductStockRecordList",
|
||||
query: {
|
||||
productId: product.value.id,
|
||||
operationType: "ORDER_RESERVE",
|
||||
activeReservationOnly: "true",
|
||||
transitionDepth: String(getCurrentRouteDepth() + 1)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentRouteDepth(): number {
|
||||
const transitionDepth = Array.isArray(route.query.transitionDepth)
|
||||
? route.query.transitionDepth[0]
|
||||
|
||||
@@ -93,15 +93,20 @@ const loading = ref(false);
|
||||
const isRefreshing = ref(false);
|
||||
const noMore = ref(false);
|
||||
const productId = computed(() => getQueryText("productId"));
|
||||
const operationType = ref<OperationFilter>(getQueryText("operationType") as OperationFilter || "ALL");
|
||||
const activeReservationRequested = getQueryText("activeReservationOnly") === "true";
|
||||
const operationType = ref<OperationFilter>(getQueryText("operationType") as OperationFilter || (activeReservationRequested ? "ORDER_RESERVE" : "ALL"));
|
||||
const direction = ref<DirectionFilter>(getQueryText("direction") as DirectionFilter || "ALL");
|
||||
const keyword = ref(getQueryText("keyword"));
|
||||
const activeReservationOnly = computed(() => activeReservationRequested && operationType.value === "ORDER_RESERVE");
|
||||
let keywordTimer: number | undefined;
|
||||
let requestToken = 0;
|
||||
const emptyText = computed(() => {
|
||||
if (loading.value) {
|
||||
return "正在加载库存流水";
|
||||
}
|
||||
if (activeReservationOnly.value) {
|
||||
return "暂无有效的预占流水";
|
||||
}
|
||||
return keyword.value.trim() || productId.value || operationType.value !== "ALL" || direction.value !== "ALL" ? "未找到匹配的库存流水" : "暂无库存流水";
|
||||
});
|
||||
const loadStateText = computed(() => loading.value ? "正在加载" : noMore.value ? "已经到底了" : "上拉加载更多");
|
||||
@@ -195,6 +200,7 @@ async function loadMore(force = false): Promise<void> {
|
||||
productId: productId.value || undefined,
|
||||
keyword: keyword.value.trim() || undefined,
|
||||
operationType: operationType.value === "ALL" ? undefined : operationType.value,
|
||||
activeReservationOnly: activeReservationOnly.value || undefined,
|
||||
direction: direction.value === "ALL" ? undefined : direction.value,
|
||||
index: pageIndex.value,
|
||||
size: pageSize
|
||||
|
||||
@@ -126,6 +126,7 @@ export type StockRecordPage = {
|
||||
bizType?: StockBizType;
|
||||
bizId?: string;
|
||||
operationType?: StockOperationType;
|
||||
activeReservationOnly?: boolean;
|
||||
direction?: StockRecordDirection;
|
||||
beginAt?: number;
|
||||
endAt?: number;
|
||||
|
||||
Reference in New Issue
Block a user