Commit 69700e20 by mushishixian

原始价问题

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