| | |
| | | PaidAmount decimal.Decimal `json:"paidAmount" form:"paidAmount" gorm:"type:decimal(12,2);not null;default '';comment:已付金额"` //已付金额 |
| | | } |
| | | |
| | | func (Purchase) TableName() string { |
| | | return "srm_purchase" |
| | | } |
| | | |
| | | type OrderStatus int |
| | | |
| | | const ( |
| | |
| | | func (slf Purchase) CalcRealTotalPrice() decimal.Decimal { |
| | | totalPrice := slf.TotalPrice |
| | | if slf.WholeDiscountType == WholeDiscountTypePercent { |
| | | totalPrice = totalPrice.Mul(slf.WholeDiscount).Div(decimal.NewFromInt(100)) |
| | | totalPrice = totalPrice.Mul(decimal.NewFromInt(1).Sub(slf.WholeDiscount.Div(decimal.NewFromInt(100)))) |
| | | } else if slf.WholeDiscountType == WholeDiscountTypeDiscount { |
| | | totalPrice = totalPrice.Sub(slf.WholeDiscount) |
| | | } |