Pārlūkot izejas kodu

feature(结算): 取消计算折扣

likai 4 gadi atpakaļ
vecāks
revīzija
21c3bb7793
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7 1
      service/settle_account_main/settle_account_main.go

+ 7 - 1
service/settle_account_main/settle_account_main.go

@@ -282,7 +282,13 @@ func (s Service) Cancel(req accountModel.AccountMainCancelReq) error {
 
 	main.ActualMachineHour = 0
 	for _, item := range details {
-		detail.PaymentAccount += item.PaymentAccount * per
+		// 计算费用
+		discount := float64(1) // 计算折扣
+		if item.Data5 != "" {
+			d, _ := strconv.ParseFloat(item.Data5, 64)
+			discount = 1 - d / 100
+		}
+		detail.PaymentAccount += item.PaymentAccount * discount * per
 	}
 
 	oldAmount := main.TotalPrice