1. 特色方功能迭代

This commit is contained in:
李琦
2026-07-03 16:48:46 +08:00
parent cef264c692
commit fb0df465a1
7 changed files with 642 additions and 245 deletions

View File

@@ -0,0 +1,9 @@
---
description:
alwaysApply: true
---
1. 写代码的时候要补充详细的中文注释(每个方法是干嘛的,为什么要这样写),如果是工作区,则所有项目都适用该规则
2. 注意不要生成太多的空行上一部分代码和下一部分代码中间的空行不要大于2行
3. 有封装好的方法、组件需要复用,不要重复造轮子
4. 小程序端的抽屉全部需要用page-container来防止用户意外退出页面

3
.gitignore vendored
View File

@@ -117,4 +117,5 @@ dist
/.hbuilderx/ /.hbuilderx/
/.idea/ /.idea/
/database/ /database/
/utils/utils.js /utils/utils.js
/.cursor/skills/

View File

@@ -14,7 +14,7 @@
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues"> <option name="myValues">
<value> <value>
<list size="16"> <list size="17">
<item index="0" class="java.lang.String" itemvalue="nobr" /> <item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" /> <item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" /> <item index="2" class="java.lang.String" itemvalue="comment" />
@@ -31,6 +31,7 @@
<item index="13" class="java.lang.String" itemvalue="u-form-item" /> <item index="13" class="java.lang.String" itemvalue="u-form-item" />
<item index="14" class="java.lang.String" itemvalue="u-checkbox-group" /> <item index="14" class="java.lang.String" itemvalue="u-checkbox-group" />
<item index="15" class="java.lang.String" itemvalue="u-checkbox" /> <item index="15" class="java.lang.String" itemvalue="u-checkbox" />
<item index="16" class="java.lang.String" itemvalue="u-parse" />
</list> </list>
</value> </value>
</option> </option>

View File

@@ -49,13 +49,25 @@ export async function createSpecialPrescriptionPatientRecordApi(params) {
return await post('/special-prescription/create-patient-record', params, 3) 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) { export function saveSpecialPrescriptionRegisterContext(ctx) {
if (!ctx || !ctx.special_prescription_id) return 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, special_prescription_id: ctx.special_prescription_id,
dose_count: ctx.dose_count || 1, dose_count: ctx.dose_count != null ? ctx.dose_count : (prev.dose_count || 1),
doctor_id: ctx.doctor_id || '', 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() { export function getSpecialPrescriptionRegisterContext() {
@@ -80,6 +92,7 @@ export async function tryCreateSpecialPrescriptionPatientRecord(registerId) {
register_id: registerId, register_id: registerId,
special_prescription_id: ctx.special_prescription_id, special_prescription_id: ctx.special_prescription_id,
dose_count: ctx.dose_count || 1, dose_count: ctx.dose_count || 1,
sku_id: ctx.sku_id || 0,
store_id: uni.getStorageSync('store_id') || '11001', store_id: uni.getStorageSync('store_id') || '11001',
doctor_id: ctx.doctor_id, doctor_id: ctx.doctor_id,
}) })

View File

@@ -191,11 +191,16 @@ export default {
} }
this.delegateStoreId = e.delegate_store_id || ''; this.delegateStoreId = e.delegate_store_id || '';
if (e.special_prescription_id) { if (e.special_prescription_id) {
saveSpecialPrescriptionRegisterContext({ const spCtx = {
special_prescription_id: e.special_prescription_id, special_prescription_id: e.special_prescription_id,
dose_count: e.special_prescription_dose_count || 1, dose_count: e.special_prescription_dose_count || 1,
doctor_id: e.id || '', doctor_id: e.id || '',
}); };
// 仅 URL 带参时才写入 sku_id避免 0 覆盖 detail 页已保存的 SKU
if (e.special_prescription_sku_id != null && e.special_prescription_sku_id !== '') {
spCtx.sku_id = Number(e.special_prescription_sku_id);
}
saveSpecialPrescriptionRegisterContext(spCtx);
} }
this.setNavTitle(STEP1_TITLE); this.setNavTitle(STEP1_TITLE);
}, },

View File

@@ -32,11 +32,15 @@
onLoad(e) { onLoad(e) {
this.register_id = e.id this.register_id = e.id
if (e.special_prescription_id) { if (e.special_prescription_id) {
saveSpecialPrescriptionRegisterContext({ const spCtx = {
special_prescription_id: e.special_prescription_id, special_prescription_id: e.special_prescription_id,
dose_count: e.special_prescription_dose_count || 1, dose_count: e.special_prescription_dose_count || 1,
doctor_id: e.doctor_id || '', doctor_id: e.doctor_id || '',
}) }
if (e.special_prescription_sku_id != null && e.special_prescription_sku_id !== '') {
spCtx.sku_id = Number(e.special_prescription_sku_id)
}
saveSpecialPrescriptionRegisterContext(spCtx)
} }
this.bindSpecialPrescriptionRecord() this.bindSpecialPrescriptionRecord()
}, },

File diff suppressed because it is too large Load Diff