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
4a12e44f
authored
Aug 18, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-价格体系修改-20230815' into dev
parents
7f382d13
6ed822cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
service/service_ly_common.go
service/service_price.go
service/service_ly_common.go
View file @
4a12e44f
...
...
@@ -393,6 +393,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
tax
:=
1.13
var
showPriceRatioList
[]
model
.
PriceRatio
for
key
,
price
:=
range
sku
.
LadderPrice
{
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
...
...
@@ -432,13 +433,15 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
priceCostUs
:=
c
.
MulFloat
(
price
.
PriceUs
,
sku
.
DiscountRatio
.
RatioUsd
)
priceCostUs
=
c
.
MyRound
(
priceCostUs
,
4
)
//美金售价
fmt
.
Println
(
"计算美金价的系数"
,
priceRatio
.
RatioUsd
)
priceUs
:=
c
.
MulFloat
(
priceCostUs
,
priceRatio
.
RatioUsd
)
//人民币成本价,mro只有人民币,所以人民币价格不是从美金来的,而且人民币是含税的.就它要特殊处理
var
priceCostCn
float64
if
sku
.
SupplierId
==
1688
{
priceCostCn
=
c
.
MulFloat
(
price
.
PriceCn
,
1
)
}
else
{
priceCostCn
=
c
.
MulFloat
(
price
.
PriceUs
,
coefficient
.
Ratio
,
tax
)
usdRatio
,
_
:=
redis
.
Float64
(
redisCon
.
Do
(
"HGET"
,
"erp_rate"
,
2
))
priceCostCn
=
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
,
tax
)
}
priceCostCn
=
c
.
MulFloat
(
c
.
MyRound
(
priceCostCn
,
4
),
sku
.
DiscountRatio
.
Ratio
)
priceCostCn
=
c
.
MyRound
(
priceCostCn
,
4
)
...
...
@@ -449,6 +452,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//处理人民币
data
[
key
]
.
PriceCn
=
c
.
MyRound
(
priceCn
,
4
)
data
[
key
]
.
PriceCostCn
=
priceCostCn
showPriceRatioList
=
append
(
showPriceRatioList
,
model
.
PriceRatio
{
Ratio
:
priceRatio
.
Ratio
,
RatioUsd
:
priceRatio
.
RatioUsd
,
})
sku
.
PriceRatio
=
showPriceRatioList
//处理活动价和原价相同的情况
if
(
sku
.
GoodsType
==
1
||
sku
.
GoodsType
==
2
||
sku
.
GoodsType
==
6
)
&&
sku
.
AcType
>
1
&&
sku
.
Ratio
>
0
{
priceAc
:=
c
.
MyRound
(
c
.
MulFloat
(
data
[
key
]
.
PriceCn
,
(
sku
.
Ratio
/
100
)),
4
)
...
...
service/service_price.go
View file @
4a12e44f
...
...
@@ -654,6 +654,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku, priceUs f
}
else
{
currency
,
_
=
redis
.
Int
(
redisCon
.
Do
(
"HGET"
,
"magic_cube_supplier_currency"
,
sku
.
Canal
))
}
fmt
.
Println
(
"进来的美金价格:"
,
priceUs
)
if
currency
>
0
{
//这里进行转换,因为这里都只能取到对应的币种转人民币的比率,我们没有直接各种币种转美金的数据,所以我这边要
//先根据对应币种转人民币,然后根据人民币转美金,才能得到不同币种对应美金的汇率
...
...
@@ -662,7 +663,7 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku, priceUs f
fmt
.
Println
(
rmbRatio
,
usRatio
)
//人民币汇率转美金汇率
usRatio
=
c
.
MyRound
(
c
.
DivFloat
(
rmbRatio
,
usRatio
),
4
)
usRatio
=
c
.
MyRound
(
c
.
DivFloat
(
rmbRatio
,
usRatio
),
6
)
priceUs
=
c
.
MyRound
(
c
.
MulFloat
(
priceUs
,
usRatio
),
4
)
}
return
priceUs
...
...
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