Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bb8901ea
authored
Mar 17, 2026
by
cen
Committed by
chenwq1
Mar 18, 2026
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix:权益入参
1 parent
9ec02a1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
24 deletions
pages/boutique/tool/components/CreateOrder.vue
pages/equity/tool/components/CreateOrder.vue
pages/boutique/tool/components/CreateOrder.vue
View file @
bb8901e
...
...
@@ -268,13 +268,14 @@ export default {
this
.
initData
()
},
methods
:
{
// 计算单个商品的最终价格(
单价优惠后的价格 * 数量
)
// 计算单个商品的最终价格(
与页面展示保持一致:先算单件优惠价,再乘数量,均向上取整两位
)
calculateFinalPrice
(
goods
,
sellPrice
,
number
,
orderTypeCode
)
{
const
price
=
parseFloat
(
sellPrice
||
0
)
const
qty
=
parseInt
(
number
||
1
)
if
(
!
price
||
!
orderTypeCode
)
{
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
const
orderType
=
String
(
orderTypeCode
||
''
)
...
...
@@ -285,17 +286,22 @@ export default {
if
(
strategyConfig
.
mode
===
'ratio'
&&
strategyConfig
.
discountRatio
)
{
const
ratio
=
parseFloat
(
strategyConfig
.
discountRatio
)
if
(
ratio
>=
0.1
&&
ratio
<=
10
)
{
// 单价 * 折扣比例 * 数量
return
utils
.
ceilDecimal
(
price
*
(
ratio
/
10
)
*
qty
)
// 单件优惠价:单价 * 折扣比例,先向上取整两位
const
unit
=
utils
.
ceilDecimal
(
price
*
(
ratio
/
10
))
// 总价:单件优惠价 * 数量,再向上取整两位
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
}
else
if
(
strategyConfig
.
mode
===
'amount'
&&
strategyConfig
.
discountAmount
)
{
const
discountAmount
=
parseFloat
(
strategyConfig
.
discountAmount
)
if
(
discountAmount
>=
0.01
&&
discountAmount
<=
price
)
{
// (单价 - 折扣金额) * 数量
return
utils
.
ceilDecimal
((
price
-
discountAmount
)
*
qty
)
// 单件优惠价:单价 - 折扣金额,先向上取整两位
const
unit
=
utils
.
ceilDecimal
(
price
-
discountAmount
)
// 总价:单件优惠价 * 数量,再向上取整两位
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
// '3' 买赠策略
...
...
@@ -303,7 +309,8 @@ export default {
if
(
strategyConfig
.
isGift
===
'1'
)
{
return
0
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
// '5' 组合付款
...
...
@@ -311,14 +318,18 @@ export default {
if
(
strategyConfig
.
mode
===
'deduct'
&&
strategyConfig
.
deductAmount
)
{
const
deductAmount
=
parseFloat
(
strategyConfig
.
deductAmount
)
if
(
deductAmount
>=
0.01
&&
deductAmount
<=
price
)
{
// (单价 - 抵扣金额) * 数量
return
utils
.
ceilDecimal
((
price
-
deductAmount
)
*
qty
)
// 单件优惠价:单价 - 抵扣金额,先向上取整两位
const
unit
=
utils
.
ceilDecimal
(
price
-
deductAmount
)
// 总价:单件优惠价 * 数量,再向上取整两位
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
},
// 计算主订单的总 finalPrice
calculateTotalFinalPrice
(
subGoodsList
)
{
...
...
pages/equity/tool/components/CreateOrder.vue
View file @
bb8901e
...
...
@@ -861,13 +861,15 @@ export default {
})
})
},
// 计算最终价格(优惠后的总价,单位:元),向上取整保留2位小数
// 计算最终价格(优惠后的总价,单位:元),与页面展示保持一致:
// 先算单件优惠价(向上取整两位),再乘数量(再向上取整两位)
calculateFinalPrice
(
goods
,
sellPrice
,
number
,
orderTypeCode
)
{
const
price
=
parseFloat
(
sellPrice
||
0
)
const
qty
=
parseInt
(
number
||
1
)
if
(
!
price
||
!
orderTypeCode
)
{
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
const
orderType
=
String
(
orderTypeCode
||
''
)
...
...
@@ -878,17 +880,18 @@ export default {
if
(
strategyConfig
.
mode
===
'ratio'
&&
strategyConfig
.
discountRatio
)
{
const
ratio
=
parseFloat
(
strategyConfig
.
discountRatio
)
if
(
ratio
>=
0.1
&&
ratio
<=
10
)
{
// 单价 * 折扣比例 * 数量
return
utils
.
ceilDecimal
(
price
*
(
ratio
/
10
)
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
*
(
ratio
/
10
))
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
}
else
if
(
strategyConfig
.
mode
===
'amount'
&&
strategyConfig
.
discountAmount
)
{
const
discountAmount
=
parseFloat
(
strategyConfig
.
discountAmount
)
if
(
discountAmount
>=
0.01
&&
discountAmount
<=
price
)
{
// (单价 - 折扣金额) * 数量
return
utils
.
ceilDecimal
(
(
price
-
discountAmount
)
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
-
discountAmount
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
// '3' 买赠策略
...
...
@@ -896,7 +899,8 @@ export default {
if
(
strategyConfig
.
isGift
===
'1'
)
{
return
0
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
// '5' 组合付款
...
...
@@ -904,15 +908,17 @@ export default {
if
(
strategyConfig
.
mode
===
'deduct'
&&
strategyConfig
.
deductAmount
)
{
const
deductAmount
=
parseFloat
(
strategyConfig
.
deductAmount
)
if
(
deductAmount
>=
0.01
&&
deductAmount
<=
price
)
{
// (单价 - 抵扣金额) * 数量
return
utils
.
ceilDecimal
(
(
price
-
deductAmount
)
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
-
deductAmount
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
}
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
}
// '1' 正常订单、'4' 冲量活动:原价
return
utils
.
ceilDecimal
(
price
*
qty
)
const
unit
=
utils
.
ceilDecimal
(
price
)
return
utils
.
ceilDecimal
(
unit
*
qty
)
},
// 计算优惠相关字段(discountType, discountValue)
calculateDiscountFields
(
goods
,
sellPrice
,
number
,
orderTypeCode
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment