diff --git a/apps/web-antd/.env.production b/apps/web-antd/.env.production index 4b7546c0..fa645c21 100644 --- a/apps/web-antd/.env.production +++ b/apps/web-antd/.env.production @@ -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 diff --git a/apps/web-antd/src/views/finance/withdrawal/components/statistics.vue b/apps/web-antd/src/views/finance/withdrawal/components/statistics.vue index 0d59faef..f362d007 100644 --- a/apps/web-antd/src/views/finance/withdrawal/components/statistics.vue +++ b/apps/web-antd/src/views/finance/withdrawal/components/statistics.vue @@ -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 | null)?.roles?.user_type) === + 1; + const balance = ref(0); const pendingEarnings = ref(0); const settledEarnings = ref(0); @@ -38,6 +45,7 @@ const overviewItems = ref([]); /** * 获取余额卡片列表数据 + * 门店不组装「冻结金额(用户未确认收货)」,避免把提现审核款误展示成未确认收货 */ 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() { diff --git a/apps/web-antd/src/views/finance/withdrawal/config/account-change-search.ts b/apps/web-antd/src/views/finance/withdrawal/config/account-change-search.ts index e4bc1b3e..b680b17b 100644 --- a/apps/web-antd/src/views/finance/withdrawal/config/account-change-search.ts +++ b/apps/web-antd/src/views/finance/withdrawal/config/account-change-search.ts @@ -1,54 +1,71 @@ import type { VbenFormProps } from '#/adapter/form'; -export const accountChangeSearchOptions: VbenFormProps = { - collapsed: false, - schema: [ - { - component: 'VbenSelect', - componentProps: { - placeholder: '来源类型', - allowClear: true, - options: [ - { label: '分账', value: 'settle' }, - { label: '提现', value: 'withdraw' }, - { label: '退款', value: 'refund' }, - ], +import { useUserStore } from '@vben/stores'; + +/** + * 资金变动筛选:门店现金账户无 frozen(未确认收货),筛选项需按角色裁剪 + * 须在组件 setup 内调用,保证 Pinia 已就绪 + */ +export function getAccountChangeSearchOptions(): VbenFormProps { + const userStore = useUserStore(); + const isStoreUser = + Number( + (userStore.userInfo as Record | 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: [ + { + component: 'VbenSelect', + componentProps: { + placeholder: '来源类型', + allowClear: true, + options: [ + { label: '分账', value: 'settle' }, + { label: '提现', value: 'withdraw' }, + { label: '退款', value: 'refund' }, + ], + }, + defaultValue: '', + fieldName: 'source_type', + label: '来源类型', }, - defaultValue: '', - fieldName: 'source_type', - label: '来源类型', - }, - { - component: 'VbenSelect', - componentProps: { - placeholder: '变更字段', - allowClear: true, - options: [ - { label: '可提现金额', value: 'able_cash' }, - { label: '可提现余额', value: 'balance' }, - { label: '冻结金额(用户未确认收货)', value: 'frozen' }, - { label: '审核中金额', value: 'frozen_cash' }, - { label: '审核中金额(余额账户)', value: 'withdrawn_frozen' }, - ], + { + component: 'VbenSelect', + componentProps: { + placeholder: '变更字段', + allowClear: true, + options: fieldNameOptions, + }, + defaultValue: '', + fieldName: 'field_name', + label: '变更字段', }, - defaultValue: '', - fieldName: 'field_name', - label: '变更字段', - }, - { - component: 'VbenInput', - componentProps: { - placeholder: '输入订单号', + { + component: 'VbenInput', + componentProps: { + placeholder: '输入订单号', + }, + defaultValue: '', + fieldName: 'order_no', + label: '订单号', }, - defaultValue: '', - fieldName: 'order_no', - label: '订单号', + ], + showCollapseButton: true, + submitButtonOptions: { + content: '查询', }, - ], - showCollapseButton: true, - submitButtonOptions: { - content: '查询', - }, - submitOnChange: true, - submitOnEnter: false, -}; + submitOnChange: true, + submitOnEnter: false, + }; +} diff --git a/apps/web-antd/src/views/finance/withdrawal/index.vue b/apps/web-antd/src/views/finance/withdrawal/index.vue index f6363a22..a3a34f5d 100644 --- a/apps/web-antd/src/views/finance/withdrawal/index.vue +++ b/apps/web-antd/src/views/finance/withdrawal/index.vue @@ -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, });