Commit e1f4d532 by 杨树贤

修复逻辑

parent e0717e04
...@@ -454,12 +454,12 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -454,12 +454,12 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//这里是去取实时美金汇率,并且计算人民币价格 //这里是去取实时美金汇率,并且计算人民币价格
var usdRatio float64 var usdRatio float64
if sku.CustomizeRateRMB != 0 { if sku.CustomizeRateRMB != 0 {
usdRatio = sku.CustomizeRateRMB priceCostCn = c.MulFloat(price.PriceCn, 1, tax)
} else { } else {
usdRatio, _ = redis.Float64(redisCon.Do("HGET", "erp_rate", 2)) usdRatio, _ = redis.Float64(redisCon.Do("HGET", "erp_rate", 2))
}
priceCostCn = c.MulFloat(price.PriceUs, usdRatio, tax) priceCostCn = c.MulFloat(price.PriceUs, usdRatio, tax)
} }
}
priceCostCn = c.MulFloat(c.MyRound(priceCostCn, 4), sku.DiscountRatio.Ratio) priceCostCn = c.MulFloat(c.MyRound(priceCostCn, 4), sku.DiscountRatio.Ratio)
priceCostCn = c.MyRound(priceCostCn, 4) priceCostCn = c.MyRound(priceCostCn, 4)
//人民币售价 //人民币售价
......
...@@ -667,6 +667,21 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS ...@@ -667,6 +667,21 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
//自定义汇率优先级最高 //自定义汇率优先级最高
customizeRateRmb := gjson.Get(currencyConfig, "customize_rate_rmb").Float() customizeRateRmb := gjson.Get(currencyConfig, "customize_rate_rmb").Float()
customizeRateUsd := gjson.Get(currencyConfig, "customize_rate_usd").Float() customizeRateUsd := gjson.Get(currencyConfig, "customize_rate_usd").Float()
if customizeRateRmb != 0 {
//因为计算人民币价格的逻辑不在这里,所以记录下来,提供给计算人民币价格的逻辑
sku.CustomizeRateRMB = customizeRateRmb
for index, price := range sku.LadderPrice {
priceUs := price.PriceUs
priceCn := c.MyRound(c.MulFloat(priceUs, customizeRateRmb), 4)
if hasTax {
priceCn = c.MyRound(c.DivFloat(priceCn, 1.13), 4)
}
sku.LadderPrice[index].PriceCn = priceCn
sku.OriginalPrice[index].PriceCn = priceCn
}
}
if customizeRateUsd != 0 { if customizeRateUsd != 0 {
for index, price := range sku.LadderPrice { for index, price := range sku.LadderPrice {
priceUs := price.PriceUs priceUs := price.PriceUs
...@@ -679,11 +694,6 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS ...@@ -679,11 +694,6 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
} }
} }
if customizeRateRmb != 0 {
//因为计算人民币价格的逻辑不在这里,所以记录下来,提供给计算人民币价格的逻辑
sku.CustomizeRateRMB = customizeRateRmb
}
if customizeRateUsd == 0 { if customizeRateUsd == 0 {
//这里进行转换,因为这里都只能取到对应的币种转人民币的比率,我们没有直接各种币种转美金的数据,所以我这边要 //这里进行转换,因为这里都只能取到对应的币种转人民币的比率,我们没有直接各种币种转美金的数据,所以我这边要
//先根据对应币种转人民币,然后根据人民币转美金,才能得到不同币种对应美金的汇率 //先根据对应币种转人民币,然后根据人民币转美金,才能得到不同币种对应美金的汇率
......
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