feat(store): 诊所管理支持配置公账账期
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled

编辑表单增加公账账期字段;列表开关区独立「公账账期」入口并可快捷修改,去掉业务配置重复公账开关。
This commit is contained in:
李琦
2026-08-26 15:49:15 +08:00
parent 02672b16bd
commit b7a70ea113
4 changed files with 111 additions and 16 deletions

View File

@@ -266,6 +266,14 @@ export async function updateStorePublicAccountPayEnabled(data: { id: number }) {
return requestClient.post<any>(`${prefix}update-public-account-pay-enabled`, data);
}
/** 更新诊所公账账期天数0=跟随全局) */
export async function updateStorePublicAccountLockDays(data: {
id: number;
public_account_lock_days: number;
}) {
return requestClient.post<any>(`${prefix}update-public-account-lock-days`, data);
}
export async function toggleSalespersonSeePriceApi(data: { store_id: number }) {
return requestClient.post<any>('salesperson-store-config/toggle-see-price', data);
}

View File

@@ -1,4 +1,8 @@
<script lang="ts" setup>
/**
* 诊所列表开关/业务配置单元格
* 公账开通与账期分开展示:开关只翻转开通;账期 Tag 点开弹窗配置
*/
import { Switch, Tag } from 'ant-design-vue';
defineProps<{
@@ -16,6 +20,8 @@ defineProps<{
onSeeRate: (id: number) => void;
onOrderPriceAdjust: (id: number) => void;
onPublicAccountPay?: (id: number) => void;
/** 点击账期 Tag 打开配置弹窗 */
onPublicAccountLockDays?: (row: Record<string, any>) => void;
onBankCardReport: (row: Record<string, any>) => void;
onClinicType?: (row: Record<string, any>) => void;
onAllowInsurance?: (id: number) => void;
@@ -30,6 +36,12 @@ function handleBankCardTagClick(
if (!canManageBankCard) return;
onBankCardReport(row);
}
/** 账期 Tag 文案0=跟随全局,>0 本店天数 */
function publicAccountLockDaysText(row: Record<string, any>): string {
const days = Number(row.public_account_lock_days || 0);
return days > 0 ? `本店${days}` : '跟随全局';
}
</script>
<template>
@@ -97,6 +109,18 @@ function handleBankCardTagClick(
</Tag>
</div>
</div>
<div v-if="onPublicAccountLockDays" class="config-item">
<span class="config-item__label">公账账期</span>
<div class="config-item__control">
<Tag
:color="Number(row.public_account_lock_days || 0) > 0 ? 'processing' : 'default'"
class="config-item__tag"
@click="onPublicAccountLockDays(row)"
>
{{ publicAccountLockDaysText(row) }}
</Tag>
</div>
</div>
</template>
<template v-else-if="section === 'business'">
@@ -148,18 +172,6 @@ function handleBankCardTagClick(
</Tag>
</div>
</div>
<div v-if="onPublicAccountPay" class="config-item">
<span class="config-item__label">公账支付</span>
<div class="config-item__control">
<Tag
:color="Number(row.public_account_pay_enabled) === 1 ? 'success' : 'default'"
class="config-item__tag"
@click="onPublicAccountPay(row.id)"
>
{{ Number(row.public_account_pay_enabled) === 1 ? '开启' : '关闭' }}
</Tag>
</div>
</div>
</template>
<template v-else-if="section === 'all'">
@@ -237,6 +249,18 @@ function handleBankCardTagClick(
</Tag>
</div>
</div>
<div v-if="onPublicAccountLockDays" class="config-item">
<span class="config-item__label">公账账期</span>
<div class="config-item__control">
<Tag
:color="Number(row.public_account_lock_days || 0) > 0 ? 'processing' : 'default'"
class="config-item__tag"
@click="onPublicAccountLockDays(row)"
>
{{ publicAccountLockDaysText(row) }}
</Tag>
</div>
</div>
</template>
</div>
</template>
@@ -259,11 +283,14 @@ function handleBankCardTagClick(
.config-item__label {
flex-shrink: 0;
min-width: 72px;
color: rgb(156 163 175);
color: hsl(var(--muted-foreground));
line-height: 1.4;
}
.config-item__control {
display: inline-flex;
align-items: center;
gap: 4px;
min-width: 0;
flex: 1;
}

View File

@@ -139,6 +139,21 @@ export const modalFormProps: VbenFormProps = {
label: '公账支付',
defaultValue: 0,
},
{
// 门店账期覆盖0=跟随全局锁定天数;>0 按本店出账/锁店
component: 'InputNumber',
formItemClass: 'col-span-6',
componentProps: {
min: 0,
max: 90,
precision: 0,
placeholder: '0=跟随全局',
},
fieldName: 'public_account_lock_days',
label: '公账账期(天)',
help: '0=跟随全局锁定天数;大于 0 按本店账期1=按日,>1=周期账单)',
defaultValue: 0,
},
{
// 诊所类型(单选)
component: 'RadioGroup',

View File

@@ -1,14 +1,14 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { computed, ref } from 'vue';
import { computed, h, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import { useClipboard } from '@vueuse/core';
import { Button, Image, message, Modal, Tag, Avatar } from 'ant-design-vue';
import { Button, Image, InputNumber, message, Modal, Tag, Avatar } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { Icon } from '#/components/icon';
@@ -31,6 +31,7 @@ import {
updateStoreSubscribeStatus,
updateStoreOrderPricePercentAdjust,
updateStorePublicAccountPayEnabled,
updateStorePublicAccountLockDays,
} from './api';
import FormModalDemo from './components/modal.vue';
import StoreBasicInfoCell from './components/cells/StoreBasicInfoCell.vue';
@@ -459,6 +460,50 @@ const updatePublicAccountPayEnabled = (id: number) => {
});
};
/**
* 列表快捷配置公账账期0=跟随全局1~90=本店天数
*/
const handlePublicAccountLockDays = (row: Record<string, any>) => {
if (!row?.id) return;
const days = ref(Number(row.public_account_lock_days || 0));
const clinicName = row.name || '该诊所';
Modal.confirm({
title: `配置公账账期 · ${clinicName}`,
content: () =>
h('div', { style: 'padding-top: 4px' }, [
h(
'p',
{
style:
'margin: 0 0 10px; color: hsl(var(--muted-foreground)); font-size: 13px; line-height: 1.5',
},
'0 = 跟随系统配置的全局锁定天数;大于 0 按本店账期1=按日账单,>1=周期账单)',
),
h(InputNumber, {
value: days.value,
min: 0,
max: 90,
precision: 0,
style: 'width: 100%',
placeholder: '0=跟随全局',
'onUpdate:value': (v: number | null) => {
days.value = Number(v ?? 0);
},
}),
]),
okText: '保存',
cancelText: '取消',
onOk: async () => {
await updateStorePublicAccountLockDays({
id: row.id,
public_account_lock_days: Number(days.value || 0),
});
message.success('账期已更新');
gridApi.query();
},
});
};
/**
* 批量同步总仓库药品
*/
@@ -602,6 +647,7 @@ const handleSwitchClinicType = (row: any) => {
:on-see-rate="updateSeeRate"
:on-order-price-adjust="updateOrderPricePercentAdjust"
:on-public-account-pay="updatePublicAccountPayEnabled"
:on-public-account-lock-days="handlePublicAccountLockDays"
:on-bank-card-report="handleBankCardReportColumnClick"
/>
</template>
@@ -619,7 +665,6 @@ const handleSwitchClinicType = (row: any) => {
:on-subscribe="updateSubscribe"
:on-see-rate="updateSeeRate"
:on-order-price-adjust="updateOrderPricePercentAdjust"
:on-public-account-pay="updatePublicAccountPayEnabled"
:on-bank-card-report="handleBankCardReportColumnClick"
:on-clinic-type="handleSwitchClinicType"
:on-allow-insurance="updateAllowInsurance"