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
69700e20
authored
a year ago
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
原始价问题
parent
87bc7803
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
21 deletions
service/service_ly_common.go
service/service_price.go
service/service_ly_common.go
View file @
69700e20
...
...
@@ -189,6 +189,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
flag
:=
0
data
:=
make
([]
model
.
LadderPrice
,
len
(
sku
.
LadderPrice
))
var
originalPrice
[]
model
.
OriginPrice
//专卖
if
sku
.
SupplierId
==
17
{
ladderPrice
:=
sku
.
LadderPrice
...
...
@@ -510,27 +511,13 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
for
key
,
price
:=
range
sku
.
LadderPrice
{
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
switch
sku
.
SupplierId
{
case
6
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
price
.
PriceUs
)
customRate
:=
7.85
//港币转美金
price
.
PriceUs
=
c
.
MyRound
(
c
.
DivFloat
(
price
.
PriceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
price
.
PriceUs
)
break
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
}
price
.
PriceUs
=
ls
.
TransformSpecialSupplierPrice
(
sku
.
SupplierId
,
price
.
PriceUs
,
coefficient
.
Ratio
)
originalPrice
=
append
(
originalPrice
,
model
.
OriginPrice
{
PriceUs
:
price
.
PriceUs
,
Purchases
:
price
.
Purchases
,
PriceCn
:
price
.
PriceCn
,
})
fmt
.
Println
(
originalPrice
)
if
price
.
Purchases
==
0
{
continue
}
...
...
@@ -613,6 +600,12 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
}
}
//判断原始价格有变化,那就要覆盖
if
len
(
originalPrice
)
>
0
{
sku
.
Original
=
originalPrice
}
//输出税费到前端
coefficient
.
Tax
=
tax
sku
.
Coefficient
=
coefficient
...
...
This diff is collapsed.
Click to expand it.
service/service_price.go
View file @
69700e20
package
service
import
(
"fmt"
"go_sku_server/model"
c
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"strconv"
"strings"
...
...
@@ -227,3 +229,29 @@ func getMouserActivityPrice(sku model.LySku) model.LySku {
}
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
}
This diff is collapsed.
Click to expand it.
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