Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d908ce29
authored
Sep 03, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
加入特殊判断
parent
b4759a26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
2 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
d908ce29
...
...
@@ -289,6 +289,8 @@ func (ls *LyService) CombineSup(sku model.LySku, spuStr string) model.LySku {
// 获取系数和总体价格,生成和处理价格的方法,很重要
func
(
ls
*
LyService
)
GetCoefficientAndPrice
(
sku
model
.
LySku
)
model
.
LySku
{
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
tax
:=
1.13
//没有阶梯价格,直接跳过
if
len
(
sku
.
LadderPrice
)
==
0
{
return
sku
...
...
@@ -302,14 +304,49 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
ladderPrice
:=
sku
.
LadderPrice
//这里是存了一些特殊供应商价格的判断,数据库里不是所有供应商都是存的人民币/美金
sku
=
priceService
.
TransformSpecialSupplierPrice
(
sku
)
//这里还有一个特殊判断
//猎芯自营 L0018319 WMS同步过来的未税成本单价(人民币),需乘以关税,再填入到基石该SKU的 成本价——国内含税(¥)
// 香港自营(L0018562)WMS同步过来的未税成本单价(美金)
//需更新到 基石该SKU的 成本价——香港交货($)且也需乘美金转人民币汇率, 再乘以关税,填入到基石该SKU的 成本价——国内含税(¥)价
if
sku
.
Canal
==
"L0018319"
{
for
_
,
price
:=
range
sku
.
OriginalPrice
{
originalPrice
=
append
(
originalPrice
,
model
.
OriginPrice
{
Purchases
:
price
.
Purchases
,
PriceCn
:
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceCn
,
tax
),
4
),
})
}
for
index
,
price
:=
range
sku
.
LadderPrice
{
ladderPrice
[
index
]
.
PriceCn
=
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceCn
,
tax
),
4
)
}
}
if
sku
.
Canal
==
"L0018562"
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
usdRatio
,
_
:=
redis
.
Float64
(
redisCon
.
Do
(
"HGET"
,
"erp_rate"
,
2
))
for
_
,
price
:=
range
sku
.
OriginalPrice
{
originalPrice
=
append
(
originalPrice
,
model
.
OriginPrice
{
Purchases
:
price
.
Purchases
,
PriceCn
:
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
*
tax
),
4
),
PriceUs
:
price
.
PriceUs
,
})
}
for
index
,
price
:=
range
sku
.
LadderPrice
{
ladderPrice
[
index
]
.
PriceCn
=
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
*
tax
),
4
)
}
}
//判断redis里面是否有成本价,有的话,那就直接去取价格,不需要生成阶梯价
//如果没有成本价字段,就要去生成阶梯价格
if
len
(
ladderPrice
)
>
0
{
if
ladderPrice
[
0
]
.
PriceCostUs
==
0
&&
ladderPrice
[
0
]
.
PriceCostCn
==
0
{
//售价组也在这里计算了
sku
=
priceService
.
GenerateLadderPrice
(
sku
)
ladderPrice
=
sku
.
LadderPrice
}
}
//获取折扣系数
sku
=
priceService
.
GetDiscountRatio
(
sku
)
data
=
make
([]
model
.
LadderPrice
,
len
(
ladderPrice
))
...
...
@@ -335,6 +372,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//专卖成本价
data
[
key
]
.
PriceCostUs
=
price
.
PriceCostUs
data
[
key
]
.
PriceCostCn
=
price
.
PriceCostCn
//判断原始价格有变化,那就要覆盖
if
len
(
originalPrice
)
>
0
{
sku
.
OriginalPrice
=
originalPrice
}
}
}
else
{
data
=
make
([]
model
.
LadderPrice
,
len
(
sku
.
LadderPrice
))
...
...
@@ -403,8 +445,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
//下面是计算价格
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
tax
:=
1.13
sku
=
priceService
.
TransformSpecialSupplierPrice
(
sku
)
var
showPriceRatioList
[]
model
.
PriceRatio
for
key
,
price
:=
range
sku
.
LadderPrice
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment