1. 特色方功能迭代(固定价格),固定价格目前统一使用药品id(-102),后期会考虑新增特色方的时候自动添加一个特色方药品
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
2. 退款的时候可以退回分成
This commit is contained in:
@@ -67,3 +67,35 @@ export function calculateChineseProductPriceLikeBackend(
|
||||
export function formatPriceDisplay(value: unknown): string {
|
||||
return formatPriceLikeBackend(value).toFixed(2);
|
||||
}
|
||||
|
||||
type ProcessRuleLine = {
|
||||
calc_method?: number;
|
||||
price?: unknown;
|
||||
};
|
||||
|
||||
/**
|
||||
* 计算委托调剂加工费(与移动端 PrescriptionCalculator.calculateProcessingFee 一致)
|
||||
* calc_method: 1=固定价格,2=按剂数,3=按数量
|
||||
*/
|
||||
export function calculateProcessingFee(
|
||||
processRule: ProcessRuleLine | null | undefined,
|
||||
dosage = 7,
|
||||
totalDrugQuantity = 0,
|
||||
): number {
|
||||
if (!processRule?.calc_method) {
|
||||
return 0;
|
||||
}
|
||||
const price = parsePriceValue(processRule.price);
|
||||
const dose = parsePriceValue(dosage);
|
||||
const qty = parsePriceValue(totalDrugQuantity);
|
||||
switch (processRule.calc_method) {
|
||||
case 1:
|
||||
return price;
|
||||
case 2:
|
||||
return price * dose;
|
||||
case 3:
|
||||
return price * dose * qty;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user