1. 特色方功能迭代
This commit is contained in:
@@ -49,13 +49,25 @@ export async function createSpecialPrescriptionPatientRecordApi(params) {
|
||||
return await post('/special-prescription/create-patient-record', params, 3)
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存特色方挂号上下文(merge 已有值,避免后续页面未传 sku_id 时覆盖为 0)
|
||||
* @param ctx {{ special_prescription_id, dose_count?, sku_id?, doctor_id? }}
|
||||
*/
|
||||
export function saveSpecialPrescriptionRegisterContext(ctx) {
|
||||
if (!ctx || !ctx.special_prescription_id) return
|
||||
uni.setStorageSync(SPECIAL_PRESCRIPTION_STORAGE_KEY, {
|
||||
const prev = getSpecialPrescriptionRegisterContext() || {}
|
||||
const merged = {
|
||||
special_prescription_id: ctx.special_prescription_id,
|
||||
dose_count: ctx.dose_count || 1,
|
||||
doctor_id: ctx.doctor_id || '',
|
||||
})
|
||||
dose_count: ctx.dose_count != null ? ctx.dose_count : (prev.dose_count || 1),
|
||||
doctor_id: ctx.doctor_id != null ? ctx.doctor_id : (prev.doctor_id || ''),
|
||||
}
|
||||
// 未传 sku_id 字段时保留 storage 已有值,防止中间页覆盖为 0
|
||||
if (Object.prototype.hasOwnProperty.call(ctx, 'sku_id')) {
|
||||
merged.sku_id = Number(ctx.sku_id) || 0
|
||||
} else {
|
||||
merged.sku_id = Number(prev.sku_id) || 0
|
||||
}
|
||||
uni.setStorageSync(SPECIAL_PRESCRIPTION_STORAGE_KEY, merged)
|
||||
}
|
||||
|
||||
export function getSpecialPrescriptionRegisterContext() {
|
||||
@@ -80,6 +92,7 @@ export async function tryCreateSpecialPrescriptionPatientRecord(registerId) {
|
||||
register_id: registerId,
|
||||
special_prescription_id: ctx.special_prescription_id,
|
||||
dose_count: ctx.dose_count || 1,
|
||||
sku_id: ctx.sku_id || 0,
|
||||
store_id: uni.getStorageSync('store_id') || '11001',
|
||||
doctor_id: ctx.doctor_id,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user