kts-component-invoice-operate 3.2.68 → 3.2.70

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 @@ declare enum LineAttributeType {
2
2
  正常 = 0,
3
3
  折扣行 = 1,
4
4
  被折扣行 = 2,
5
- 折让行 = 3
5
+ 折让行 = 3,
6
+ 赠品行 = 4
6
7
  }
7
8
  export default LineAttributeType;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  /** 销售折让 */
3
- export default function uaeSalesDiscount(): {
3
+ export default function useSalesDiscount(): {
4
4
  /** 按钮 */
5
5
  button: JSX.Element;
6
6
  };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ /** 销售赠品 */
3
+ export default function useSalesGifts(): {
4
+ /** 按钮 */
5
+ button: JSX.Element;
6
+ };
package/dist/index.esm.js CHANGED
@@ -616,6 +616,63 @@ function _nonIterableRest() {
616
616
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
617
617
  }
618
618
 
619
+ function _createForOfIteratorHelper(o, allowArrayLike) {
620
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
621
+
622
+ if (!it) {
623
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
624
+ if (it) o = it;
625
+ var i = 0;
626
+
627
+ var F = function () {};
628
+
629
+ return {
630
+ s: F,
631
+ n: function () {
632
+ if (i >= o.length) return {
633
+ done: true
634
+ };
635
+ return {
636
+ done: false,
637
+ value: o[i++]
638
+ };
639
+ },
640
+ e: function (e) {
641
+ throw e;
642
+ },
643
+ f: F
644
+ };
645
+ }
646
+
647
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
648
+ }
649
+
650
+ var normalCompletion = true,
651
+ didErr = false,
652
+ err;
653
+ return {
654
+ s: function () {
655
+ it = it.call(o);
656
+ },
657
+ n: function () {
658
+ var step = it.next();
659
+ normalCompletion = step.done;
660
+ return step;
661
+ },
662
+ e: function (e) {
663
+ didErr = true;
664
+ err = e;
665
+ },
666
+ f: function () {
667
+ try {
668
+ if (!normalCompletion && it.return != null) it.return();
669
+ } finally {
670
+ if (didErr) throw err;
671
+ }
672
+ }
673
+ };
674
+ }
675
+
619
676
  function styleInject(css, ref) {
620
677
  if ( ref === void 0 ) ref = {};
621
678
  var insertAt = ref.insertAt;
@@ -917,6 +974,7 @@ var LineAttributeType;
917
974
  LineAttributeType[LineAttributeType["\u6298\u6263\u884C"] = 1] = "\u6298\u6263\u884C";
918
975
  LineAttributeType[LineAttributeType["\u88AB\u6298\u6263\u884C"] = 2] = "\u88AB\u6298\u6263\u884C";
919
976
  LineAttributeType[LineAttributeType["\u6298\u8BA9\u884C"] = 3] = "\u6298\u8BA9\u884C";
977
+ LineAttributeType[LineAttributeType["\u8D60\u54C1\u884C"] = 4] = "\u8D60\u54C1\u884C";
920
978
  })(LineAttributeType || (LineAttributeType = {}));
921
979
 
922
980
  var LineAttributeType$1 = LineAttributeType;
@@ -13905,7 +13963,7 @@ var useRowSelection = (function () {
13905
13963
  };
13906
13964
  });
13907
13965
 
13908
- var css_248z$a = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n display: flex;\n gap: 10px;\n padding-right: 10px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n gap: 5px;\n}\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-be-discount .ktsAntX-table-cell,\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-discount .ktsAntX-table-cell {\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table-search-protrude {\n background: #ff0;\n color: #000;\n font-weight: bold;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item-control {\n line-height: 1;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input:focus {\n box-shadow: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input,\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-select-selection--single {\n border: none;\n border-radius: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .has-error .ktsAnt3x-input {\n border: #f5222d solid 1px;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .has-error .kts-invoice-operate-goods-list-table-tax-rate {\n border: #f5222d solid 1px;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAntX-checkbox-wrapper .ktsAntX-checkbox-checked .ktsAntX-checkbox-inner::after {\n width: 5px;\n height: 10px;\n}\n";
13966
+ var css_248z$a = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n display: flex;\n gap: 10px;\n padding-right: 10px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n gap: 5px;\n}\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-be-discount .ktsAntX-table-cell,\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-discount .ktsAntX-table-cell {\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table-search-protrude {\n background: #ff0;\n color: #000;\n font-weight: bold;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item-control {\n line-height: 1;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input:focus {\n box-shadow: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input,\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-select-selection--single {\n border: none;\n border-radius: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAntX-checkbox-wrapper .ktsAntX-checkbox-checked .ktsAntX-checkbox-inner::after {\n width: 5px;\n height: 10px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-control.has-error {\n border: 1px solid #f00;\n}\n";
13909
13967
  styleInject(css_248z$a);
13910
13968
 
13911
13969
  var keys$1 = {};
@@ -14711,7 +14769,7 @@ function useMergeDiscount() {
14711
14769
 
14712
14770
  /** 销售折让 */
14713
14771
 
14714
- function uaeSalesDiscount() {
14772
+ function useSalesDiscount() {
14715
14773
  var controller = Invoice.useInvoiceController();
14716
14774
  var selectedGoodIndex = controller.useMemo(function (s) {
14717
14775
  return s.goodsListState.selectedGoodIndex;
@@ -14903,6 +14961,84 @@ function uaeSalesDiscount() {
14903
14961
  };
14904
14962
  }
14905
14963
 
14964
+ /** 销售赠品 */
14965
+
14966
+ function useSalesGifts() {
14967
+ var controller = Invoice.useInvoiceController();
14968
+ var goodsList = controller.useMemo(function (s) {
14969
+ return s.goodsListState.goodsList;
14970
+ }, []);
14971
+ var giveaways = React.useMemo(function () {
14972
+ return goodsList.filter(function (e) {
14973
+ return e.lineAttribute === LineAttributeType$1.赠品行;
14974
+ });
14975
+ }, [goodsList]);
14976
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14977
+ var _iterator, _step, g;
14978
+
14979
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14980
+ while (1) {
14981
+ switch (_context.prev = _context.next) {
14982
+ case 0:
14983
+ _iterator = _createForOfIteratorHelper(giveaways);
14984
+ _context.prev = 1;
14985
+
14986
+ _iterator.s();
14987
+
14988
+ case 3:
14989
+ if ((_step = _iterator.n()).done) {
14990
+ _context.next = 10;
14991
+ break;
14992
+ }
14993
+
14994
+ g = _step.value;
14995
+ g.lineAttribute = LineAttributeType$1.正常;
14996
+ _context.next = 8;
14997
+ return controller.addGoodDiscountV2([{
14998
+ $index: g.$index,
14999
+ discolineAmountunt: g.lineAmountIncludeTax || 0
15000
+ }]);
15001
+
15002
+ case 8:
15003
+ _context.next = 3;
15004
+ break;
15005
+
15006
+ case 10:
15007
+ _context.next = 15;
15008
+ break;
15009
+
15010
+ case 12:
15011
+ _context.prev = 12;
15012
+ _context.t0 = _context["catch"](1);
15013
+
15014
+ _iterator.e(_context.t0);
15015
+
15016
+ case 15:
15017
+ _context.prev = 15;
15018
+
15019
+ _iterator.f();
15020
+
15021
+ return _context.finish(15);
15022
+
15023
+ case 18:
15024
+ case "end":
15025
+ return _context.stop();
15026
+ }
15027
+ }
15028
+ }, _callee, null, [[1, 12, 15, 18]]);
15029
+ })), [controller, giveaways]);
15030
+ var button = React.useMemo(function () {
15031
+ if (giveaways.length <= 0) return React.createElement(React.Fragment, null);
15032
+ return React.createElement(Button, {
15033
+ onClick: onClick
15034
+ }, "\u9500\u552E\u8D60\u54C1");
15035
+ }, [giveaways, onClick]);
15036
+ return {
15037
+ /** 按钮 */
15038
+ button: button
15039
+ };
15040
+ }
15041
+
14906
15042
  var GoodsList = /*#__PURE__*/function (_React$Component) {
14907
15043
  _inherits(GoodsList, _React$Component);
14908
15044
 
@@ -14967,7 +15103,10 @@ var Main = decorator(Form.create())(function (props) {
14967
15103
  var mergeDiscount = useMergeDiscount();
14968
15104
  /** 销售折让 */
14969
15105
 
14970
- var salesDiscount = uaeSalesDiscount();
15106
+ var salesDiscount = useSalesDiscount();
15107
+ /** 销售赠品 */
15108
+
15109
+ var salesGifts = useSalesGifts();
14971
15110
  /** 清空自动赋码缓存 */
14972
15111
 
14973
15112
  React.useEffect(function () {
@@ -15125,7 +15264,7 @@ var Main = decorator(Form.create())(function (props) {
15125
15264
  className: "kts-invoice-operate-goods-list-able"
15126
15265
  }, React.createElement("div", {
15127
15266
  className: "kts-invoice-operate-goods-list-able-list"
15128
- }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, React.createElement(Search, null)), React.createElement("div", {
15267
+ }, React.createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, salesGifts.button, React.createElement(Search, null)), React.createElement("div", {
15129
15268
  className: "kts-invoice-operate-goods-list-able-extend"
15130
15269
  }, props.menuExpansion, React.createElement(DescribeSwitch, null), React.createElement(TaxIncludedSwitch, null))), React.createElement("div", {
15131
15270
  className: classNames('kts-invoice-operate-goods-list-table', {
package/dist/index.js CHANGED
@@ -626,6 +626,63 @@ function _nonIterableRest() {
626
626
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
627
627
  }
628
628
 
629
+ function _createForOfIteratorHelper(o, allowArrayLike) {
630
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
631
+
632
+ if (!it) {
633
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
634
+ if (it) o = it;
635
+ var i = 0;
636
+
637
+ var F = function () {};
638
+
639
+ return {
640
+ s: F,
641
+ n: function () {
642
+ if (i >= o.length) return {
643
+ done: true
644
+ };
645
+ return {
646
+ done: false,
647
+ value: o[i++]
648
+ };
649
+ },
650
+ e: function (e) {
651
+ throw e;
652
+ },
653
+ f: F
654
+ };
655
+ }
656
+
657
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
658
+ }
659
+
660
+ var normalCompletion = true,
661
+ didErr = false,
662
+ err;
663
+ return {
664
+ s: function () {
665
+ it = it.call(o);
666
+ },
667
+ n: function () {
668
+ var step = it.next();
669
+ normalCompletion = step.done;
670
+ return step;
671
+ },
672
+ e: function (e) {
673
+ didErr = true;
674
+ err = e;
675
+ },
676
+ f: function () {
677
+ try {
678
+ if (!normalCompletion && it.return != null) it.return();
679
+ } finally {
680
+ if (didErr) throw err;
681
+ }
682
+ }
683
+ };
684
+ }
685
+
629
686
  function styleInject(css, ref) {
630
687
  if ( ref === void 0 ) ref = {};
631
688
  var insertAt = ref.insertAt;
@@ -927,6 +984,7 @@ var LineAttributeType;
927
984
  LineAttributeType[LineAttributeType["\u6298\u6263\u884C"] = 1] = "\u6298\u6263\u884C";
928
985
  LineAttributeType[LineAttributeType["\u88AB\u6298\u6263\u884C"] = 2] = "\u88AB\u6298\u6263\u884C";
929
986
  LineAttributeType[LineAttributeType["\u6298\u8BA9\u884C"] = 3] = "\u6298\u8BA9\u884C";
987
+ LineAttributeType[LineAttributeType["\u8D60\u54C1\u884C"] = 4] = "\u8D60\u54C1\u884C";
930
988
  })(LineAttributeType || (LineAttributeType = {}));
931
989
 
932
990
  var LineAttributeType$1 = LineAttributeType;
@@ -13915,7 +13973,7 @@ var useRowSelection = (function () {
13915
13973
  };
13916
13974
  });
13917
13975
 
13918
- var css_248z$a = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n display: flex;\n gap: 10px;\n padding-right: 10px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n gap: 5px;\n}\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-be-discount .ktsAntX-table-cell,\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-discount .ktsAntX-table-cell {\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table-search-protrude {\n background: #ff0;\n color: #000;\n font-weight: bold;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item-control {\n line-height: 1;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input:focus {\n box-shadow: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input,\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-select-selection--single {\n border: none;\n border-radius: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .has-error .ktsAnt3x-input {\n border: #f5222d solid 1px;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .has-error .kts-invoice-operate-goods-list-table-tax-rate {\n border: #f5222d solid 1px;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAntX-checkbox-wrapper .ktsAntX-checkbox-checked .ktsAntX-checkbox-inner::after {\n width: 5px;\n height: 10px;\n}\n";
13976
+ var css_248z$a = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n display: flex;\n gap: 10px;\n padding-right: 10px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n gap: 5px;\n}\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-be-discount .ktsAntX-table-cell,\n.kts-invoice-operate-goods-list .ktsAntX-table .ktsAntX-table-row.kts-invoice-operate-goods-discount .ktsAntX-table-cell {\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table-search-protrude {\n background: #ff0;\n color: #000;\n font-weight: bold;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item {\n margin: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-item-control {\n line-height: 1;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input:focus {\n box-shadow: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-input,\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-select-selection--single {\n border: none;\n border-radius: 0;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-table-virtual .ktsAntX-table .ktsAntX-table-tbody .ktsAntX-checkbox-wrapper .ktsAntX-checkbox-checked .ktsAntX-checkbox-inner::after {\n width: 5px;\n height: 10px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-control.has-error {\n border: 1px solid #f00;\n}\n";
13919
13977
  styleInject(css_248z$a);
13920
13978
 
13921
13979
  var keys$1 = {};
@@ -14721,7 +14779,7 @@ function useMergeDiscount() {
14721
14779
 
14722
14780
  /** 销售折让 */
14723
14781
 
14724
- function uaeSalesDiscount() {
14782
+ function useSalesDiscount() {
14725
14783
  var controller = Invoice.useInvoiceController();
14726
14784
  var selectedGoodIndex = controller.useMemo(function (s) {
14727
14785
  return s.goodsListState.selectedGoodIndex;
@@ -14913,6 +14971,84 @@ function uaeSalesDiscount() {
14913
14971
  };
14914
14972
  }
14915
14973
 
14974
+ /** 销售赠品 */
14975
+
14976
+ function useSalesGifts() {
14977
+ var controller = Invoice.useInvoiceController();
14978
+ var goodsList = controller.useMemo(function (s) {
14979
+ return s.goodsListState.goodsList;
14980
+ }, []);
14981
+ var giveaways = React__default['default'].useMemo(function () {
14982
+ return goodsList.filter(function (e) {
14983
+ return e.lineAttribute === LineAttributeType$1.赠品行;
14984
+ });
14985
+ }, [goodsList]);
14986
+ var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14987
+ var _iterator, _step, g;
14988
+
14989
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14990
+ while (1) {
14991
+ switch (_context.prev = _context.next) {
14992
+ case 0:
14993
+ _iterator = _createForOfIteratorHelper(giveaways);
14994
+ _context.prev = 1;
14995
+
14996
+ _iterator.s();
14997
+
14998
+ case 3:
14999
+ if ((_step = _iterator.n()).done) {
15000
+ _context.next = 10;
15001
+ break;
15002
+ }
15003
+
15004
+ g = _step.value;
15005
+ g.lineAttribute = LineAttributeType$1.正常;
15006
+ _context.next = 8;
15007
+ return controller.addGoodDiscountV2([{
15008
+ $index: g.$index,
15009
+ discolineAmountunt: g.lineAmountIncludeTax || 0
15010
+ }]);
15011
+
15012
+ case 8:
15013
+ _context.next = 3;
15014
+ break;
15015
+
15016
+ case 10:
15017
+ _context.next = 15;
15018
+ break;
15019
+
15020
+ case 12:
15021
+ _context.prev = 12;
15022
+ _context.t0 = _context["catch"](1);
15023
+
15024
+ _iterator.e(_context.t0);
15025
+
15026
+ case 15:
15027
+ _context.prev = 15;
15028
+
15029
+ _iterator.f();
15030
+
15031
+ return _context.finish(15);
15032
+
15033
+ case 18:
15034
+ case "end":
15035
+ return _context.stop();
15036
+ }
15037
+ }
15038
+ }, _callee, null, [[1, 12, 15, 18]]);
15039
+ })), [controller, giveaways]);
15040
+ var button = React__default['default'].useMemo(function () {
15041
+ if (giveaways.length <= 0) return React__default['default'].createElement(React__default['default'].Fragment, null);
15042
+ return React__default['default'].createElement(ktsComponentsAntdX3.Button, {
15043
+ onClick: onClick
15044
+ }, "\u9500\u552E\u8D60\u54C1");
15045
+ }, [giveaways, onClick]);
15046
+ return {
15047
+ /** 按钮 */
15048
+ button: button
15049
+ };
15050
+ }
15051
+
14916
15052
  var GoodsList = /*#__PURE__*/function (_React$Component) {
14917
15053
  _inherits(GoodsList, _React$Component);
14918
15054
 
@@ -14977,7 +15113,10 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
14977
15113
  var mergeDiscount = useMergeDiscount();
14978
15114
  /** 销售折让 */
14979
15115
 
14980
- var salesDiscount = uaeSalesDiscount();
15116
+ var salesDiscount = useSalesDiscount();
15117
+ /** 销售赠品 */
15118
+
15119
+ var salesGifts = useSalesGifts();
14981
15120
  /** 清空自动赋码缓存 */
14982
15121
 
14983
15122
  React__default['default'].useEffect(function () {
@@ -15135,7 +15274,7 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
15135
15274
  className: "kts-invoice-operate-goods-list-able"
15136
15275
  }, React__default['default'].createElement("div", {
15137
15276
  className: "kts-invoice-operate-goods-list-able-list"
15138
- }, React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, React__default['default'].createElement(Search, null)), React__default['default'].createElement("div", {
15277
+ }, React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, mergeDetails.button, mergeDiscount.button, addDiscountRowButton.drawer, salesDiscount.button, salesGifts.button, React__default['default'].createElement(Search, null)), React__default['default'].createElement("div", {
15139
15278
  className: "kts-invoice-operate-goods-list-able-extend"
15140
15279
  }, props.menuExpansion, React__default['default'].createElement(DescribeSwitch, null), React__default['default'].createElement(TaxIncludedSwitch, null))), React__default['default'].createElement("div", {
15141
15280
  className: classNames__default['default']('kts-invoice-operate-goods-list-table', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.68",
3
+ "version": "3.2.70",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -3,5 +3,6 @@ enum LineAttributeType {
3
3
  折扣行 = 1,
4
4
  被折扣行 = 2,
5
5
  折让行 = 3,
6
+ 赠品行 = 4,
6
7
  }
7
8
  export default LineAttributeType;
@@ -106,5 +106,5 @@ export default class GoodsListState {
106
106
  addComparisonIndex?: string;
107
107
 
108
108
  /** 商品拖拽数据 */
109
- drag = new Drag()
109
+ drag = new Drag();
110
110
  }
@@ -73,5 +73,5 @@ export default class InvoiceController extends InvoiceControllerForm {
73
73
  getTaxCategoryCodeList?: () => Promise<any>;
74
74
 
75
75
  /** 获取筛选后的列表 */
76
- getGoodsSearch = getGoodsSearch
76
+ getGoodsSearch = getGoodsSearch;
77
77
  }
@@ -249,9 +249,9 @@ const lines: any[] = [
249
249
  "id": "40823568750477313",
250
250
  "itemModelName": "",
251
251
  "itemName": "打折",
252
- "lineAmountExcludeTax": -100,
253
- "lineAmountIncludeTax": -100,
254
- "lineAttribute": 3,
252
+ "lineAmountExcludeTax": 100,
253
+ "lineAmountIncludeTax": 100,
254
+ "lineAttribute": 4,
255
255
  "lineDiscountExcludeTax": null,
256
256
  "lineDiscountRate": null,
257
257
  "lineId": "1740823580142206976",
@@ -167,16 +167,13 @@
167
167
  display: none;
168
168
  }
169
169
 
170
- .has-error .ktsAnt3x-input {
171
- border: #f5222d solid 1px;
172
- }
173
-
174
- .has-error .kts-invoice-operate-goods-list-table-tax-rate {
175
- border: #f5222d solid 1px;
176
- }
177
-
178
170
  .ktsAntX-checkbox-wrapper .ktsAntX-checkbox-checked .ktsAntX-checkbox-inner::after {
179
171
  width : 5px;
180
172
  height: 10px;
181
173
  }
182
174
  }
175
+ .kts-invoice-operate-goods-list-table {
176
+ .ktsAnt3x-form-item-control.has-error {
177
+ border: 1px solid #f00;
178
+ }
179
+ }
@@ -29,7 +29,8 @@ import useDelRowButton from './ui/BulkMenu/hooks/useDelRowButton';
29
29
  import useAddDiscountRowButton from './ui/BulkMenu/hooks/useAddDiscountRowButton';
30
30
  import useMergeDetails from './ui/BulkMenu/hooks/useMergeDetails';
31
31
  import useMergeDiscount from './ui/BulkMenu/hooks/useMergeDiscount';
32
- import uaeSalesDiscount from './ui/BulkMenu/hooks/uaeSalesDiscount';
32
+ import useSalesDiscount from './ui/BulkMenu/hooks/useSalesDiscount';
33
+ import useSalesGifts from './ui/BulkMenu/hooks/useSalesGifts';
33
34
 
34
35
  export interface IGoodsListProps {
35
36
  /** 扩展部分 */
@@ -93,7 +94,10 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
93
94
  const mergeDiscount = useMergeDiscount()
94
95
 
95
96
  /** 销售折让 */
96
- const salesDiscount = uaeSalesDiscount()
97
+ const salesDiscount = useSalesDiscount()
98
+
99
+ /** 销售赠品 */
100
+ const salesGifts = useSalesGifts()
97
101
 
98
102
  /** 清空自动赋码缓存 */
99
103
  React.useEffect(() => {
@@ -156,6 +160,9 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
156
160
  {/* 销售折让 */}
157
161
  {salesDiscount.button}
158
162
 
163
+ {/* 销售赠品 */}
164
+ {salesGifts.button}
165
+
159
166
  {/* 搜索 */}
160
167
  <Search />
161
168
  </div>
@@ -6,7 +6,7 @@ import Invoice from '../../../../../../..'
6
6
  import { LineAttributeType } from "../../../../../../../InvoiceController";
7
7
 
8
8
  /** 销售折让 */
9
- export default function uaeSalesDiscount() {
9
+ export default function useSalesDiscount() {
10
10
 
11
11
  const controller = Invoice.useInvoiceController();
12
12
 
@@ -0,0 +1,37 @@
1
+
2
+ import React from "react"
3
+ import { Button, message } from "kts-components-antd-x3"
4
+ import { chain, bignumber } from 'mathjs';
5
+ import Invoice from '../../../../../../..'
6
+ import { LineAttributeType } from "../../../../../../../InvoiceController";
7
+
8
+ /** 销售赠品 */
9
+ export default function useSalesGifts() {
10
+
11
+ const controller = Invoice.useInvoiceController();
12
+
13
+ const goodsList = controller.useMemo(s => s.goodsListState.goodsList, [])
14
+
15
+ const giveaways = React.useMemo(() => goodsList.filter(e => e.lineAttribute === LineAttributeType.赠品行), [goodsList])
16
+
17
+ const onClick = React.useCallback(async () => {
18
+ for (let g of giveaways) {
19
+ g.lineAttribute = LineAttributeType.正常;
20
+ await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
21
+ }
22
+ }, [controller, giveaways])
23
+
24
+ const button = React.useMemo(() => {
25
+ if (giveaways.length <= 0) return <></>;
26
+ return (
27
+ <Button onClick={onClick} >
28
+ 销售赠品
29
+ </Button>
30
+ )
31
+ }, [giveaways, onClick])
32
+
33
+ return {
34
+ /** 按钮 */
35
+ button,
36
+ }
37
+ }