Commit d1b6f109 by 杨树贤

Merge branch 'master' into dev

parents 74a0d406 6bdd5ce6
......@@ -91,6 +91,7 @@ type LySku struct {
Coo string `json:"coo"`
Tariff float64 `json:"tariff"`
TariffFormat string `json:"tariff_format"`
AbilityLevel int `json:"ability_level"`
}
type DiscountRatio struct {
......@@ -283,6 +284,8 @@ func InitSkuData(sku string) (data LySku) {
data.Coo = gjson.Get(sku, "coo").String()
data.AbilityLevel = int(gjson.Get(sku,"ability_level").Int())
return
}
......
......@@ -566,8 +566,10 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
func (ls *LyService) GetTariffAndPrice(sku model.LySku) model.LySku {
if len(sku.LadderPrice) == 0 {
sku.Coo = ""
return sku
}
//判断场地是否是美国,是美国的话,输出关税率以及转换价格
//https://cf.ichunt.net/pages/viewpage.action?pageId=35326045
usLabelList := []string{
......@@ -583,6 +585,7 @@ func (ls *LyService) GetTariffAndPrice(sku model.LySku) model.LySku {
}
//先判断供应商对不对
if !c.CheckIntSliceContains(int(sku.SupplierId), usSupplierIdList) {
sku.Coo = ""
return sku
}
......@@ -591,12 +594,18 @@ func (ls *LyService) GetTariffAndPrice(sku model.LySku) model.LySku {
//判断原始人民币有没有价格,没有的话,那就是最终的人民币价格 X 2.25
var transformedLadderPrice []model.LadderPrice
transformedLadderPrice = sku.LadderPrice
//digikey暂时不处理
if sku.SupplierId != 7 {
for index, price := range sku.LadderPrice {
transformedLadderPrice[index].PriceCn = c.MyRound(c.MulFloat(price.PriceCn,2.25),4)
transformedLadderPrice[index].PriceAc = c.MyRound(c.MulFloat(price.PriceAc,2.25),4)
transformedLadderPrice[index].PriceCn = c.MyRound(c.MulFloat(price.PriceCn, 2.25), 4)
transformedLadderPrice[index].PriceAc = c.MyRound(c.MulFloat(price.PriceAc, 2.25), 4)
}
}
sku.Tariff = 2.25
sku.TariffFormat = "125%"
} else {
sku.Coo = ""
}
return sku
......
......@@ -707,7 +707,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
//这里面还要判断,如果是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)
priceCn := c.MyRound(c.MulFloat(priceUs, rmbRatio, 1.13), 4)
sku.LadderPrice[index].PriceCn = priceCn
}
}
......
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