imeik-bizui 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bizui/src/FieldFloorPriceBoard/core/FloorPriceBoard.vue +1 -0
- package/dist/bizui/src/FieldFloorPriceBoard/core/FloorPriceDetailDialog.vue +1 -1
- package/dist/bizui/src/FieldFloorPriceBoard/core/utils.js +34 -22
- package/dist/imeik-bizui.common.js +159 -140
- package/dist/imeik-bizui.common.js.gz +0 -0
- package/dist/imeik-bizui.css +1 -1
- package/dist/imeik-bizui.css.gz +0 -0
- package/dist/imeik-bizui.umd.js +159 -140
- package/dist/imeik-bizui.umd.js.gz +0 -0
- package/dist/imeik-bizui.umd.min.js +6 -6
- package/dist/imeik-bizui.umd.min.js.gz +0 -0
- package/package.json +1 -1
|
@@ -397,7 +397,7 @@ export default {
|
|
|
397
397
|
},
|
|
398
398
|
formatCell(value, col = {}) {
|
|
399
399
|
if (col.type === 'number' || col.type === 'highlight' || col.digits != null) {
|
|
400
|
-
//
|
|
400
|
+
// 金额按接口原样展示(不千分位、不截断小数)
|
|
401
401
|
return formatNumber(value, {
|
|
402
402
|
digits: col.digits != null ? col.digits : null,
|
|
403
403
|
fallback: '-'
|
|
@@ -2,40 +2,55 @@
|
|
|
2
2
|
* 底价看板 / 明细弹窗 · 纯展示工具(格式化、默认文案、前端差距推导)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* 数值展示:默认按接口原样(不千分位、不截断小数位)。
|
|
7
|
+
* 仅当显式传入 digits 时才按固定小数位输出。
|
|
8
|
+
* 注意:toLocaleString 默认最多 3 位小数,会导致四位金额被截断,故原样路径不用它。
|
|
9
|
+
*/
|
|
6
10
|
export function formatNumber(value, { digits = null, fallback = '-' } = {}) {
|
|
7
11
|
if (value === undefined || value === null || value === '') return fallback
|
|
8
|
-
|
|
9
|
-
if (Number.isNaN(n)) return String(value)
|
|
12
|
+
|
|
10
13
|
if (digits === null || digits === undefined) {
|
|
11
|
-
|
|
14
|
+
if (typeof value === 'string') {
|
|
15
|
+
const s = value.trim()
|
|
16
|
+
if (s === '') return fallback
|
|
17
|
+
if (Number.isNaN(Number(s))) return fallback
|
|
18
|
+
return s
|
|
19
|
+
}
|
|
20
|
+
const n = Number(value)
|
|
21
|
+
if (Number.isNaN(n)) return String(value)
|
|
22
|
+
return String(n)
|
|
12
23
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
|
|
25
|
+
const n = Number(value)
|
|
26
|
+
if (Number.isNaN(n)) return String(value)
|
|
27
|
+
return n.toFixed(digits)
|
|
17
28
|
}
|
|
18
29
|
|
|
19
|
-
/** 金额带
|
|
30
|
+
/** 金额带 ¥;默认跟随接口原值,如 ¥ 2401.4385 */
|
|
20
31
|
export function formatMoney(value, { digits = null, fallback = '-' } = {}) {
|
|
21
32
|
const body = formatNumber(value, { digits, fallback: null })
|
|
22
33
|
if (body == null) return fallback
|
|
23
34
|
return `¥ ${body}`
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
/**
|
|
37
|
+
/** 绝对值的原样展示(去掉正负号) */
|
|
38
|
+
function rawAbsBody(value, n) {
|
|
39
|
+
if (typeof value === 'string') {
|
|
40
|
+
return value.trim().replace(/^[+-]/, '')
|
|
41
|
+
}
|
|
42
|
+
return String(Math.abs(n))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 带正负号的差距展示;默认跟随原精度,如 +23.6800 / -3.1 */
|
|
27
46
|
export function formatSignedNumber(value, { digits = null, fallback = '-' } = {}) {
|
|
28
47
|
if (value === undefined || value === null || value === '') return fallback
|
|
29
48
|
const n = Number(value)
|
|
30
49
|
if (Number.isNaN(n)) return String(value)
|
|
31
|
-
const abs = Math.abs(n)
|
|
32
50
|
const body =
|
|
33
51
|
digits === null || digits === undefined
|
|
34
|
-
?
|
|
35
|
-
: abs.
|
|
36
|
-
minimumFractionDigits: digits,
|
|
37
|
-
maximumFractionDigits: digits
|
|
38
|
-
})
|
|
52
|
+
? rawAbsBody(value, n)
|
|
53
|
+
: Math.abs(n).toFixed(digits)
|
|
39
54
|
if (n > 0) return `+${body}`
|
|
40
55
|
if (n < 0) return `-${body}`
|
|
41
56
|
return body
|
|
@@ -46,7 +61,7 @@ export function formatSignedNumber(value, { digits = null, fallback = '-' } = {}
|
|
|
46
61
|
* - gap < 0 → 低于底价 / 禁止;文案「低 N 元/支」
|
|
47
62
|
* - gap > 0 → 通过;文案「高 N 元/支」
|
|
48
63
|
* - gap = 0 → 持平
|
|
49
|
-
*
|
|
64
|
+
* 展示不截断小数位(不用 toLocaleString)
|
|
50
65
|
*/
|
|
51
66
|
export function computePriceGap(afterPrice, standard, { digits = null } = {}) {
|
|
52
67
|
const after = Number(afterPrice)
|
|
@@ -68,11 +83,8 @@ export function computePriceGap(afterPrice, standard, { digits = null } = {}) {
|
|
|
68
83
|
const abs = Math.abs(gap)
|
|
69
84
|
const body =
|
|
70
85
|
digits === null || digits === undefined
|
|
71
|
-
? abs
|
|
72
|
-
: abs.
|
|
73
|
-
minimumFractionDigits: digits,
|
|
74
|
-
maximumFractionDigits: digits
|
|
75
|
-
})
|
|
86
|
+
? String(abs)
|
|
87
|
+
: abs.toFixed(digits)
|
|
76
88
|
let gapLabel = '持平'
|
|
77
89
|
if (gap < 0) gapLabel = `低 ${body} 元/支`
|
|
78
90
|
else if (gap > 0) gapLabel = `高 ${body} 元/支`
|