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