Commit 6ed822cf by 杨树贤

精度丢失问题

parent 55e7752d
......@@ -393,7 +393,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
tax := 1.13
//var showPriceRatioList []model.PriceRatio
var showPriceRatioList []model.PriceRatio
for key, price := range sku.LadderPrice {
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
......@@ -452,6 +452,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//处理人民币
data[key].PriceCn = c.MyRound(priceCn, 4)
data[key].PriceCostCn = priceCostCn
showPriceRatioList = append(showPriceRatioList, model.PriceRatio{
Ratio: priceRatio.Ratio,
RatioUsd: priceRatio.RatioUsd,
})
sku.PriceRatio = showPriceRatioList
//处理活动价和原价相同的情况
if (sku.GoodsType == 1 || sku.GoodsType == 2 || sku.GoodsType == 6) && sku.AcType > 1 && sku.Ratio > 0 {
priceAc := c.MyRound(c.MulFloat(data[key].PriceCn, (sku.Ratio/100)), 4)
......
......@@ -663,9 +663,8 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku, priceUs f
fmt.Println(rmbRatio, usRatio)
//人民币汇率转美金汇率
usRatio = c.MyRound(c.DivFloat(rmbRatio, usRatio), 4)
usRatio = c.MyRound(c.DivFloat(rmbRatio, usRatio), 6)
priceUs = c.MyRound(c.MulFloat(priceUs, usRatio), 4)
fmt.Println(priceUs)
}
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