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 +1 -1
- package/src/printer/store.js +4 -1
- package/src/printer/table.js +7 -4
package/package.json
CHANGED
package/src/printer/store.js
CHANGED
|
@@ -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) =>
|
|
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
|
|
package/src/printer/table.js
CHANGED
|
@@ -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
|
|
122
|
-
|
|
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
|
-
)
|
|
130
|
+
)
|
|
128
131
|
}
|
|
129
132
|
// 多栏商品的明细取 __details_MULTI_SUFFIX
|
|
130
133
|
if (val.specialDetailsKey)
|