gm-printer 10.11.5-beta2 → 10.11.5

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.
Files changed (40) hide show
  1. package/.eslintcache +1 -1
  2. package/README.md +102 -7
  3. package/build/demo.js +54 -0
  4. package/locales/en.json +1 -0
  5. package/locales/th.json +1 -0
  6. package/locales/zh-HK.json +1 -0
  7. package/package.json +10 -8
  8. package/src/common/editor_edit_field.js +82 -16
  9. package/src/common/editor_store.js +58 -0
  10. package/src/components/index.js +3 -1
  11. package/src/components/index.less +1 -0
  12. package/src/components/tip/index.js +19 -35
  13. package/src/components/tooltip/index.js +26 -0
  14. package/src/components/tooltip/style.less +16 -0
  15. package/src/editor/context_menu.js +16 -16
  16. package/src/editor/editor.js +16 -9
  17. package/src/editor/store.js +97 -12
  18. package/src/{editor_cannibalize → editor_account}/context_menu.js +42 -16
  19. package/src/{editor_cannibalize → editor_account}/editor.js +24 -9
  20. package/src/editor_account/index.js +4 -0
  21. package/src/editor_account/store.js +263 -0
  22. package/src/editor_purchase/context_menu.js +0 -1
  23. package/src/editor_purchase/editor_special_table.js +5 -2
  24. package/src/editor_purchase/store.js +27 -5
  25. package/src/index.js +2 -2
  26. package/src/printer/block.js +18 -10
  27. package/src/printer/printer.js +2 -2
  28. package/src/printer/qrcode.js +5 -2
  29. package/src/printer/store.js +116 -30
  30. package/src/printer/style.lesss +13 -3
  31. package/src/printer/table.js +57 -16
  32. package/src/printer/table_special_tr.js +1 -0
  33. package/src/printer/table_subtotal_tr.js +47 -7
  34. package/src/svg/question-circle-o.svg +1 -0
  35. package/src/util.js +53 -2
  36. package/webpack.config.js +19 -1
  37. package/global.d.ts +0 -67
  38. package/src/editor_cannibalize/index.js +0 -4
  39. package/src/editor_cannibalize/store.js +0 -29
  40. package/yarn-error.log +0 -9770
@@ -18,64 +18,64 @@ class Store extends EditorStore {
18
18
  text: i18next.t('{{列.序号}}')
19
19
  },
20
20
  {
21
- head: i18next.t('商品名'),
21
+ head: i18next.t('组合商品名'),
22
22
  headStyle: {
23
23
  textAlign: 'center'
24
24
  },
25
25
  style: {
26
26
  textAlign: 'center'
27
27
  },
28
- text: i18next.t('{{列.组合商品_名}}')
28
+ text: i18next.t('{{列.组合商品名}}')
29
29
  },
30
30
  {
31
- head: i18next.t('商品编码'),
31
+ head: i18next.t('类型'),
32
32
  headStyle: {
33
33
  textAlign: 'center'
34
34
  },
35
35
  style: {
36
36
  textAlign: 'center'
37
37
  },
38
- text: i18next.t('{{列.组合商品_自定义编码}}')
38
+ text: i18next.t('{{列.类型}}')
39
39
  },
40
40
  {
41
- head: i18next.t('包装单位'),
41
+ head: i18next.t('下单数'),
42
42
  headStyle: {
43
43
  textAlign: 'center'
44
44
  },
45
45
  style: {
46
46
  textAlign: 'center'
47
47
  },
48
- text: i18next.t('{{列.组合商品_包装单位}}')
48
+ text: i18next.t('{{列.下单数}}')
49
49
  },
50
50
  {
51
- head: i18next.t('下单数'),
51
+ head: i18next.t('销售单位'),
52
52
  headStyle: {
53
53
  textAlign: 'center'
54
54
  },
55
55
  style: {
56
56
  textAlign: 'center'
57
57
  },
58
- text: i18next.t('{{列.组合商品_下单数}}')
58
+ text: i18next.t('{{列.销售单位}}')
59
59
  },
60
60
  {
61
- head: i18next.t('单价'),
61
+ head: i18next.t('含税单价(销售单位)'),
62
62
  headStyle: {
63
63
  textAlign: 'center'
64
64
  },
65
65
  style: {
66
66
  textAlign: 'center'
67
67
  },
68
- text: i18next.t('{{列.组合商品_单价}}')
68
+ text: i18next.t('{{列.含税单价_销售单位}}')
69
69
  },
70
70
  {
71
- head: i18next.t('下单金额'),
71
+ head: i18next.t('下单金额(参考金额)'),
72
72
  headStyle: {
73
73
  textAlign: 'center'
74
74
  },
75
75
  style: {
76
76
  textAlign: 'center'
77
77
  },
78
- text: i18next.t('{{列.组合商品_下单金额}}')
78
+ text: i18next.t('{{列.下单金额_参考金额}}')
79
79
  }
80
80
  ]
81
81
  break
@@ -255,6 +255,91 @@ class Store extends EditorStore {
255
255
  ]
256
256
  break
257
257
  }
258
+ case 'turnover': {
259
+ target.columns = [
260
+ {
261
+ head: i18next.t('序号'),
262
+ headStyle: {
263
+ textAlign: 'center'
264
+ },
265
+ style: {
266
+ textAlign: 'center'
267
+ },
268
+ text: i18next.t('{{列.序号}}')
269
+ },
270
+ {
271
+ head: i18next.t('周转物名称'),
272
+ headStyle: {
273
+ textAlign: 'center'
274
+ },
275
+ style: {
276
+ textAlign: 'center'
277
+ },
278
+ text: i18next.t('{{列.周转物名称}}')
279
+ },
280
+ {
281
+ head: i18next.t('单位'),
282
+ headStyle: {
283
+ textAlign: 'center'
284
+ },
285
+ style: {
286
+ textAlign: 'center'
287
+ },
288
+ text: i18next.t('{{列.单位}}')
289
+ },
290
+ {
291
+ head: i18next.t('关联商品'),
292
+ headStyle: {
293
+ textAlign: 'center'
294
+ },
295
+ style: {
296
+ textAlign: 'center'
297
+ },
298
+ text: i18next.t('{{列.关联商品}}')
299
+ },
300
+ {
301
+ head: i18next.t('单个货值'),
302
+ headStyle: {
303
+ textAlign: 'center'
304
+ },
305
+ style: {
306
+ textAlign: 'center'
307
+ },
308
+ text: i18next.t('{{列.单个货值}}')
309
+ },
310
+ {
311
+ head: i18next.t('预借出数'),
312
+ headStyle: {
313
+ textAlign: 'center'
314
+ },
315
+ style: {
316
+ textAlign: 'center'
317
+ },
318
+ text: i18next.t('{{列.预借出数}}')
319
+ },
320
+ {
321
+ head: i18next.t('借出数'),
322
+ headStyle: {
323
+ textAlign: 'center'
324
+ },
325
+ style: {
326
+ textAlign: 'center'
327
+ },
328
+ text: i18next.t('{{列.借出数}}')
329
+ },
330
+ {
331
+ head: i18next.t('货值'),
332
+ headStyle: {
333
+ textAlign: 'center'
334
+ },
335
+ style: {
336
+ textAlign: 'center'
337
+ },
338
+ text: i18next.t('{{列.货值}}')
339
+ }
340
+ ]
341
+ break
342
+ }
258
343
  default:
259
344
  }
260
345
  }
@@ -2,12 +2,13 @@ import i18next from '../../locales'
2
2
  import React from 'react'
3
3
  import CommonContextMenu from '../common/common_context_menu'
4
4
  import { inject, observer } from 'mobx-react'
5
+ import _ from 'lodash'
5
6
  import { Printer } from '../printer'
6
7
 
7
8
  const blockTypeList = [
8
9
  { value: '', text: i18next.t('插入文本') },
9
10
  { value: 'line', text: i18next.t('插入线条') },
10
- { value: 'image', text: i18next.t('插入图片') }
11
+ { value: 'counter', text: i18next.t('插入分类汇总') }
11
12
  ]
12
13
 
13
14
  @inject(stores => ({
@@ -16,41 +17,66 @@ const blockTypeList = [
16
17
  }))
17
18
  @observer
18
19
  class ContextMenu extends React.Component {
20
+ /**
21
+ * 是否存在每页合计按钮,非异常明细才有按钮
22
+ * @param name => ContextMenu 的 this.state.name
23
+ * @return {boolean}
24
+ */
25
+ hasSubtotalBtn = name => {
26
+ if (!name) return false
27
+ const noSubtotalList = ['abnormal', 'abnormalDetails']
28
+ const arr = name.split('.')
29
+ if (_.includes(arr, 'table')) {
30
+ const dataKey = this.props.editStore.config.contents[arr[2]].dataKey
31
+ return !_.includes(noSubtotalList, dataKey)
32
+ }
33
+ }
34
+
19
35
  handleChangeTableDataKey = (key, name) => {
20
36
  const { editStore } = this.props
21
37
 
22
- editStore.changeTableDataKeyStockout(name, key)
38
+ editStore.changeTableDataKey(name, key)
39
+ }
40
+
41
+ handleSubtotal = name => {
42
+ const { editStore } = this.props
43
+
44
+ editStore.setSubtotalShow(name)
23
45
  }
24
46
 
25
47
  renderOrderActionBtn = name => {
48
+ if (!this.hasSubtotalBtn(name)) {
49
+ return null
50
+ }
51
+
26
52
  const arr = name.split('.')
27
- const { dataKey } = this.props.editStore.config.contents[arr[2]]
53
+ const { dataKey, subtotal } = this.props.editStore.config.contents[arr[2]]
28
54
  const keyArr = dataKey.split('_')
29
55
 
30
- const isQuantityActive = keyArr.includes('quantity')
31
- // const isMoneyActive = keyArr.includes('money')
32
- const isMultiActive = keyArr.includes('multi')
56
+ // const isMultiActive = keyArr.includes('multi')
57
+ // const isCategoryActive = keyArr.includes('category')
58
+ const isSubtotalActive = subtotal.show
33
59
 
34
60
  return (
35
61
  <>
36
- <div
62
+ {/* <div
37
63
  onClick={this.handleChangeTableDataKey.bind(this, 'multi', name)}
38
64
  className={isMultiActive ? 'active' : ''}
39
65
  >
40
66
  {i18next.t('双栏商品')}
41
67
  </div>
42
68
  <div
43
- onClick={this.handleChangeTableDataKey.bind(this, 'quantity', name)}
44
- className={isQuantityActive ? 'active' : ''}
45
- >
46
- {i18next.t('调拨数小计')}
47
- </div>
48
- {/* <div
49
- onClick={this.handleChangeTableDataKey.bind(this, 'money', name)}
50
- className={isMoneyActive ? 'active' : ''}
69
+ onClick={this.handleChangeTableDataKey.bind(this, 'category', name)}
70
+ className={isCategoryActive ? 'active' : ''}
51
71
  >
52
- {i18next.t('调拨金额小计')}
72
+ {i18next.t('商品分类')}
53
73
  </div> */}
74
+ <div
75
+ onClick={this.handleSubtotal.bind(this, name)}
76
+ className={isSubtotalActive ? 'active' : ''}
77
+ >
78
+ {i18next.t('每页合计')}
79
+ </div>
54
80
  </>
55
81
  )
56
82
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import _ from 'lodash'
4
- import { Flex } from '../components'
4
+ import { Flex, ToolTip } from '../components'
5
5
  import { Gap, Title } from '../common/component'
6
6
  import editStore from './store'
7
7
  import { observer, inject } from 'mobx-react'
@@ -13,15 +13,13 @@ import ContextMenu from './context_menu'
13
13
  import i18next from '../../locales'
14
14
  import withStore from '../common/hoc_with_store'
15
15
 
16
- const tableDataKeyList = [{ value: 'orders', text: i18next.t('全部商品') }]
17
-
18
16
  @withStore(editStore)
19
17
  @inject('editStore')
20
18
  @observer
21
19
  class Editor extends React.Component {
22
20
  render() {
23
- const { onSave, showEditor, addFields } = this.props
24
- // console.log('挑拨单数据',this.props)
21
+ const { onSave, showEditor, addFields, showNewDate } = this.props
22
+
25
23
  return (
26
24
  <div className='gm-printer-edit'>
27
25
  <Flex className='gm-printer-edit-title-fixed'>
@@ -30,8 +28,16 @@ class Editor extends React.Component {
30
28
  text={
31
29
  <span className='gm-text-desc gm-padding-left-5'>
32
30
  {i18next.t(
33
- '说明:选中内容进行编辑,可拖动字段移动位置,右键使用更多功能'
31
+ '说明:选中内容进行编辑,可拖动字段移动位置,右键使用更多功能,更多详情点击'
34
32
  )}
33
+ <a
34
+ href='https://v.qq.com/x/page/t08044292dd.html'
35
+ target='_blank'
36
+ className='btn-link'
37
+ rel='noopener noreferrer'
38
+ >
39
+ {i18next.t('查看视频教程')}
40
+ </a>
35
41
  </span>
36
42
  }
37
43
  />
@@ -41,11 +47,18 @@ class Editor extends React.Component {
41
47
  <div className='gm-printer-edit-zone'>
42
48
  <EditorTitle onSave={onSave} />
43
49
  <Gap height='10px' />
50
+ <>
51
+ <>{i18next.t('模版类型')}</>
52
+ <ToolTip text='表示该模板是针对单一商户的配送单模板(商户配送单),或是账户合并打印配送单(账户配送单)的模板。' />
53
+ <span>{':' + i18next.t('账户配送单')}</span>
54
+ </>
55
+ <Gap height='10px' />
44
56
  <EditorSelect />
45
57
  <Gap height='5px' />
46
- <EditorField tableDataKeyList={tableDataKeyList} />
58
+ <EditorField showNewDate={showNewDate} />
47
59
  <Gap height='5px' />
48
60
  <EditorAddField addFields={addFields} />
61
+ <Gap height='5px' />
49
62
 
50
63
  <div id='gm-printer-tip' />
51
64
 
@@ -66,11 +79,13 @@ Editor.propTypes = {
66
79
  onSave: PropTypes.func,
67
80
  showEditor: PropTypes.bool,
68
81
  mockData: PropTypes.object.isRequired,
69
- addFields: PropTypes.object.isRequired
82
+ addFields: PropTypes.object.isRequired,
83
+ showNewDate: PropTypes.bool
70
84
  }
71
85
 
72
86
  Editor.deaultProps = {
73
- onSave: _.noop
87
+ onSave: _.noop,
88
+ showNewDate: false
74
89
  }
75
90
 
76
91
  export default Editor
@@ -0,0 +1,4 @@
1
+ import withShadowDom from '../common/hoc_with_shadow_dom'
2
+ import EditorAccount from './editor'
3
+
4
+ export default withShadowDom(EditorAccount)
@@ -0,0 +1,263 @@
1
+ import EditorStore from '../common/editor_store'
2
+ import i18next from '../../locales'
3
+
4
+ class Store extends EditorStore {
5
+ // 复写父类方法
6
+ setTableDataKeyEffect(target, dataKey) {
7
+ switch (dataKey) {
8
+ case 'combination': {
9
+ target.columns = [
10
+ {
11
+ head: i18next.t('序号'),
12
+ headStyle: {
13
+ textAlign: 'center'
14
+ },
15
+ style: {
16
+ textAlign: 'center'
17
+ },
18
+ text: i18next.t('{{列.序号}}')
19
+ },
20
+ {
21
+ head: i18next.t('商品名'),
22
+ headStyle: {
23
+ textAlign: 'center'
24
+ },
25
+ style: {
26
+ textAlign: 'center'
27
+ },
28
+ text: i18next.t('{{列.组合商品_名}}')
29
+ },
30
+ {
31
+ head: i18next.t('商品编码'),
32
+ headStyle: {
33
+ textAlign: 'center'
34
+ },
35
+ style: {
36
+ textAlign: 'center'
37
+ },
38
+ text: i18next.t('{{列.组合商品_自定义编码}}')
39
+ },
40
+ {
41
+ head: i18next.t('包装单位'),
42
+ headStyle: {
43
+ textAlign: 'center'
44
+ },
45
+ style: {
46
+ textAlign: 'center'
47
+ },
48
+ text: i18next.t('{{列.组合商品_包装单位}}')
49
+ },
50
+ {
51
+ head: i18next.t('下单数'),
52
+ headStyle: {
53
+ textAlign: 'center'
54
+ },
55
+ style: {
56
+ textAlign: 'center'
57
+ },
58
+ text: i18next.t('{{列.组合商品_下单数}}')
59
+ },
60
+ {
61
+ head: i18next.t('单价'),
62
+ headStyle: {
63
+ textAlign: 'center'
64
+ },
65
+ style: {
66
+ textAlign: 'center'
67
+ },
68
+ text: i18next.t('{{列.组合商品_单价}}')
69
+ },
70
+ {
71
+ head: i18next.t('下单金额'),
72
+ headStyle: {
73
+ textAlign: 'center'
74
+ },
75
+ style: {
76
+ textAlign: 'center'
77
+ },
78
+ text: i18next.t('{{列.组合商品_下单金额}}')
79
+ }
80
+ ]
81
+ break
82
+ }
83
+ case 'reward': {
84
+ target.columns = [
85
+ {
86
+ head: i18next.t('积分商品名'),
87
+ headStyle: {
88
+ textAlign: 'center'
89
+ },
90
+ style: {
91
+ textAlign: 'center'
92
+ },
93
+ text: i18next.t('{{列.积分商品名}}')
94
+ },
95
+ {
96
+ head: i18next.t('规格'),
97
+ headStyle: {
98
+ textAlign: 'center'
99
+ },
100
+ style: {
101
+ textAlign: 'center'
102
+ },
103
+ text: i18next.t('{{列.规格}}')
104
+ },
105
+ {
106
+ head: i18next.t('兑换数'),
107
+ headStyle: {
108
+ textAlign: 'center'
109
+ },
110
+ style: {
111
+ textAlign: 'center'
112
+ },
113
+ text: i18next.t('{{列.兑换数}}')
114
+ },
115
+ {
116
+ head: i18next.t('消耗积分'),
117
+ headStyle: {
118
+ textAlign: 'center'
119
+ },
120
+ style: {
121
+ textAlign: 'center'
122
+ },
123
+ text: i18next.t('{{列.消耗积分}}')
124
+ }
125
+ ]
126
+ break
127
+ }
128
+ case 'abnormal': {
129
+ target.columns = [
130
+ {
131
+ head: i18next.t('商品名'),
132
+ headStyle: {
133
+ textAlign: 'center'
134
+ },
135
+ style: {
136
+ textAlign: 'center'
137
+ },
138
+ text: i18next.t('{{列.商品名}}')
139
+ },
140
+ {
141
+ head: i18next.t('异常原因'),
142
+ headStyle: {
143
+ textAlign: 'center'
144
+ },
145
+ style: {
146
+ textAlign: 'center'
147
+ },
148
+ text: i18next.t('{{列.异常原因}}')
149
+ },
150
+ {
151
+ head: i18next.t('异常数量'),
152
+ headStyle: {
153
+ textAlign: 'center'
154
+ },
155
+ style: {
156
+ textAlign: 'center'
157
+ },
158
+ text: i18next.t('{{列.异常数量}}')
159
+ },
160
+ {
161
+ head: i18next.t('异常金额'),
162
+ headStyle: {
163
+ textAlign: 'center'
164
+ },
165
+ style: {
166
+ textAlign: 'center'
167
+ },
168
+ text: i18next.t('{{列.异常金额}}')
169
+ }
170
+ ]
171
+ break
172
+ }
173
+ case 'orders': {
174
+ target.columns = [
175
+ {
176
+ head: i18next.t('序号'),
177
+ headStyle: {
178
+ textAlign: 'center'
179
+ },
180
+ style: {
181
+ textAlign: 'center'
182
+ },
183
+ text: i18next.t('{{列.序号}}')
184
+ },
185
+ {
186
+ head: i18next.t('类别'),
187
+ headStyle: {
188
+ textAlign: 'center'
189
+ },
190
+ style: {
191
+ textAlign: 'center'
192
+ },
193
+ text: i18next.t('{{列.类别}}')
194
+ },
195
+ {
196
+ head: i18next.t('商品名'),
197
+ headStyle: {
198
+ textAlign: 'center'
199
+ },
200
+ style: {
201
+ textAlign: 'center'
202
+ },
203
+ text: i18next.t('{{列.商品名}}')
204
+ },
205
+ {
206
+ head: i18next.t('规格'),
207
+ headStyle: {
208
+ textAlign: 'center'
209
+ },
210
+ style: {
211
+ textAlign: 'center'
212
+ },
213
+ text: i18next.t('{{列.规格}}')
214
+ },
215
+ {
216
+ head: i18next.t('下单数'),
217
+ headStyle: {
218
+ textAlign: 'center'
219
+ },
220
+ style: {
221
+ textAlign: 'center'
222
+ },
223
+ text: i18next.t('{{列.下单数}}{{列.销售单位}}')
224
+ },
225
+ {
226
+ head: i18next.t('出库数(基本单位)'),
227
+ headStyle: {
228
+ textAlign: 'center'
229
+ },
230
+ style: {
231
+ textAlign: 'center'
232
+ },
233
+ text: i18next.t('{{列.出库数_基本单位}}{{列.基本单位}}')
234
+ },
235
+ {
236
+ head: i18next.t('单价(基本单位)'),
237
+ headStyle: {
238
+ textAlign: 'center'
239
+ },
240
+ style: {
241
+ textAlign: 'center'
242
+ },
243
+ text: i18next.t('{{列.单价_基本单位}}')
244
+ },
245
+ {
246
+ head: i18next.t('出库金额'),
247
+ headStyle: {
248
+ textAlign: 'center'
249
+ },
250
+ style: {
251
+ textAlign: 'center'
252
+ },
253
+ text: i18next.t('{{列.出库金额}}')
254
+ }
255
+ ]
256
+ break
257
+ }
258
+ default:
259
+ }
260
+ }
261
+ }
262
+
263
+ export default new Store()
@@ -42,7 +42,6 @@ class ContextMenu extends React.Component {
42
42
  const arr = name.split('.')
43
43
  const { dataKey } = this.props.editStore.config.contents[arr[2]]
44
44
  const keyArr = dataKey.split('_')
45
- console.log('dataKey', dataKey, name)
46
45
 
47
46
  const isMultiActive = keyArr.includes('multi')
48
47
  const isCategoryActive = keyArr.includes('category')
@@ -17,7 +17,11 @@ import { inject, observer } from 'mobx-react'
17
17
 
18
18
  const dataKeyList = [
19
19
  { value: 'purchase_no_detail', text: i18next.t('不打印明细') },
20
- { value: 'purchase_last_col', text: i18next.t('单列-总表最后一列') },
20
+ { value: 'purchase_last_col', text: i18next.t('单列-总表最后一列(换行)') },
21
+ {
22
+ value: 'purchase_last_col_noLineBreak',
23
+ text: i18next.t('单列-总表最后一列(不换行)')
24
+ },
21
25
  { value: 'purchase_one_row', text: i18next.t('单列-总表下方一行') },
22
26
  { value: 'purchase_flex_2', text: i18next.t('双栏-总表下方一行两栏') },
23
27
  { value: 'purchase_flex_4', text: i18next.t('四栏-总表下方一行四栏') }
@@ -59,7 +63,6 @@ class TableDetailEditor extends React.Component {
59
63
  <div>
60
64
  <Title title={i18next.t('设置采购明细')} />
61
65
  <Gap />
62
-
63
66
  <Flex alignCenter className='gm-padding-top-5'>
64
67
  <div>{i18next.t('采购明细')}:</div>
65
68
  <Select