更新加项面板tag显示

This commit is contained in:
xianyi
2026-01-07 16:10:15 +08:00
parent 77273b28b9
commit 0a43bba87f

View File

@@ -5,8 +5,6 @@ import { searchPhysicalExamAddItem, getAddItemCustomerInfo, getChannelCompanyLis
import { Button, Input } from '../ui';
import { cls } from '../../utils/cls';
import nozImage from '../../assets/image/noz.png';
import { setAddItemBillPdf } from '../../utils/examActions';
interface AddonTag {
title: string;
type: 1 | 2 | 3 | 4; // 1: 热门(红), 2: 普通(灰), 3: 医生推荐(蓝), 4: 折扣信息
@@ -21,6 +19,7 @@ interface AddonItem {
currentPrice?: string;
combinationItemCode?: number | null;
isEnjoyDiscount?: number | null;
discount_name?: string | null;
}
interface ExamAddonPanelProps {
@@ -213,6 +212,7 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
: '0.00',
combinationItemCode: item.combination_item_code ?? null,
isEnjoyDiscount: item.is_enjoy_discount ?? null,
discount_name: item.discount_rate ?? null,
tags: [],
paid: false,
}));
@@ -281,16 +281,7 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
// 获取折扣信息文字(从 tags 中提取 type 4 的标签,或计算折扣)
const getDiscountText = (item: AddonItem) => {
const discountTag = item.tags?.find(t => t.type === 4);
if (discountTag) return discountTag.title;
const orig = parseFloat(item.originalPrice || '0');
const curr = parseFloat(item.currentPrice || '0');
if (orig > 0 && curr < orig) {
const percent = Math.round((curr / orig) * 100);
return `渠道 ${percent}`;
}
return '渠道价';
return item.discount_name;
};
// 构建折扣选项列表
@@ -367,16 +358,7 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
});
if (res.Status === 200 && res.Data?.pdf_url && res.Data?.pdf_sort !== undefined && res.Data?.pdf_sort !== null) {
// 保存加项PDF信息到localStorage未签名状态
setAddItemBillPdf(examId, {
pdf_sort: res.Data.pdf_sort,
combinationCode: combinationItemCodes,
payment_status: res.Data.payment_status ?? null,
payment_status_name: res.Data.payment_status_name ?? null,
pdf_name: res.Data.pdf_name || '加项单',
pdf_url: res.Data.pdf_url,
is_signed: false,
});
return true;
} else {
console.error('获取加项PDF失败', res.Message);