Beispiel #1
0
// 获取优惠的金额(四舍五入)
func (this *Coupon) GetCouponFee(orderFee float32) float32 {
	if float32(this._detailsValue.MinFee) > orderFee {
		return 0
	}
	var couponFee float32

	if this._detailsValue.Fee != 0 {
		couponFee = couponFee + float32(this._detailsValue.Fee)
	}

	if this._detailsValue.Discount != 100 {
		couponFee = couponFee + orderFee*
			(float32(100-this._detailsValue.Discount)/100)
	}
	return math.Round32(couponFee, 2)
}
Beispiel #2
0
func RoundAmount(amount float32) float32 {
	return math.Round32(amount, 2)
}