Commit 2a977c78 by 杨树贤

Merge branch 'ysx-特定专营供应商自动转换人民币-20250415' into dev

parents e7d262a2 ab8360bc
Showing with 16 additions and 1 deletions
...@@ -276,7 +276,6 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku { ...@@ -276,7 +276,6 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
}) })
sku.LadderPrice = generatedLadderPrice sku.LadderPrice = generatedLadderPrice
sku.PriceRatio = showPriceRatioList sku.PriceRatio = showPriceRatioList
return sku return sku
} }
// 成本价阶梯数 由最高库存计算得到 // 成本价阶梯数 由最高库存计算得到
...@@ -674,6 +673,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS ...@@ -674,6 +673,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
} }
hasTax := false hasTax := false
symbol := "$" symbol := "$"
usToCn := false
if currencyConfig != "" { if currencyConfig != "" {
currency = int(gjson.Get(currencyConfig, "currency").Int()) currency = int(gjson.Get(currencyConfig, "currency").Int())
if currency == 0 { if currency == 0 {
...@@ -681,6 +681,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS ...@@ -681,6 +681,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
} }
hasTax = gjson.Get(currencyConfig, "has_tax").Bool() hasTax = gjson.Get(currencyConfig, "has_tax").Bool()
symbol = gjson.Get(currencyConfig, "symbol").String() symbol = gjson.Get(currencyConfig, "symbol").String()
usToCn = gjson.Get(currencyConfig, "us_to_cn").Bool()
//自定义汇率优先级最高 //自定义汇率优先级最高
customizeRateRmb := gjson.Get(currencyConfig, "customize_rate_rmb").Float() customizeRateRmb := gjson.Get(currencyConfig, "customize_rate_rmb").Float()
...@@ -699,6 +700,19 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS ...@@ -699,6 +700,19 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
} }
} }
if customizeRateRmb == 0 {
for index, price := range sku.LadderPrice {
priceUs := price.PriceUs
//sku.OriginalPrice[index].PriceCn = priceCn
//这里面还要判断,如果是usToCn为true代表也要走美金转人民币的逻辑(前提是没有人民币价格)
if price.PriceCn == 0 && usToCn == true {
rmbRatio, _ := redis.Float64(redisCon.Do("HGET", "erp_rate", currency))
priceCn := c.MyRound(c.MulFloat(priceUs, rmbRatio), 4)
sku.LadderPrice[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
...@@ -708,6 +722,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS ...@@ -708,6 +722,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
} }
sku.LadderPrice[index].PriceUs = priceUs sku.LadderPrice[index].PriceUs = priceUs
sku.OriginalPrice[index].PriceUs = priceUs sku.OriginalPrice[index].PriceUs = 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