Initial project commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
export const formatSpotPrice = (spot) => {
|
||||
if (!spot) {
|
||||
return { label: "", isFree: false };
|
||||
}
|
||||
|
||||
if (spot.is_free) {
|
||||
return { label: "免费", isFree: true };
|
||||
}
|
||||
|
||||
const min = spot.price_min;
|
||||
const max = spot.price_max;
|
||||
|
||||
if (min != null && max != null) {
|
||||
if (Number(min) === Number(max)) {
|
||||
return { label: `收费 ¥${min}`, isFree: false };
|
||||
}
|
||||
return { label: `收费 ¥${min} - ¥${max}`, isFree: false };
|
||||
}
|
||||
|
||||
if (min != null || max != null) {
|
||||
return { label: `收费 ¥${min ?? max}`, isFree: false };
|
||||
}
|
||||
|
||||
return { label: "收费", isFree: false };
|
||||
};
|
||||
Reference in New Issue
Block a user