更新
This commit is contained in:
@@ -5,10 +5,16 @@
|
||||
|
||||
export type FormulaType = '主方' | '辅方'
|
||||
|
||||
/** 药师身份来自当前业务订单本次有效的签署审核,不回退到开方医生或历史审核人。 */
|
||||
export const DEFAULT_PHARMACIST_SIGNATURE =
|
||||
'https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/images/20261117/202611171443119d5159658.png'
|
||||
|
||||
/** 笺面优先使用本次有效审核签名;缺省使用默认图片,仅供展示,不写回审核记录。 */
|
||||
export function rxPharmacistSignature(data: Record<string, any> | null | undefined): string {
|
||||
if (Number(data?.prescription_audit_status) !== 1) return ''
|
||||
return String(data?.prescription_audit_signature || '').trim()
|
||||
if (!data) return ''
|
||||
const signature = Number(data.prescription_audit_status) === 1
|
||||
? String(data.prescription_audit_signature || '').trim()
|
||||
: ''
|
||||
return signature || DEFAULT_PHARMACIST_SIGNATURE
|
||||
}
|
||||
|
||||
export type SlipHerb = {
|
||||
|
||||
@@ -60,19 +60,7 @@
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">供货方式</span>
|
||||
<div
|
||||
v-for="tab in supplyModeTabs"
|
||||
:key="'sm-' + String(tab.value)"
|
||||
:class="[
|
||||
'px-4 py-1.5 rounded-lg cursor-pointer transition-all duration-200 select-none text-sm',
|
||||
queryParams.supply_mode === tab.value
|
||||
? 'bg-primary text-white shadow-md'
|
||||
: 'bg-gray-50 text-gray-600 hover:bg-gray-100'
|
||||
]"
|
||||
@click="handleSupplyModeTabClick(tab.value)"
|
||||
>
|
||||
<span class="font-medium">{{ tab.label }}</span>
|
||||
</div>
|
||||
<span class="px-4 py-1.5 rounded-lg bg-primary text-white text-sm font-medium">甘草</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">快递方式</span>
|
||||
@@ -2450,18 +2438,6 @@ function handleFulfillmentStatusTabClick(value: number | '') {
|
||||
|
||||
const activeFocusKey = ref<'' | 'pendingRx' | 'pendingPay' | 'pendingShip' | 'risk'>('')
|
||||
|
||||
const supplyModeTabs = [
|
||||
{ label: '全部', value: '' as '' | 'gancao' | 'direct' | 'self' },
|
||||
{ label: '甘草', value: 'gancao' as const },
|
||||
{ label: '洛阳直发', value: 'direct' as const },
|
||||
{ label: '自营', value: 'self' as const }
|
||||
]
|
||||
|
||||
function handleSupplyModeTabClick(value: '' | 'gancao' | 'direct' | 'self') {
|
||||
queryParams.supply_mode = value
|
||||
resetPage()
|
||||
}
|
||||
|
||||
const expressCompanyTabs = [
|
||||
{ label: '全部', value: '' as '' | 'sf' | 'jd' },
|
||||
{ label: '顺丰', value: 'sf' as const },
|
||||
@@ -2491,8 +2467,6 @@ const queryParams = reactive({
|
||||
fulfillment_status: '' as number | '',
|
||||
prescription_audit_status: '' as number | '',
|
||||
payment_slip_audit_status: '' as number | '',
|
||||
/** 供货方式:甘草 / 洛阳直发(含未上传)/ 自营 */
|
||||
supply_mode: '' as '' | 'gancao' | 'direct' | 'self',
|
||||
/** 服务渠道:'' 不限;'0' 未指派(库内 '' 或 '0') */
|
||||
service_channel: '' as '' | '0',
|
||||
/** 是否含辅方:'' 不限;'1' 含辅方;'0' 不含辅方 */
|
||||
@@ -2582,7 +2556,8 @@ const onTimeTypeChange = () => handleTimeTypeChange(handleQuery)
|
||||
const onCustomDateChange = () => handleCustomDateChange(handleQuery)
|
||||
|
||||
function normalizePrescriptionOrderListQuery(params: Record<string, unknown>): Record<string, unknown> {
|
||||
const p: Record<string, unknown> = { ...params }
|
||||
// 本列表及导出固定展示甘草、金额低于 2000 元的订单,重置筛选时仍保留。
|
||||
const p: Record<string, unknown> = { ...params, supply_mode: 'gancao', amount_lt: 2000 }
|
||||
if (p.prescription_id === '' || p.prescription_id === undefined) {
|
||||
delete p.prescription_id
|
||||
} else {
|
||||
@@ -2611,9 +2586,6 @@ function normalizePrescriptionOrderListQuery(params: Record<string, unknown>): R
|
||||
} else {
|
||||
p.payment_slip_audit_status = Number(p.payment_slip_audit_status)
|
||||
}
|
||||
if (!p.supply_mode || p.supply_mode === '') {
|
||||
delete p.supply_mode
|
||||
}
|
||||
if (p.doctor_id === '' || p.doctor_id === undefined || p.doctor_id === null) {
|
||||
delete p.doctor_id
|
||||
} else {
|
||||
@@ -2885,7 +2857,6 @@ function handleReset() {
|
||||
queryParams.fulfillment_status = ''
|
||||
queryParams.prescription_audit_status = ''
|
||||
queryParams.payment_slip_audit_status = ''
|
||||
queryParams.supply_mode = ''
|
||||
queryParams.service_channel = ''
|
||||
queryParams.has_aux_formula = ''
|
||||
queryParams.audit_admin_id = ''
|
||||
|
||||
@@ -62,19 +62,7 @@
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">供货方式</span>
|
||||
<div
|
||||
v-for="tab in supplyModeTabs"
|
||||
:key="'sm-' + String(tab.value)"
|
||||
:class="[
|
||||
'px-4 py-1.5 rounded-lg cursor-pointer transition-all duration-200 select-none text-sm',
|
||||
queryParams.supply_mode === tab.value
|
||||
? 'bg-primary text-white shadow-md'
|
||||
: 'bg-gray-50 text-gray-600 hover:bg-gray-100'
|
||||
]"
|
||||
@click="handleSupplyModeTabClick(tab.value)"
|
||||
>
|
||||
<span class="font-medium">{{ tab.label }}</span>
|
||||
</div>
|
||||
<span class="px-4 py-1.5 rounded-lg bg-primary text-white text-sm font-medium">甘草</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">快递方式</span>
|
||||
@@ -2965,18 +2953,6 @@ function handleFulfillmentStatusTabClick(value: number | '') {
|
||||
|
||||
const activeFocusKey = ref<'' | 'pendingRx' | 'pendingPay' | 'pendingShip' | 'risk'>('')
|
||||
|
||||
const supplyModeTabs = [
|
||||
{ label: '全部', value: '' as '' | 'gancao' | 'direct' | 'self' },
|
||||
{ label: '甘草', value: 'gancao' as const },
|
||||
{ label: '洛阳直发', value: 'direct' as const },
|
||||
{ label: '自营', value: 'self' as const }
|
||||
]
|
||||
|
||||
function handleSupplyModeTabClick(value: '' | 'gancao' | 'direct' | 'self') {
|
||||
queryParams.supply_mode = value
|
||||
resetPage()
|
||||
}
|
||||
|
||||
const expressCompanyTabs = [
|
||||
{ label: '全部', value: '' as '' | 'sf' | 'jd' },
|
||||
{ label: '顺丰', value: 'sf' as const },
|
||||
@@ -3006,8 +2982,6 @@ const queryParams = reactive({
|
||||
fulfillment_status: '' as number | '',
|
||||
prescription_audit_status: '' as number | '',
|
||||
payment_slip_audit_status: '' as number | '',
|
||||
/** 供货方式:甘草 / 洛阳直发(含未上传)/ 自营 */
|
||||
supply_mode: '' as '' | 'gancao' | 'direct' | 'self',
|
||||
/** 下单人(关联操作日志 audit_rx_* / audit_pay_*) */
|
||||
audit_admin_id: '' as number | ''
|
||||
})
|
||||
@@ -3086,7 +3060,8 @@ const onCustomDateChange = () => handleCustomDateChange(handleQuery)
|
||||
|
||||
async function fetchLists(params: Record<string, unknown>) {
|
||||
const [start_time, end_time] = resolveCreateTimeRange()
|
||||
const p: Record<string, unknown> = { ...params, start_time, end_time }
|
||||
// 与桌面列表保持一致,查询、翻页和重置均保留固定展示范围。
|
||||
const p: Record<string, unknown> = { ...params, start_time, end_time, supply_mode: 'gancao', amount_lt: 2000 }
|
||||
if (p.prescription_id === '' || p.prescription_id === undefined) {
|
||||
delete p.prescription_id
|
||||
} else {
|
||||
@@ -3101,9 +3076,6 @@ async function fetchLists(params: Record<string, unknown>) {
|
||||
if (p.payment_slip_audit_status === '' || p.payment_slip_audit_status === undefined) {
|
||||
delete p.payment_slip_audit_status
|
||||
}
|
||||
if (!p.supply_mode || p.supply_mode === '') {
|
||||
delete p.supply_mode
|
||||
}
|
||||
if (p.doctor_id === '' || p.doctor_id === undefined || p.doctor_id === null) {
|
||||
delete p.doctor_id
|
||||
} else {
|
||||
@@ -3323,7 +3295,6 @@ function handleReset() {
|
||||
queryParams.fulfillment_status = ''
|
||||
queryParams.prescription_audit_status = ''
|
||||
queryParams.payment_slip_audit_status = ''
|
||||
queryParams.supply_mode = ''
|
||||
queryParams.audit_admin_id = ''
|
||||
resetParams()
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ const { parse, compileScript, compileTemplate } = require('@vue/compiler-sfc')
|
||||
const root = path.resolve(__dirname, '../src')
|
||||
const signature = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4z8DwHwAFgAI/ScLbtAAAAABJRU5ErkJggg=='
|
||||
const oldSignature = 'data:image/png;base64,old-order-signature'
|
||||
const defaultSignature = 'https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/images/20261117/202611171443119d5159658.png'
|
||||
const signedOrder = () => ({
|
||||
id: 42, prescription_id: 8, fulfillment_status: 1, prescription_audit_status: 1,
|
||||
prescription_audit_signature: signature, prescription_audit_signed_name: '本单药师',
|
||||
@@ -128,6 +129,7 @@ for (const page of ['order_list.vue', 'order_list_h5.vue']) {
|
||||
const html = await renderedSlip(state.prescriptionViewData.value, variant)
|
||||
assert.match(html, /<img[^>]*alt="药师签名"/)
|
||||
assert.ok(html.includes(`src="${signature}"`))
|
||||
assert.equal(html.includes(defaultSignature), false)
|
||||
assert.equal(html.includes('本单药师'), false)
|
||||
assert.ok(html.indexOf('开方医师') < html.indexOf('药师签名'))
|
||||
}
|
||||
@@ -145,7 +147,7 @@ for (const page of ['order_list.vue', 'order_list_h5.vue']) {
|
||||
assert.equal(html.includes(oldSignature), false)
|
||||
})
|
||||
|
||||
test(`${page}: pending, rejected, cancelled and refunded fresh orders remove stale pharmacist images from both slips`, async () => {
|
||||
test(`${page}: missing or invalid audit signatures show the default image without restoring stale signatures`, async () => {
|
||||
const stale = { ...basePrescription(), ...signedOrder(), id: 8 }
|
||||
for (const order of [
|
||||
{ ...signedOrder(), prescription_audit_status: 0 },
|
||||
@@ -159,7 +161,10 @@ for (const page of ['order_list.vue', 'order_list_h5.vue']) {
|
||||
assert.equal(state.prescriptionViewData.value.prescription_audit_signature, '')
|
||||
for (const variant of ['internal', 'user']) {
|
||||
const html = await renderedSlip(state.prescriptionViewData.value, variant)
|
||||
assert.equal(html.includes('alt="药师签名"'), false)
|
||||
assert.ok(html.includes(`src="${defaultSignature}"`))
|
||||
assert.ok(html.includes('alt="药师签名"'))
|
||||
assert.equal(html.includes(signature), false)
|
||||
assert.equal(html.includes(oldSignature), false)
|
||||
assert.equal(html.includes('本单药师'), false)
|
||||
}
|
||||
}
|
||||
@@ -179,7 +184,9 @@ for (const page of ['order_list.vue', 'order_list_h5.vue']) {
|
||||
setPrescription({ ...basePrescription(), ...signedOrder(), id: 8 })
|
||||
await state.confirmRevokeRxAudit({ id: 42 })
|
||||
assert.equal(state.prescriptionViewData.value.prescription_audit_signature, '')
|
||||
assert.equal((await renderedSlip(state.prescriptionViewData.value, 'user')).includes('alt="药师签名"'), false)
|
||||
const revokedHtml = await renderedSlip(state.prescriptionViewData.value, 'user')
|
||||
assert.ok(revokedHtml.includes(`src="${defaultSignature}"`))
|
||||
assert.equal(revokedHtml.includes(signature), false)
|
||||
})
|
||||
|
||||
test(`${page}: another order's detail and failed detail loads cannot borrow a cached signature`, async () => {
|
||||
|
||||
@@ -294,16 +294,21 @@ test('signature pad maps CSS coordinates once at high DPR and preserves strokes
|
||||
assert.equal(props.modelValue, signature)
|
||||
})
|
||||
|
||||
test('prescription slip only displays the pharmacist signature for the current signed approval', () => {
|
||||
test('prescription slip prefers the current signed approval and uses the default image when missing', () => {
|
||||
const source = fs.readFileSync(path.join(root, 'src/components/prescription-slip/utils.ts'), 'utf8')
|
||||
const { rxPharmacistSignature } = loadModule(source, () => { throw new Error('unexpected import') })
|
||||
const defaultSignature = 'https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/images/20261117/202611171443119d5159658.png'
|
||||
const signed = { prescription_audit_status: 1, prescription_audit_signature: signature, prescription_audit_signed_name: ' 李药师 ', doctor_name: '王医生' }
|
||||
assert.equal(rxPharmacistSignature(signed), signature)
|
||||
assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_status: '1' }), signature)
|
||||
for (const status of [0, 2, null, undefined]) assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_status: status }), '')
|
||||
assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_signature: '' }), '')
|
||||
for (const status of [0, 2, null, undefined]) assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_status: status }), defaultSignature)
|
||||
for (const missing of ['', ' ', null, undefined]) {
|
||||
assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_signature: missing }), defaultSignature)
|
||||
}
|
||||
assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_signed_name: '' }), signature)
|
||||
assert.equal(rxPharmacistSignature({ doctor_name: '王医生' }), '')
|
||||
assert.equal(rxPharmacistSignature({ doctor_name: '王医生' }), defaultSignature)
|
||||
assert.equal(rxPharmacistSignature(null), '')
|
||||
assert.equal(rxPharmacistSignature(undefined), '')
|
||||
component('components/prescription-slip/index.vue')
|
||||
component('views/consumer/prescription/components/AuditSignatureRecord.vue')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user