Commit 69700e20 by mushishixian

原始价问题

parent 87bc7803
......@@ -189,6 +189,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
flag := 0
data := make([]model.LadderPrice, len(sku.LadderPrice))
var originalPrice []model.OriginPrice
//专卖
if sku.SupplierId == 17 {
ladderPrice := sku.LadderPrice
......@@ -510,27 +511,13 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
for key, price := range sku.LadderPrice {
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
switch sku.SupplierId {
case 6:
fmt.Println("特殊处理,原始美金价为 : ", price.PriceUs)
customRate := 7.85 //港币转美金
price.PriceUs = c.MyRound(c.DivFloat(price.PriceUs, customRate), 4)
fmt.Println("特殊处理后的美金价为 : ", price.PriceUs)
break
case 21:
fmt.Println("特殊处理,原始美金价为 : ", price.PriceUs)
customRate := coefficient.Ratio //人民币转美金
price.PriceUs = c.MyRound(c.DivFloat(price.PriceUs, customRate), 4)
fmt.Println("特殊处理后的美金价为 : ", price.PriceUs)
break
case 1676:
fmt.Println("特殊处理,原始美金价为 : ", price.PriceUs)
customRate := 0.93 //欧元转美金
price.PriceUs = c.MyRound(c.DivFloat(price.PriceUs, customRate), 4)
fmt.Println("特殊处理后的美金价为 : ", price.PriceUs)
break
}
price.PriceUs = ls.TransformSpecialSupplierPrice(sku.SupplierId, price.PriceUs, coefficient.Ratio)
originalPrice = append(originalPrice, model.OriginPrice{
PriceUs: price.PriceUs,
Purchases: price.Purchases,
PriceCn: price.PriceCn,
})
fmt.Println(originalPrice)
if price.Purchases == 0 {
continue
}
......@@ -613,6 +600,12 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
}
}
//判断原始价格有变化,那就要覆盖
if len(originalPrice) > 0 {
sku.Original = originalPrice
}
//输出税费到前端
coefficient.Tax = tax
sku.Coefficient = coefficient
......
package service
import (
"fmt"
"go_sku_server/model"
c "go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"strconv"
"strings"
......@@ -227,3 +229,29 @@ func getMouserActivityPrice(sku model.LySku) model.LySku {
}
return sku
}
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
func (ls *LyService) TransformSpecialSupplierPrice(supplierId int64, priceUs float64, usRatio float64) float64 {
switch supplierId {
case 6:
fmt.Println("特殊处理,原始美金价为 : ", priceUs)
customRate := 7.85 //港币转美金
priceUs = c.MyRound(c.DivFloat(priceUs, customRate), 4)
fmt.Println("特殊处理后的美金价为 : ", priceUs)
break
case 21:
fmt.Println("特殊处理,原始美金价为 : ", priceUs)
customRate := usRatio //人民币转美金
priceUs = c.MyRound(c.DivFloat(priceUs, customRate), 4)
fmt.Println("特殊处理后的美金价为 : ", priceUs)
break
case 1676:
fmt.Println("特殊处理,原始美金价为 : ", priceUs)
customRate := 0.93 //欧元转美金
priceUs = c.MyRound(c.DivFloat(priceUs, customRate), 4)
fmt.Println("特殊处理后的美金价为 : ", priceUs)
break
}
return priceUs
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment