kts-component-invoice-operate 3.2.128 → 3.2.130-1

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.
@@ -2,6 +2,7 @@ import './index.less';
2
2
  import React from 'react';
3
3
  import InvoiceController from './InvoiceController';
4
4
  import * as calculator from './tools/calculate';
5
+ import * as utils from './tools/utils';
5
6
  import GoodsList from './ui/default/GoodsList';
6
7
  import Seller from './ui/default/Seller';
7
8
  import Buyer from './ui/default/Buyer';
@@ -53,6 +54,8 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
53
54
  static idGenerator: () => string;
54
55
  /** 金额计算方法 */
55
56
  static calculator: typeof calculator;
57
+ /** 工具方法 */
58
+ static utils: typeof utils;
56
59
  /** 获取控制器钩子 */
57
60
  static useInvoiceController: () => InvoiceController;
58
61
  render(): JSX.Element;
@@ -0,0 +1 @@
1
+ export * as Money from './money';
@@ -0,0 +1,2 @@
1
+ /** 数字转中文 */
2
+ export declare const toStringChinese: (value: any) => any;
package/dist/index.esm.js CHANGED
@@ -916,9 +916,12 @@ var ImportGoods = /*#__PURE__*/_createClass(function ImportGoods() {
916
916
  dataIndex: 'unit',
917
917
  key: 'unit'
918
918
  }, {
919
- title: '税率(%)',
919
+ title: '税率',
920
920
  dataIndex: 'taxRate',
921
- key: 'taxRate'
921
+ key: 'taxRate',
922
+ render: function render(text) {
923
+ return text || text === 0 ? "".concat(text, "%") : '';
924
+ }
922
925
  }, {
923
926
  title: '单价(含税)',
924
927
  dataIndex: 'priceIncludeTax',
@@ -9733,6 +9736,39 @@ function useToGenerateId(controller) {
9733
9736
  }, [goodsList]);
9734
9737
  }
9735
9738
 
9739
+ var Nzh = require("nzh");
9740
+
9741
+ var nzhcn = new Nzh({
9742
+ ch: '零壹贰叁肆伍陆柒捌玖',
9743
+ ch_u: '个拾佰仟万亿',
9744
+ ch_f: '负',
9745
+ ch_d: '点',
9746
+ m_t: '人民币',
9747
+ m_z: '整',
9748
+ m_u: '圆角分'
9749
+ });
9750
+ /** 数字转中文 */
9751
+
9752
+ var toStringChinese = function toStringChinese(value) {
9753
+ try {
9754
+ return nzhcn.toMoney(value, {
9755
+ outSymbol: false
9756
+ });
9757
+ } catch (e) {
9758
+ return '';
9759
+ }
9760
+ };
9761
+
9762
+ var index = /*#__PURE__*/Object.freeze({
9763
+ __proto__: null,
9764
+ toStringChinese: toStringChinese
9765
+ });
9766
+
9767
+ var utils = /*#__PURE__*/Object.freeze({
9768
+ __proto__: null,
9769
+ Money: index
9770
+ });
9771
+
9736
9772
  var _defs, _path, _path2, _path3;
9737
9773
 
9738
9774
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -10092,7 +10128,7 @@ function TableVirtual (props) {
10092
10128
  var css_248z$3 = ".kts-invoice-operate-goods-list-statistics {\n background: #fafafa;\n overflow-y: scroll;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row {\n height: 30px;\n line-height: 30px;\n border-bottom: 1px solid #e8e8e8;\n display: flex;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div {\n border-right: 1px solid #e8e8e8;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div label {\n padding: 0 10px;\n}\n";
10093
10129
  styleInject(css_248z$3);
10094
10130
 
10095
- var nzhcn = require('nzh').cn;
10131
+ var nzhcn$1 = require('nzh').cn;
10096
10132
 
10097
10133
  var Statistics = (function () {
10098
10134
  var controller = Invoice.useInvoiceController();
@@ -10219,9 +10255,7 @@ var Statistics = (function () {
10219
10255
  flex: 5,
10220
10256
  border: 'none'
10221
10257
  }
10222
- }, /*#__PURE__*/React.createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React.createElement("label", null, nzhcn.toMoney(lineAmountIncludeTax, {
10223
- outSymbol: false
10224
- }))), /*#__PURE__*/React.createElement("div", {
10258
+ }, /*#__PURE__*/React.createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React.createElement("label", null, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React.createElement("div", {
10225
10259
  style: {
10226
10260
  flex: 5,
10227
10261
  border: 'none'
@@ -13726,7 +13760,7 @@ var useColumns = (function (form) {
13726
13760
  }, {
13727
13761
  title: /*#__PURE__*/React.createElement(TitleText, {
13728
13762
  required: true
13729
- }, "\u7A0E\u7387%"),
13763
+ }, "\u7A0E\u7387"),
13730
13764
  dataIndex: 'taxRate',
13731
13765
  key: 'taxRate',
13732
13766
  align: 'right',
@@ -15572,52 +15606,68 @@ function useSalesGifts() {
15572
15606
  while (1) {
15573
15607
  switch (_context.prev = _context.next) {
15574
15608
  case 0:
15609
+ _context.next = 2;
15610
+ return controller.saveEditGood();
15611
+
15612
+ case 2:
15613
+ _context.next = 4;
15614
+ return controller.wait();
15615
+
15616
+ case 4:
15617
+ if (!controller.state.goodsListState.editGood) {
15618
+ _context.next = 6;
15619
+ break;
15620
+ }
15621
+
15622
+ return _context.abrupt("return");
15623
+
15624
+ case 6:
15575
15625
  _iterator = _createForOfIteratorHelper(giveaways);
15576
- _context.prev = 1;
15626
+ _context.prev = 7;
15577
15627
 
15578
15628
  _iterator.s();
15579
15629
 
15580
- case 3:
15630
+ case 9:
15581
15631
  if ((_step = _iterator.n()).done) {
15582
- _context.next = 10;
15632
+ _context.next = 16;
15583
15633
  break;
15584
15634
  }
15585
15635
 
15586
15636
  g = _step.value;
15587
15637
  g.lineAttribute = LineAttributeType$1.正常;
15588
- _context.next = 8;
15638
+ _context.next = 14;
15589
15639
  return controller.addGoodDiscountV2([{
15590
15640
  $index: g.$index,
15591
15641
  discolineAmountunt: g.lineAmountIncludeTax || 0
15592
15642
  }]);
15593
15643
 
15594
- case 8:
15595
- _context.next = 3;
15644
+ case 14:
15645
+ _context.next = 9;
15596
15646
  break;
15597
15647
 
15598
- case 10:
15599
- _context.next = 15;
15648
+ case 16:
15649
+ _context.next = 21;
15600
15650
  break;
15601
15651
 
15602
- case 12:
15603
- _context.prev = 12;
15604
- _context.t0 = _context["catch"](1);
15652
+ case 18:
15653
+ _context.prev = 18;
15654
+ _context.t0 = _context["catch"](7);
15605
15655
 
15606
15656
  _iterator.e(_context.t0);
15607
15657
 
15608
- case 15:
15609
- _context.prev = 15;
15658
+ case 21:
15659
+ _context.prev = 21;
15610
15660
 
15611
15661
  _iterator.f();
15612
15662
 
15613
- return _context.finish(15);
15663
+ return _context.finish(21);
15614
15664
 
15615
- case 18:
15665
+ case 24:
15616
15666
  case "end":
15617
15667
  return _context.stop();
15618
15668
  }
15619
15669
  }
15620
- }, _callee, null, [[1, 12, 15, 18]]);
15670
+ }, _callee, null, [[7, 18, 21, 24]]);
15621
15671
  })), [controller, giveaways]);
15622
15672
  var onClickManual = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
15623
15673
  var _controller$state$goo, goodsMap, _selectedGoodIndex, _giveaways, _iterator2, _step2, g;
@@ -15627,70 +15677,86 @@ function useSalesGifts() {
15627
15677
  switch (_context2.prev = _context2.next) {
15628
15678
  case 0:
15629
15679
  _context2.prev = 0;
15680
+ _context2.next = 3;
15681
+ return controller.saveEditGood();
15682
+
15683
+ case 3:
15684
+ _context2.next = 5;
15685
+ return controller.wait();
15686
+
15687
+ case 5:
15688
+ if (!controller.state.goodsListState.editGood) {
15689
+ _context2.next = 7;
15690
+ break;
15691
+ }
15692
+
15693
+ return _context2.abrupt("return");
15694
+
15695
+ case 7:
15630
15696
  _controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, _selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
15631
15697
  _giveaways = _selectedGoodIndex.map(function (e) {
15632
15698
  return goodsMap.get(e);
15633
15699
  }).filter(function (e) {
15634
15700
  return !!e;
15635
15701
  });
15636
- _context2.next = 5;
15702
+ _context2.next = 11;
15637
15703
  return checkLineAttribute(_giveaways);
15638
15704
 
15639
- case 5:
15705
+ case 11:
15640
15706
  _iterator2 = _createForOfIteratorHelper(_giveaways);
15641
- _context2.prev = 6;
15707
+ _context2.prev = 12;
15642
15708
 
15643
15709
  _iterator2.s();
15644
15710
 
15645
- case 8:
15711
+ case 14:
15646
15712
  if ((_step2 = _iterator2.n()).done) {
15647
- _context2.next = 14;
15713
+ _context2.next = 20;
15648
15714
  break;
15649
15715
  }
15650
15716
 
15651
15717
  g = _step2.value;
15652
- _context2.next = 12;
15718
+ _context2.next = 18;
15653
15719
  return controller.addGoodDiscountV2([{
15654
15720
  $index: g.$index,
15655
15721
  discolineAmountunt: g.lineAmountIncludeTax || 0
15656
15722
  }]);
15657
15723
 
15658
- case 12:
15659
- _context2.next = 8;
15724
+ case 18:
15725
+ _context2.next = 14;
15660
15726
  break;
15661
15727
 
15662
- case 14:
15663
- _context2.next = 19;
15728
+ case 20:
15729
+ _context2.next = 25;
15664
15730
  break;
15665
15731
 
15666
- case 16:
15667
- _context2.prev = 16;
15668
- _context2.t0 = _context2["catch"](6);
15732
+ case 22:
15733
+ _context2.prev = 22;
15734
+ _context2.t0 = _context2["catch"](12);
15669
15735
 
15670
15736
  _iterator2.e(_context2.t0);
15671
15737
 
15672
- case 19:
15673
- _context2.prev = 19;
15738
+ case 25:
15739
+ _context2.prev = 25;
15674
15740
 
15675
15741
  _iterator2.f();
15676
15742
 
15677
- return _context2.finish(19);
15743
+ return _context2.finish(25);
15678
15744
 
15679
- case 22:
15745
+ case 28:
15680
15746
  controller.state.goodsListState.selectedGoodIndex = [];
15681
- _context2.next = 27;
15747
+ _context2.next = 33;
15682
15748
  break;
15683
15749
 
15684
- case 25:
15685
- _context2.prev = 25;
15750
+ case 31:
15751
+ _context2.prev = 31;
15686
15752
  _context2.t1 = _context2["catch"](0);
15687
15753
 
15688
- case 27:
15754
+ case 33:
15689
15755
  case "end":
15690
15756
  return _context2.stop();
15691
15757
  }
15692
15758
  }
15693
- }, _callee2, null, [[0, 25], [6, 16, 19, 22]]);
15759
+ }, _callee2, null, [[0, 31], [12, 22, 25, 28]]);
15694
15760
  })), [controller]);
15695
15761
  var items = React.useMemo(function () {
15696
15762
  return [{
@@ -17505,8 +17571,6 @@ function SvgFork(props) {
17505
17571
  var css_248z$j = ".kts-invoice-operate-goods-list-statistics-digtal {\n overflow-y: scroll;\n /* 设置滚动条滑块颜色 */\n}\n.kts-invoice-operate-goods-list-statistics-digtal::-webkit-scrollbar-track {\n background-color: #f1f1f1;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total {\n height: 42px;\n display: flex;\n align-items: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total > div:first-child {\n width: 225px;\n color: #9F613E;\n font-family: PingFang SC;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax {\n border-top: 2px solid #9F613E;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child {\n border-right: 2px solid #9F613E;\n}\n";
17506
17572
  styleInject(css_248z$j);
17507
17573
 
17508
- var nzhcn$1 = require('nzh').cn;
17509
-
17510
17574
  var Statistics$1 = (function () {
17511
17575
  var controller = Invoice.useInvoiceController();
17512
17576
  /** 是否不含税) */
@@ -17617,9 +17681,7 @@ var Statistics$1 = (function () {
17617
17681
  fontWeight: 'bold',
17618
17682
  marginLeft: 4
17619
17683
  }
17620
- }, nzhcn$1.toMoney(lineAmountIncludeTax, {
17621
- outSymbol: false
17622
- }))), /*#__PURE__*/React.createElement("div", {
17684
+ }, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React.createElement("div", {
17623
17685
  style: {
17624
17686
  flex: 1
17625
17687
  }
@@ -20576,7 +20638,7 @@ var useColumns$1 = (function (form) {
20576
20638
  }, {
20577
20639
  title: /*#__PURE__*/React.createElement(TitleText$1, {
20578
20640
  required: true
20579
- }, "\u7A0E\u7387%"),
20641
+ }, "\u7A0E\u7387"),
20580
20642
  dataIndex: 'taxRate',
20581
20643
  key: 'taxRate',
20582
20644
  align: 'right',
@@ -24105,6 +24167,8 @@ var Invoice = /*#__PURE__*/function (_React$PureComponent) {
24105
24167
 
24106
24168
  /** 金额计算方法 */
24107
24169
 
24170
+ /** 工具方法 */
24171
+
24108
24172
  /** 获取控制器钩子 */
24109
24173
  function render() {
24110
24174
  if (this.props.invoiceType === 'digtal') {
@@ -24132,6 +24196,7 @@ Invoice.SignDigtal = SignDigtal;
24132
24196
  Invoice.GoodsListDigtal = GoodsList$1;
24133
24197
  Invoice.idGenerator = idGenerator;
24134
24198
  Invoice.calculator = calculator;
24199
+ Invoice.utils = utils;
24135
24200
 
24136
24201
  Invoice.useInvoiceController = function () {
24137
24202
  return React.useContext(InvoiceContext);
package/dist/index.js CHANGED
@@ -926,9 +926,12 @@ var ImportGoods = /*#__PURE__*/_createClass(function ImportGoods() {
926
926
  dataIndex: 'unit',
927
927
  key: 'unit'
928
928
  }, {
929
- title: '税率(%)',
929
+ title: '税率',
930
930
  dataIndex: 'taxRate',
931
- key: 'taxRate'
931
+ key: 'taxRate',
932
+ render: function render(text) {
933
+ return text || text === 0 ? "".concat(text, "%") : '';
934
+ }
932
935
  }, {
933
936
  title: '单价(含税)',
934
937
  dataIndex: 'priceIncludeTax',
@@ -9743,6 +9746,39 @@ function useToGenerateId(controller) {
9743
9746
  }, [goodsList]);
9744
9747
  }
9745
9748
 
9749
+ var Nzh = require("nzh");
9750
+
9751
+ var nzhcn = new Nzh({
9752
+ ch: '零壹贰叁肆伍陆柒捌玖',
9753
+ ch_u: '个拾佰仟万亿',
9754
+ ch_f: '负',
9755
+ ch_d: '点',
9756
+ m_t: '人民币',
9757
+ m_z: '整',
9758
+ m_u: '圆角分'
9759
+ });
9760
+ /** 数字转中文 */
9761
+
9762
+ var toStringChinese = function toStringChinese(value) {
9763
+ try {
9764
+ return nzhcn.toMoney(value, {
9765
+ outSymbol: false
9766
+ });
9767
+ } catch (e) {
9768
+ return '';
9769
+ }
9770
+ };
9771
+
9772
+ var index = /*#__PURE__*/Object.freeze({
9773
+ __proto__: null,
9774
+ toStringChinese: toStringChinese
9775
+ });
9776
+
9777
+ var utils = /*#__PURE__*/Object.freeze({
9778
+ __proto__: null,
9779
+ Money: index
9780
+ });
9781
+
9746
9782
  var _defs, _path, _path2, _path3;
9747
9783
 
9748
9784
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -10102,7 +10138,7 @@ function TableVirtual (props) {
10102
10138
  var css_248z$3 = ".kts-invoice-operate-goods-list-statistics {\n background: #fafafa;\n overflow-y: scroll;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row {\n height: 30px;\n line-height: 30px;\n border-bottom: 1px solid #e8e8e8;\n display: flex;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div {\n border-right: 1px solid #e8e8e8;\n}\n.kts-invoice-operate-goods-list-statistics .kts-invoice-operate-goods-list-statistics-row > div label {\n padding: 0 10px;\n}\n";
10103
10139
  styleInject(css_248z$3);
10104
10140
 
10105
- var nzhcn = require('nzh').cn;
10141
+ var nzhcn$1 = require('nzh').cn;
10106
10142
 
10107
10143
  var Statistics = (function () {
10108
10144
  var controller = Invoice.useInvoiceController();
@@ -10229,9 +10265,7 @@ var Statistics = (function () {
10229
10265
  flex: 5,
10230
10266
  border: 'none'
10231
10267
  }
10232
- }, /*#__PURE__*/React__default['default'].createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React__default['default'].createElement("label", null, nzhcn.toMoney(lineAmountIncludeTax, {
10233
- outSymbol: false
10234
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
10268
+ }, /*#__PURE__*/React__default['default'].createElement("label", null, "\u4EF7\u7A0E\u5408\u8BA1\uFF08\u5927\u5199\uFF09"), /*#__PURE__*/React__default['default'].createElement("label", null, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React__default['default'].createElement("div", {
10235
10269
  style: {
10236
10270
  flex: 5,
10237
10271
  border: 'none'
@@ -13736,7 +13770,7 @@ var useColumns = (function (form) {
13736
13770
  }, {
13737
13771
  title: /*#__PURE__*/React__default['default'].createElement(TitleText, {
13738
13772
  required: true
13739
- }, "\u7A0E\u7387%"),
13773
+ }, "\u7A0E\u7387"),
13740
13774
  dataIndex: 'taxRate',
13741
13775
  key: 'taxRate',
13742
13776
  align: 'right',
@@ -15582,52 +15616,68 @@ function useSalesGifts() {
15582
15616
  while (1) {
15583
15617
  switch (_context.prev = _context.next) {
15584
15618
  case 0:
15619
+ _context.next = 2;
15620
+ return controller.saveEditGood();
15621
+
15622
+ case 2:
15623
+ _context.next = 4;
15624
+ return controller.wait();
15625
+
15626
+ case 4:
15627
+ if (!controller.state.goodsListState.editGood) {
15628
+ _context.next = 6;
15629
+ break;
15630
+ }
15631
+
15632
+ return _context.abrupt("return");
15633
+
15634
+ case 6:
15585
15635
  _iterator = _createForOfIteratorHelper(giveaways);
15586
- _context.prev = 1;
15636
+ _context.prev = 7;
15587
15637
 
15588
15638
  _iterator.s();
15589
15639
 
15590
- case 3:
15640
+ case 9:
15591
15641
  if ((_step = _iterator.n()).done) {
15592
- _context.next = 10;
15642
+ _context.next = 16;
15593
15643
  break;
15594
15644
  }
15595
15645
 
15596
15646
  g = _step.value;
15597
15647
  g.lineAttribute = LineAttributeType$1.正常;
15598
- _context.next = 8;
15648
+ _context.next = 14;
15599
15649
  return controller.addGoodDiscountV2([{
15600
15650
  $index: g.$index,
15601
15651
  discolineAmountunt: g.lineAmountIncludeTax || 0
15602
15652
  }]);
15603
15653
 
15604
- case 8:
15605
- _context.next = 3;
15654
+ case 14:
15655
+ _context.next = 9;
15606
15656
  break;
15607
15657
 
15608
- case 10:
15609
- _context.next = 15;
15658
+ case 16:
15659
+ _context.next = 21;
15610
15660
  break;
15611
15661
 
15612
- case 12:
15613
- _context.prev = 12;
15614
- _context.t0 = _context["catch"](1);
15662
+ case 18:
15663
+ _context.prev = 18;
15664
+ _context.t0 = _context["catch"](7);
15615
15665
 
15616
15666
  _iterator.e(_context.t0);
15617
15667
 
15618
- case 15:
15619
- _context.prev = 15;
15668
+ case 21:
15669
+ _context.prev = 21;
15620
15670
 
15621
15671
  _iterator.f();
15622
15672
 
15623
- return _context.finish(15);
15673
+ return _context.finish(21);
15624
15674
 
15625
- case 18:
15675
+ case 24:
15626
15676
  case "end":
15627
15677
  return _context.stop();
15628
15678
  }
15629
15679
  }
15630
- }, _callee, null, [[1, 12, 15, 18]]);
15680
+ }, _callee, null, [[7, 18, 21, 24]]);
15631
15681
  })), [controller, giveaways]);
15632
15682
  var onClickManual = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
15633
15683
  var _controller$state$goo, goodsMap, _selectedGoodIndex, _giveaways, _iterator2, _step2, g;
@@ -15637,70 +15687,86 @@ function useSalesGifts() {
15637
15687
  switch (_context2.prev = _context2.next) {
15638
15688
  case 0:
15639
15689
  _context2.prev = 0;
15690
+ _context2.next = 3;
15691
+ return controller.saveEditGood();
15692
+
15693
+ case 3:
15694
+ _context2.next = 5;
15695
+ return controller.wait();
15696
+
15697
+ case 5:
15698
+ if (!controller.state.goodsListState.editGood) {
15699
+ _context2.next = 7;
15700
+ break;
15701
+ }
15702
+
15703
+ return _context2.abrupt("return");
15704
+
15705
+ case 7:
15640
15706
  _controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, _selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
15641
15707
  _giveaways = _selectedGoodIndex.map(function (e) {
15642
15708
  return goodsMap.get(e);
15643
15709
  }).filter(function (e) {
15644
15710
  return !!e;
15645
15711
  });
15646
- _context2.next = 5;
15712
+ _context2.next = 11;
15647
15713
  return checkLineAttribute(_giveaways);
15648
15714
 
15649
- case 5:
15715
+ case 11:
15650
15716
  _iterator2 = _createForOfIteratorHelper(_giveaways);
15651
- _context2.prev = 6;
15717
+ _context2.prev = 12;
15652
15718
 
15653
15719
  _iterator2.s();
15654
15720
 
15655
- case 8:
15721
+ case 14:
15656
15722
  if ((_step2 = _iterator2.n()).done) {
15657
- _context2.next = 14;
15723
+ _context2.next = 20;
15658
15724
  break;
15659
15725
  }
15660
15726
 
15661
15727
  g = _step2.value;
15662
- _context2.next = 12;
15728
+ _context2.next = 18;
15663
15729
  return controller.addGoodDiscountV2([{
15664
15730
  $index: g.$index,
15665
15731
  discolineAmountunt: g.lineAmountIncludeTax || 0
15666
15732
  }]);
15667
15733
 
15668
- case 12:
15669
- _context2.next = 8;
15734
+ case 18:
15735
+ _context2.next = 14;
15670
15736
  break;
15671
15737
 
15672
- case 14:
15673
- _context2.next = 19;
15738
+ case 20:
15739
+ _context2.next = 25;
15674
15740
  break;
15675
15741
 
15676
- case 16:
15677
- _context2.prev = 16;
15678
- _context2.t0 = _context2["catch"](6);
15742
+ case 22:
15743
+ _context2.prev = 22;
15744
+ _context2.t0 = _context2["catch"](12);
15679
15745
 
15680
15746
  _iterator2.e(_context2.t0);
15681
15747
 
15682
- case 19:
15683
- _context2.prev = 19;
15748
+ case 25:
15749
+ _context2.prev = 25;
15684
15750
 
15685
15751
  _iterator2.f();
15686
15752
 
15687
- return _context2.finish(19);
15753
+ return _context2.finish(25);
15688
15754
 
15689
- case 22:
15755
+ case 28:
15690
15756
  controller.state.goodsListState.selectedGoodIndex = [];
15691
- _context2.next = 27;
15757
+ _context2.next = 33;
15692
15758
  break;
15693
15759
 
15694
- case 25:
15695
- _context2.prev = 25;
15760
+ case 31:
15761
+ _context2.prev = 31;
15696
15762
  _context2.t1 = _context2["catch"](0);
15697
15763
 
15698
- case 27:
15764
+ case 33:
15699
15765
  case "end":
15700
15766
  return _context2.stop();
15701
15767
  }
15702
15768
  }
15703
- }, _callee2, null, [[0, 25], [6, 16, 19, 22]]);
15769
+ }, _callee2, null, [[0, 31], [12, 22, 25, 28]]);
15704
15770
  })), [controller]);
15705
15771
  var items = React__default['default'].useMemo(function () {
15706
15772
  return [{
@@ -17515,8 +17581,6 @@ function SvgFork(props) {
17515
17581
  var css_248z$j = ".kts-invoice-operate-goods-list-statistics-digtal {\n overflow-y: scroll;\n /* 设置滚动条滑块颜色 */\n}\n.kts-invoice-operate-goods-list-statistics-digtal::-webkit-scrollbar-track {\n background-color: #f1f1f1;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total {\n height: 42px;\n display: flex;\n align-items: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child,\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total > div:first-child {\n width: 225px;\n color: #9F613E;\n font-family: PingFang SC;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax {\n border-top: 2px solid #9F613E;\n}\n.kts-invoice-operate-goods-list-statistics-digtal .statistics-digtal-total-tax > div:first-child {\n border-right: 2px solid #9F613E;\n}\n";
17516
17582
  styleInject(css_248z$j);
17517
17583
 
17518
- var nzhcn$1 = require('nzh').cn;
17519
-
17520
17584
  var Statistics$1 = (function () {
17521
17585
  var controller = Invoice.useInvoiceController();
17522
17586
  /** 是否不含税) */
@@ -17627,9 +17691,7 @@ var Statistics$1 = (function () {
17627
17691
  fontWeight: 'bold',
17628
17692
  marginLeft: 4
17629
17693
  }
17630
- }, nzhcn$1.toMoney(lineAmountIncludeTax, {
17631
- outSymbol: false
17632
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
17694
+ }, toStringChinese(lineAmountIncludeTax))), /*#__PURE__*/React__default['default'].createElement("div", {
17633
17695
  style: {
17634
17696
  flex: 1
17635
17697
  }
@@ -20586,7 +20648,7 @@ var useColumns$1 = (function (form) {
20586
20648
  }, {
20587
20649
  title: /*#__PURE__*/React__default['default'].createElement(TitleText$1, {
20588
20650
  required: true
20589
- }, "\u7A0E\u7387%"),
20651
+ }, "\u7A0E\u7387"),
20590
20652
  dataIndex: 'taxRate',
20591
20653
  key: 'taxRate',
20592
20654
  align: 'right',
@@ -24115,6 +24177,8 @@ var Invoice = /*#__PURE__*/function (_React$PureComponent) {
24115
24177
 
24116
24178
  /** 金额计算方法 */
24117
24179
 
24180
+ /** 工具方法 */
24181
+
24118
24182
  /** 获取控制器钩子 */
24119
24183
  function render() {
24120
24184
  if (this.props.invoiceType === 'digtal') {
@@ -24142,6 +24206,7 @@ Invoice.SignDigtal = SignDigtal;
24142
24206
  Invoice.GoodsListDigtal = GoodsList$1;
24143
24207
  Invoice.idGenerator = idGenerator;
24144
24208
  Invoice.calculator = calculator;
24209
+ Invoice.utils = utils;
24145
24210
 
24146
24211
  Invoice.useInvoiceController = function () {
24147
24212
  return React__default['default'].useContext(InvoiceContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.128",
3
+ "version": "3.2.130-1",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -37,9 +37,10 @@ export default class ImportGoods<ColumnType = any> {
37
37
  key: 'unit',
38
38
  },
39
39
  {
40
- title: '税率(%)',
40
+ title: '税率',
41
41
  dataIndex: 'taxRate',
42
42
  key: 'taxRate',
43
+ render: text => text || text === 0 ? `${text}%` : ''
43
44
  },
44
45
  {
45
46
  title: '单价(含税)',
@@ -5,6 +5,7 @@ import InvoiceController from './InvoiceController';
5
5
  import useToGenerateId from './tools/useToGenerateId';
6
6
  import idGenerator from './tools/idGenerator';
7
7
  import * as calculator from './tools/calculate';
8
+ import * as utils from './tools/utils';
8
9
 
9
10
  import InvoiceHeader from './ui/default/InvoiceHeader';
10
11
  import GoodsList from './ui/default/GoodsList';
@@ -93,6 +94,9 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
93
94
  /** 金额计算方法 */
94
95
  static calculator = calculator;
95
96
 
97
+ /** 工具方法 */
98
+ static utils = utils;
99
+
96
100
  /** 获取控制器钩子 */
97
101
  static useInvoiceController = () => { return React.useContext(InvoiceContext) };
98
102
 
@@ -0,0 +1 @@
1
+ export * as Money from './money';
@@ -0,0 +1,20 @@
1
+ const Nzh = require("nzh");
2
+
3
+ const nzhcn = new Nzh({
4
+ ch: '零壹贰叁肆伍陆柒捌玖'
5
+ ,ch_u: '个拾佰仟万亿'
6
+ ,ch_f: '负'
7
+ ,ch_d: '点'
8
+ ,m_t: '人民币'
9
+ ,m_z: '整'
10
+ ,m_u: '圆角分'
11
+ })
12
+
13
+ /** 数字转中文 */
14
+ export const toStringChinese = (value: any) => {
15
+ try {
16
+ return nzhcn.toMoney(value, { outSymbol: false })
17
+ } catch(e) {
18
+ return ''
19
+ }
20
+ };
@@ -475,7 +475,7 @@ export default (form: WrappedFormUtils) => {
475
475
  },
476
476
  },
477
477
  {
478
- title: <TitleText required >税率%</TitleText>,
478
+ title: <TitleText required >税率</TitleText>,
479
479
  dataIndex: 'taxRate',
480
480
  key: 'taxRate',
481
481
  align: 'right',
@@ -19,6 +19,9 @@ export default function useSalesGifts() {
19
19
  const giveaways = React.useMemo(() => goodsList.filter(e => e.lineAttribute === LineAttributeType.赠品行), [goodsList])
20
20
 
21
21
  const onClickAuto = React.useCallback(async () => {
22
+ await controller.saveEditGood();
23
+ await controller.wait();
24
+ if (controller.state.goodsListState.editGood) return;
22
25
  for (let g of giveaways) {
23
26
  g.lineAttribute = LineAttributeType.正常;
24
27
  await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
@@ -27,6 +30,9 @@ export default function useSalesGifts() {
27
30
 
28
31
  const onClickManual = React.useCallback(async () => {
29
32
  try {
33
+ await controller.saveEditGood();
34
+ await controller.wait();
35
+ if (controller.state.goodsListState.editGood) return;
30
36
  const { goodsMap, selectedGoodIndex } = controller.state.goodsListState;
31
37
  const giveaways = selectedGoodIndex.map(e => goodsMap.get(e) as IGood).filter(e => !!e);
32
38
 
@@ -3,6 +3,7 @@ import { } from 'kts-components-antd-x3';
3
3
  import { chain, bignumber } from 'mathjs';
4
4
  import { LineAttributeType } from '../../../../../../Invoice/InvoiceController';
5
5
  import Invoice from '../../../../..';
6
+ import { Money } from '../../../../../tools/utils';
6
7
  import './index.less';
7
8
 
8
9
  const nzhcn = require('nzh').cn;
@@ -101,7 +102,7 @@ export default () => {
101
102
  <div style={{ flex: 5, border: 'none' }}>
102
103
  <label>价税合计(大写)</label>
103
104
  <label>
104
- {nzhcn.toMoney(lineAmountIncludeTax, { outSymbol: false })}
105
+ {Money.toStringChinese(lineAmountIncludeTax)}
105
106
  </label>
106
107
  </div>
107
108
  <div style={{ flex: 5, border: 'none' }}>
@@ -445,7 +445,7 @@ export default (form: WrappedFormUtils) => {
445
445
  },
446
446
  },
447
447
  {
448
- title: <TitleText required >税率%</TitleText>,
448
+ title: <TitleText required >税率</TitleText>,
449
449
  dataIndex: 'taxRate',
450
450
  key: 'taxRate',
451
451
  align: 'right',
@@ -4,10 +4,9 @@ import { } from 'kts-components-antd-x3';
4
4
  import { ReactComponent as ForkSvg } from './svg/fork.svg';
5
5
  import { chain, bignumber } from 'mathjs';
6
6
  import Invoice from '../../../../..';
7
+ import { Money } from '../../../../../tools/utils';
7
8
  import './index.less';
8
9
 
9
- const nzhcn = require('nzh').cn;
10
-
11
10
  export default () => {
12
11
  const controller = Invoice.useInvoiceController();
13
12
 
@@ -88,7 +87,7 @@ export default () => {
88
87
  <div>价税合计(大写)</div>
89
88
  <div style={{ paddingLeft: 30 }} >
90
89
  <Icon style={{fontSize: 16}} component={ForkSvg} />
91
- <span style={{ fontWeight: 'bold', marginLeft: 4 }} >{nzhcn.toMoney(lineAmountIncludeTax, { outSymbol: false })}</span>
90
+ <span style={{ fontWeight: 'bold', marginLeft: 4 }} >{Money.toStringChinese(lineAmountIncludeTax)}</span>
92
91
  </div>
93
92
  <div style={{ flex: 1 }} />
94
93
  <div style={{ width: 90, color: '#9F613E' }} >(小写)</div>