diff --git a/.cursor/rules/Code-Standards.mdc b/.cursor/rules/Code-Standards.mdc new file mode 100644 index 0000000..99af2df --- /dev/null +++ b/.cursor/rules/Code-Standards.mdc @@ -0,0 +1,9 @@ +--- +description: +alwaysApply: true +--- + +1. 写代码的时候要补充详细的中文注释(每个方法是干嘛的,为什么要这样写),如果是工作区,则所有项目都适用该规则 +2. 注意不要生成太多的空行,上一部分代码和下一部分代码中间的空行不要大于2行 +3. 有封装好的方法、组件需要复用,不要重复造轮子 +4. 小程序端的抽屉全部需要用page-container来防止用户意外退出页面 diff --git a/.gitignore b/.gitignore index 797bf55..a16a244 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,5 @@ dist /.hbuilderx/ /.idea/ /database/ -/utils/utils.js \ No newline at end of file +/utils/utils.js +/.cursor/skills/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index ae45ba1..f7f6408 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -14,7 +14,7 @@ diff --git a/request/api/specialPrescription.js b/request/api/specialPrescription.js index 0a012aa..097b55d 100644 --- a/request/api/specialPrescription.js +++ b/request/api/specialPrescription.js @@ -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, }) diff --git a/subPackages/doctor/doctor-userinfo.vue b/subPackages/doctor/doctor-userinfo.vue index 333a455..7c2dd3d 100644 --- a/subPackages/doctor/doctor-userinfo.vue +++ b/subPackages/doctor/doctor-userinfo.vue @@ -191,11 +191,16 @@ export default { } this.delegateStoreId = e.delegate_store_id || ''; if (e.special_prescription_id) { - saveSpecialPrescriptionRegisterContext({ + const spCtx = { special_prescription_id: e.special_prescription_id, dose_count: e.special_prescription_dose_count || 1, 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); }, diff --git a/subPackages/register/register-success.vue b/subPackages/register/register-success.vue index 32e4734..1d07c54 100644 --- a/subPackages/register/register-success.vue +++ b/subPackages/register/register-success.vue @@ -32,11 +32,15 @@ onLoad(e) { this.register_id = e.id if (e.special_prescription_id) { - saveSpecialPrescriptionRegisterContext({ + const spCtx = { special_prescription_id: e.special_prescription_id, dose_count: e.special_prescription_dose_count || 1, 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() }, diff --git a/subPackages/special-prescription/detail.vue b/subPackages/special-prescription/detail.vue index b808f2a..dfaefff 100644 --- a/subPackages/special-prescription/detail.vue +++ b/subPackages/special-prescription/detail.vue @@ -3,19 +3,19 @@ - + - + - - - - - ¥ - {{ detail.price_per_dose }} - /贴 + + + + + + + + + ¥ + {{ detail.price_per_dose }} + /贴 + + + 暂无报价 + + + + 已售 {{ detail.sales_count }} + + - - 暂无报价 + + + + + {{ detail.name }} + + + + + {{ tag }} + + - 已售 {{ detail.sales_count }} + + - {{ detail.name }} - - - {{ tag }} + + + + + 详情介绍 + + + + + + + - - - 详情介绍 - - - - - - - - - + - + + > + 去挂号选方 + @@ -84,45 +107,98 @@ - + + - 确认贴数 - - + + + + ¥ + {{ unitPrice }} + /贴 + + + 已选:{{ selectedSkuId === 0 ? '自定义贴数' : (selectedSku ? selectedSku.sku_name : '') }} {{ doseCount }}贴 + - - 贴数 - - + + + + + + + 自定义贴数 + + ¥{{ customSkuDisplayPrice }} + - - 单价 - ¥{{ detail.price_per_dose }}/贴 - + + + + - - 预估金额 - ¥{{ totalPrice }} - + + + {{ sku.sku_name }} + ¥{{ sku.sale_price }} - + + + + + + + + + + + + + + + + + 预估金额 + + ¥ + {{ totalPrice }} + + + + @@ -131,6 +207,7 @@ + \ No newline at end of file