1. 推广员功能增强
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
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (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
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
This commit is contained in:
60
apps/web-antd/src/utils/chinesePrescriptionMargin.ts
Normal file
60
apps/web-antd/src/utils/chinesePrescriptionMargin.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
|
||||
* 中药处方毛利率计算(仅商品计费,不含诊疗费/加工费)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
export function isSeeRateEnabled(seeRate: unknown): boolean {
|
||||
|
||||
return Number(seeRate) === 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function isValidBuyPrice(value: unknown): boolean {
|
||||
|
||||
if (value === null || value === undefined || value === '') {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
const n = Number(value);
|
||||
|
||||
return !Number.isNaN(n);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function calcItemMarginPercent(
|
||||
|
||||
price: number | string | undefined,
|
||||
|
||||
buyPrice: number | string | undefined,
|
||||
|
||||
): string {
|
||||
|
||||
const p = Number(price);
|
||||
|
||||
if (!p || p <= 0 || !isValidBuyPrice(buyPrice)) {
|
||||
|
||||
return '--';
|
||||
|
||||
}
|
||||
|
||||
const b = Number(buyPrice);
|
||||
|
||||
return (((p - b) / p) * 100).toFixed(2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface ChineseDrugMarginRow {
|
||||
|
||||
price?: number | string;
|
||||
|
||||
Reference in New Issue
Block a user