Commit 87bc7803 by mushishixian

特殊供应商原始币种处理

parent 30795bf2
...@@ -612,3 +612,8 @@ func MulFloat(first float64, args ...float64) float64 { ...@@ -612,3 +612,8 @@ func MulFloat(first float64, args ...float64) float64 {
} }
return result return result
} }
//浮点除法
func DivFloat(first float64, second float64) float64 {
return ((first * 1000000000) / (second * 1000000000))
}
...@@ -508,6 +508,29 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -508,6 +508,29 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//$tax = config('website.tax'); //$tax = config('website.tax');
tax := 1.13 tax := 1.13
for key, price := range sku.LadderPrice { 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
}
if price.Purchases == 0 { if price.Purchases == 0 {
continue continue
} }
......
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