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 6b2f4c18
authored
Mar 09, 2026
by
cen
Committed by
chenwq1
Mar 18, 2026
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 修改订单类型
1 parent
ea45ecf9
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
78 deletions
components/OrderPopup/components/OrderTypePopup.vue
env.js
pages/boutique/tool/components/CreateOrder.vue
pages/boutique/tool/components/DefeatOrder.vue
pages/boutique/tool/index.vue
utils/cache/constantData.js
utils/utils.js
components/OrderPopup/components/OrderTypePopup.vue
View file @
6b2f4c1
...
@@ -23,6 +23,8 @@ export default {
...
@@ -23,6 +23,8 @@ export default {
methods
:
{
methods
:
{
async
getList
()
{
async
getList
()
{
const
params
=
this
.
params
const
params
=
this
.
params
let
flag
=
null
let
hasStorage
=
!!
(
uni
&&
uni
.
$storage
&&
uni
.
$storage
.
get
)
// 默认支持所有订单类型
// 默认支持所有订单类型
let
data
=
[
let
data
=
[
{
name
:
'正常订单'
,
value
:
'1'
},
{
name
:
'正常订单'
,
value
:
'1'
},
...
@@ -34,9 +36,52 @@ export default {
...
@@ -34,9 +36,52 @@ export default {
// 基于门店配置控制是否只允许“正常订单”
// 基于门店配置控制是否只允许“正常订单”
try
{
try
{
const
flag
=
uni
?.
$storage
?.
get
&&
uni
.
$storage
.
get
(
'createAllGoodsFlag'
)
// 1)优先从本地缓存读取(CreateOrder / EquityCreateOrder 入口会写入)
// createAllGoodsFlag = 0:只能选择正常订单
if
(
hasStorage
)
{
if
(
flag
===
0
||
flag
===
'0'
)
{
const
rawFlag
=
uni
.
$storage
.
get
(
'createAllGoodsFlag'
)
if
(
rawFlag
!==
undefined
&&
rawFlag
!==
null
)
{
flag
=
String
(
rawFlag
)
}
}
// 2)本地没有时,实时调轻改/权益配置接口兜底一次(避免先打开弹窗再拿到配置的竞态)
if
(
flag
===
null
)
{
const
userInfo
=
hasStorage
?
uni
.
$storage
.
get
(
'userInfo'
)
:
null
// merchantId 来源:userInfo > 父组件传入的 data(如 orderObj).merchantId > params.merchantId
const
merchantId
=
(
userInfo
&&
(
userInfo
.
shopMerchantId
||
userInfo
.
merchantId
))
||
(
this
.
data
&&
this
.
data
.
merchantId
)
||
(
params
&&
params
.
merchantId
)
if
(
merchantId
)
{
// 轻改接口
if
(
uni
?.
$api
?.
boutiqueApi
?.
getShopMerchantPointConfig
)
{
try
{
const
res
=
await
uni
.
$api
.
boutiqueApi
.
getShopMerchantPointConfig
({
merchantId
})
if
(
res
&&
res
.
createAllGoodsFlag
!==
undefined
&&
res
.
createAllGoodsFlag
!==
null
)
{
flag
=
String
(
res
.
createAllGoodsFlag
)
uni
.
$storage
.
set
(
'createAllGoodsFlag'
,
res
.
createAllGoodsFlag
)
}
}
catch
(
err
)
{
console
.
warn
(
'fetch createAllGoodsFlag failed in OrderTypePopup (boutique)'
,
err
)
}
}
// 若轻改未返回 createAllGoodsFlag,再试权益接口(同一弹窗可能用于权益页)
if
(
flag
===
null
&&
uni
?.
$api
?.
equityApi
?.
getShopMerchantPointConfig
)
{
try
{
const
res
=
await
uni
.
$api
.
equityApi
.
getShopMerchantPointConfig
({
merchantId
})
if
(
res
&&
res
.
createAllGoodsFlag
!==
undefined
&&
res
.
createAllGoodsFlag
!==
null
)
{
flag
=
String
(
res
.
createAllGoodsFlag
)
uni
.
$storage
.
set
(
'createAllGoodsFlag'
,
res
.
createAllGoodsFlag
)
}
}
catch
(
err
)
{
console
.
warn
(
'fetch createAllGoodsFlag failed in OrderTypePopup (equity)'
,
err
)
}
}
}
}
// 3)有 flag 且不为 1 时,只允许“正常订单”
if
(
flag
!==
null
&&
flag
!==
'1'
)
{
data
=
[{
name
:
'正常订单'
,
value
:
'1'
}]
data
=
[{
name
:
'正常订单'
,
value
:
'1'
}]
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -44,6 +89,8 @@ export default {
...
@@ -44,6 +89,8 @@ export default {
console
.
warn
(
'read createAllGoodsFlag failed'
,
e
)
console
.
warn
(
'read createAllGoodsFlag failed'
,
e
)
}
}
// 打开弹窗时输出:当前 createAllGoodsFlag 值、本次展示的订单类型
console
.
log
(
'[OrderTypePopup] createAllGoodsFlag:'
,
flag
,
'| 订单类型:'
,
(
data
||
[]).
map
(
i
=>
i
.
name
).
join
(
'、'
))
this
.
updateParams
(
params
,
data
||
[])
this
.
updateParams
(
params
,
data
||
[])
},
},
initData
(
list
)
{
initData
(
list
)
{
...
...
env.js
View file @
6b2f4c1
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'beta'
]
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'beta'
]
const
index
=
2
const
index
=
1
/**
/**
*
*
0本地
0本地
...
...
pages/boutique/tool/components/CreateOrder.vue
View file @
6b2f4c1
...
@@ -947,7 +947,7 @@ export default {
...
@@ -947,7 +947,7 @@ export default {
// 单商品
// 单商品
const
sellPrice
=
parseFloat
(
e
.
goods
.
sellPrice
||
0
)
const
sellPrice
=
parseFloat
(
e
.
goods
.
sellPrice
||
0
)
const
number
=
parseInt
(
e
.
goods
.
number
||
1
)
const
number
=
parseInt
(
e
.
goods
.
number
||
1
)
const
finalPrice
=
e
.
goods
.
finalPrice
!==
undefined
&&
e
.
goods
.
finalPrice
!==
null
&&
!
isNaN
(
parseFloat
(
e
.
goods
.
finalPrice
))
?
parseFloat
(
e
.
goods
.
finalPrice
)
:
this
.
calculateFinalPrice
(
e
.
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
finalPrice
=
this
.
calculateFinalPrice
(
e
.
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
discountFields
=
this
.
calculateDiscountFields
(
e
.
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
discountFields
=
this
.
calculateDiscountFields
(
e
.
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
unitFinalPrice
=
finalPrice
/
number
const
unitFinalPrice
=
finalPrice
/
number
subGoodsList
.
push
({
subGoodsList
.
push
({
...
@@ -968,7 +968,7 @@ export default {
...
@@ -968,7 +968,7 @@ export default {
e
.
packageGoods
.
goodsList
.
forEach
(
g
=>
{
e
.
packageGoods
.
goodsList
.
forEach
(
g
=>
{
const
sellPrice
=
parseFloat
(
g
.
sellPrice
||
0
)
const
sellPrice
=
parseFloat
(
g
.
sellPrice
||
0
)
const
number
=
parseInt
(
e
.
packageGoods
.
number
||
1
)
const
number
=
parseInt
(
e
.
packageGoods
.
number
||
1
)
const
finalPrice
=
g
.
finalPrice
!==
undefined
&&
g
.
finalPrice
!==
null
&&
!
isNaN
(
parseFloat
(
g
.
finalPrice
))
?
parseFloat
(
g
.
finalPrice
)
:
this
.
calculateFinalPrice
(
g
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
finalPrice
=
this
.
calculateFinalPrice
(
g
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
discountFields
=
this
.
calculateDiscountFields
(
g
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
discountFields
=
this
.
calculateDiscountFields
(
g
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
unitFinalPrice
=
finalPrice
/
number
const
unitFinalPrice
=
finalPrice
/
number
subGoodsList
.
push
({
subGoodsList
.
push
({
...
@@ -992,7 +992,7 @@ export default {
...
@@ -992,7 +992,7 @@ export default {
const
goods
=
e
.
multipleSpecificationsGoods
.
goods
const
goods
=
e
.
multipleSpecificationsGoods
.
goods
const
sellPrice
=
parseFloat
(
goods
.
sellPrice
||
0
)
const
sellPrice
=
parseFloat
(
goods
.
sellPrice
||
0
)
const
number
=
parseInt
(
e
.
multipleSpecificationsGoods
.
number
||
1
)
const
number
=
parseInt
(
e
.
multipleSpecificationsGoods
.
number
||
1
)
const
finalPrice
=
goods
.
finalPrice
!==
undefined
&&
goods
.
finalPrice
!==
null
&&
!
isNaN
(
parseFloat
(
goods
.
finalPrice
))
?
parseFloat
(
goods
.
finalPrice
)
:
this
.
calculateFinalPrice
(
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
finalPrice
=
this
.
calculateFinalPrice
(
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
discountFields
=
this
.
calculateDiscountFields
(
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
discountFields
=
this
.
calculateDiscountFields
(
goods
,
sellPrice
,
number
,
obj
.
orderTypeCode
)
const
unitFinalPrice
=
finalPrice
/
number
const
unitFinalPrice
=
finalPrice
/
number
subGoodsList
.
push
({
subGoodsList
.
push
({
...
...
pages/boutique/tool/components/DefeatOrder.vue
View file @
6b2f4c1
...
@@ -686,6 +686,10 @@ export default {
...
@@ -686,6 +686,10 @@ export default {
// deliveryCell.hidden = false
// deliveryCell.hidden = false
// }
// }
}
}
// 订单类型配置:createAllGoodsFlag = 1 显示全部类型;0 仅正常订单
if
(
res
.
createAllGoodsFlag
!==
undefined
&&
res
.
createAllGoodsFlag
!==
null
)
{
uni
.
$storage
.
set
(
'createAllGoodsFlag'
,
res
.
createAllGoodsFlag
)
}
},
},
// 判断二级流量方
// 判断二级流量方
async
getSubShopMerchantList
(
merchantId
)
{
async
getSubShopMerchantList
(
merchantId
)
{
...
...
pages/boutique/tool/index.vue
View file @
6b2f4c1
<
template
>
<
template
>
<view
class=
"detail-box"
>
<view
class=
"detail-box"
>
<view
class=
"nav-bar"
>
<view
class=
"nav-bar"
>
<view
<view
class=
"back"
@
click=
"backPage"
>
class=
"back"
<uni-icons
type=
"left"
:size=
"20"
color=
"#000"
></uni-icons>
@
click=
"backPage"
>
<uni-icons
type=
"left"
:size=
"20"
color=
"#000"
></uni-icons>
</view>
</view>
<view
class=
"title"
>
展业工具
</view>
<view
class=
"title"
>
展业工具
</view>
</view>
</view>
...
@@ -17,23 +10,9 @@
...
@@ -17,23 +10,9 @@
<view
class=
"detail-left"
>
<view
class=
"detail-left"
>
<view
class=
"common-title"
>
展业
</view>
<view
class=
"common-title"
>
展业
</view>
<view
class=
"content"
>
<view
class=
"content"
>
<image
<image
class=
"banner"
src=
"../../../assets/images/common/tool_banner.png"
mode=
"scaleToFill"
/>
class=
"banner"
src=
"../../../assets/images/common/tool_banner.png"
mode=
"scaleToFill"
/>
<template
v-if=
"toolComponentName === 'DailyReport'"
>
<template
v-if=
"toolComponentName === 'DailyReport'"
>
<uni-calendar
<uni-calendar
ref=
"calendar"
:clearDate=
"false"
:endDate=
"endDate"
:showMonth=
"false"
@
monthSwitch=
"currentMonth = `$
{$event.year}-${$event.month}`" @change="currentDate = $event.fulldate" backgroundColor="transparent" :selected="selectedDays" :date="currentDate" />
ref=
"calendar"
:clearDate=
"false"
:endDate=
"endDate"
:showMonth=
"false"
@
monthSwitch=
"currentMonth = `$
{$event.year}-${$event.month}`"
@change="currentDate = $event.fulldate"
backgroundColor="transparent"
:selected="selectedDays"
:date="currentDate"
/>
</
template
>
</
template
>
<
template
v-else-if=
"toolComponentName === 'WageAppeal'"
>
<
template
v-else-if=
"toolComponentName === 'WageAppeal'"
>
<MonthCalendar
@
confirm=
"confirmMonth"
></MonthCalendar>
<MonthCalendar
@
confirm=
"confirmMonth"
></MonthCalendar>
...
@@ -44,49 +23,24 @@
...
@@ -44,49 +23,24 @@
</view>
</view>
</view>
</view>
<view
class=
"detail-right"
>
<view
class=
"detail-right"
>
<component
<component
:is=
"toolComponentName"
@
jump=
"jump"
:transmission-of-data=
"transmissionOfData"
:currentDate=
"currentDate"
:currentMonth=
"currentMonth"
:lastMonth=
"lastMonth"
@
setCalendarSelected=
"selectedDays = $event"
:enterType=
"enterType"
/>
:is=
"toolComponentName"
@
jump=
"jump"
:transmission-of-data=
"transmissionOfData"
:currentDate=
"currentDate"
:currentMonth=
"currentMonth"
:lastMonth=
"lastMonth"
@
setCalendarSelected=
"selectedDays = $event"
:enterType=
"enterType"
/>
</view>
</view>
</view>
</view>
<NoticePopup
<NoticePopup
ref=
"notice"
title=
"重要提示"
text=
"当前页面暂未保存,是否确认退出"
type=
"warning"
></NoticePopup>
ref=
"notice"
title=
"重要提示"
text=
"当前页面暂未保存,是否确认退出"
type=
"warning"
></NoticePopup>
<!-- 学习中心权限弹窗 -->
<!-- 学习中心权限弹窗 -->
<StudyPopup
:show
.
sync=
"showStudyPermissionPopup"
title=
""
:width=
"848"
:height=
"870"
:topImage=
"require('@/assets/images/common/warning-notice.png')"
:topImageWidth=
"848"
:topImageHeight=
"248"
style=
"overflow: hidden"
>
<StudyPopup
:show
.
sync=
"showStudyPermissionPopup"
title=
""
:width=
"848"
:height=
"870"
:topImage=
"require('@/assets/images/common/warning-notice.png')"
:topImageWidth=
"848"
:topImageHeight=
"248"
style=
"overflow: hidden"
>
<StudyCenterPermissionPopup
:lockReason=
"lockReason"
@
confirm=
"handleStudyPermissionConfirm"
/>
<StudyCenterPermissionPopup
:lockReason=
"lockReason"
@
confirm=
"handleStudyPermissionConfirm"
/>
</StudyPopup>
</StudyPopup>
<!-- 异常订单锁单弹窗,样式与车险工具页保持一致 -->
<!-- 异常订单锁单弹窗,样式与车险工具页保持一致 -->
<ErrorOrderPopup
<ErrorOrderPopup
:show
.
sync=
"showErrorOrderPopup"
title=
""
:width=
"848"
:height=
"870"
:topImage=
"require('@/assets/images/common/warning-notice.png')"
:topImageWidth=
"848"
:topImageHeight=
"248"
style=
"overflow: hidden"
>
:show
.
sync=
"showErrorOrderPopup"
title=
""
:width=
"848"
:height=
"870"
:topImage=
"require('@/assets/images/common/warning-notice.png')"
:topImageWidth=
"848"
:topImageHeight=
"248"
style=
"overflow: hidden"
>
<view>
<view>
<view
class=
"error-order-title"
>
异常订单提醒
</view>
<view
class=
"error-order-title"
>
异常订单提醒
</view>
<view
class=
"error-order-content"
>
存在{{ abnormalOrderCount }} 条异常订单未处理,请尽快处理!
</view>
<view
class=
"error-order-content"
>
存在{{ abnormalOrderCount }} 条异常订单未处理,请尽快处理!
</view>
</view>
</view>
<
template
#
footer
>
<
template
#
footer
>
<view
class=
"flex justify-between error-order-footer"
>
<view
class=
"flex justify-between error-order-footer"
>
<view
class=
"footer-btn sure flex-1"
@
click=
"showErrorOrderPopup = false"
>
<view
class=
"footer-btn sure flex-1"
@
click=
"showErrorOrderPopup = false"
>
好的
</view>
好的
</view>
</view>
</view>
</
template
>
</
template
>
</ErrorOrderPopup>
</ErrorOrderPopup>
...
@@ -129,7 +83,7 @@ export default {
...
@@ -129,7 +83,7 @@ export default {
MonthCalendar
,
MonthCalendar
,
ErrorOrderPopup
ErrorOrderPopup
},
},
data
()
{
data
()
{
return
{
return
{
toolComponentName
:
''
,
toolComponentName
:
''
,
transmissionOfData
:
null
,
transmissionOfData
:
null
,
...
@@ -143,10 +97,10 @@ export default {
...
@@ -143,10 +97,10 @@ export default {
// 异常订单锁单弹窗
// 异常订单锁单弹窗
showErrorOrderPopup
:
false
,
showErrorOrderPopup
:
false
,
abnormalOrderCount
:
0
,
abnormalOrderCount
:
0
,
enterType
:
''
,
enterType
:
''
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
if
(
options
.
componentName
)
this
.
toolComponentName
=
options
.
componentName
if
(
options
.
componentName
)
this
.
toolComponentName
=
options
.
componentName
if
(
options
.
currentDate
)
this
.
setCurrentDate
(
options
.
currentDate
)
if
(
options
.
currentDate
)
this
.
setCurrentDate
(
options
.
currentDate
)
if
(
options
.
enterType
)
this
.
enterType
=
options
.
enterType
if
(
options
.
enterType
)
this
.
enterType
=
options
.
enterType
...
@@ -167,20 +121,20 @@ export default {
...
@@ -167,20 +121,20 @@ export default {
}
}
})
})
},
},
onUnload
()
{
onUnload
()
{
uni
.
$off
(
'showErrorOrderPopup'
)
uni
.
$off
(
'showErrorOrderPopup'
)
},
},
methods
:
{
methods
:
{
setCurrentDate
(
currentDate
)
{
setCurrentDate
(
currentDate
)
{
this
.
currentDate
=
currentDate
this
.
currentDate
=
currentDate
this
.
currentMonth
=
dayjs
(
currentDate
).
format
(
'YYYY-MM'
)
this
.
currentMonth
=
dayjs
(
currentDate
).
format
(
'YYYY-MM'
)
},
},
async
entranceClick
(
item
)
{
async
entranceClick
(
item
)
{
if
(
this
.
toolComponentName
==
item
.
name
)
return
if
(
this
.
toolComponentName
==
item
.
name
)
return
const
noInterceptPage
=
[
'DailyReport'
]
const
noInterceptPage
=
[
'DailyReport'
]
// 原禁止提单inspectionOfProhibitionBill方法被替换getLimitRecord
// 原禁止提单inspectionOfProhibitionBill方法被替换getLimitRecord
// if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
// if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
if
(
!
noInterceptPage
.
includes
(
item
.
name
)
&&
(
(
await
this
.
checkDailyReport
()
)))
return
if
(
!
noInterceptPage
.
includes
(
item
.
name
)
&&
(
await
this
.
checkDailyReport
(
)))
return
// 提示去学习中心弹窗
// 提示去学习中心弹窗
const
res
=
await
this
.
getLimitRecord
()
const
res
=
await
this
.
getLimitRecord
()
if
(
res
.
lockOrder
)
{
if
(
res
.
lockOrder
)
{
...
@@ -229,11 +183,11 @@ export default {
...
@@ -229,11 +183,11 @@ export default {
// 打开弹窗
// 打开弹窗
this
.
$refs
.
notice
.
open
()
this
.
$refs
.
notice
.
open
()
},
},
backPage
()
{
backPage
()
{
uni
.
navigateBack
()
uni
.
navigateBack
()
},
},
// name:跳转组件名,val:跳转参数
// name:跳转组件名,val:跳转参数
jump
(
name
,
val
)
{
jump
(
name
,
val
)
{
this
.
toolComponentName
=
name
this
.
toolComponentName
=
name
console
.
log
(
this
.
toolComponentName
,
val
)
console
.
log
(
this
.
toolComponentName
,
val
)
if
(
val
)
{
if
(
val
)
{
...
@@ -254,7 +208,7 @@ export default {
...
@@ -254,7 +208,7 @@ export default {
// 确认选择的月份
// 确认选择的月份
confirmMonth
(
month
)
{
confirmMonth
(
month
)
{
this
.
lastMonth
=
month
this
.
lastMonth
=
month
}
,
}
}
}
}
}
</
script
>
</
script
>
...
@@ -319,7 +273,7 @@ export default {
...
@@ -319,7 +273,7 @@ export default {
margin-top
:
toRpx
(
64
);
margin-top
:
toRpx
(
64
);
margin-bottom
:
toRpx
(
48
);
margin-bottom
:
toRpx
(
48
);
width
:
100%
;
width
:
100%
;
.cancel{
.cancel
{
height
:
toRpx
(
88
);
height
:
toRpx
(
88
);
border-radius
:
toRpx
(
64
);
border-radius
:
toRpx
(
64
);
opacity
:
1
;
opacity
:
1
;
...
@@ -331,7 +285,7 @@ export default {
...
@@ -331,7 +285,7 @@ export default {
font-size
:
toRpx
(
32
);
font-size
:
toRpx
(
32
);
font-weight
:
400
;
font-weight
:
400
;
}
}
.sure
{
.sure
{
height
:
toRpx
(
88
);
height
:
toRpx
(
88
);
border-radius
:
toRpx
(
64
);
border-radius
:
toRpx
(
64
);
opacity
:
1
;
opacity
:
1
;
...
...
utils/cache/constantData.js
View file @
6b2f4c1
...
@@ -44,5 +44,6 @@ export const STORAGE_OBJECTKEY = {
...
@@ -44,5 +44,6 @@ export const STORAGE_OBJECTKEY = {
studyCenterPermission
:
'studyCenterPermission'
,
studyCenterPermission
:
'studyCenterPermission'
,
caseInfo
:
'caseInfo'
,
caseInfo
:
'caseInfo'
,
boutique_YQorderSetting
:
'boutique_YQorderSetting'
,
boutique_YQorderSetting
:
'boutique_YQorderSetting'
,
sessionId
:
'sessionId'
sessionId
:
'sessionId'
,
createAllGoodsFlag
:
'createAllGoodsFlag'
}
}
utils/utils.js
View file @
6b2f4c1
...
@@ -232,10 +232,11 @@ const decimal = (num, fixed) => {
...
@@ -232,10 +232,11 @@ const decimal = (num, fixed) => {
/** 向上取整,保留 fixed 位小数(默认2位),用于商品价格、总价等 */
/** 向上取整,保留 fixed 位小数(默认2位),用于商品价格、总价等 */
const
ceilDecimal
=
(
num
,
fixed
=
2
)
=>
{
const
ceilDecimal
=
(
num
,
fixed
=
2
)
=>
{
const
n
=
Number
(
num
)
const
n
=
Number
(
num
)
if
(
isNaN
(
n
))
return
0
if
(
isNaN
(
n
)
||
n
===
0
)
return
0
const
pow
=
Math
.
pow
(
10
,
fixed
)
const
pow
=
Math
.
pow
(
10
,
fixed
)
// 避免浮点误差导致的边界问题(如 1.005、256.693 等)
// 先乘 pow 再减极小量后 ceil,避免 1.01 等已整步长的数被浮点误差多进一位成 1.02
return
Math
.
ceil
((
n
+
Number
.
EPSILON
)
*
pow
)
/
pow
const
tolerance
=
1
e
-
10
return
Math
.
ceil
((
n
*
pow
)
-
tolerance
)
/
pow
}
}
const
setPrice
=
price
=>
{
const
setPrice
=
price
=>
{
...
...
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