imeik-bizui 2.7.1 → 2.7.2

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.
@@ -242,9 +242,10 @@ export default {
242
242
  type: Boolean,
243
243
  default: false
244
244
  },
245
+ /** 价格/金额小数位,默认两位 */
245
246
  numberDigits: {
246
247
  type: Number,
247
- default: null
248
+ default: 2
248
249
  },
249
250
  maxColumns: {
250
251
  type: Number,
@@ -308,7 +309,7 @@ export default {
308
309
  },
309
310
  applyTotalFeeText() {
310
311
  if (this.applyTotalFee == null || this.applyTotalFee === '') return ''
311
- return `${formatNumber(this.applyTotalFee)} 元`
312
+ return `${formatNumber(this.applyTotalFee, { digits: this.numberDigits })} 元`
312
313
  },
313
314
  yearText() {
314
315
  if (this.year == null || this.year === '') return ''
@@ -397,9 +397,9 @@ export default {
397
397
  },
398
398
  formatCell(value, col = {}) {
399
399
  if (col.type === 'number' || col.type === 'highlight' || col.digits != null) {
400
- // 与看板一致:不强制小数位,保留接口原值精度
400
+ // 价格/金额统一两位小数;数量列勿标 type:number,或显式 digits:null
401
401
  return formatNumber(value, {
402
- digits: col.digits != null ? col.digits : null,
402
+ digits: col.digits != null ? col.digits : 2,
403
403
  fallback: '-'
404
404
  })
405
405
  }
@@ -408,7 +408,7 @@ export default {
408
408
  },
409
409
  formatGapCell(value, col = {}) {
410
410
  return formatSignedNumber(value, {
411
- digits: col.digits != null ? col.digits : null,
411
+ digits: col.digits != null ? col.digits : 2,
412
412
  fallback: '-'
413
413
  })
414
414
  },
@@ -149,7 +149,7 @@ function buildSections(data = {}) {
149
149
  footer: {
150
150
  label: '合计(含本次)',
151
151
  theme: 'purple',
152
- values: [`金额 ${formatNumber(sumBy(saleRows, 'amount'))}`]
152
+ values: [`金额 ${formatNumber(sumBy(saleRows, 'amount'), { digits: 2 })}`]
153
153
  }
154
154
  })
155
155
  }
@@ -171,7 +171,7 @@ function buildSections(data = {}) {
171
171
  theme: 'danger',
172
172
  values: [
173
173
  `数量 ${formatNumber(sumBy(nonSaleRows, 'qty'))}`,
174
- `折算费用 ${formatNumber(sumBy(nonSaleRows, 'amount'))}`
174
+ `折算费用 ${formatNumber(sumBy(nonSaleRows, 'amount'), { digits: 2 })}`
175
175
  ]
176
176
  }
177
177
  })
@@ -191,7 +191,7 @@ function buildSections(data = {}) {
191
191
  footer: {
192
192
  label: '合计(含本次)',
193
193
  theme: 'danger',
194
- values: [formatNumber(sumBy(expenseRows, 'costAmount'))]
194
+ values: [formatNumber(sumBy(expenseRows, 'costAmount'), { digits: 2 })]
195
195
  }
196
196
  })
197
197
  }
@@ -16,15 +16,15 @@ export function formatNumber(value, { digits = null, fallback = '-' } = {}) {
16
16
  })
17
17
  }
18
18
 
19
- /** 金额带 ¥,如 ¥ 860 */
20
- export function formatMoney(value, { digits = null, fallback = '-' } = {}) {
19
+ /** 金额带 ¥,如 ¥ 800.00;价格/金额默认保留两位小数 */
20
+ export function formatMoney(value, { digits = 2, fallback = '-' } = {}) {
21
21
  const body = formatNumber(value, { digits, fallback: null })
22
22
  if (body == null) return fallback
23
23
  return `¥ ${body}`
24
24
  }
25
25
 
26
- /** 带正负号的差距展示,如 -23.68 / +3.1;digits 默认 null 保留原精度 */
27
- export function formatSignedNumber(value, { digits = null, fallback = '-' } = {}) {
26
+ /** 带正负号的差距展示,如 -23.68 / +3.10;金额默认两位小数 */
27
+ export function formatSignedNumber(value, { digits = 2, fallback = '-' } = {}) {
28
28
  if (value === undefined || value === null || value === '') return fallback
29
29
  const n = Number(value)
30
30
  if (Number.isNaN(n)) return String(value)
@@ -46,9 +46,9 @@ export function formatSignedNumber(value, { digits = null, fallback = '-' } = {}
46
46
  * - gap < 0 → 低于底价 / 禁止;文案「低 N 元/支」
47
47
  * - gap > 0 → 通过;文案「高 N 元/支」
48
48
  * - gap = 0 → 持平
49
- * digits 默认 null,与看板金额一致不强制取整
49
+ * digits 默认 2,与看板/明细金额展示一致
50
50
  */
51
- export function computePriceGap(afterPrice, standard, { digits = null } = {}) {
51
+ export function computePriceGap(afterPrice, standard, { digits = 2 } = {}) {
52
52
  const after = Number(afterPrice)
53
53
  const std = Number(standard)
54
54
  if (