add product sku

This commit is contained in:
Timi
2026-09-07 12:59:27 +08:00
parent 9841723177
commit 1d70aebd83
49 changed files with 3700 additions and 756 deletions
+20 -4
View File
@@ -49,6 +49,7 @@
<product-stock-health-table
v-entrance-transition="350"
:list="stockHealthList"
:sku-health-list="skuHealthList"
:loading="isLoading"
/>
</div>
@@ -58,6 +59,7 @@
<script setup lang="ts">
import GaoProductChartAPI from "@/api/GaoProductChartAPI";
import GaoProductSkuChartAPI from "@/api/GaoProductSkuChartAPI";
import ProductFulfillmentRankChart from "@/pages/product/component/ProductFulfillmentRankChart.vue";
import ProductFulfillmentTrendChart from "@/pages/product/component/ProductFulfillmentTrendChart.vue";
import ProductSalesRankChart from "@/pages/product/component/ProductSalesRankChart.vue";
@@ -70,7 +72,8 @@ import type {
GaoProductSalesDailyStatView,
GaoProductSalesRankView,
GaoProductStockHealthView,
GaoProductStockMovementDailyStatView
GaoProductStockMovementDailyStatView,
GaoProductSkuStockHealthView
} from "@/types/GaoChart";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import { useNavBarStore } from "@/store/navBarStore";
@@ -100,6 +103,7 @@ const fulfillmentDailyList = ref<GaoProductFulfillmentDailyStatView[]>([]);
const fulfillmentRankList = ref<GaoProductFulfillmentRankView[]>([]);
const stockMovementList = ref<GaoProductStockMovementDailyStatView[]>([]);
const stockHealthList = ref<GaoProductStockHealthView[]>([]);
const skuHealthList = ref<GaoProductSkuStockHealthView[]>([]);
const isLoading = ref(false);
let requestId = 0;
@@ -111,11 +115,11 @@ const summaryList = computed<SummaryItem[]>(() => [
},
{
label: "直接销量",
value: formatQuantity(sumNumber(salesDailyList.value, item => item.directQuantity))
value: formatQuantity(sumNumber(salesDailyList.value, item => item.directBaseQuantity))
},
{
label: "套餐权益",
value: formatQuantity(sumNumber(salesDailyList.value, item => item.packageQuantity))
value: formatQuantity(sumNumber(salesDailyList.value, item => item.packageBaseQuantity))
},
{
label: "直接销售额",
@@ -123,7 +127,7 @@ const summaryList = computed<SummaryItem[]>(() => [
},
{
label: "低库存产品",
value: `${stockHealthList.value.filter(item => item.lowStock === 1).length} 个`
value: `${stockHealthList.value.filter(item => 0 < (item.lowStockSkuCount || 0)).length} 个`
}
]);
@@ -176,6 +180,17 @@ async function loadCharts(): Promise<void> {
fulfillmentRankList.value = fulfillmentRank || [];
stockMovementList.value = stockMovement || [];
stockHealthList.value = stockHealth || [];
skuHealthList.value = [];
if (stockHealthList.value.some(item => 0 < (item.lowStockSkuCount || 0))) {
try {
const skuHealth = await GaoProductSkuChartAPI.stockHealth({ storeId: storeId.value });
if (currentRequestId === requestId) {
skuHealthList.value = (skuHealth || []).filter(item => item.lowStock === 1);
}
} catch (error) {
Message.warning(getErrorMessage(error, "低库存规格明细加载失败"));
}
}
} catch (error) {
if (currentRequestId === requestId) {
Message.error(getErrorMessage(error, "产品图表加载失败"));
@@ -195,6 +210,7 @@ function clearData(): void {
fulfillmentRankList.value = [];
stockMovementList.value = [];
stockHealthList.value = [];
skuHealthList.value = [];
}
function buildDefaultDateRange(): [string, string] {