mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(CouponCell): fix discounted price (#7123)
This commit is contained in:
parent
d3a90c89fd
commit
afe4248799
@ -1,5 +1,5 @@
|
|||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace, isDef } from '../utils';
|
||||||
import { inherit } from '../utils/functional';
|
import { inherit } from '../utils/functional';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@ -26,7 +26,15 @@ function formatValue(props: CouponCellProps) {
|
|||||||
const coupon = coupons[+chosenCoupon];
|
const coupon = coupons[+chosenCoupon];
|
||||||
|
|
||||||
if (coupon) {
|
if (coupon) {
|
||||||
const value = coupon.value || coupon.denominations || 0;
|
let value = 0;
|
||||||
|
if (isDef(coupon.value)) {
|
||||||
|
({ value } = coupon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDef(coupon.denominations)) {
|
||||||
|
value = coupon.denominations!;
|
||||||
|
}
|
||||||
|
|
||||||
return `-${currency} ${(value / 100).toFixed(2)}`;
|
return `-${currency} ${(value / 100).toFixed(2)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user