feat:优化了门店搜索组件、优化了模态框默认的内容

This commit is contained in:
李琦
2026-07-23 16:37:55 +08:00
parent bbb133476a
commit 5fcb65aa0d
4 changed files with 90 additions and 79 deletions

View File

@@ -20,5 +20,5 @@ VITE_INJECT_APP_LOADING=true
VITE_ARCHIVER=true
# WebSocket 连接地址
# VITE_WS_URL=wss://api.ws.g.xiaokang88.com/ws
VITE_WS_URL=wss://xk.ws.nailaoyun.cn/ws
VITE_WS_URL=wss://api.ws.g.xiaokang88.com/ws
# VITE_WS_URL=wss://xk.ws.nailaoyun.cn/ws

View File

@@ -4,6 +4,7 @@ import { ref } from 'vue';
import { type AnalysisOverviewItem, useVbenModal } from '@vben/common-ui';
import { AnalysisOverview } from '@vben/common-ui';
import { SvgCakeIcon } from '@vben/icons';
import { useUserStore } from '@vben/stores';
import { Button, Card, message } from 'ant-design-vue';
@@ -22,6 +23,12 @@ const props = defineProps({
},
});
const userStore = useUserStore();
/** 门店账号无「未确认收货」冻结概念,不展示该卡片(提现冻结走「审核中金额」) */
const isStoreUser =
Number((userStore.userInfo as Record<string, any> | null)?.roles?.user_type) ===
1;
const balance = ref(0);
const pendingEarnings = ref(0);
const settledEarnings = ref(0);
@@ -38,6 +45,7 @@ const overviewItems = ref<AnalysisOverviewItem[]>([]);
/**
* 获取余额卡片列表数据
* 门店不组装「冻结金额(用户未确认收货)」,避免把提现审核款误展示成未确认收货
*/
function showCard() {
showMyCard();
@@ -47,11 +55,11 @@ function showCard() {
settledEarnings.value = res.settled_earnings;
totalEarnings.value = res.total; // 累计收益
withdrawnAmount.value = res.withdrawn; // 已提现金额
withdrawnFrozenAmount.value = res.withdrawn_frozen; // 已提现金额
frozenAmount.value = res.frozen; // 已提现金额
withdrawnFrozenAmount.value = res.withdrawn_frozen; // 审核中金额
frozenAmount.value = res.frozen; // 未确认收货款(仅供应商/配送仓有意义)
// arrivedAmount.value = res.data.arrived_amount.toNumber();
fee.value = res.charge;
overviewItems.value = [
const items: AnalysisOverviewItem[] = [
{
icon: SvgCakeIcon,
title: '累计收益',
@@ -66,13 +74,18 @@ function showCard() {
totalValue: balance.value,
value: balance.value,
},
{
];
// 供应商/配送仓才有确认收货前冻结;门店现金账户无此字段
if (!isStoreUser) {
items.push({
icon: 'game-icons:frozen-orb',
title: '冻结金额(用户未确认收货)',
totalTitle: '冻结金额(用户未确认收货)',
totalValue: frozenAmount.value,
value: frozenAmount.value,
},
});
}
items.push(
{
icon: 'fxemoji:hourglassflowingsand',
title: '待结算收益',
@@ -94,28 +107,8 @@ function showCard() {
totalValue: withdrawnAmount.value,
value: withdrawnAmount.value,
},
// {
// icon: SvgCardIcon,
// title: '已提现金额',
// totalTitle: '已提现金额',
// totalValue: withdrawnAmount.value,
// value: withdrawnAmount.value,
// },
// {
// icon: 'flat-color-icons:ok',
// title: '到账金额',
// totalTitle: '到账金额',
// totalValue: arrivedAmount.value,
// value: arrivedAmount.value,
// },
// {
// icon: 'icon-park:flash-payment',
// title: '手续费',
// totalTitle: '手续费',
// totalValue: fee.value,
// value: fee.value,
// },
];
);
overviewItems.value = items;
});
}
function showMyCard() {

View File

@@ -1,6 +1,28 @@
import type { VbenFormProps } from '#/adapter/form';
export const accountChangeSearchOptions: VbenFormProps = {
import { useUserStore } from '@vben/stores';
/**
* 资金变动筛选:门店现金账户无 frozen未确认收货筛选项需按角色裁剪
* 须在组件 setup 内调用,保证 Pinia 已就绪
*/
export function getAccountChangeSearchOptions(): VbenFormProps {
const userStore = useUserStore();
const isStoreUser =
Number(
(userStore.userInfo as Record<string, any> | null)?.roles?.user_type,
) === 1;
const fieldNameOptions = [
{ label: '可提现金额', value: 'able_cash' },
{ label: '可提现余额', value: 'balance' },
// 仅供应商/配送仓余额账户有「确认收货前冻结」
...(!isStoreUser
? [{ label: '冻结金额(用户未确认收货)', value: 'frozen' }]
: []),
{ label: '审核中金额', value: 'frozen_cash' },
{ label: '审核中金额(余额账户)', value: 'withdrawn_frozen' },
];
return {
collapsed: false,
schema: [
{
@@ -23,13 +45,7 @@ export const accountChangeSearchOptions: VbenFormProps = {
componentProps: {
placeholder: '变更字段',
allowClear: true,
options: [
{ label: '可提现金额', value: 'able_cash' },
{ label: '可提现余额', value: 'balance' },
{ label: '冻结金额(用户未确认收货)', value: 'frozen' },
{ label: '审核中金额', value: 'frozen_cash' },
{ label: '审核中金额(余额账户)', value: 'withdrawn_frozen' },
],
options: fieldNameOptions,
},
defaultValue: '',
fieldName: 'field_name',
@@ -51,4 +67,5 @@ export const accountChangeSearchOptions: VbenFormProps = {
},
submitOnChange: true,
submitOnEnter: false,
};
};
}

View File

@@ -19,7 +19,7 @@ import DetailModal from '#/views/business/order/product-order/components/detail.
import SettlementDetailDrawer from './components/settlement-detail-drawer.vue';
import Statistics from './components/statistics.vue';
import { accountChangeSearchOptions } from './config/account-change-search';
import { getAccountChangeSearchOptions } from './config/account-change-search';
import { accountChangeGridOptions } from './config/account-change-table';
import { formOptions } from './config/search';
import { formOptions3 } from './config/settlement-log-search';
@@ -47,8 +47,9 @@ const [Grid3] = useVbenVxeGrid({
gridOptions: gridOptions3,
});
// 门店侧裁剪掉「冻结金额(用户未确认收货)」筛选项,须在 setup 内按当前角色生成
const [Grid4] = useVbenVxeGrid({
formOptions: accountChangeSearchOptions,
formOptions: getAccountChangeSearchOptions(),
gridOptions: accountChangeGridOptions,
});