Compare commits
1 Commits
关羽
...
bug464-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c083cc698 |
@@ -473,15 +473,12 @@ function calculateTotalPrice() {
|
||||
}
|
||||
});
|
||||
totalPrice.value = sum.toFixed(2);
|
||||
// Bug #464: 零售价与诊疗子项合计总价实时同步
|
||||
// Bug #464: 零售价与诊疗子项合计总价实时同步,直接赋值不使用nextTick避免多调用方竞争
|
||||
const hasValidItem = treatmentItems.value.some(
|
||||
(item) => item.adviceDefinitionId && item.adviceDefinitionId !== ''
|
||||
);
|
||||
if (hasValidItem) {
|
||||
// 使用 nextTick 确保总价更新后零售价才更新,避免 Vue 响应式时序问题
|
||||
nextTick(() => {
|
||||
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
||||
});
|
||||
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
||||
} else {
|
||||
form.value.retailPrice = undefined;
|
||||
}
|
||||
@@ -763,10 +760,7 @@ function selectRow(row, index) {
|
||||
treatmentItems.value[index].adviceDefinitionId = row.id;
|
||||
treatmentItems.value[index].retailPrice = row.retailPrice || 0;
|
||||
medicineSearchKey.value = '';
|
||||
// 使用 nextTick 确保 DOM 更新后再计算总价
|
||||
nextTick(() => {
|
||||
calculateTotalPrice();
|
||||
});
|
||||
calculateTotalPrice();
|
||||
}
|
||||
|
||||
// 清空诊疗子项
|
||||
|
||||
Reference in New Issue
Block a user