mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:59:19 +08:00
feat: 统一工作台与概览页筛选器,商品概览支持按店铺过滤
This commit is contained in:
+6
@@ -35,6 +35,12 @@ public class ProductOverviewQueryDTO {
|
||||
@NotNull(message = "结束日期不能为空")
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 店铺ID(可选;传入时仅统计该店铺下该商品的订单与推广费分摊)
|
||||
*/
|
||||
@Schema(description = "店铺ID(可选)", example = "1")
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 税率(默认0.04)
|
||||
*/
|
||||
|
||||
+51
-27
@@ -16,8 +16,10 @@ import top.xyquan.ecomdmbbackend.modules.ecom.product.overview.service.ProductOv
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.product.service.ProductService;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.mapper.PromotionFeeMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.model.po.PromotionFeePO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.shop.model.po.ShopPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.shop.monthlytarget.mapper.ShopMonthlyTargetMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.shop.monthlytarget.model.po.ShopMonthlyTargetPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -41,6 +43,7 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
private final ProductService productService;
|
||||
private final ProductSpecMapper productSpecMapper;
|
||||
private final ShopMonthlyTargetMapper shopMonthlyTargetMapper;
|
||||
private final ShopService shopService;
|
||||
|
||||
public ProductOverviewServiceImpl(CurrentUserContext currentUserContext,
|
||||
OrderMapper orderMapper,
|
||||
@@ -48,7 +51,8 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
OrderStatusStatResolver orderStatusStatResolver,
|
||||
ProductService productService,
|
||||
ProductSpecMapper productSpecMapper,
|
||||
ShopMonthlyTargetMapper shopMonthlyTargetMapper) {
|
||||
ShopMonthlyTargetMapper shopMonthlyTargetMapper,
|
||||
ShopService shopService) {
|
||||
this.currentUserContext = currentUserContext;
|
||||
this.orderMapper = orderMapper;
|
||||
this.promotionFeeMapper = promotionFeeMapper;
|
||||
@@ -56,6 +60,29 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
this.productService = productService;
|
||||
this.productSpecMapper = productSpecMapper;
|
||||
this.shopMonthlyTargetMapper = shopMonthlyTargetMapper;
|
||||
this.shopService = shopService;
|
||||
}
|
||||
|
||||
private void applyProductOverviewOrderScope(LambdaQueryWrapper<OrderPO> wrapper,
|
||||
Long companyId,
|
||||
Long productId,
|
||||
Long shopId,
|
||||
LocalDateTime startDateTime,
|
||||
LocalDateTime endDateTime,
|
||||
List<Long> unionStatusIds) {
|
||||
wrapper.eq(OrderPO::getCompanyId, companyId)
|
||||
.apply("EXISTS (SELECT 1 FROM ec_product_spec s WHERE s.id = ec_order.product_spec_id AND s.product_id = {0})",
|
||||
productId)
|
||||
.ge(OrderPO::getOrderTime, startDateTime)
|
||||
.le(OrderPO::getOrderTime, endDateTime);
|
||||
if (shopId != null) {
|
||||
wrapper.eq(OrderPO::getShopId, shopId);
|
||||
}
|
||||
if (!unionStatusIds.isEmpty()) {
|
||||
wrapper.in(OrderPO::getStatusId, unionStatusIds);
|
||||
} else {
|
||||
wrapper.isNull(OrderPO::getId);
|
||||
}
|
||||
}
|
||||
|
||||
/** 税额 = max(0, 销售额 − 退款) × 税率,保留两位小数。 */
|
||||
@@ -85,6 +112,14 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
throw new BusinessException("开始日期不能晚于结束日期");
|
||||
}
|
||||
|
||||
Long filterShopId = queryDTO.getShopId();
|
||||
if (filterShopId != null) {
|
||||
ShopPO shop = shopService.getById(filterShopId);
|
||||
if (shop == null || !shop.getCompanyId().equals(companyId)) {
|
||||
throw new BusinessException("店铺不存在");
|
||||
}
|
||||
}
|
||||
|
||||
LocalDate startDate = queryDTO.getStartDate();
|
||||
LocalDate endDate = queryDTO.getEndDate();
|
||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||
@@ -100,24 +135,21 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
|
||||
// 查询订单数据
|
||||
LambdaQueryWrapper<OrderPO> orderWrapper = new LambdaQueryWrapper<>();
|
||||
orderWrapper.eq(OrderPO::getCompanyId, companyId)
|
||||
.apply("EXISTS (SELECT 1 FROM ec_product_spec s WHERE s.id = ec_order.product_spec_id AND s.product_id = {0})",
|
||||
queryDTO.getProductId())
|
||||
.ge(OrderPO::getOrderTime, startDateTime)
|
||||
.le(OrderPO::getOrderTime, endDateTime);
|
||||
if (!unionStatusIds.isEmpty()) {
|
||||
orderWrapper.in(OrderPO::getStatusId, unionStatusIds);
|
||||
} else {
|
||||
orderWrapper.isNull(OrderPO::getId);
|
||||
}
|
||||
applyProductOverviewOrderScope(orderWrapper, companyId, queryDTO.getProductId(), filterShopId,
|
||||
startDateTime, endDateTime, unionStatusIds);
|
||||
List<OrderPO> orders = orderMapper.selectList(orderWrapper);
|
||||
|
||||
// 收集店铺ID列表
|
||||
List<Long> shopIds = orders.stream()
|
||||
.map(OrderPO::getShopId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 推广费/达成率所用店铺:指定店铺时固定该店,否则取订单涉及店铺
|
||||
List<Long> shopIds;
|
||||
if (filterShopId != null) {
|
||||
shopIds = List.of(filterShopId);
|
||||
} else {
|
||||
shopIds = orders.stream()
|
||||
.map(OrderPO::getShopId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 查询推广费(相关店铺 + 日期)
|
||||
List<PromotionFeePO> promotionFees = new ArrayList<>();
|
||||
@@ -154,16 +186,8 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
LocalDateTime lastEndTime = lastEndDate.atTime(23, 59, 59);
|
||||
|
||||
LambdaQueryWrapper<OrderPO> lastPeriodWrapper = new LambdaQueryWrapper<>();
|
||||
lastPeriodWrapper.eq(OrderPO::getCompanyId, companyId)
|
||||
.apply("EXISTS (SELECT 1 FROM ec_product_spec s WHERE s.id = ec_order.product_spec_id AND s.product_id = {0})",
|
||||
queryDTO.getProductId())
|
||||
.ge(OrderPO::getOrderTime, lastStartTime)
|
||||
.le(OrderPO::getOrderTime, lastEndTime);
|
||||
if (!unionStatusIds.isEmpty()) {
|
||||
lastPeriodWrapper.in(OrderPO::getStatusId, unionStatusIds);
|
||||
} else {
|
||||
lastPeriodWrapper.isNull(OrderPO::getId);
|
||||
}
|
||||
applyProductOverviewOrderScope(lastPeriodWrapper, companyId, queryDTO.getProductId(), filterShopId,
|
||||
lastStartTime, lastEndTime, unionStatusIds);
|
||||
List<OrderPO> lastPeriodOrders = orderMapper.selectList(lastPeriodWrapper);
|
||||
|
||||
// ========== 构建返回对象 ==========
|
||||
|
||||
@@ -3,6 +3,8 @@ export namespace ProductOverviewDTO {
|
||||
export interface Query {
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 店铺ID(可选;仅统计该店铺下该商品的数据) */
|
||||
shopId?: number;
|
||||
/** 开始日期 */
|
||||
startDate: string;
|
||||
/** 结束日期 */
|
||||
|
||||
@@ -45,16 +45,37 @@ export function normalizeOverviewRangePickerChange(
|
||||
|
||||
const START_Q = 'startDate';
|
||||
const END_Q = 'endDate';
|
||||
const SHOP_Q = 'shopId';
|
||||
|
||||
/** 概览页跳转(店铺/商品)时附带的 query,与全店概览一致 */
|
||||
export function buildOverviewRouteQuery(dateRange: [Dayjs, Dayjs]): {
|
||||
export type OverviewRouteQuery = {
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
} {
|
||||
return {
|
||||
shopId?: string;
|
||||
};
|
||||
|
||||
/** 概览页跳转(店铺/商品)时附带的 query,与全店概览一致 */
|
||||
export function buildOverviewRouteQuery(
|
||||
dateRange: [Dayjs, Dayjs],
|
||||
options?: { shopId?: number },
|
||||
): OverviewRouteQuery {
|
||||
const query: OverviewRouteQuery = {
|
||||
startDate: dateRange[0].format('YYYY-MM-DD'),
|
||||
endDate: dateRange[1].format('YYYY-MM-DD'),
|
||||
};
|
||||
if (options?.shopId != null && options.shopId > 0) {
|
||||
query.shopId = String(options.shopId);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
/** 从路由 query 解析工作台/概览带入的店铺 ID */
|
||||
export function parseOverviewShopIdFromQuery(
|
||||
query: Record<string, unknown>,
|
||||
): number | undefined {
|
||||
const raw = query[SHOP_Q];
|
||||
const s = Array.isArray(raw) ? raw[0] : raw;
|
||||
const id = Number(s);
|
||||
return Number.isFinite(id) && id > 0 ? id : undefined;
|
||||
}
|
||||
|
||||
/** 从当前地址栏读取概览日期 query(含 replaceState 写入、未反映到 Vue Router 的情况) */
|
||||
|
||||
@@ -8,10 +8,10 @@ import { createIconifyIcon } from '@vben/icons';
|
||||
import { Button, DatePicker, InputNumber, message, Select, Spin, Tabs } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getActivePlatformsApi } from '#/api/ecommerce/platform/apis';
|
||||
import { getPlatformPageApi } from '#/api/ecommerce/platform/apis';
|
||||
import type { PlatformVO } from '#/api/ecommerce/platform/types';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop/apis';
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import type { ShopDTO, ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import { getWorkbenchSummaryApi } from '#/api/ecommerce/workbench/apis';
|
||||
import type { WorkbenchDTO, WorkbenchVO } from '#/api/ecommerce/workbench/types';
|
||||
import { $t } from '#/locales';
|
||||
@@ -142,42 +142,198 @@ const parseTaxRate = (value: string | undefined) => {
|
||||
return Number.isFinite(num) ? Math.round((num / 100) * 1e12) / 1e12 : 0;
|
||||
};
|
||||
|
||||
const FILTER_PAGE_SIZE = 20;
|
||||
|
||||
const platforms = ref<PlatformVO.Info[]>([]);
|
||||
const platformLoading = ref(false);
|
||||
const platformPage = ref(1);
|
||||
const platformTotal = ref(0);
|
||||
const platformSearchKeyword = ref('');
|
||||
const selectedPlatformLabelCache = ref('');
|
||||
|
||||
const shops = ref<ShopVO.Info[]>([]);
|
||||
const metaLoaded = ref(false);
|
||||
const shopLoading = ref(false);
|
||||
const shopPage = ref(1);
|
||||
const shopTotal = ref(0);
|
||||
const shopSearchKeyword = ref('');
|
||||
const selectedShopLabelCache = ref('');
|
||||
|
||||
const selectedPlatformSlug = ref<string>('all');
|
||||
const selectedShopSlug = ref<string>('all');
|
||||
/** 筛选元数据按需加载,不阻塞首屏 summary */
|
||||
const metaLoaded = ref(true);
|
||||
|
||||
const filteredShops = computed(() => {
|
||||
if (selectedPlatformSlug.value === 'all') {
|
||||
return shops.value;
|
||||
}
|
||||
const pid = Number(selectedPlatformSlug.value);
|
||||
return shops.value.filter((s) => s.platformId === pid);
|
||||
});
|
||||
/** 未选择时表示「全部」 */
|
||||
const selectedPlatformSlug = ref<string | undefined>(undefined);
|
||||
const selectedShopSlug = ref<string | undefined>(undefined);
|
||||
|
||||
watch(filteredShops, (list) => {
|
||||
if (selectedShopSlug.value === 'all') return;
|
||||
const ok = list.some((s) => String(s.id) === selectedShopSlug.value);
|
||||
if (!ok) selectedShopSlug.value = 'all';
|
||||
});
|
||||
let platformSearchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
let shopSearchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const platformSelectOptions = computed(() => [
|
||||
{ label: '全平台', value: 'all' },
|
||||
...platforms.value.map((p) => ({
|
||||
function parseSelectedPlatformId(): number | undefined {
|
||||
const slug = selectedPlatformSlug.value;
|
||||
if (!slug) return undefined;
|
||||
const id = Number(slug);
|
||||
return Number.isFinite(id) && id > 0 ? id : undefined;
|
||||
}
|
||||
|
||||
function parseSelectedShopId(): number | undefined {
|
||||
const slug = selectedShopSlug.value;
|
||||
if (!slug) return undefined;
|
||||
const id = Number(slug);
|
||||
return Number.isFinite(id) && id > 0 ? id : undefined;
|
||||
}
|
||||
|
||||
const platformSelectOptions = computed(() => {
|
||||
const opts = platforms.value.map((p) => ({
|
||||
label: p.platformName,
|
||||
value: String(p.id),
|
||||
})),
|
||||
]);
|
||||
}));
|
||||
const slug = selectedPlatformSlug.value;
|
||||
if (slug && !opts.some((o) => o.value === slug)) {
|
||||
opts.unshift({
|
||||
label: selectedPlatformLabelCache.value || `平台 #${slug}`,
|
||||
value: slug,
|
||||
});
|
||||
}
|
||||
return opts;
|
||||
});
|
||||
|
||||
const shopSelectOptions = computed(() => [
|
||||
{ label: '全部门店', value: 'all' },
|
||||
...filteredShops.value.map((s) => ({
|
||||
const shopSelectOptions = computed(() => {
|
||||
const opts = shops.value.map((s) => ({
|
||||
label: s.name,
|
||||
value: String(s.id),
|
||||
})),
|
||||
]);
|
||||
}));
|
||||
const slug = selectedShopSlug.value;
|
||||
if (slug && !opts.some((o) => o.value === slug)) {
|
||||
opts.unshift({
|
||||
label: selectedShopLabelCache.value || `店铺 #${slug}`,
|
||||
value: slug,
|
||||
});
|
||||
}
|
||||
return opts;
|
||||
});
|
||||
|
||||
watch(selectedPlatformSlug, (slug) => {
|
||||
if (!slug) {
|
||||
selectedPlatformLabelCache.value = '';
|
||||
} else {
|
||||
const hit = platforms.value.find((p) => String(p.id) === slug);
|
||||
if (hit) selectedPlatformLabelCache.value = hit.platformName;
|
||||
}
|
||||
selectedShopSlug.value = undefined;
|
||||
selectedShopLabelCache.value = '';
|
||||
shops.value = [];
|
||||
shopSearchKeyword.value = '';
|
||||
});
|
||||
|
||||
watch(selectedShopSlug, (slug) => {
|
||||
if (!slug) {
|
||||
selectedShopLabelCache.value = '';
|
||||
return;
|
||||
}
|
||||
const hit = shops.value.find((s) => String(s.id) === slug);
|
||||
if (hit) selectedShopLabelCache.value = hit.name;
|
||||
});
|
||||
|
||||
async function fetchPlatformList(page = 1, append = false) {
|
||||
if (platformLoading.value) return;
|
||||
platformLoading.value = true;
|
||||
try {
|
||||
const keyword = platformSearchKeyword.value.trim();
|
||||
const data = await getPlatformPageApi({
|
||||
page,
|
||||
pageSize: FILTER_PAGE_SIZE,
|
||||
filters: {
|
||||
...(keyword ? { platformName: keyword } : {}),
|
||||
isActive: 1,
|
||||
},
|
||||
});
|
||||
const records = data.records ?? [];
|
||||
platforms.value = append ? [...platforms.value, ...records] : records;
|
||||
platformTotal.value = data.total ?? 0;
|
||||
platformPage.value = page;
|
||||
} catch {
|
||||
message.error('平台列表加载失败');
|
||||
} finally {
|
||||
platformLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchShopList(page = 1, append = false) {
|
||||
if (shopLoading.value) return;
|
||||
shopLoading.value = true;
|
||||
try {
|
||||
const keyword = shopSearchKeyword.value.trim();
|
||||
const filters: ShopDTO.Filters = {};
|
||||
if (keyword) filters.name = keyword;
|
||||
const platformId = parseSelectedPlatformId();
|
||||
if (platformId != null) {
|
||||
filters.platformId = platformId;
|
||||
}
|
||||
const data = await getShopPageApi({
|
||||
page,
|
||||
pageSize: FILTER_PAGE_SIZE,
|
||||
filters,
|
||||
});
|
||||
const records = data.records ?? [];
|
||||
shops.value = append ? [...shops.value, ...records] : records;
|
||||
shopTotal.value = data.total ?? 0;
|
||||
shopPage.value = page;
|
||||
} catch {
|
||||
message.error('店铺列表加载失败');
|
||||
} finally {
|
||||
shopLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlatformSearch(keyword: string) {
|
||||
if (platformSearchTimer) clearTimeout(platformSearchTimer);
|
||||
platformSearchTimer = setTimeout(() => {
|
||||
platformSearchKeyword.value = keyword;
|
||||
void fetchPlatformList(1, false);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handleShopSearch(keyword: string) {
|
||||
if (shopSearchTimer) clearTimeout(shopSearchTimer);
|
||||
shopSearchTimer = setTimeout(() => {
|
||||
shopSearchKeyword.value = keyword;
|
||||
void fetchShopList(1, false);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handlePlatformPopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
if (scrollHeight - scrollTop - clientHeight < 50) {
|
||||
const hasMore = platformPage.value * FILTER_PAGE_SIZE < platformTotal.value;
|
||||
if (hasMore && !platformLoading.value) {
|
||||
void fetchPlatformList(platformPage.value + 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleShopPopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
if (scrollHeight - scrollTop - clientHeight < 50) {
|
||||
const hasMore = shopPage.value * FILTER_PAGE_SIZE < shopTotal.value;
|
||||
if (hasMore && !shopLoading.value) {
|
||||
void fetchShopList(shopPage.value + 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlatformDropdownVisibleChange(open: boolean) {
|
||||
if (!open) return;
|
||||
platformSearchKeyword.value = '';
|
||||
void fetchPlatformList(1, false);
|
||||
}
|
||||
|
||||
function handleShopDropdownVisibleChange(open: boolean) {
|
||||
if (!open) return;
|
||||
shopSearchKeyword.value = '';
|
||||
void fetchShopList(1, false);
|
||||
}
|
||||
|
||||
const workbenchData = ref<WorkbenchVO.Info | null>(null);
|
||||
const workbenchLoading = ref(false);
|
||||
@@ -202,12 +358,10 @@ const workbenchExportContext = computed<WorkbenchDTO.ExportPayload>(() => ({
|
||||
dateRange.value[1].format('YYYY-MM-DD'),
|
||||
],
|
||||
taxRate: taxRate.value,
|
||||
...(selectedPlatformSlug.value !== 'all'
|
||||
? { platformId: Number(selectedPlatformSlug.value) }
|
||||
: {}),
|
||||
...(selectedShopSlug.value !== 'all'
|
||||
? { shopId: Number(selectedShopSlug.value) }
|
||||
...(parseSelectedPlatformId() != null
|
||||
? { platformId: parseSelectedPlatformId()! }
|
||||
: {}),
|
||||
...(parseSelectedShopId() != null ? { shopId: parseSelectedShopId()! } : {}),
|
||||
}));
|
||||
|
||||
async function fetchWorkbenchSummary() {
|
||||
@@ -221,11 +375,13 @@ async function fetchWorkbenchSummary() {
|
||||
],
|
||||
taxRate: taxRate.value,
|
||||
};
|
||||
if (selectedPlatformSlug.value !== 'all') {
|
||||
query.platformId = Number(selectedPlatformSlug.value);
|
||||
const platformId = parseSelectedPlatformId();
|
||||
if (platformId != null) {
|
||||
query.platformId = platformId;
|
||||
}
|
||||
if (selectedShopSlug.value !== 'all') {
|
||||
query.shopId = Number(selectedShopSlug.value);
|
||||
const shopId = parseSelectedShopId();
|
||||
if (shopId != null) {
|
||||
query.shopId = shopId;
|
||||
}
|
||||
workbenchData.value = await getWorkbenchSummaryApi(query);
|
||||
} catch (e: unknown) {
|
||||
@@ -239,20 +395,6 @@ async function fetchWorkbenchSummary() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadShopAndPlatformMeta() {
|
||||
try {
|
||||
const [platList, shopRes] = await Promise.all([
|
||||
getActivePlatformsApi(),
|
||||
getShopPageApi({ page: 1, pageSize: 500, filters: {} }),
|
||||
]);
|
||||
platforms.value = platList ?? [];
|
||||
shops.value = shopRes?.records ?? [];
|
||||
} catch {
|
||||
message.error('店铺或平台列表加载失败');
|
||||
}
|
||||
metaLoaded.value = true;
|
||||
}
|
||||
|
||||
const activeTab = ref('finance');
|
||||
|
||||
function handleShopNavigate(shopId: number) {
|
||||
@@ -263,9 +405,15 @@ function handleShopNavigate(shopId: number) {
|
||||
}
|
||||
|
||||
function handleProductNavigate(productId: number) {
|
||||
const shopId = parseSelectedShopId();
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${productId}`,
|
||||
query: buildOverviewRouteQuery(dateRange.value),
|
||||
query: buildOverviewRouteQuery(
|
||||
dateRange.value,
|
||||
shopId != null && Number.isFinite(shopId) && shopId > 0
|
||||
? { shopId }
|
||||
: undefined,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -323,7 +471,6 @@ watch(
|
||||
let darkObserver: MutationObserver | null = null;
|
||||
|
||||
onMounted(async () => {
|
||||
await loadShopAndPlatformMeta();
|
||||
await fetchWorkbenchSummary();
|
||||
setTimeout(() => {
|
||||
void redrawActiveTabCharts();
|
||||
@@ -338,6 +485,8 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (platformSearchTimer) clearTimeout(platformSearchTimer);
|
||||
if (shopSearchTimer) clearTimeout(shopSearchTimer);
|
||||
darkObserver?.disconnect();
|
||||
darkObserver = null;
|
||||
});
|
||||
@@ -403,7 +552,7 @@ onUnmounted(() => {
|
||||
class="workbench-filter-platform-shop w-full min-w-0 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:w-auto sm:max-w-[min(calc(100vw-2.5rem),56rem)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 flex-col gap-2 rounded-xl bg-white/30 p-1 sm:flex-row sm:items-stretch sm:gap-0 sm:divide-x sm:divide-slate-300/50 dark:bg-[hsl(240deg_3.7%_22%/30%)] dark:sm:divide-[hsl(240deg_3.7%_35%)]"
|
||||
class="flex min-w-0 flex-col gap-2 rounded-xl bg-white/30 p-1 sm:flex-row sm:items-center sm:gap-0 sm:divide-x sm:divide-slate-300/50 dark:bg-[hsl(240deg_3.7%_22%/30%)] dark:sm:divide-[hsl(240deg_3.7%_35%)]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 items-center gap-2 px-2 py-0.5 sm:w-[11.5rem] sm:flex-none sm:shrink-0 sm:py-0"
|
||||
@@ -416,10 +565,27 @@ onUnmounted(() => {
|
||||
<Select
|
||||
v-model:value="selectedPlatformSlug"
|
||||
size="small"
|
||||
show-search
|
||||
allow-clear
|
||||
:filter-option="false"
|
||||
:loading="platformLoading"
|
||||
:options="platformSelectOptions"
|
||||
placeholder="选择平台"
|
||||
placeholder="全部平台"
|
||||
class="workbench-header-select min-w-0 flex-1"
|
||||
/>
|
||||
@search="handlePlatformSearch"
|
||||
@popup-scroll="handlePlatformPopupScroll"
|
||||
@dropdown-visible-change="handlePlatformDropdownVisibleChange"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="platformLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无平台
|
||||
</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
<div
|
||||
class="flex min-w-0 flex-1 items-center gap-2 border-t border-slate-200/80 px-2 pt-2 sm:min-w-[16rem] sm:border-t-0 sm:py-0 sm:pt-0 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
@@ -432,11 +598,28 @@ onUnmounted(() => {
|
||||
<Select
|
||||
v-model:value="selectedShopSlug"
|
||||
size="small"
|
||||
show-search
|
||||
allow-clear
|
||||
:filter-option="false"
|
||||
:loading="shopLoading"
|
||||
:options="shopSelectOptions"
|
||||
placeholder="选择店铺"
|
||||
placeholder="全部店铺"
|
||||
:dropdown-match-select-width="false"
|
||||
class="workbench-header-select workbench-shop-select min-w-0 flex-1"
|
||||
/>
|
||||
@search="handleShopSearch"
|
||||
@popup-scroll="handleShopPopupScroll"
|
||||
@dropdown-visible-change="handleShopDropdownVisibleChange"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="shopLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无店铺
|
||||
</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -566,16 +749,8 @@ onUnmounted(() => {
|
||||
ref="periodCompareTabRef"
|
||||
:active-tab="activeTab"
|
||||
:tax-rate="taxRate"
|
||||
:platform-id="
|
||||
selectedPlatformSlug !== 'all'
|
||||
? Number(selectedPlatformSlug)
|
||||
: undefined
|
||||
"
|
||||
:shop-id="
|
||||
selectedShopSlug !== 'all'
|
||||
? Number(selectedShopSlug)
|
||||
: undefined
|
||||
"
|
||||
:platform-id="parseSelectedPlatformId()"
|
||||
:shop-id="parseSelectedShopId()"
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
@@ -645,6 +820,7 @@ onUnmounted(() => {
|
||||
min-height: 2.125rem !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
padding-inline: 10px 28px !important;
|
||||
background-color: rgb(255 255 255 / 0.92) !important;
|
||||
}
|
||||
|
||||
@@ -662,7 +838,37 @@ onUnmounted(() => {
|
||||
color: rgb(15 23 42) !important;
|
||||
}
|
||||
|
||||
/* 搜索态:输入框与光标垂直居中(平台/店铺共用) */
|
||||
:deep(.workbench-header-select .ant-select-selection-wrap) {
|
||||
position: relative !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
flex: 1 1 auto !important;
|
||||
min-width: 0 !important;
|
||||
min-height: 1.25rem;
|
||||
align-self: center !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-select .ant-select-selection-search) {
|
||||
position: absolute !important;
|
||||
inset-inline-start: 10px !important;
|
||||
inset-inline-end: 28px !important;
|
||||
top: 50% !important;
|
||||
bottom: auto !important;
|
||||
transform: translateY(-50%) !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
height: 1.25rem !important;
|
||||
margin-inline-start: 0 !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-select .ant-select-selection-search-input) {
|
||||
height: 1.25rem !important;
|
||||
line-height: 1.25rem !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
/* 店铺:在通用样式之后覆盖,选中项可换行以显示完整店名 */
|
||||
:deep(.workbench-header-select.workbench-shop-select.ant-select) {
|
||||
@@ -674,9 +880,15 @@ onUnmounted(() => {
|
||||
) {
|
||||
height: auto !important;
|
||||
min-height: 2.125rem !important;
|
||||
align-items: flex-start !important;
|
||||
padding-top: 6px !important;
|
||||
padding-bottom: 6px !important;
|
||||
align-items: center !important;
|
||||
padding-block: 6px !important;
|
||||
padding-inline: 10px 28px !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-select.workbench-shop-select .ant-select-arrow) {
|
||||
top: 50% !important;
|
||||
margin-top: 0 !important;
|
||||
transform: translateY(-50%) !important;
|
||||
}
|
||||
|
||||
:deep(
|
||||
@@ -694,6 +906,7 @@ onUnmounted(() => {
|
||||
overflow: visible !important;
|
||||
text-overflow: clip !important;
|
||||
line-height: 1.35 !important;
|
||||
align-self: center !important;
|
||||
}
|
||||
|
||||
:deep(.tax-rate-input .ant-input-number-input) {
|
||||
|
||||
+137
-4
@@ -1,10 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
import { Button, DatePicker, InputNumber } from 'ant-design-vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { Button, DatePicker, InputNumber, Select, Spin } from 'ant-design-vue';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { normalizeOverviewRangePickerChange } from '#/utils/overview-date-range';
|
||||
|
||||
interface SelectOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
modelValue: {
|
||||
taxRate: number;
|
||||
@@ -18,15 +25,59 @@ interface Props {
|
||||
customDateRange: [Dayjs, Dayjs] | undefined;
|
||||
dateRange: [Dayjs, Dayjs];
|
||||
};
|
||||
/** 路由 query.shopId,未选店铺时为 undefined */
|
||||
shopId?: number;
|
||||
shopOptions?: SelectOption[];
|
||||
shopListLoading?: boolean;
|
||||
/** 当前商品 ID(与路由 params.id 一致) */
|
||||
productId?: number;
|
||||
productOptions?: SelectOption[];
|
||||
productListLoading?: boolean;
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:modelValue', val: Props['modelValue']): void;
|
||||
(e: 'shop-change', shopId: number | undefined): void;
|
||||
(e: 'shop-search', keyword: string): void;
|
||||
(e: 'shop-popup-scroll', event: Event): void;
|
||||
(e: 'shop-dropdown-visible-change', open: boolean): void;
|
||||
(e: 'product-change', productId: number): void;
|
||||
(e: 'product-search', keyword: string): void;
|
||||
(e: 'product-popup-scroll', event: Event): void;
|
||||
(e: 'product-dropdown-visible-change', open: boolean): void;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
shopOptions: () => [],
|
||||
shopListLoading: false,
|
||||
productOptions: () => [],
|
||||
productListLoading: false,
|
||||
});
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const shopSelectValue = computed(() => {
|
||||
if (props.shopId != null && props.shopId > 0) {
|
||||
return String(props.shopId);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
const handleShopSelectChange = (value: unknown) => {
|
||||
if (value === '' || value == null) {
|
||||
emit('shop-change', undefined);
|
||||
return;
|
||||
}
|
||||
const id = Number(value);
|
||||
if (!Number.isFinite(id) || id <= 0) return;
|
||||
emit('shop-change', id);
|
||||
};
|
||||
|
||||
const handleProductSelectChange = (value: unknown) => {
|
||||
const id = Number(value);
|
||||
if (!Number.isFinite(id) || id <= 0) return;
|
||||
emit('product-change', id);
|
||||
};
|
||||
|
||||
const TAX_RATE_KEY = 'overview-tax-rate';
|
||||
|
||||
const formatTaxRate = (value: null | number | string | undefined) => {
|
||||
@@ -125,13 +176,92 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
size="small"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 dark:!bg-[hsl(240deg_3.7%_22%/30%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)] !text-sm !font-bold !text-center"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 !text-center !text-sm !font-bold dark:!bg-[hsl(240deg_3.7%_22%/30%)]"
|
||||
:formatter="formatTaxRate"
|
||||
:parser="parseTaxRate"
|
||||
@change="handleTaxRateChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 店铺 + 商品(布局/配色与工作台平台+店铺筛选一致) -->
|
||||
<div
|
||||
class="overview-filter-select-group w-full min-w-0 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:w-auto sm:max-w-[min(calc(100vw-2.5rem),56rem)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 flex-col gap-2 rounded-xl bg-white/30 p-1 sm:flex-row sm:items-center sm:gap-0 sm:divide-x sm:divide-slate-300/50 dark:bg-[hsl(240deg_3.7%_22%/30%)] dark:sm:divide-[hsl(240deg_3.7%_35%)]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 items-center gap-2 px-2 py-0.5 sm:w-[11.5rem] sm:flex-none sm:shrink-0 sm:py-0"
|
||||
>
|
||||
<span
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
店铺
|
||||
</span>
|
||||
<Select
|
||||
:value="shopSelectValue"
|
||||
size="small"
|
||||
show-search
|
||||
allow-clear
|
||||
:filter-option="false"
|
||||
:loading="props.shopListLoading"
|
||||
:options="props.shopOptions"
|
||||
placeholder="全部店铺"
|
||||
:dropdown-match-select-width="false"
|
||||
class="overview-header-select overview-shop-select min-w-0 flex-1"
|
||||
@change="handleShopSelectChange"
|
||||
@search="(kw: string) => emit('shop-search', kw)"
|
||||
@popup-scroll="(e: Event) => emit('shop-popup-scroll', e)"
|
||||
@dropdown-visible-change="(open: boolean) => emit('shop-dropdown-visible-change', open)"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="props.shopListLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无店铺
|
||||
</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
<div
|
||||
class="flex min-w-0 flex-1 items-center gap-2 border-t border-slate-200/80 px-2 pt-2 sm:min-w-[16rem] sm:border-t-0 sm:py-0 sm:pt-0 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
>
|
||||
<span
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
商品
|
||||
</span>
|
||||
<Select
|
||||
:value="props.productId != null && props.productId > 0 ? String(props.productId) : undefined"
|
||||
size="small"
|
||||
show-search
|
||||
:filter-option="false"
|
||||
:loading="props.productListLoading"
|
||||
:options="props.productOptions"
|
||||
placeholder="选择商品"
|
||||
:dropdown-match-select-width="false"
|
||||
class="overview-header-select overview-product-select min-w-0 flex-1"
|
||||
@change="handleProductSelectChange"
|
||||
@search="(kw: string) => emit('product-search', kw)"
|
||||
@popup-scroll="(e: Event) => emit('product-popup-scroll', e)"
|
||||
@dropdown-visible-change="(open: boolean) => emit('product-dropdown-visible-change', open)"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="props.productListLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无商品
|
||||
</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间选择器 -->
|
||||
<div
|
||||
class="flex w-full flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto sm:flex-row sm:items-center sm:gap-1.5 sm:p-1"
|
||||
@@ -239,4 +369,7 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
:deep(.ant-picker-input > input) {
|
||||
color: hsl(240deg 5% 64.9%);
|
||||
}
|
||||
</style>
|
||||
|
||||
</style>
|
||||
|
||||
<style src="../../../styles/overview-header-select.css"></style>
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import { computed, onActivated, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { computed, onActivated, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
@@ -14,15 +14,25 @@ import StatCards from './components/StatCards.vue';
|
||||
import SalesTrendChart from './components/SalesTrendChart.vue';
|
||||
import SpecSalesTop10Panel from './components/SpecSalesTop10Panel.vue';
|
||||
import SpecSummaryTable from './components/SpecSummaryTable.vue';
|
||||
import { getProductPageApi } from '#/api/ecommerce/product/apis';
|
||||
import type { ProductVO } from '#/api/ecommerce/product/types';
|
||||
import { getProductOverviewApi } from '#/api/ecommerce/product-overview';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop/apis';
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import {
|
||||
applyOverviewDateRangeFromUrl,
|
||||
buildOverviewRouteQuery,
|
||||
parseOverviewShopIdFromQuery,
|
||||
syncOverviewDateRangeToUrl,
|
||||
} from '#/utils/overview-date-range';
|
||||
|
||||
defineOptions({ name: 'ProductOverview' });
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const PRODUCT_PAGE_SIZE = 20;
|
||||
const SHOP_PAGE_SIZE = 20;
|
||||
|
||||
/** 当前是否为商品概览路由(keep-alive 下勿用其它页的 params.id 请求商品接口) */
|
||||
const isProductOverviewRoute = () =>
|
||||
@@ -36,10 +46,62 @@ const productId = computed(() => {
|
||||
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
||||
});
|
||||
|
||||
/** 路由 query.shopId:工作台筛选店铺跳转时带入 */
|
||||
const contextShopId = computed(() => {
|
||||
if (!isProductOverviewRoute()) return undefined;
|
||||
return parseOverviewShopIdFromQuery(
|
||||
route.query as Record<string, unknown>,
|
||||
);
|
||||
});
|
||||
|
||||
const shops = ref<ShopVO.Info[]>([]);
|
||||
const shopsLoading = ref(false);
|
||||
const shopPage = ref(1);
|
||||
const shopTotal = ref(0);
|
||||
const shopSearchKeyword = ref('');
|
||||
const selectedShopLabelCache = ref('');
|
||||
|
||||
const products = ref<ProductVO.Info[]>([]);
|
||||
const productsLoading = ref(false);
|
||||
const productPage = ref(1);
|
||||
const productTotal = ref(0);
|
||||
const productSearchKeyword = ref('');
|
||||
|
||||
let productSearchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
let shopSearchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const shopSelectOptions = computed(() => {
|
||||
const opts = shops.value.map((s) => ({
|
||||
label: s.name,
|
||||
value: String(s.id),
|
||||
}));
|
||||
const id = contextShopId.value;
|
||||
if (id != null && id > 0 && !opts.some((o) => o.value === String(id))) {
|
||||
opts.unshift({
|
||||
label: selectedShopLabelCache.value || `店铺 #${id}`,
|
||||
value: String(id),
|
||||
});
|
||||
}
|
||||
return opts;
|
||||
});
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const overviewData = ref<any>(null);
|
||||
|
||||
const productSelectOptions = computed(() => {
|
||||
const opts = products.value.map((p) => ({
|
||||
label: p.name,
|
||||
value: String(p.id),
|
||||
}));
|
||||
const id = productId.value;
|
||||
if (id > 0 && !opts.some((o) => o.value === String(id))) {
|
||||
const name = overviewData.value?.productName ?? `商品 #${id}`;
|
||||
return [{ label: name, value: String(id) }, ...opts];
|
||||
}
|
||||
return opts;
|
||||
});
|
||||
|
||||
const normalizeOverview = (raw: any) => {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
return {
|
||||
@@ -148,6 +210,133 @@ const syncDateRangeToRouteQuery = () => {
|
||||
syncOverviewDateRangeToUrl(dateRange.value);
|
||||
};
|
||||
|
||||
function buildProductOverviewQuery() {
|
||||
return buildOverviewRouteQuery(
|
||||
dateRange.value,
|
||||
contextShopId.value != null && contextShopId.value > 0
|
||||
? { shopId: contextShopId.value }
|
||||
: undefined,
|
||||
);
|
||||
}
|
||||
|
||||
async function fetchShopList(page = 1, append = false) {
|
||||
if (shopsLoading.value) return;
|
||||
shopsLoading.value = true;
|
||||
try {
|
||||
const keyword = shopSearchKeyword.value.trim();
|
||||
const data = await getShopPageApi({
|
||||
page,
|
||||
pageSize: SHOP_PAGE_SIZE,
|
||||
filters: keyword ? { name: keyword } : {},
|
||||
});
|
||||
const records = data.records ?? [];
|
||||
shops.value = append ? [...shops.value, ...records] : records;
|
||||
shopTotal.value = data.total ?? 0;
|
||||
shopPage.value = page;
|
||||
const id = contextShopId.value;
|
||||
if (id != null && id > 0) {
|
||||
const hit = shops.value.find((s) => s.id === id);
|
||||
if (hit) selectedShopLabelCache.value = hit.name;
|
||||
}
|
||||
} catch {
|
||||
message.error('店铺列表加载失败');
|
||||
} finally {
|
||||
shopsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleShopSearch(keyword: string) {
|
||||
if (shopSearchTimer) clearTimeout(shopSearchTimer);
|
||||
shopSearchTimer = setTimeout(() => {
|
||||
shopSearchKeyword.value = keyword;
|
||||
void fetchShopList(1, false);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handleShopPopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
if (scrollHeight - scrollTop - clientHeight < 50) {
|
||||
const hasMore = shopPage.value * SHOP_PAGE_SIZE < shopTotal.value;
|
||||
if (hasMore && !shopsLoading.value) {
|
||||
void fetchShopList(shopPage.value + 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleShopDropdownVisibleChange(open: boolean) {
|
||||
if (!open) return;
|
||||
shopSearchKeyword.value = '';
|
||||
void fetchShopList(1, false);
|
||||
}
|
||||
|
||||
function handleShopChange(nextShopId: number | undefined) {
|
||||
products.value = [];
|
||||
productSearchKeyword.value = '';
|
||||
router.replace({
|
||||
path: `/ecom/product/overview/${productId.value}`,
|
||||
query: buildOverviewRouteQuery(
|
||||
dateRange.value,
|
||||
nextShopId != null && nextShopId > 0 ? { shopId: nextShopId } : undefined,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchProductList(page = 1, append = false) {
|
||||
if (productsLoading.value) return;
|
||||
productsLoading.value = true;
|
||||
try {
|
||||
const keyword = productSearchKeyword.value.trim();
|
||||
const data = await getProductPageApi({
|
||||
page,
|
||||
pageSize: PRODUCT_PAGE_SIZE,
|
||||
filters: keyword ? { keywords: keyword } : {},
|
||||
});
|
||||
const records = data.records ?? [];
|
||||
products.value = append ? [...products.value, ...records] : records;
|
||||
productTotal.value = data.total ?? 0;
|
||||
productPage.value = page;
|
||||
} catch {
|
||||
message.error('商品列表加载失败');
|
||||
} finally {
|
||||
productsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleProductSearch(keyword: string) {
|
||||
if (productSearchTimer) clearTimeout(productSearchTimer);
|
||||
productSearchTimer = setTimeout(() => {
|
||||
productSearchKeyword.value = keyword;
|
||||
void fetchProductList(1, false);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handleProductPopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
if (scrollHeight - scrollTop - clientHeight < 50) {
|
||||
const hasMore = productPage.value * PRODUCT_PAGE_SIZE < productTotal.value;
|
||||
if (hasMore && !productsLoading.value) {
|
||||
void fetchProductList(productPage.value + 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleProductDropdownVisibleChange(open: boolean) {
|
||||
if (!open) return;
|
||||
productSearchKeyword.value = '';
|
||||
void fetchProductList(1, false);
|
||||
}
|
||||
|
||||
function handleProductChange(nextProductId: number) {
|
||||
if (!nextProductId || nextProductId === productId.value) return;
|
||||
lastRequestKey.value = '';
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${nextProductId}`,
|
||||
query: buildProductOverviewQuery(),
|
||||
});
|
||||
}
|
||||
|
||||
// 时间范围状态(传递给子组件)
|
||||
const timeRangeState = computed(() => ({
|
||||
taxRate: taxRate.value,
|
||||
@@ -178,6 +367,9 @@ async function loadOverviewData() {
|
||||
startDate: dateRange.value[0].format('YYYY-MM-DD'),
|
||||
endDate: dateRange.value[1].format('YYYY-MM-DD'),
|
||||
taxRate: taxRate.value,
|
||||
...(contextShopId.value != null && contextShopId.value > 0
|
||||
? { shopId: contextShopId.value }
|
||||
: {}),
|
||||
});
|
||||
overviewData.value = normalizeOverview(res);
|
||||
} catch (err: any) {
|
||||
@@ -193,7 +385,7 @@ const refreshOverviewByCurrentParams = async (force = false) => {
|
||||
applyDateRangeFromRouteQuery();
|
||||
if (!productId.value) return;
|
||||
|
||||
const requestKey = `${productId.value}_${dateRange.value[0].format('YYYY-MM-DD')}_${dateRange.value[1].format('YYYY-MM-DD')}`;
|
||||
const requestKey = `${productId.value}_${dateRange.value[0].format('YYYY-MM-DD')}_${dateRange.value[1].format('YYYY-MM-DD')}_${contextShopId.value ?? ''}`;
|
||||
if (!force && lastRequestKey.value === requestKey) {
|
||||
return;
|
||||
}
|
||||
@@ -209,6 +401,7 @@ watch(
|
||||
route.params.id,
|
||||
route.query.startDate,
|
||||
route.query.endDate,
|
||||
route.query.shopId,
|
||||
],
|
||||
async () => {
|
||||
if (!isProductOverviewRoute()) return;
|
||||
@@ -216,8 +409,16 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
watch(contextShopId, () => {
|
||||
products.value = [];
|
||||
lastRequestKey.value = '';
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if (!isProductOverviewRoute()) return;
|
||||
if (contextShopId.value != null && contextShopId.value > 0) {
|
||||
void fetchShopList(1, false);
|
||||
}
|
||||
await refreshOverviewByCurrentParams(true);
|
||||
});
|
||||
|
||||
@@ -226,8 +427,10 @@ onActivated(async () => {
|
||||
await refreshOverviewByCurrentParams(true);
|
||||
});
|
||||
|
||||
// 计算 page title 用 productName
|
||||
const pageTitle = computed(() => overviewData.value?.productName || '商品概览');
|
||||
onUnmounted(() => {
|
||||
if (productSearchTimer) clearTimeout(productSearchTimer);
|
||||
if (shopSearchTimer) clearTimeout(shopSearchTimer);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -240,7 +443,7 @@ const pageTitle = computed(() => overviewData.value?.productName || '商品概
|
||||
<div
|
||||
class="text-xl font-black tracking-tight text-slate-900 dark:text-[hsl(0deg_0%_98%)] sm:text-2xl md:text-3xl"
|
||||
>
|
||||
{{ pageTitle }}
|
||||
商品概览
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -249,7 +452,21 @@ const pageTitle = computed(() => overviewData.value?.productName || '商品概
|
||||
<TimeRangeBar
|
||||
class="w-full"
|
||||
:model-value="timeRangeState"
|
||||
:shop-id="contextShopId"
|
||||
:shop-options="shopSelectOptions"
|
||||
:shop-list-loading="shopsLoading"
|
||||
:product-id="productId"
|
||||
:product-options="productSelectOptions"
|
||||
:product-list-loading="productsLoading"
|
||||
@update:model-value="handleTimeRangeChange"
|
||||
@shop-change="handleShopChange"
|
||||
@shop-search="handleShopSearch"
|
||||
@shop-popup-scroll="handleShopPopupScroll"
|
||||
@shop-dropdown-visible-change="handleShopDropdownVisibleChange"
|
||||
@product-change="handleProductChange"
|
||||
@product-search="handleProductSearch"
|
||||
@product-popup-scroll="handleProductPopupScroll"
|
||||
@product-dropdown-visible-change="handleProductDropdownVisibleChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
+35
-8
@@ -1,11 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getOverviewDateQueryFromLocation } from '#/utils/overview-date-range';
|
||||
import {
|
||||
buildOverviewRouteQuery,
|
||||
getOverviewDateQueryFromLocation,
|
||||
} from '#/utils/overview-date-range';
|
||||
import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
|
||||
import { formatIntCell, formatNumberCell } from '#/utils/overview-table-cells';
|
||||
import {
|
||||
@@ -33,18 +37,41 @@ interface Emits {
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const emit = defineEmits<Emits>();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const cellMoneyApi = (v: number | null | undefined) =>
|
||||
formatNumberCell(v, formatCurrencyZhFromApi);
|
||||
|
||||
function currentShopIdFromRoute(): number | undefined {
|
||||
const id = Number(route.params.id);
|
||||
return Number.isFinite(id) && id > 0 ? id : undefined;
|
||||
}
|
||||
|
||||
function goToProductOverview(productId: number) {
|
||||
const q = getOverviewDateQueryFromLocation();
|
||||
router.push(
|
||||
q
|
||||
? { path: `/ecom/product/overview/${productId}`, query: q }
|
||||
: { path: `/ecom/product/overview/${productId}` },
|
||||
);
|
||||
const dateQ = getOverviewDateQueryFromLocation();
|
||||
const shopId = currentShopIdFromRoute();
|
||||
|
||||
if (dateQ) {
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${productId}`,
|
||||
query: buildOverviewRouteQuery(
|
||||
[dayjs(dateQ.startDate), dayjs(dateQ.endDate)],
|
||||
shopId != null ? { shopId } : undefined,
|
||||
),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (shopId != null) {
|
||||
router.push({
|
||||
path: `/ecom/product/overview/${productId}`,
|
||||
query: { shopId: String(shopId) },
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
router.push({ path: `/ecom/product/overview/${productId}` });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
+68
-3
@@ -1,10 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import { Button, DatePicker, InputNumber } from 'ant-design-vue';
|
||||
import { Button, DatePicker, InputNumber, Select, Spin } from 'ant-design-vue';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { normalizeOverviewRangePickerChange } from '#/utils/overview-date-range';
|
||||
|
||||
interface ShopSelectOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
modelValue: {
|
||||
taxRate: number;
|
||||
@@ -18,15 +23,32 @@ interface Props {
|
||||
customDateRange: [Dayjs, Dayjs] | undefined;
|
||||
dateRange: [Dayjs, Dayjs];
|
||||
};
|
||||
/** 当前店铺 ID(与路由 params.id 一致) */
|
||||
shopId?: number;
|
||||
shopOptions?: ShopSelectOption[];
|
||||
shopListLoading?: boolean;
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:modelValue', val: Props['modelValue']): void;
|
||||
(e: 'shop-change', shopId: number): void;
|
||||
(e: 'shop-search', keyword: string): void;
|
||||
(e: 'shop-popup-scroll', event: Event): void;
|
||||
(e: 'shop-dropdown-visible-change', open: boolean): void;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
shopOptions: () => [],
|
||||
shopListLoading: false,
|
||||
});
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const handleShopSelectChange = (value: unknown) => {
|
||||
const id = Number(value);
|
||||
if (!Number.isFinite(id) || id <= 0) return;
|
||||
emit('shop-change', id);
|
||||
};
|
||||
|
||||
const TAX_RATE_KEY = 'overview-tax-rate';
|
||||
|
||||
const formatTaxRate = (value: null | number | string | undefined) => {
|
||||
@@ -125,13 +147,53 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
size="small"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 dark:!bg-[hsl(240deg_3.7%_22%/30%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)] !text-sm !font-bold"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 !text-center !text-sm !font-bold dark:!bg-[hsl(240deg_3.7%_22%/30%)]"
|
||||
:formatter="formatTaxRate"
|
||||
:parser="parseTaxRate"
|
||||
@change="handleTaxRateChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 店铺选择(布局/配色与工作台一致) -->
|
||||
<div
|
||||
class="overview-filter-select-group w-full min-w-0 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:w-auto sm:max-w-[min(calc(100vw-2.5rem),28rem)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 items-center gap-2 rounded-xl bg-white/30 p-1 px-2 dark:bg-[hsl(240deg_3.7%_22%/30%)] sm:min-w-[16rem]"
|
||||
>
|
||||
<span
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
店铺
|
||||
</span>
|
||||
<Select
|
||||
:value="props.shopId != null && props.shopId > 0 ? String(props.shopId) : undefined"
|
||||
size="small"
|
||||
show-search
|
||||
:filter-option="false"
|
||||
:loading="props.shopListLoading"
|
||||
:options="props.shopOptions"
|
||||
placeholder="选择店铺"
|
||||
:dropdown-match-select-width="false"
|
||||
class="overview-header-select overview-shop-select min-w-0 flex-1"
|
||||
@change="handleShopSelectChange"
|
||||
@search="(kw: string) => emit('shop-search', kw)"
|
||||
@popup-scroll="(e: Event) => emit('shop-popup-scroll', e)"
|
||||
@dropdown-visible-change="(open: boolean) => emit('shop-dropdown-visible-change', open)"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="props.shopListLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无店铺
|
||||
</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间选择器 -->
|
||||
<div
|
||||
class="flex w-full flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto sm:flex-row sm:items-center sm:gap-1.5 sm:p-1"
|
||||
@@ -239,4 +301,7 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
:deep(.ant-picker-input > input) {
|
||||
color: hsl(240deg 5% 64.9%);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style src="../../../styles/overview-header-select.css"></style>
|
||||
|
||||
@@ -6,19 +6,22 @@ import {
|
||||
computed,
|
||||
onActivated,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
watch,
|
||||
} from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { message, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getShopOverviewStatisticsApi } from '#/api/ecommerce/shop';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop/apis';
|
||||
import { exportByPost } from '#/utils/export';
|
||||
import {
|
||||
applyOverviewDateRangeFromUrl,
|
||||
buildOverviewRouteQuery,
|
||||
syncOverviewDateRangeToUrl,
|
||||
} from '#/utils/overview-date-range';
|
||||
|
||||
@@ -31,6 +34,17 @@ import ProductCategorySwitcher from './components/ProductCategorySwitcher.vue';
|
||||
defineOptions({ name: 'ShopOverview' });
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const SHOP_PAGE_SIZE = 20;
|
||||
|
||||
const shops = ref<ShopVO.Info[]>([]);
|
||||
const shopsLoading = ref(false);
|
||||
const shopPage = ref(1);
|
||||
const shopTotal = ref(0);
|
||||
const shopSearchKeyword = ref('');
|
||||
|
||||
let shopSearchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
/** 当前是否为店铺概览路由(keep-alive 下 route.params.id 会随其它标签变化,不可仅凭 id 请求) */
|
||||
const isShopOverviewRoute = () =>
|
||||
@@ -48,6 +62,19 @@ const loading = ref(false);
|
||||
const exportLoading = ref(false);
|
||||
const overviewData = ref<null | ShopVO.OverviewStatistics>(null);
|
||||
|
||||
const shopSelectOptions = computed(() => {
|
||||
const opts = shops.value.map((s) => ({
|
||||
label: s.name,
|
||||
value: String(s.id),
|
||||
}));
|
||||
const id = shopId.value;
|
||||
if (id > 0 && !opts.some((o) => o.value === String(id))) {
|
||||
const name = overviewData.value?.shopName ?? `店铺 #${id}`;
|
||||
return [{ label: name, value: String(id) }, ...opts];
|
||||
}
|
||||
return opts;
|
||||
});
|
||||
|
||||
// 品类导出相关
|
||||
const categoryExportMode = ref(false);
|
||||
const selectedExportCategoryIds = ref<number[]>([]);
|
||||
@@ -161,6 +188,61 @@ const syncDateRangeToRouteQuery = () => {
|
||||
syncOverviewDateRangeToUrl(dateRange.value);
|
||||
};
|
||||
|
||||
async function fetchShopList(page = 1, append = false) {
|
||||
if (shopsLoading.value) return;
|
||||
shopsLoading.value = true;
|
||||
try {
|
||||
const keyword = shopSearchKeyword.value.trim();
|
||||
const data = await getShopPageApi({
|
||||
page,
|
||||
pageSize: SHOP_PAGE_SIZE,
|
||||
filters: keyword ? { name: keyword } : {},
|
||||
});
|
||||
const records = data.records ?? [];
|
||||
shops.value = append ? [...shops.value, ...records] : records;
|
||||
shopTotal.value = data.total ?? 0;
|
||||
shopPage.value = page;
|
||||
} catch {
|
||||
message.error('店铺列表加载失败');
|
||||
} finally {
|
||||
shopsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleShopSearch(keyword: string) {
|
||||
if (shopSearchTimer) clearTimeout(shopSearchTimer);
|
||||
shopSearchTimer = setTimeout(() => {
|
||||
shopSearchKeyword.value = keyword;
|
||||
void fetchShopList(1, false);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handleShopPopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
if (scrollHeight - scrollTop - clientHeight < 50) {
|
||||
const hasMore = shopPage.value * SHOP_PAGE_SIZE < shopTotal.value;
|
||||
if (hasMore && !shopsLoading.value) {
|
||||
void fetchShopList(shopPage.value + 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleShopDropdownVisibleChange(open: boolean) {
|
||||
if (!open) return;
|
||||
shopSearchKeyword.value = '';
|
||||
void fetchShopList(1, false);
|
||||
}
|
||||
|
||||
function handleShopChange(nextShopId: number) {
|
||||
if (!nextShopId || nextShopId === shopId.value) return;
|
||||
lastRequestKey.value = '';
|
||||
router.push({
|
||||
path: `/ecom/shop/overview/${nextShopId}`,
|
||||
query: buildOverviewRouteQuery(dateRange.value),
|
||||
});
|
||||
}
|
||||
|
||||
// 加载概览数据
|
||||
const loadOverviewData = async () => {
|
||||
if (!isShopOverviewRoute() || !shopId.value) return;
|
||||
@@ -290,6 +372,10 @@ onMounted(async () => {
|
||||
await refreshOverviewByCurrentParams(true);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (shopSearchTimer) clearTimeout(shopSearchTimer);
|
||||
});
|
||||
|
||||
onActivated(async () => {
|
||||
if (!isShopOverviewRoute()) return;
|
||||
await refreshOverviewByCurrentParams(true);
|
||||
@@ -306,7 +392,7 @@ onActivated(async () => {
|
||||
<div
|
||||
class="text-xl font-black tracking-tight text-slate-900 dark:text-[hsl(0deg_0%_98%)] sm:text-2xl md:text-3xl"
|
||||
>
|
||||
{{ overviewData?.shopName ? `店铺经营概览(${overviewData.shopName})` : '店铺经营概览' }}
|
||||
店铺经营概览
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -315,7 +401,14 @@ onActivated(async () => {
|
||||
<TimeRangeBar
|
||||
class="w-full"
|
||||
:model-value="timeRangeState"
|
||||
:shop-id="shopId"
|
||||
:shop-options="shopSelectOptions"
|
||||
:shop-list-loading="shopsLoading"
|
||||
@update:model-value="handleTimeRangeChange"
|
||||
@shop-change="handleShopChange"
|
||||
@shop-search="handleShopSearch"
|
||||
@shop-popup-scroll="handleShopPopupScroll"
|
||||
@shop-dropdown-visible-change="handleShopDropdownVisibleChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
/* 概览页头部 Select:与工作台 workbench-header-select 样式、配色一致 */
|
||||
.overview-header-select {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.overview-header-select .ant-select-selector {
|
||||
border-radius: 0.75rem !important;
|
||||
border: none !important;
|
||||
font-weight: 700;
|
||||
font-size: 0.875rem !important;
|
||||
line-height: 1.25rem !important;
|
||||
min-height: 2.125rem !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
padding-inline: 10px 28px !important;
|
||||
background-color: rgb(255 255 255 / 0.92) !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.overview-header-select.ant-select-single
|
||||
.ant-select-selector
|
||||
.ant-select-selection-item,
|
||||
.overview-header-select.ant-select-single
|
||||
.ant-select-selector
|
||||
.ant-select-selection-placeholder {
|
||||
line-height: 1.25rem !important;
|
||||
color: rgb(15 23 42) !important;
|
||||
}
|
||||
|
||||
.overview-header-select .ant-select-selection-wrap {
|
||||
position: relative !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
flex: 1 1 auto !important;
|
||||
min-width: 0 !important;
|
||||
min-height: 1.25rem;
|
||||
align-self: center !important;
|
||||
}
|
||||
|
||||
.overview-header-select .ant-select-selection-search {
|
||||
position: absolute !important;
|
||||
inset-inline-start: 10px !important;
|
||||
inset-inline-end: 28px !important;
|
||||
top: 50% !important;
|
||||
bottom: auto !important;
|
||||
transform: translateY(-50%) !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
height: 1.25rem !important;
|
||||
margin-inline-start: 0 !important;
|
||||
}
|
||||
|
||||
.overview-header-select .ant-select-selection-search-input {
|
||||
height: 1.25rem !important;
|
||||
line-height: 1.25rem !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
vertical-align: middle !important;
|
||||
color: rgb(15 23 42) !important;
|
||||
}
|
||||
|
||||
.overview-header-select.overview-shop-select .ant-select-selector,
|
||||
.overview-header-select.overview-product-select .ant-select-selector {
|
||||
height: auto !important;
|
||||
min-height: 2.125rem !important;
|
||||
align-items: center !important;
|
||||
padding-block: 6px !important;
|
||||
padding-inline: 10px 28px !important;
|
||||
}
|
||||
|
||||
.overview-header-select.overview-shop-select .ant-select-arrow,
|
||||
.overview-header-select.overview-product-select .ant-select-arrow {
|
||||
top: 50% !important;
|
||||
margin-top: 0 !important;
|
||||
transform: translateY(-50%) !important;
|
||||
color: rgb(100 116 139) !important;
|
||||
}
|
||||
|
||||
.overview-header-select.overview-shop-select.ant-select-single
|
||||
.ant-select-selector
|
||||
.ant-select-selection-item,
|
||||
.overview-header-select.overview-shop-select.ant-select-single
|
||||
.ant-select-selector
|
||||
.ant-select-selection-placeholder,
|
||||
.overview-header-select.overview-product-select.ant-select-single
|
||||
.ant-select-selector
|
||||
.ant-select-selection-item,
|
||||
.overview-header-select.overview-product-select.ant-select-single
|
||||
.ant-select-selector
|
||||
.ant-select-selection-placeholder {
|
||||
white-space: normal !important;
|
||||
word-break: break-word !important;
|
||||
overflow: visible !important;
|
||||
text-overflow: clip !important;
|
||||
line-height: 1.35 !important;
|
||||
align-self: center !important;
|
||||
}
|
||||
|
||||
html.dark .overview-header-select .ant-select-selector {
|
||||
background-color: hsl(240deg 3.7% 18%) !important;
|
||||
}
|
||||
|
||||
html.dark .overview-header-select.ant-select-single .ant-select-selector .ant-select-selection-item,
|
||||
html.dark .overview-header-select.ant-select-single .ant-select-selector .ant-select-selection-placeholder,
|
||||
html.dark .overview-header-select .ant-select-selection-search-input {
|
||||
color: hsl(0deg 0% 95%) !important;
|
||||
}
|
||||
|
||||
html.dark .overview-header-select .ant-select-arrow,
|
||||
html.dark .overview-header-select .ant-select-clear {
|
||||
color: hsl(240deg 5% 64.9%) !important;
|
||||
}
|
||||
Reference in New Issue
Block a user