gm-printer 10.14.2-alpha.5 → 10.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.14.2-alpha.5",
3
+ "version": "10.14.3",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -11,7 +11,10 @@ import _ from 'lodash'
11
11
  import Big from 'big.js'
12
12
 
13
13
  export const TR_BASE_HEIGHT = 23
14
- const price = (n, f = 2) => Big(n || 0).toFixed(f)
14
+ const price = (n, f = 2) => {
15
+ if (isNaN(n)) return null
16
+ return Big(n || 0).toFixed(f)
17
+ }
15
18
  class PrinterStore {
16
19
  @observable ready = false
17
20
 
@@ -117,14 +117,17 @@ class Table extends React.Component {
117
117
  /{{(price\()?列\.([^{{]+)}}/g,
118
118
  (s, s1, s2) => {
119
119
  if (s1) {
120
- // 有price函数插进来
121
- const mix_suffix = s2.replace(/\*/, () => `${MULTI_SUFFIX}*`)
122
- return `{{${s1}列.${mix_suffix}${colNum}}}`
120
+ // 有price函数插进来, 匹配‘ _基本单位 ’类似的字符串并添加后缀,生成三栏或者双栏数据
121
+ const _s = s.replace(
122
+ /_[\u4e00-\u9fa5]*/g,
123
+ match => `${match}${MULTI_SUFFIX}${colNum}`
124
+ )
125
+ return _s
123
126
  } else {
124
127
  return `{{列.${s2}${MULTI_SUFFIX}${colNum}}}`
125
128
  }
126
129
  }
127
- ) // {{列.xx}} => {{列.xxMULTI_SUFFIXi}}
130
+ )
128
131
  }
129
132
  // 多栏商品的明细取 __details_MULTI_SUFFIX
130
133
  if (val.specialDetailsKey)