Commit 0a8fd74e by 杨树贤

兼容销售限价

parent 9bc09bdb
Showing with 38 additions and 20 deletions
...@@ -185,27 +185,39 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -185,27 +185,39 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku.CustomPriceList, _ = customPriceService.getCustomPriceList(sku) sku.CustomPriceList, _ = customPriceService.getCustomPriceList(sku)
} }
case 3: case 3:
//如果是寄售的,也不走价格体系 //如果是寄售的,不走价格体系
if sku.Source != 12 { if sku.Source == 12 {
//这里还有个特殊判断,要兼容华云改价格体系之前的老数据 break
//判断组织是3并且阶梯价数量为2的就是老数据 }
//兼容最近的价格配置,即上传了成本价(阶梯数量0) + 会员价(阶梯数量1) + 企业价(阶梯数量2) //这里还有个特殊判断,要兼容华云改价格体系之前的老数据
if (sku.OrgId == 3 && len(sku.LadderPrice) == 2) || (sku.OrgId == 3 && len(sku.LadderPrice) == 3 && sku.LadderPrice[0].Purchases == 0) { //判断组织是3并且阶梯价数量为2,并且第一个阶梯不是0的就是老数据
priceService := PriceService{} //兼容最近的价格配置,即上传了成本价(阶梯数量0) + 会员价(阶梯数量1) + 企业价(阶梯数量2)
sku.LadderPrice = priceService.GetIEdgePrice(sku.LadderPrice) //又要兼容新的价格配置,即上传了成本价(阶梯数量0) + 会员价(阶梯数量1) + 企业价(阶梯数量2) + 销售限价(阶梯数量3)
} else { //还有一种特殊情况,那就是只上传成本价和销售限价,那么就是要走价格体系的(最新)
//这里猎芯和华云都是走同一套的价格体系了 if (sku.OrgId == 3 && len(sku.LadderPrice) == 2 && sku.LadderPrice[0].Purchases != 0) ||
//获取系数和价格 (sku.OrgId == 3 && len(sku.LadderPrice) == 3 && sku.LadderPrice[0].Purchases == 0) ||
sku = ls.GetCoefficientAndPrice(sku) (sku.OrgId == 3 && len(sku.LadderPrice) == 4 && sku.LadderPrice[0].Purchases == 0) {
//获取自定义价格后的阶梯价 priceService := PriceService{}
customPriceService := CustomPrice{} sku.LadderPrice = priceService.GetIEdgePrice(sku.LadderPrice)
sku.CustomPriceList, _ = customPriceService.getCustomPriceList(sku) } else {
//这里还要针对华云的阶梯价进行一次转换,因为要兼容目前华云的使用方式
if sku.OrgId == 3 { //判断是不是华云的,如果是的话,还要判断是不是有成本价和销售限价,如果是的话,要把销售限价去掉,因为走的价格体系的前提是有成本价的时候
sku.LadderPrice = customPriceService.transformIEdgeLadderPrice(sku) //只能有一个阶梯,并且阶梯数量为0
} if sku.OrgId == 3 && len(sku.LadderPrice) == 2 {
sku.LadderPrice = sku.LadderPrice[:1]
}
//这里猎芯和华云都是走同一套的价格体系了
//获取系数和价格
sku = ls.GetCoefficientAndPrice(sku)
fmt.Println(sku.LadderPrice)
//获取自定义价格后的阶梯价
customPriceService := CustomPrice{}
sku.CustomPriceList, _ = customPriceService.getCustomPriceList(sku)
//这里还要针对华云的阶梯价进行一次转换,因为要兼容目前华云的使用方式
if sku.OrgId == 3 {
sku.LadderPrice = customPriceService.transformIEdgeLadderPrice(sku)
} }
} }
break break
default: default:
......
...@@ -742,6 +742,7 @@ func (ps *PriceService) GetIEdgePrice(ladderPrice []model.LadderPrice) []model.L ...@@ -742,6 +742,7 @@ func (ps *PriceService) GetIEdgePrice(ladderPrice []model.LadderPrice) []model.L
0: "成本价", 0: "成本价",
1: "标准价", 1: "标准价",
2: "企业价", 2: "企业价",
3: "销售限价",
} }
for index, price := range ladderPrice { for index, price := range ladderPrice {
ladderPrice[index].PriceName = priceNameMap[price.Purchases] ladderPrice[index].PriceName = priceNameMap[price.Purchases]
...@@ -752,5 +753,10 @@ func (ps *PriceService) GetIEdgePrice(ladderPrice []model.LadderPrice) []model.L ...@@ -752,5 +753,10 @@ func (ps *PriceService) GetIEdgePrice(ladderPrice []model.LadderPrice) []model.L
ladderPrice = ladderPrice[1:] ladderPrice = ladderPrice[1:]
} }
//如果是4个价格,那么只要中间2个
if len(ladderPrice) == 4 {
ladderPrice = ladderPrice[1:3]
}
return ladderPrice return ladderPrice
} }
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