1. 优化医生、诊所的设置
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
Release Drafter / update_release_draft (push) Has been cancelled
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
Release Drafter / update_release_draft (push) Has been cancelled
This commit is contained in:
@@ -5,7 +5,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, Image, message } from 'ant-design-vue';
|
||||
import { Button, Image, message, Avatar } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
@@ -26,6 +26,7 @@ import { formatAddressDisplay } from '#/util/address-index';
|
||||
import { createAdminGridOptions } from './table-config';
|
||||
import { getRoleMeta } from './role-meta';
|
||||
import DoctorCardModal from '#/views/doctor/doctor/components/DoctorCardModal.vue';
|
||||
import { resolveAvatarUrl } from '#/views/system/store-input/utils/inputUser';
|
||||
|
||||
function formatAdminRegion(row: {
|
||||
province_id?: number;
|
||||
@@ -255,6 +256,50 @@ const copyToClipboard = async (text: string) => {
|
||||
<template #region="{ row }">
|
||||
{{ formatAdminRegion(row) }}
|
||||
</template>
|
||||
<template #store_name="{ row }">
|
||||
<div v-if="row.store?.name" class="flex items-center gap-2">
|
||||
<Avatar
|
||||
:src="resolveAvatarUrl(row.store?.pic)"
|
||||
:size="28"
|
||||
shape="square"
|
||||
>
|
||||
{{ (row.store.name || '?').charAt(0) }}
|
||||
</Avatar>
|
||||
<div class="min-w-0">
|
||||
<div class="truncate">{{ row.store.name }}</div>
|
||||
<div class="text-xs text-gray-400">ID: {{ row.store_id }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else-if="row.store_id">诊所 #{{ row.store_id }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #doctor_profile="{ row }">
|
||||
<Button
|
||||
v-if="row.doctor_profile?.name || row.doctor_id"
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-auto !p-0"
|
||||
@click="openDoctorCard(row)"
|
||||
>
|
||||
<div class="flex items-center gap-2 text-left">
|
||||
<Avatar
|
||||
:src="resolveAvatarUrl(row.doctor_profile?.avatar)"
|
||||
:size="28"
|
||||
>
|
||||
{{ (row.doctor_profile?.name || '?').charAt(0) }}
|
||||
</Avatar>
|
||||
<div class="min-w-0">
|
||||
<div class="truncate text-[#1677ff]">
|
||||
{{ row.doctor_profile?.name || `su_id: ${row.doctor_id}` }}
|
||||
</div>
|
||||
<div v-if="row.doctor_profile?.mobile" class="text-xs text-gray-400">
|
||||
{{ row.doctor_profile.mobile }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Button>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #login_account="{ row }">
|
||||
<span v-if="row.login_account">
|
||||
<Button
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { VbenFormProps } from '#/adapter/form';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getStoreOption } from '#/views/system/store/api';
|
||||
import { getSupplierOption } from '#/views/system/supplier/api';
|
||||
|
||||
import type { AdminFormType } from './role-meta';
|
||||
@@ -180,21 +179,7 @@ export function createAdminModalFormProps(
|
||||
|
||||
if (formType === 'clinic' || formType === 'doctor' || formType === 'pharmacist') {
|
||||
schema.push({
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
filterOption: (input: string, option: { label?: string }) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
|
||||
showSearch: true,
|
||||
afterFetch: (data: { id: number; name: string }[]) => {
|
||||
return data.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
api: getStoreOption,
|
||||
placeholder: '请选择诊所',
|
||||
},
|
||||
component: 'StorePicker',
|
||||
fieldName: 'store_id',
|
||||
formItemClass: 'col-span-6',
|
||||
label: '所属诊所',
|
||||
@@ -204,12 +189,18 @@ export function createAdminModalFormProps(
|
||||
|
||||
if (formType === 'doctor') {
|
||||
schema.push({
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '关联医生档案 ID(可选,建议在医生管理中创建)',
|
||||
component: 'DoctorPicker',
|
||||
componentProps: (values: { store_id?: number }) => ({
|
||||
storeId: values.store_id,
|
||||
}),
|
||||
dependencies: {
|
||||
triggerFields: ['store_id'],
|
||||
componentProps: (values: { store_id?: number }) => ({
|
||||
storeId: values.store_id,
|
||||
}),
|
||||
},
|
||||
fieldName: 'doctor_id',
|
||||
label: '医生ID',
|
||||
label: '关联医生',
|
||||
formItemClass: 'col-span-6',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
export type PlatformAdminUserInfo = {
|
||||
role_id?: number;
|
||||
roles?: { id?: number };
|
||||
} | null | undefined;
|
||||
|
||||
/** 超级管理员、系统管理员(role_id 1/2) */
|
||||
export function isPlatformSuperAdmin(userInfo: PlatformAdminUserInfo): boolean {
|
||||
const roleId = Number(userInfo?.role_id ?? userInfo?.roles?.id);
|
||||
return roleId === 1 || roleId === 2;
|
||||
}
|
||||
|
||||
/** 是否可编辑医生卡片中的 service_user 及资料写操作 */
|
||||
export function canEditDoctorServiceUser(userInfo: PlatformAdminUserInfo): boolean {
|
||||
return isPlatformSuperAdmin(userInfo);
|
||||
}
|
||||
|
||||
/** 是否可管理诊所银行卡报备入口 */
|
||||
export function canManageStoreBankCard(userInfo: PlatformAdminUserInfo): boolean {
|
||||
return isPlatformSuperAdmin(userInfo);
|
||||
}
|
||||
@@ -18,6 +18,13 @@ interface RowType {
|
||||
store_id?: number;
|
||||
doctor_id?: number;
|
||||
pharmacist_id?: number;
|
||||
store?: { id?: number; name?: string; pic?: string; mobile?: string };
|
||||
doctor_profile?: {
|
||||
su_id?: number;
|
||||
name?: string;
|
||||
avatar?: string;
|
||||
mobile?: string;
|
||||
} | null;
|
||||
province_id?: number;
|
||||
city_id?: number;
|
||||
}
|
||||
@@ -55,11 +62,21 @@ function buildColumns(formType: AdminFormType) {
|
||||
}
|
||||
|
||||
if (formType === 'clinic' || formType === 'doctor' || formType === 'pharmacist') {
|
||||
cols.push({ field: 'store_id', title: '诊所ID', width: 100 });
|
||||
cols.push({
|
||||
field: 'store_id',
|
||||
title: '所属诊所',
|
||||
minWidth: 180,
|
||||
slots: { default: 'store_name' },
|
||||
});
|
||||
}
|
||||
|
||||
if (formType === 'doctor') {
|
||||
cols.push({ field: 'doctor_id', title: '医生ID', width: 100 });
|
||||
cols.push({
|
||||
field: 'doctor_id',
|
||||
title: '关联医生',
|
||||
minWidth: 180,
|
||||
slots: { default: 'doctor_profile' },
|
||||
});
|
||||
}
|
||||
|
||||
if (formType === 'pharmacist') {
|
||||
|
||||
@@ -38,11 +38,13 @@ import DrugPriceModal from '#/views/system/store/components/DrugPriceModal.vue';
|
||||
import StoreExternalFieldModal from '#/views/system/store/components/StoreExternalFieldModal.vue';
|
||||
import BankCardReportModal from '#/views/system/store-bank-card/components/BankCardReportModal.vue';
|
||||
import BankCardStatusModal from '#/views/system/store-bank-card/components/BankCardStatusModal.vue';
|
||||
import BankCardStoreEditModal from '#/views/system/store-bank-card/components/BankCardStoreEditModal.vue';
|
||||
import { getStoreBankCardReportDetail } from '#/views/system/store-bank-card/api';
|
||||
// 导入搜索表单配置
|
||||
import { formOptions } from './config/search';
|
||||
// 导入表格配置
|
||||
import { gridOptions } from './config/table';
|
||||
import { canManageStoreBankCard } from '#/views/system/admin/_shared/platform-admin-role';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
@@ -52,6 +54,10 @@ const isPlatformAdmin = computed(() => {
|
||||
return userStore?.userInfo?.roles?.user_type === 2;
|
||||
});
|
||||
|
||||
const canManageBankCard = computed(() =>
|
||||
canManageStoreBankCard(userStore.userInfo),
|
||||
);
|
||||
|
||||
// 跳转到审核页面
|
||||
const goToAudit = () => {
|
||||
router.push('/system/store-input/audit');
|
||||
@@ -126,6 +132,19 @@ const [BankCardStatusModalComponent, bankCardStatusModalApi] = useVbenModal({
|
||||
connectedComponent: BankCardStatusModal,
|
||||
});
|
||||
|
||||
const [BankCardStoreEditModalComponent, bankCardStoreEditModalApi] = useVbenModal({
|
||||
connectedComponent: BankCardStoreEditModal,
|
||||
});
|
||||
|
||||
const openBankCardStoreEdit = (row: any) => {
|
||||
bankCardStoreEditModalApi.setData({
|
||||
storeId: row.id,
|
||||
storeName: row.name,
|
||||
gridApi,
|
||||
});
|
||||
bankCardStoreEditModalApi.open();
|
||||
};
|
||||
|
||||
const openBankCardReport = async (row: any, update = false) => {
|
||||
let report = null;
|
||||
try {
|
||||
@@ -175,6 +194,7 @@ function getBankCardReportTagText(row: any) {
|
||||
}
|
||||
|
||||
function handleBankCardReportColumnClick(row: any) {
|
||||
if (!canManageBankCard.value) return;
|
||||
const status = Number(row.bank_card_report_status ?? 0);
|
||||
if (status === 1 || status === 2) {
|
||||
openBankCardStatus(row);
|
||||
@@ -354,6 +374,7 @@ const batchSyncDrugPrice = () => {
|
||||
<FormModal />
|
||||
<BankCardReportModalComponent />
|
||||
<BankCardStatusModalComponent />
|
||||
<BankCardStoreEditModalComponent />
|
||||
<QrCodePreviewModal />
|
||||
<DrugPriceModalComponent />
|
||||
<BindConsultationModalComponent />
|
||||
@@ -420,6 +441,7 @@ const batchSyncDrugPrice = () => {
|
||||
<StoreConfigTogglesCell
|
||||
:row="row"
|
||||
section="switches"
|
||||
:can-manage-bank-card="canManageBankCard"
|
||||
:get-bank-card-report-tag-color="getBankCardReportTagColor"
|
||||
:get-bank-card-report-tag-text="getBankCardReportTagText"
|
||||
:on-shipping-free="updateShippingFree"
|
||||
@@ -435,6 +457,7 @@ const batchSyncDrugPrice = () => {
|
||||
section="business"
|
||||
show-insurance
|
||||
show-salesperson-see-price
|
||||
:can-manage-bank-card="canManageBankCard"
|
||||
:get-bank-card-report-tag-color="getBankCardReportTagColor"
|
||||
:get-bank-card-report-tag-text="getBankCardReportTagText"
|
||||
:on-shipping-free="updateShippingFree"
|
||||
@@ -579,6 +602,14 @@ const batchSyncDrugPrice = () => {
|
||||
icon: 'ant-design:credit-card-outlined',
|
||||
size: 'small',
|
||||
auth: ['Super Admin', 'Admin'],
|
||||
onClick: () => openBankCardStoreEdit(row),
|
||||
},
|
||||
{
|
||||
label: '修改报备银行卡',
|
||||
type: 'link',
|
||||
icon: 'ant-design:file-protect-outlined',
|
||||
size: 'small',
|
||||
auth: ['Super Admin', 'Admin'],
|
||||
onClick: () => openBankCardReport(row, true),
|
||||
},
|
||||
]"
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
reportStoreBankCard,
|
||||
updateStoreBankCard,
|
||||
} from '../api';
|
||||
import { USE_TYPE_TRANSFER } from '../config/constants';
|
||||
import {
|
||||
LABEL_UPDATE_REPORT_BANK_CARD,
|
||||
USE_TYPE_TRANSFER,
|
||||
} from '../config/constants';
|
||||
import { bankCardReportFormProps } from '../config/form';
|
||||
|
||||
const mode = ref<'report' | 'update'>('report');
|
||||
@@ -115,7 +118,9 @@ const [Modal, modalApi] = useVbenModal({
|
||||
use_type: USE_TYPE_TRANSFER,
|
||||
});
|
||||
message.success(
|
||||
isRejectedResubmit.value ? '银行卡报备已重新提交' : '银行卡修改已提交',
|
||||
isRejectedResubmit.value
|
||||
? '银行卡报备已重新提交'
|
||||
: '报备银行卡修改已提交',
|
||||
);
|
||||
} else {
|
||||
await reportStoreBankCard({
|
||||
@@ -174,7 +179,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
const modalTitle = computed(() => {
|
||||
const prefix = mode.value === 'report' ? '银行卡报备' : '修改银行卡';
|
||||
const prefix =
|
||||
mode.value === 'report' ? '银行卡报备' : LABEL_UPDATE_REPORT_BANK_CARD;
|
||||
return storeName.value ? `${prefix} - ${storeName.value}` : prefix;
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Alert, Form, FormItem, Input, message, Select, Spin } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
getSelectableBankCards,
|
||||
getStoreBankCardReportDetail,
|
||||
} from '../api';
|
||||
import {
|
||||
LABEL_UPDATE_STORE_BANK_CARD,
|
||||
STORE_BANK_ACCOUNT_TYPE_OPTIONS,
|
||||
} from '../config/constants';
|
||||
import {
|
||||
buildCurrentStoreReportOption,
|
||||
mapReportPayloadToStoreBankForm,
|
||||
mergeSelectableBankCardOptions,
|
||||
type BankCardSelectableOption,
|
||||
} from '../utils/bankCardImport';
|
||||
import { getStoreInfo, updateStoreBankInfoApi } from '#/views/system/store/api';
|
||||
|
||||
const storeId = ref(0);
|
||||
const storeName = ref('');
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const gridApiRef = ref<any>(null);
|
||||
const selectableOptions = ref<BankCardSelectableOption[]>([]);
|
||||
const selectedCardKey = ref<string | undefined>();
|
||||
const importedFromReport = ref(false);
|
||||
|
||||
const formState = ref({
|
||||
bank_user_name: '',
|
||||
bank_card: '',
|
||||
bank_name: '',
|
||||
bank_account_type: 2,
|
||||
bank_no: '',
|
||||
});
|
||||
|
||||
const modalTitle = computed(() =>
|
||||
storeName.value
|
||||
? `${LABEL_UPDATE_STORE_BANK_CARD} - ${storeName.value}`
|
||||
: LABEL_UPDATE_STORE_BANK_CARD,
|
||||
);
|
||||
|
||||
/** 下拉搜索过滤 */
|
||||
function filterSelectableOption(input: string, option: { label?: string }) {
|
||||
return (option?.label ?? '').toLowerCase().includes(input.toLowerCase());
|
||||
}
|
||||
|
||||
/** 加载可导入的已报备银行卡列表 */
|
||||
async function loadSelectableCards() {
|
||||
if (!storeId.value) {
|
||||
selectableOptions.value = [];
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const [selectableRes, detailRes] = await Promise.all([
|
||||
getSelectableBankCards(storeId.value),
|
||||
getStoreBankCardReportDetail(storeId.value).catch(() => null),
|
||||
]);
|
||||
const currentOption = buildCurrentStoreReportOption(detailRes);
|
||||
selectableOptions.value = mergeSelectableBankCardOptions(
|
||||
currentOption,
|
||||
selectableRes?.options ?? [],
|
||||
);
|
||||
} catch {
|
||||
selectableOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
/** 加载门店当前银行卡信息 */
|
||||
async function loadStoreBankInfo() {
|
||||
if (!storeId.value) return;
|
||||
loading.value = true;
|
||||
try {
|
||||
const info = await getStoreInfo(storeId.value);
|
||||
formState.value = {
|
||||
bank_user_name: info?.bank_user_name ?? '',
|
||||
bank_card: info?.bank_card ?? '',
|
||||
bank_name: info?.bank_name ?? '',
|
||||
bank_account_type: Number(info?.bank_account_type ?? 2) || 2,
|
||||
bank_no: info?.bank_no ?? '',
|
||||
};
|
||||
} catch {
|
||||
message.error('加载门店银行卡信息失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 选择已报备记录后填充表单 */
|
||||
function handleSelectExistingCard(value: string | undefined) {
|
||||
if (!value) {
|
||||
importedFromReport.value = false;
|
||||
return;
|
||||
}
|
||||
const option = selectableOptions.value.find((item) => item.value === value);
|
||||
if (!option) {
|
||||
importedFromReport.value = false;
|
||||
return;
|
||||
}
|
||||
formState.value = mapReportPayloadToStoreBankForm(option.payload);
|
||||
importedFromReport.value = true;
|
||||
}
|
||||
|
||||
function resetImportState() {
|
||||
selectedCardKey.value = undefined;
|
||||
selectableOptions.value = [];
|
||||
importedFromReport.value = false;
|
||||
}
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
if (!storeId.value) return;
|
||||
saving.value = true;
|
||||
try {
|
||||
await updateStoreBankInfoApi({
|
||||
id: storeId.value,
|
||||
...formState.value,
|
||||
});
|
||||
message.success('门店银行卡信息已保存');
|
||||
gridApiRef.value?.query?.();
|
||||
gridApiRef.value?.reload?.();
|
||||
modalApi.close();
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
const data = modalApi.getData<{
|
||||
storeId: number;
|
||||
storeName?: string;
|
||||
gridApi?: any;
|
||||
}>();
|
||||
storeId.value = data?.storeId ?? 0;
|
||||
storeName.value = data?.storeName ?? '';
|
||||
gridApiRef.value = data?.gridApi ?? null;
|
||||
resetImportState();
|
||||
loadStoreBankInfo();
|
||||
loadSelectableCards();
|
||||
return;
|
||||
}
|
||||
storeId.value = 0;
|
||||
storeName.value = '';
|
||||
gridApiRef.value = null;
|
||||
resetImportState();
|
||||
formState.value = {
|
||||
bank_user_name: '',
|
||||
bank_card: '',
|
||||
bank_name: '',
|
||||
bank_account_type: 2,
|
||||
bank_no: '',
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="modalTitle" class="w-[520px]" :confirm-loading="saving">
|
||||
<Alert
|
||||
type="info"
|
||||
show-icon
|
||||
class="mb-4"
|
||||
message="仅修改系统门店银行卡信息,不会提交易票联报备。"
|
||||
/>
|
||||
<div v-if="selectableOptions.length > 0" class="mb-4">
|
||||
<div class="mb-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
从已报备银行卡导入
|
||||
</div>
|
||||
<Select
|
||||
v-model:value="selectedCardKey"
|
||||
allow-clear
|
||||
show-search
|
||||
class="w-full"
|
||||
:filter-option="filterSelectableOption"
|
||||
:options="selectableOptions"
|
||||
placeholder="选择历史报备记录(可跨门店)"
|
||||
@change="handleSelectExistingCard"
|
||||
/>
|
||||
</div>
|
||||
<Alert
|
||||
v-if="importedFromReport"
|
||||
type="success"
|
||||
show-icon
|
||||
class="mb-4"
|
||||
message="已从报备记录导入卡信息,确认后仅写入系统门店,不会提交易票联报备。"
|
||||
/>
|
||||
<Spin :spinning="loading">
|
||||
<Form layout="vertical">
|
||||
<FormItem label="开户人姓名" required>
|
||||
<Input
|
||||
v-model:value="formState.bank_user_name"
|
||||
placeholder="请输入开户人姓名"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="银行卡号" required>
|
||||
<Input v-model:value="formState.bank_card" placeholder="请输入银行卡号" />
|
||||
</FormItem>
|
||||
<FormItem label="开户银行名称" required>
|
||||
<Input v-model:value="formState.bank_name" placeholder="请输入开户银行名称" />
|
||||
</FormItem>
|
||||
<FormItem label="银行账户类型" required>
|
||||
<Select
|
||||
v-model:value="formState.bank_account_type"
|
||||
:options="STORE_BANK_ACCOUNT_TYPE_OPTIONS"
|
||||
placeholder="请选择银行账户类型"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="银行联行号">
|
||||
<Input
|
||||
v-model:value="formState.bank_no"
|
||||
placeholder="对公/存折或非62开头卡号时必填"
|
||||
/>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Spin>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -8,3 +8,16 @@ export const EPL_TRANSFER_ACCOUNT_TYPE_OPTIONS = [
|
||||
export const USE_TYPE_TRANSFER = '2';
|
||||
|
||||
export const USE_TYPE_TRANSFER_TEXT = '转账卡';
|
||||
|
||||
/** 易票联报备修改入口文案 */
|
||||
export const LABEL_UPDATE_REPORT_BANK_CARD = '修改报备银行卡';
|
||||
|
||||
/** 系统门店银行卡字段编辑入口文案 */
|
||||
export const LABEL_UPDATE_STORE_BANK_CARD = '修改银行卡';
|
||||
|
||||
/** yii_store 银行账户类型选项 */
|
||||
export const STORE_BANK_ACCOUNT_TYPE_OPTIONS = [
|
||||
{ label: '对公', value: 1 },
|
||||
{ label: '对私', value: 2 },
|
||||
{ label: '存折', value: 5 },
|
||||
];
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/** 门店银行卡表单字段(yii_store) */
|
||||
export type StoreBankFormState = {
|
||||
bank_user_name: string;
|
||||
bank_card: string;
|
||||
bank_name: string;
|
||||
bank_account_type: number;
|
||||
bank_no: string;
|
||||
};
|
||||
|
||||
export type BankCardSelectableOption = {
|
||||
value: string;
|
||||
label: string;
|
||||
payload: Record<string, any>;
|
||||
};
|
||||
|
||||
/** 卡号脱敏展示(与后端 mask 规则一致) */
|
||||
export function maskBankCardForDisplay(bankCard?: string | null): string {
|
||||
const card = String(bankCard ?? '').trim();
|
||||
if (!card) return '';
|
||||
if (card.length <= 8) return card;
|
||||
return `${card.slice(0, 4)}${'*'.repeat(Math.max(0, card.length - 8))}${card.slice(-4)}`;
|
||||
}
|
||||
|
||||
/** 报备 payload 映射为门店银行卡表单字段 */
|
||||
export function mapReportPayloadToStoreBankForm(
|
||||
payload: Record<string, any>,
|
||||
): StoreBankFormState {
|
||||
return {
|
||||
bank_user_name: String(payload.bank_user_name ?? ''),
|
||||
bank_card: String(payload.bank_card ?? ''),
|
||||
bank_name: String(payload.bank_name ?? ''),
|
||||
bank_account_type: Number(payload.bank_account_type ?? 2) || 2,
|
||||
bank_no: String(payload.bank_no ?? ''),
|
||||
};
|
||||
}
|
||||
|
||||
/** 从报备详情构建本门店导入选项 */
|
||||
export function buildCurrentStoreReportOption(
|
||||
detail: Record<string, any> | null | undefined,
|
||||
): BankCardSelectableOption | null {
|
||||
if (!detail?.id) return null;
|
||||
const bankCard = String(detail.bank_card ?? '').trim();
|
||||
const bankUserName = String(detail.bank_user_name ?? '').trim();
|
||||
if (!bankCard || !bankUserName) return null;
|
||||
|
||||
const masked =
|
||||
detail.bank_card_masked || maskBankCardForDisplay(bankCard);
|
||||
|
||||
return {
|
||||
value: `current_report_${detail.id}`,
|
||||
label: `本门店报备 #${detail.id}(${masked})`,
|
||||
payload: mapReportPayloadToStoreBankForm(detail),
|
||||
};
|
||||
}
|
||||
|
||||
/** 合并本店报备与跨店历史报备选项(本店置顶) */
|
||||
export function mergeSelectableBankCardOptions(
|
||||
currentOption: BankCardSelectableOption | null,
|
||||
remoteOptions: BankCardSelectableOption[] = [],
|
||||
): BankCardSelectableOption[] {
|
||||
if (!currentOption) return remoteOptions;
|
||||
const rest = remoteOptions.filter((item) => item.value !== currentOption.value);
|
||||
return [currentOption, ...rest];
|
||||
}
|
||||
@@ -198,3 +198,17 @@ export async function updateStoreExternalFieldApi(data: {
|
||||
}) {
|
||||
return requestClient.post<any>(`${prefix}update-store-external-field`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅更新系统门店银行卡字段(不触发易票联报备)
|
||||
*/
|
||||
export async function updateStoreBankInfoApi(data: {
|
||||
id: number;
|
||||
bank_user_name: string;
|
||||
bank_card: string;
|
||||
bank_name: string;
|
||||
bank_account_type: number;
|
||||
bank_no?: string;
|
||||
}) {
|
||||
return requestClient.post<any>(`${prefix}update-store-bank-info`, data);
|
||||
}
|
||||
|
||||
@@ -3,32 +3,18 @@ import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Form, FormItem, message, Select } from 'ant-design-vue';
|
||||
import { Form, FormItem, message } from 'ant-design-vue';
|
||||
|
||||
import { getDoctorOptionApi, updateSpecialPrescriptionDoctorApi } from '../api';
|
||||
import DoctorPicker from '#/components/form/components/doctor-picker.vue';
|
||||
|
||||
import { updateSpecialPrescriptionDoctorApi } from '../api';
|
||||
|
||||
const formState = ref({
|
||||
id: undefined as number | undefined,
|
||||
special_prescription_doctor_id: undefined as number | undefined,
|
||||
});
|
||||
|
||||
const doctorOptions = ref<Array<{ id: number; name: string }>>([]);
|
||||
const gridApiRef = ref<any>(null);
|
||||
const loading = ref(false);
|
||||
|
||||
async function loadDoctorOptions(storeId?: number) {
|
||||
if (!storeId) {
|
||||
doctorOptions.value = [];
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const doctors = await getDoctorOptionApi(storeId);
|
||||
doctorOptions.value = doctors || [];
|
||||
} catch (error) {
|
||||
console.error('获取医生列表失败:', error);
|
||||
doctorOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
@@ -37,7 +23,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
loading.value = true;
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
try {
|
||||
await updateSpecialPrescriptionDoctorApi({
|
||||
@@ -50,11 +35,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||
} catch {
|
||||
message.error('绑定失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
modalApi.setState({ confirmLoading: false });
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
const { values, gridApi } = modalApi.getData<Record<string, any>>();
|
||||
gridApiRef.value = gridApi;
|
||||
@@ -62,24 +46,18 @@ const [Modal, modalApi] = useVbenModal({
|
||||
id: values?.id,
|
||||
special_prescription_doctor_id: values?.special_prescription_doctor_id || undefined,
|
||||
};
|
||||
await loadDoctorOptions(formState.value.id);
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal title="绑定特色方默认医生" class="w-[500px]">
|
||||
<Modal title="换绑特色方默认医生" class="w-[500px]">
|
||||
<Form :model="formState" layout="vertical">
|
||||
<FormItem label="特色方默认挂号医生">
|
||||
<Select
|
||||
<DoctorPicker
|
||||
v-model:value="formState.special_prescription_doctor_id"
|
||||
:options="doctorOptions"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
placeholder="请选择特色方默认挂号医生"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="(input: string, option: any) => option.name.toLowerCase().includes(input.toLowerCase())"
|
||||
:store-id="formState.id"
|
||||
/>
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
||||
@@ -7,6 +7,8 @@ defineProps<{
|
||||
showClinicType?: boolean;
|
||||
showInsurance?: boolean;
|
||||
showSalespersonSeePrice?: boolean;
|
||||
/** 是否可点击银行卡报备 Tag(超管/系统管理员) */
|
||||
canManageBankCard?: boolean;
|
||||
getBankCardReportTagColor: (status: number) => string;
|
||||
getBankCardReportTagText: (row: Record<string, any>) => string;
|
||||
onShippingFree: (id: number) => void;
|
||||
@@ -18,6 +20,15 @@ defineProps<{
|
||||
onAllowInsurance?: (id: number) => void;
|
||||
onSalespersonSeePrice?: (id: number) => void;
|
||||
}>();
|
||||
|
||||
function handleBankCardTagClick(
|
||||
row: Record<string, any>,
|
||||
canManageBankCard: boolean | undefined,
|
||||
onBankCardReport: (row: Record<string, any>) => void,
|
||||
) {
|
||||
if (!canManageBankCard) return;
|
||||
onBankCardReport(row);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -93,8 +104,8 @@ defineProps<{
|
||||
<div class="config-item__control">
|
||||
<Tag
|
||||
:color="getBankCardReportTagColor(row.bank_card_report_status)"
|
||||
class="config-item__tag"
|
||||
@click="onBankCardReport(row)"
|
||||
:class="['config-item__tag', { 'config-item__tag--readonly': !canManageBankCard }]"
|
||||
@click="handleBankCardTagClick(row, canManageBankCard, onBankCardReport)"
|
||||
>
|
||||
{{ getBankCardReportTagText(row) }}
|
||||
</Tag>
|
||||
@@ -146,8 +157,8 @@ defineProps<{
|
||||
<div class="config-item__control">
|
||||
<Tag
|
||||
:color="getBankCardReportTagColor(row.bank_card_report_status)"
|
||||
class="config-item__tag"
|
||||
@click="onBankCardReport(row)"
|
||||
:class="['config-item__tag', { 'config-item__tag--readonly': !canManageBankCard }]"
|
||||
@click="handleBankCardTagClick(row, canManageBankCard, onBankCardReport)"
|
||||
>
|
||||
{{ getBankCardReportTagText(row) }}
|
||||
</Tag>
|
||||
@@ -228,6 +239,11 @@ defineProps<{
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.config-item__tag--readonly {
|
||||
cursor: default;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.clinic-type-tag {
|
||||
transition: all 0.2s ease;
|
||||
user-select: none;
|
||||
|
||||
@@ -41,7 +41,7 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
field: 'special_prescription_config',
|
||||
align: 'left',
|
||||
title: '特色方配置',
|
||||
width: 140,
|
||||
width: 180,
|
||||
slots: { default: 'special_prescription_config' },
|
||||
},
|
||||
{
|
||||
|
||||
@@ -8,13 +8,14 @@ import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { Button, Image, message, Modal, Tag } from 'ant-design-vue';
|
||||
import { Button, Image, message, Modal, Tag, Avatar } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { Icon } from '#/components/icon';
|
||||
import QrCodePreview from '#/components/modal/QrCodePreview.vue';
|
||||
import PromoterInfoCard from '#/components/promoter/PromoterInfoCard.vue';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { resolveAvatarUrl } from '#/views/system/store-input/utils/inputUser';
|
||||
|
||||
import {
|
||||
batchSyncDrugPriceApi,
|
||||
@@ -39,9 +40,11 @@ import StoreExternalFieldModal from './components/StoreExternalFieldModal.vue';
|
||||
import SalespersonCommissionDrawer from './components/SalespersonCommissionDrawer.vue';
|
||||
import BankCardReportModal from '#/views/system/store-bank-card/components/BankCardReportModal.vue';
|
||||
import BankCardStatusModal from '#/views/system/store-bank-card/components/BankCardStatusModal.vue';
|
||||
import BankCardStoreEditModal from '#/views/system/store-bank-card/components/BankCardStoreEditModal.vue';
|
||||
import { getStoreBankCardReportDetail } from '#/views/system/store-bank-card/api';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
import { canManageStoreBankCard } from '#/views/system/admin/_shared/platform-admin-role';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
@@ -51,6 +54,10 @@ const isPlatformAdmin = computed(() => {
|
||||
return userStore?.userInfo?.roles?.user_type === 2;
|
||||
});
|
||||
|
||||
const canManageBankCard = computed(() =>
|
||||
canManageStoreBankCard(userStore.userInfo),
|
||||
);
|
||||
|
||||
// 跳转到审核页面
|
||||
const goToAudit = () => {
|
||||
router.push('/system/store-input/audit');
|
||||
@@ -120,6 +127,19 @@ const [BankCardStatusModalComponent, bankCardStatusModalApi] = useVbenModal({
|
||||
connectedComponent: BankCardStatusModal,
|
||||
});
|
||||
|
||||
const [BankCardStoreEditModalComponent, bankCardStoreEditModalApi] = useVbenModal({
|
||||
connectedComponent: BankCardStoreEditModal,
|
||||
});
|
||||
|
||||
const openBankCardStoreEdit = (row: any) => {
|
||||
bankCardStoreEditModalApi.setData({
|
||||
storeId: row.id,
|
||||
storeName: row.name,
|
||||
gridApi,
|
||||
});
|
||||
bankCardStoreEditModalApi.open();
|
||||
};
|
||||
|
||||
const openBankCardReport = async (row: any, update = false) => {
|
||||
let report = null;
|
||||
try {
|
||||
@@ -169,6 +189,7 @@ function getBankCardReportTagText(row: any) {
|
||||
}
|
||||
|
||||
function handleBankCardReportColumnClick(row: any) {
|
||||
if (!canManageBankCard.value) return;
|
||||
const status = Number(row.bank_card_report_status ?? 0);
|
||||
if (status === 1 || status === 2) {
|
||||
openBankCardStatus(row);
|
||||
@@ -380,6 +401,7 @@ const handleSwitchClinicType = (row: any) => {
|
||||
<FormModal />
|
||||
<BankCardReportModalComponent />
|
||||
<BankCardStatusModalComponent />
|
||||
<BankCardStoreEditModalComponent />
|
||||
<QrCodePreviewModal />
|
||||
<DrugPriceModalComponent />
|
||||
<BindConsultationModalComponent />
|
||||
@@ -449,6 +471,7 @@ const handleSwitchClinicType = (row: any) => {
|
||||
<StoreConfigTogglesCell
|
||||
:row="row"
|
||||
section="switches"
|
||||
:can-manage-bank-card="canManageBankCard"
|
||||
:get-bank-card-report-tag-color="getBankCardReportTagColor"
|
||||
:get-bank-card-report-tag-text="getBankCardReportTagText"
|
||||
:on-shipping-free="updateShippingFree"
|
||||
@@ -465,6 +488,7 @@ const handleSwitchClinicType = (row: any) => {
|
||||
show-clinic-type
|
||||
show-insurance
|
||||
show-salesperson-see-price
|
||||
:can-manage-bank-card="canManageBankCard"
|
||||
:get-bank-card-report-tag-color="getBankCardReportTagColor"
|
||||
:get-bank-card-report-tag-text="getBankCardReportTagText"
|
||||
:on-shipping-free="updateShippingFree"
|
||||
@@ -530,10 +554,14 @@ const handleSwitchClinicType = (row: any) => {
|
||||
<template #special_prescription_config="{ row }">
|
||||
<div
|
||||
v-if="row.special_prescription_doctor_id"
|
||||
class="cursor-pointer hover:text-blue-500"
|
||||
class="flex cursor-pointer items-center gap-2 hover:text-blue-500"
|
||||
@click="showBindSpecialPrescriptionDoctorModal(row)"
|
||||
>
|
||||
<div>医生ID:{{ row.special_prescription_doctor_id }}</div>
|
||||
<Avatar
|
||||
:size="32"
|
||||
:src="resolveAvatarUrl(row.special_prescription_doctor_avatar)"
|
||||
/>
|
||||
<span>{{ row.special_prescription_doctor_name || '未知医生' }}</span>
|
||||
</div>
|
||||
<Button
|
||||
v-else
|
||||
@@ -657,6 +685,14 @@ const handleSwitchClinicType = (row: any) => {
|
||||
icon: 'ant-design:credit-card-outlined',
|
||||
size: 'small',
|
||||
auth: ['Super Admin', 'Admin'],
|
||||
onClick: () => openBankCardStoreEdit(row),
|
||||
},
|
||||
{
|
||||
label: '修改报备银行卡',
|
||||
type: 'link',
|
||||
icon: 'ant-design:file-protect-outlined',
|
||||
size: 'small',
|
||||
auth: ['Super Admin', 'Admin'],
|
||||
onClick: () => openBankCardReport(row, true),
|
||||
},
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user