用户完善情况搜索,算一算价格修改
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"hepa-calc-admin-api/api/service"
|
||||
"hepa-calc-admin-api/global"
|
||||
"hepa-calc-admin-api/utils"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
@@ -569,7 +570,7 @@ func (b *Question) GetQuestionPrice(c *gin.Context) {
|
||||
|
||||
for _, question := range questions {
|
||||
// 总价
|
||||
price = price + question.Price
|
||||
price = price + math.Round(question.Price*100)/100
|
||||
|
||||
// 处理折扣价格
|
||||
if question.DiscountPrice != nil {
|
||||
@@ -580,19 +581,24 @@ func (b *Question) GetQuestionPrice(c *gin.Context) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if discountPrice == nil {
|
||||
discountPrice = question.DiscountPrice
|
||||
} else {
|
||||
d := *discountPrice + *question.DiscountPrice
|
||||
discountPrice = &d
|
||||
d := math.Round(*question.DiscountPrice * 100)
|
||||
|
||||
if discountPrice == nil {
|
||||
discountPrice = &d
|
||||
} else {
|
||||
d = d + *discountPrice
|
||||
discountPrice = &d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var g dto.QuestionPriceDto
|
||||
g.Price = price
|
||||
g.DiscountPrice = discountPrice
|
||||
if discountPrice != nil {
|
||||
u := *discountPrice / 100
|
||||
g.DiscountPrice = &u
|
||||
}
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user