예제 #1
0
파일: coupon.go 프로젝트: yonglehou/go2o
// 获取优惠的金额(四舍五入)
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)
}
예제 #2
0
파일: float.go 프로젝트: zoe527/go2o
func RoundAmount(amount float32) float32 {
	return math.Round32(amount, 2)
}