From a3a802263a107d618b73426087a27194eccb5fff Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期三, 27 十二月 2023 16:10:38 +0800
Subject: [PATCH] 销售明细和报价单修改

---
 api/v1/quotation.go |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/api/v1/quotation.go b/api/v1/quotation.go
index d237955..e1cf09f 100644
--- a/api/v1/quotation.go
+++ b/api/v1/quotation.go
@@ -9,6 +9,7 @@
 	"aps_crm/pkg/ecode"
 	"aps_crm/utils"
 	"github.com/gin-gonic/gin"
+	"github.com/shopspring/decimal"
 )
 
 type QuotationApi struct{}
@@ -195,6 +196,14 @@
 		return
 	}
 
+	for _, quotation := range quotations {
+		amount := decimal.NewFromInt(0)
+		for _, product := range quotation.Products {
+			amount = amount.Add(product.Total)
+		}
+		quotation.AmountTotal = amount
+	}
+
 	ctx.OkWithDetailed(response.QuotationResponse{
 		List:  quotations,
 		Count: int(total),

--
Gitblit v1.8.0