mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 14:29:19 +08:00
fix: 修复店铺概览和商品概览
This commit is contained in:
@@ -504,7 +504,7 @@ const activeTab = ref('finance');
|
||||
|
||||
function handleShopNavigate(shopId: number) {
|
||||
router.push({
|
||||
path: `/ecom/shop/overview/${shopId}`,
|
||||
path: `/ec/shop/overview/${shopId}`,
|
||||
query: buildOverviewRouteQuery(dateRange.value),
|
||||
});
|
||||
}
|
||||
@@ -512,7 +512,7 @@ function handleShopNavigate(shopId: number) {
|
||||
function handleProductNavigate(productId: number) {
|
||||
const shopId = parseSelectedShopId();
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${productId}`,
|
||||
path: `/ec/product/overview/${productId}`,
|
||||
query: buildOverviewRouteQuery(
|
||||
dateRange.value,
|
||||
shopId != null && Number.isFinite(shopId) && shopId > 0
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
|
||||
import { getWorkbenchPeriodCompareSliceApi } from '#/api/bi/workbench/apis';
|
||||
import type { WorkbenchDTO, WorkbenchVO } from '#/api/bi/workbench/types';
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview/types';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
|
||||
import { normalizeOverviewRangePickerChange } from '#/utils/overview-date-range';
|
||||
import {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { computed } from 'vue';
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
import type { WorkbenchDTO } from '#/api/bi/workbench/types';
|
||||
|
||||
import { message, Segmented } from 'ant-design-vue';
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
|
||||
import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
|
||||
import { formatIntCell, formatNumberCell } from '#/utils/overview-table-cells';
|
||||
|
||||
+6
-9
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { computed } from 'vue';
|
||||
@@ -130,10 +130,7 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
@change="
|
||||
(e) => {
|
||||
if ((e.target as HTMLInputElement).checked) {
|
||||
emit(
|
||||
'update:selectedExportShopIds',
|
||||
shopSummary?.shops?.map((s) => s.shopId) || [],
|
||||
);
|
||||
emit('update:selectedExportShopIds', (shopSummary?.shops?.map((s) => s.shopId) || []).filter((id): id is number => id !== undefined));
|
||||
} else {
|
||||
emit('update:selectedExportShopIds', []);
|
||||
}
|
||||
@@ -281,7 +278,7 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
const newIds = checked
|
||||
? [...selectedExportShopIds, shop.shopId]
|
||||
: selectedExportShopIds.filter((id) => id !== shop.shopId);
|
||||
emit('update:selectedExportShopIds', newIds);
|
||||
emit('update:selectedExportShopIds', newIds.filter((id): id is number => id !== undefined));
|
||||
}
|
||||
"
|
||||
/>
|
||||
@@ -292,7 +289,7 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
>
|
||||
<span
|
||||
class="inline-flex cursor-pointer items-center gap-1 rounded-full bg-blue-50 dark:bg-blue-900/30 px-3 py-1 text-sm font-bold text-blue-600 dark:text-blue-400 transition-colors hover:text-blue-300 hover:underline"
|
||||
@click="emit('navigate', shop.shopId)"
|
||||
@click="emit('navigate', shop.shopId as number)"
|
||||
>
|
||||
{{ shop.shopName }}
|
||||
<JumpIcon class="text-xs" />
|
||||
@@ -321,10 +318,10 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
</td>
|
||||
<!-- 规模 -->
|
||||
<td class="p-6 font-black">
|
||||
{{ formatAmount(shop.salesAmount) }}
|
||||
{{ formatAmount(shop.salesAmount as number) }}
|
||||
</td>
|
||||
<td class="p-6 font-black text-amber-700 dark:text-amber-400">
|
||||
{{ formatAmount(shop.dealAmount) }}
|
||||
{{ formatAmount(shop.dealAmount as number ) }}
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
{{ formatIntCell(shop.orderCount) }}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { WorkbenchDTO, WorkbenchVO } from '#/api/bi/workbench/types';
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
|
||||
import { computed, nextTick, ref } from 'vue';
|
||||
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview';
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
import type { WorkbenchVO } from '#/api/bi/workbench/types';
|
||||
|
||||
function yuanField(v?: number | null): number {
|
||||
@@ -39,7 +39,7 @@ function aggregateShopTotal(
|
||||
const orderCount = sum('orderCount') || 1;
|
||||
const totalPromotionFee = sum('totalPromotionFee');
|
||||
const averageOrderValue = salesAmount / orderCount;
|
||||
const feeRatio = salesAmount ? (totalPromotionFee / salesAmount) * 100 : 0;
|
||||
const feeRatio = salesAmount ? totalPromotionFee / salesAmount : 0;
|
||||
return {
|
||||
shopId: 0,
|
||||
shopName: '合计',
|
||||
@@ -110,7 +110,7 @@ function aggregateCategoryTotal(
|
||||
const orderCount = sum('orderCount') || 1;
|
||||
const totalPromotionFee = sum('totalPromotionFee');
|
||||
const averageOrderValue = salesAmount / orderCount;
|
||||
const feeRatio = salesAmount ? (totalPromotionFee / salesAmount) * 100 : 0;
|
||||
const feeRatio = salesAmount ? totalPromotionFee / salesAmount : 0;
|
||||
return {
|
||||
categoryName: '合计',
|
||||
salesAmount,
|
||||
@@ -174,7 +174,7 @@ function aggregatePlatformTotal(
|
||||
const orderCount = sum('orderCount') || 1;
|
||||
const totalPromotionFee = sum('totalPromotionFee');
|
||||
const averageOrderValue = salesAmount / orderCount;
|
||||
const feeRatio = salesAmount ? (totalPromotionFee / salesAmount) * 100 : 0;
|
||||
const feeRatio = salesAmount ? totalPromotionFee / salesAmount : 0;
|
||||
return {
|
||||
platformCode: '',
|
||||
platformName: '合计',
|
||||
|
||||
@@ -626,7 +626,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
function goToShopDetail(shopId: number) {
|
||||
router.push(`/ecom/shop/overview/${shopId}`);
|
||||
router.push(`/ec/shop/overview/${shopId}`);
|
||||
}
|
||||
|
||||
function openDetail(row: OrderVO.Info) {
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ function open(record: ProductVO.Info) {
|
||||
/** 跳转经营统计 */
|
||||
function goOverview() {
|
||||
if (!product.value) return;
|
||||
router.push(`/ecom/product/overview/${product.value.id}`);
|
||||
router.push(`/ec/product/overview/${product.value.id}`);
|
||||
modalApi.close();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ import dayjs from 'dayjs';
|
||||
import { getCategoryTreeApi } from '#/api/ec/product/category';
|
||||
import { createProductApi, updateProductApi } from '#/api/ec/product';
|
||||
import { uploadFileToOss } from '#/utils/oss-upload';
|
||||
import CategoryFormModal from '#/views/ecommerce/config/category-config/components/CategoryFormModal.vue';
|
||||
import ProductCostSyncToOrdersModal from '#/views/ecommerce/product/components/ProductCostSyncToOrdersModal.vue';
|
||||
import CategoryFormModal from '#/views/ec/product/category/components/CategoryFormModal.vue';
|
||||
import ProductCostSyncToOrdersModal from '#/views/ec/product/components/ProductCostSyncToOrdersModal.vue';
|
||||
|
||||
interface Emits {
|
||||
(e: 'success'): void;
|
||||
|
||||
@@ -287,7 +287,7 @@ function openProductDetail(record: ProductVO.Info) {
|
||||
}
|
||||
|
||||
function goToOverview(record: ProductVO.Info) {
|
||||
router.push(`/ecom/product/overview/${record.id}`);
|
||||
router.push(`/ec/product/overview/${record.id}`);
|
||||
}
|
||||
|
||||
async function handleDelete(record: ProductVO.Info) {
|
||||
|
||||
@@ -36,7 +36,7 @@ const SHOP_PAGE_SIZE = 20;
|
||||
|
||||
/** 当前是否为商品概览路由(keep-alive 下勿用其它页的 params.id 请求商品接口) */
|
||||
const isProductOverviewRoute = () =>
|
||||
/\/ecom\/product\/overview\/[^/]+\/?$/.test(route.path);
|
||||
/\/ec\/product\/overview\/[^/]+\/?$/.test(route.path);
|
||||
|
||||
// 商品ID(从路由参数获取)
|
||||
const productId = computed(() => {
|
||||
@@ -274,7 +274,7 @@ function handleShopChange(nextShopId: number | undefined) {
|
||||
products.value = [];
|
||||
productSearchKeyword.value = '';
|
||||
router.replace({
|
||||
path: `/ecom/product/overview/${productId.value}`,
|
||||
path: `/ec/product/overview/${productId.value}`,
|
||||
query: buildOverviewRouteQuery(
|
||||
dateRange.value,
|
||||
nextShopId != null && nextShopId > 0 ? { shopId: nextShopId } : undefined,
|
||||
@@ -332,7 +332,7 @@ function handleProductChange(nextProductId: number) {
|
||||
if (!nextProductId || nextProductId === productId.value) return;
|
||||
lastRequestKey.value = '';
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${nextProductId}`,
|
||||
path: `/ec/product/overview/${nextProductId}`,
|
||||
query: buildProductOverviewQuery(),
|
||||
});
|
||||
}
|
||||
|
||||
+3
-3
@@ -54,7 +54,7 @@ function goToProductOverview(productId: number) {
|
||||
|
||||
if (dateQ) {
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${productId}`,
|
||||
path: `/ec/product/overview/${productId}`,
|
||||
query: buildOverviewRouteQuery(
|
||||
[dayjs(dateQ.startDate), dayjs(dateQ.endDate)],
|
||||
shopId != null ? { shopId } : undefined,
|
||||
@@ -65,13 +65,13 @@ function goToProductOverview(productId: number) {
|
||||
|
||||
if (shopId != null) {
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${productId}`,
|
||||
path: `/ec/product/overview/${productId}`,
|
||||
query: { shopId: String(shopId) },
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
router.push({ path: `/ecom/product/overview/${productId}` });
|
||||
router.push({ path: `/ec/product/overview/${productId}` });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ let shopSearchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
/** 当前是否为店铺概览路由(keep-alive 下 route.params.id 会随其它标签变化,不可仅凭 id 请求) */
|
||||
const isShopOverviewRoute = () =>
|
||||
/\/ecom\/shop\/overview\/[^/]+\/?$/.test(route.path);
|
||||
/\/ec\/shop\/overview\/[^/]+\/?$/.test(route.path);
|
||||
|
||||
// 店铺ID(从路由参数获取)
|
||||
const shopId = computed(() => {
|
||||
@@ -237,7 +237,7 @@ function handleShopChange(nextShopId: number) {
|
||||
if (!nextShopId || nextShopId === shopId.value) return;
|
||||
lastRequestKey.value = '';
|
||||
router.push({
|
||||
path: `/ecom/shop/overview/${nextShopId}`,
|
||||
path: `/ec/shop/overview/${nextShopId}`,
|
||||
query: buildOverviewRouteQuery(dateRange.value),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user