kts-component-invoice-operate 3.2.8 → 3.2.10

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": "kts-component-invoice-operate",
3
- "version": "3.2.8",
3
+ "version": "3.2.10",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -2,4 +2,15 @@ import React from 'react';
2
2
  import Invoice from '../../..';
3
3
  import 'antd/dist/antd.css';
4
4
 
5
- export default () => <Invoice invoiceType='digtal' />;
5
+ export default () => {
6
+ return (
7
+ <Invoice
8
+ invoiceType='digtal'
9
+ invoiceHeader={
10
+ <Invoice.InvoiceHeader
11
+ title='自定义'
12
+ />
13
+ }
14
+ />
15
+ )
16
+ };
@@ -36,38 +36,49 @@ export default () => {
36
36
  await controller.wait();
37
37
  await controller.run(async s => {
38
38
 
39
+ // 不能给编辑状态的行增加折扣!
39
40
  let isOk = s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0;
40
41
  if (isOk) {
41
42
  message.error({ content: '不能给编辑状态的行增加折扣!', key: '不能给编辑状态的行增加折扣!' });
42
43
  return;
43
44
  }
44
45
 
46
+ // 项目不连续,不允许添加折扣
45
47
  if (!isContinuityNum(s.goodsListState.selectedGoodIndex.map(e => s.goodsListState.goodsMap.get(e)?.serialNo || -2).sort((a, b) => a - b))) {
46
48
  message.error({ content: '项目不连续,不允许添加折扣', key: '项目不连续,不允许添加折扣' });
47
49
  return;
48
50
  }
49
51
 
52
+ // 不允许重复添加折扣
50
53
  isOk = s.goodsListState.selectedGoodIndex.some($index => s.goodsListState.goodsMap.get($index)?.lineAttribute !== LineAttributeType.正常)
51
54
  if (isOk) {
52
55
  message.error({ content: '不允许重复添加折扣', key: '不允许重复添加折扣' });
53
56
  return;
54
57
  }
55
58
 
59
+ // 存在不同税率,不允许同时添加折扣
60
+ if (areAllValuesEqual(s.goodsListState.selectedGoodIndex.map(e => s.goodsListState.goodsMap.get(e)?.taxRate)) === false) {
61
+ message.error({ content: '存在不同税率,不允许同时添加折扣', key: '存在不同税率,不允许同时添加折扣' });
62
+ return;
63
+ }
64
+
65
+ // 添加折扣时项目金额不能为空或零
56
66
  isOk = s.goodsListState.selectedGoodIndex.some($index => {
57
67
  const good = s.goodsListState.goodsMap.get($index);
58
- return !good || (good.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !good.taxFreeType)
68
+ return `${good?.lineAmountIncludeTax}` === '0'
59
69
  })
60
70
  if (isOk) {
61
- message.error({ content: '零税率需要设置免税类型,请在赋码中设置!', key: '零税率需要设置免税类型,请在赋码中设置!' });
71
+ message.error({ content: '添加折扣时项目金额不能为空或零', key: '添加折扣时项目金额不能为空或零' });
62
72
  return;
63
73
  }
64
74
 
75
+ // 零税率需要设置免税类型,请在赋码中设置!
65
76
  isOk = s.goodsListState.selectedGoodIndex.some($index => {
66
77
  const good = s.goodsListState.goodsMap.get($index);
67
- return `${good?.lineAmountIncludeTax}` === '0'
78
+ return !good || (good.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !good.taxFreeType)
68
79
  })
69
80
  if (isOk) {
70
- message.error({ content: '金额为0不能添加折扣行', key: '金额为0不能添加折扣行' });
81
+ message.error({ content: '零税率需要设置免税类型,请在赋码中设置!', key: '零税率需要设置免税类型,请在赋码中设置!' });
71
82
  return;
72
83
  }
73
84
 
@@ -318,3 +329,12 @@ function isContinuityNum(array: number[]) {
318
329
  return isContinuation;
319
330
  }
320
331
 
332
+ /** 数组的值是否相等 */
333
+ function areAllValuesEqual(arr: any[]) {
334
+ for (let i = 1; i < arr.length; i++) {
335
+ if (arr[i] !== arr[0]) {
336
+ return false;
337
+ }
338
+ }
339
+ return true;
340
+ }
@@ -45,14 +45,14 @@ export default decorator<IBuyerProps, IBuyerProps & FormComponentProps>(Form.cre
45
45
  <span>注</span>
46
46
  </div>
47
47
  <div>
48
- {getFieldDecorator('remark', {
48
+ {getFieldDecorator('remarks', {
49
49
  initialValue: props.defaultRemark
50
50
  })(<MyDiv />)}
51
51
  </div>
52
52
  </div>
53
53
  <Form layout='inline' className='digtal-readOnly-form' >
54
54
  <Form.Item label='开票人' >
55
- {getFieldDecorator('issuer', {
55
+ {getFieldDecorator('drawer', {
56
56
  initialValue: props.defaultRemark
57
57
  })(<MyDiv />)}
58
58
  </Form.Item>
@@ -1,12 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none">
2
- <g clip-path="url(#clip0_715_372)">
3
- <path d="M7.5 14.5312C3.61687 14.5312 0.46875 11.3831 0.46875 7.5C0.46875 3.61687 3.61687 0.46875 7.5 0.46875C11.3831 0.46875 14.5312 3.61687 14.5312 7.5C14.5312 11.3831 11.3831 14.5312 7.5 14.5312ZM7.5 13.5938C10.8656 13.5938 13.5938 10.8656 13.5938 7.5C13.5938 4.13438 10.8656 1.40625 7.5 1.40625C4.13438 1.40625 1.40625 4.13438 1.40625 7.5C1.40625 10.8656 4.13438 13.5938 7.5 13.5938Z" />
4
- <path d="M3.75 7.96875C3.62568 7.96875 3.50645 7.91936 3.41854 7.83146C3.33064 7.74355 3.28125 7.62432 3.28125 7.5C3.28125 7.37568 3.33064 7.25645 3.41854 7.16854C3.50645 7.08064 3.62568 7.03125 3.75 7.03125H11.25C11.3743 7.03125 11.4935 7.08064 11.5815 7.16854C11.6694 7.25645 11.7188 7.37568 11.7188 7.5C11.7188 7.62432 11.6694 7.74355 11.5815 7.83146C11.4935 7.91936 11.3743 7.96875 11.25 7.96875H3.75Z" />
5
- <path d="M7.03125 3.75C7.03125 3.62568 7.08064 3.50645 7.16854 3.41854C7.25645 3.33064 7.37568 3.28125 7.5 3.28125C7.62432 3.28125 7.74355 3.33064 7.83146 3.41854C7.91936 3.50645 7.96875 3.62568 7.96875 3.75V11.25C7.96875 11.3743 7.91936 11.4935 7.83146 11.5815C7.74355 11.6694 7.62432 11.7188 7.5 11.7188C7.37568 11.7188 7.25645 11.6694 7.16854 11.5815C7.08064 11.4935 7.03125 11.3743 7.03125 11.25V3.75Z" />
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_715_372">
9
- <rect width="15" height="15" />
10
- </clipPath>
11
- </defs>
12
- </svg>