kts-component-invoice-operate 1.2.29 → 1.2.31

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.
@@ -33,6 +33,13 @@ export default class EndowCode {
33
33
  readonly readOnlyTaxRateMap: {
34
34
  [key: string]: (value?: GoodsListState) => boolean;
35
35
  };
36
+ /**
37
+ * 自动截取商品名称(设置这个属性,截取就不会在提示用户)
38
+ * @param good 赋码的
39
+ * @param itemName 截取后的字符串
40
+ * @param cut 被截取的字符串
41
+ **/
42
+ onAutomaticInterception?: (good: IGood, itemName: string, cut: string) => Promise<void>;
36
43
  /** 优惠政策类型列表 */
37
44
  favouredPolicyNameList: string[];
38
45
  /** 免税类型 列表 */
package/dist/index.esm.js CHANGED
@@ -939,6 +939,7 @@ var EndowCode = /*#__PURE__*/_createClass(function EndowCode() {
939
939
  /** 草稿发票 */
940
940
  DRAFT: draft
941
941
  };
942
+ this.onAutomaticInterception = void 0;
942
943
  this.favouredPolicyNameList = ['100%先征后退', '即征即退30%', '即征即退50%', '即征即退70%', '按3%简易征收', '按5%简易征收', '按3%简易征收减按1.5%计征', '稀土产品', '简易征收', '50%先征后退', '不征税', '先征后退', '免税', '即征即退100%', '超税负3%即征即退', '超税负8%即征即退', '超税负12%即征即退'];
943
944
  this.taxFreeTypeList = [{
944
945
  label: '出口免税和其他免税优惠政策(免税)',
@@ -12602,12 +12603,14 @@ var DrawerBody$3 = function DrawerBody(props) {
12602
12603
 
12603
12604
  var onSubmit = React.useCallback(function (values) {
12604
12605
  controller.pipeline( /*#__PURE__*/function () {
12605
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
12606
- var endowCodeGood;
12607
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
12606
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
12607
+ var endowCodeGood, _onOk;
12608
+
12609
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
12608
12610
  while (1) {
12609
- switch (_context11.prev = _context11.next) {
12611
+ switch (_context14.prev = _context14.next) {
12610
12612
  case 0:
12613
+ /** 准备赋码的货物索引列表 */
12611
12614
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
12612
12615
  return s.goodsListState.goodsMap.get(e);
12613
12616
  }); // 赋码
@@ -12627,29 +12630,58 @@ var DrawerBody$3 = function DrawerBody(props) {
12627
12630
  var lineAmountExcludeTax = chain$1(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
12628
12631
  var priceExcludeTax = good.priceIncludeTax ? chain$1(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
12629
12632
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
12630
- good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined; // if (s.goodsListState.isTaxIncluded) {
12631
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
12632
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
12633
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
12634
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
12635
- // } else {
12636
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
12637
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
12638
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
12639
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
12640
- // }
12641
-
12633
+ good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
12642
12634
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
12643
12635
  }); //截取名称
12644
12636
 
12645
12637
  if (!endowCodeGood.some(function (e) {
12646
12638
  return bytesLnegth((e === null || e === void 0 ? void 0 : e.itemName) || '') > 92;
12647
12639
  })) {
12648
- _context11.next = 5;
12640
+ _context14.next = 11;
12641
+ break;
12642
+ }
12643
+
12644
+ _onOk = /*#__PURE__*/function () {
12645
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
12646
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
12647
+ while (1) {
12648
+ switch (_context11.prev = _context11.next) {
12649
+ case 0:
12650
+ endowCodeGood.forEach(function (e) {
12651
+ if (e && e.itemName) {
12652
+ var itemName = e.itemName;
12653
+ e.itemName = cutStr(e.itemName, 91);
12654
+ s.goodsListState.endowCode.onAutomaticInterception && s.goodsListState.endowCode.onAutomaticInterception(e, e.itemName || '', itemName.replace(e.itemName || '', ''));
12655
+ }
12656
+ });
12657
+
12658
+ case 1:
12659
+ case "end":
12660
+ return _context11.stop();
12661
+ }
12662
+ }
12663
+ }, _callee11);
12664
+ }));
12665
+
12666
+ return function onOk() {
12667
+ return _ref12.apply(this, arguments);
12668
+ };
12669
+ }();
12670
+
12671
+ if (!s.goodsListState.endowCode.onAutomaticInterception) {
12672
+ _context14.next = 9;
12649
12673
  break;
12650
12674
  }
12651
12675
 
12652
- _context11.next = 5;
12676
+ _context14.next = 7;
12677
+ return _onOk();
12678
+
12679
+ case 7:
12680
+ _context14.next = 11;
12681
+ break;
12682
+
12683
+ case 9:
12684
+ _context14.next = 11;
12653
12685
  return function () {
12654
12686
  return new Promise(function (resolve) {
12655
12687
  confirm({
@@ -12657,32 +12689,69 @@ var DrawerBody$3 = function DrawerBody(props) {
12657
12689
  content: '商品名称长度过长,是否截取名称',
12658
12690
  okText: '确定',
12659
12691
  cancelText: '取消',
12660
- onOk: function onOk() {
12661
- endowCodeGood.forEach(function (e) {
12662
- if (e && e.itemName) {
12663
- e.itemName = cutStr(e.itemName, 91);
12664
- }
12665
- });
12666
- message.success('商品名称截取成功!');
12667
- resolve();
12668
- },
12669
- onCancel: function onCancel() {
12670
- resolve();
12671
- }
12692
+ onOk: function () {
12693
+ var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
12694
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
12695
+ while (1) {
12696
+ switch (_context12.prev = _context12.next) {
12697
+ case 0:
12698
+ _context12.next = 2;
12699
+ return _onOk();
12700
+
12701
+ case 2:
12702
+ message.success('商品名称截取成功!');
12703
+ resolve();
12704
+
12705
+ case 4:
12706
+ case "end":
12707
+ return _context12.stop();
12708
+ }
12709
+ }
12710
+ }, _callee12);
12711
+ }));
12712
+
12713
+ function onOk() {
12714
+ return _onOk2.apply(this, arguments);
12715
+ }
12716
+
12717
+ return onOk;
12718
+ }(),
12719
+ onCancel: function () {
12720
+ var _onCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
12721
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
12722
+ while (1) {
12723
+ switch (_context13.prev = _context13.next) {
12724
+ case 0:
12725
+ resolve();
12726
+
12727
+ case 1:
12728
+ case "end":
12729
+ return _context13.stop();
12730
+ }
12731
+ }
12732
+ }, _callee13);
12733
+ }));
12734
+
12735
+ function onCancel() {
12736
+ return _onCancel.apply(this, arguments);
12737
+ }
12738
+
12739
+ return onCancel;
12740
+ }()
12672
12741
  });
12673
12742
  });
12674
12743
  }();
12675
12744
 
12676
- case 5:
12745
+ case 11:
12677
12746
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
12678
12747
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
12679
12748
 
12680
- case 7:
12749
+ case 13:
12681
12750
  case "end":
12682
- return _context11.stop();
12751
+ return _context14.stop();
12683
12752
  }
12684
12753
  }
12685
- }, _callee11);
12754
+ }, _callee14);
12686
12755
  }));
12687
12756
 
12688
12757
  return function (_x9) {
@@ -12695,23 +12764,23 @@ var DrawerBody$3 = function DrawerBody(props) {
12695
12764
  FormEffectHooks.onFieldValueChange$('taxRate').subscribe(function (e) {
12696
12765
  setTaxRate(e.value);
12697
12766
  actions.setFieldState('taxFreeType', /*#__PURE__*/function () {
12698
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(s) {
12699
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
12767
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
12768
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
12700
12769
  while (1) {
12701
- switch (_context12.prev = _context12.next) {
12770
+ switch (_context15.prev = _context15.next) {
12702
12771
  case 0:
12703
12772
  if (e.value !== 0) s.value = undefined;
12704
12773
 
12705
12774
  case 1:
12706
12775
  case "end":
12707
- return _context12.stop();
12776
+ return _context15.stop();
12708
12777
  }
12709
12778
  }
12710
- }, _callee12);
12779
+ }, _callee15);
12711
12780
  }));
12712
12781
 
12713
12782
  return function (_x10) {
12714
- return _ref12.apply(this, arguments);
12783
+ return _ref13.apply(this, arguments);
12715
12784
  };
12716
12785
  }());
12717
12786
  }); // 是否享受优惠政策
@@ -12719,23 +12788,23 @@ var DrawerBody$3 = function DrawerBody(props) {
12719
12788
  FormEffectHooks.onFieldValueChange$('favouredPolicyMark').subscribe(function (e) {
12720
12789
  setFavouredPolicyMark(e.value);
12721
12790
  actions.setFieldState('favouredPolicyName', /*#__PURE__*/function () {
12722
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
12723
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
12791
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
12792
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
12724
12793
  while (1) {
12725
- switch (_context13.prev = _context13.next) {
12794
+ switch (_context16.prev = _context16.next) {
12726
12795
  case 0:
12727
12796
  if (e.value === 0) s.value = undefined;
12728
12797
 
12729
12798
  case 1:
12730
12799
  case "end":
12731
- return _context13.stop();
12800
+ return _context16.stop();
12732
12801
  }
12733
12802
  }
12734
- }, _callee13);
12803
+ }, _callee16);
12735
12804
  }));
12736
12805
 
12737
12806
  return function (_x11) {
12738
- return _ref13.apply(this, arguments);
12807
+ return _ref14.apply(this, arguments);
12739
12808
  };
12740
12809
  }());
12741
12810
  });
@@ -12763,7 +12832,7 @@ var DrawerBody$3 = function DrawerBody(props) {
12763
12832
  }), React.createElement(SchemaMarkupField, {
12764
12833
  name: "shorthand",
12765
12834
  type: "string",
12766
- default: getShorthand(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.itemName),
12835
+ default: getShorthand((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxClassificationCode) ? defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.itemName : ''),
12767
12836
  title: "\u5546\u54C1\u548C\u670D\u52A1\u5206\u7C7B\u7B80\u79F0"
12768
12837
  }), React.createElement(SchemaMarkupField, {
12769
12838
  name: "taxRate",
@@ -12824,23 +12893,23 @@ var DrawerBody$3 = function DrawerBody(props) {
12824
12893
  }, "\u786E\u5B9A"), React.createElement(Button, {
12825
12894
  onClick: function onClick() {
12826
12895
  controller.pipeline( /*#__PURE__*/function () {
12827
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
12828
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
12896
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
12897
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
12829
12898
  while (1) {
12830
- switch (_context14.prev = _context14.next) {
12899
+ switch (_context17.prev = _context17.next) {
12831
12900
  case 0:
12832
- return _context14.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
12901
+ return _context17.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
12833
12902
 
12834
12903
  case 1:
12835
12904
  case "end":
12836
- return _context14.stop();
12905
+ return _context17.stop();
12837
12906
  }
12838
12907
  }
12839
- }, _callee14);
12908
+ }, _callee17);
12840
12909
  }));
12841
12910
 
12842
12911
  return function (_x12) {
12843
- return _ref14.apply(this, arguments);
12912
+ return _ref15.apply(this, arguments);
12844
12913
  };
12845
12914
  }())();
12846
12915
  }
@@ -12875,7 +12944,7 @@ var getItemName$1 = function getItemName(value, shorthand) {
12875
12944
 
12876
12945
  var arr = value.match(/\*[^*]+\*/);
12877
12946
 
12878
- if (arr) {
12947
+ if (arr && value.charAt(0) === '*') {
12879
12948
  return value.replace(/\*[^*]+\*/, "*".concat(shorthand, "*"));
12880
12949
  } else {
12881
12950
  return "*".concat(shorthand, "*").concat(value);
package/dist/index.js CHANGED
@@ -949,6 +949,7 @@ var EndowCode = /*#__PURE__*/_createClass(function EndowCode() {
949
949
  /** 草稿发票 */
950
950
  DRAFT: draft
951
951
  };
952
+ this.onAutomaticInterception = void 0;
952
953
  this.favouredPolicyNameList = ['100%先征后退', '即征即退30%', '即征即退50%', '即征即退70%', '按3%简易征收', '按5%简易征收', '按3%简易征收减按1.5%计征', '稀土产品', '简易征收', '50%先征后退', '不征税', '先征后退', '免税', '即征即退100%', '超税负3%即征即退', '超税负8%即征即退', '超税负12%即征即退'];
953
954
  this.taxFreeTypeList = [{
954
955
  label: '出口免税和其他免税优惠政策(免税)',
@@ -12612,12 +12613,14 @@ var DrawerBody$3 = function DrawerBody(props) {
12612
12613
 
12613
12614
  var onSubmit = React__default['default'].useCallback(function (values) {
12614
12615
  controller.pipeline( /*#__PURE__*/function () {
12615
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
12616
- var endowCodeGood;
12617
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
12616
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
12617
+ var endowCodeGood, _onOk;
12618
+
12619
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
12618
12620
  while (1) {
12619
- switch (_context11.prev = _context11.next) {
12621
+ switch (_context14.prev = _context14.next) {
12620
12622
  case 0:
12623
+ /** 准备赋码的货物索引列表 */
12621
12624
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
12622
12625
  return s.goodsListState.goodsMap.get(e);
12623
12626
  }); // 赋码
@@ -12637,29 +12640,58 @@ var DrawerBody$3 = function DrawerBody(props) {
12637
12640
  var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
12638
12641
  var priceExcludeTax = good.priceIncludeTax ? mathjs.chain(mathjs.bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
12639
12642
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
12640
- good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined; // if (s.goodsListState.isTaxIncluded) {
12641
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
12642
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
12643
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
12644
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
12645
- // } else {
12646
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
12647
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
12648
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
12649
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
12650
- // }
12651
-
12643
+ good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
12652
12644
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
12653
12645
  }); //截取名称
12654
12646
 
12655
12647
  if (!endowCodeGood.some(function (e) {
12656
12648
  return bytesLnegth((e === null || e === void 0 ? void 0 : e.itemName) || '') > 92;
12657
12649
  })) {
12658
- _context11.next = 5;
12650
+ _context14.next = 11;
12651
+ break;
12652
+ }
12653
+
12654
+ _onOk = /*#__PURE__*/function () {
12655
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
12656
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
12657
+ while (1) {
12658
+ switch (_context11.prev = _context11.next) {
12659
+ case 0:
12660
+ endowCodeGood.forEach(function (e) {
12661
+ if (e && e.itemName) {
12662
+ var itemName = e.itemName;
12663
+ e.itemName = cutStr(e.itemName, 91);
12664
+ s.goodsListState.endowCode.onAutomaticInterception && s.goodsListState.endowCode.onAutomaticInterception(e, e.itemName || '', itemName.replace(e.itemName || '', ''));
12665
+ }
12666
+ });
12667
+
12668
+ case 1:
12669
+ case "end":
12670
+ return _context11.stop();
12671
+ }
12672
+ }
12673
+ }, _callee11);
12674
+ }));
12675
+
12676
+ return function onOk() {
12677
+ return _ref12.apply(this, arguments);
12678
+ };
12679
+ }();
12680
+
12681
+ if (!s.goodsListState.endowCode.onAutomaticInterception) {
12682
+ _context14.next = 9;
12659
12683
  break;
12660
12684
  }
12661
12685
 
12662
- _context11.next = 5;
12686
+ _context14.next = 7;
12687
+ return _onOk();
12688
+
12689
+ case 7:
12690
+ _context14.next = 11;
12691
+ break;
12692
+
12693
+ case 9:
12694
+ _context14.next = 11;
12663
12695
  return function () {
12664
12696
  return new Promise(function (resolve) {
12665
12697
  confirm({
@@ -12667,32 +12699,69 @@ var DrawerBody$3 = function DrawerBody(props) {
12667
12699
  content: '商品名称长度过长,是否截取名称',
12668
12700
  okText: '确定',
12669
12701
  cancelText: '取消',
12670
- onOk: function onOk() {
12671
- endowCodeGood.forEach(function (e) {
12672
- if (e && e.itemName) {
12673
- e.itemName = cutStr(e.itemName, 91);
12674
- }
12675
- });
12676
- ktsComponentsAntdX3.message.success('商品名称截取成功!');
12677
- resolve();
12678
- },
12679
- onCancel: function onCancel() {
12680
- resolve();
12681
- }
12702
+ onOk: function () {
12703
+ var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
12704
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
12705
+ while (1) {
12706
+ switch (_context12.prev = _context12.next) {
12707
+ case 0:
12708
+ _context12.next = 2;
12709
+ return _onOk();
12710
+
12711
+ case 2:
12712
+ ktsComponentsAntdX3.message.success('商品名称截取成功!');
12713
+ resolve();
12714
+
12715
+ case 4:
12716
+ case "end":
12717
+ return _context12.stop();
12718
+ }
12719
+ }
12720
+ }, _callee12);
12721
+ }));
12722
+
12723
+ function onOk() {
12724
+ return _onOk2.apply(this, arguments);
12725
+ }
12726
+
12727
+ return onOk;
12728
+ }(),
12729
+ onCancel: function () {
12730
+ var _onCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
12731
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
12732
+ while (1) {
12733
+ switch (_context13.prev = _context13.next) {
12734
+ case 0:
12735
+ resolve();
12736
+
12737
+ case 1:
12738
+ case "end":
12739
+ return _context13.stop();
12740
+ }
12741
+ }
12742
+ }, _callee13);
12743
+ }));
12744
+
12745
+ function onCancel() {
12746
+ return _onCancel.apply(this, arguments);
12747
+ }
12748
+
12749
+ return onCancel;
12750
+ }()
12682
12751
  });
12683
12752
  });
12684
12753
  }();
12685
12754
 
12686
- case 5:
12755
+ case 11:
12687
12756
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
12688
12757
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
12689
12758
 
12690
- case 7:
12759
+ case 13:
12691
12760
  case "end":
12692
- return _context11.stop();
12761
+ return _context14.stop();
12693
12762
  }
12694
12763
  }
12695
- }, _callee11);
12764
+ }, _callee14);
12696
12765
  }));
12697
12766
 
12698
12767
  return function (_x9) {
@@ -12705,23 +12774,23 @@ var DrawerBody$3 = function DrawerBody(props) {
12705
12774
  antd.FormEffectHooks.onFieldValueChange$('taxRate').subscribe(function (e) {
12706
12775
  setTaxRate(e.value);
12707
12776
  actions.setFieldState('taxFreeType', /*#__PURE__*/function () {
12708
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(s) {
12709
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
12777
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
12778
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
12710
12779
  while (1) {
12711
- switch (_context12.prev = _context12.next) {
12780
+ switch (_context15.prev = _context15.next) {
12712
12781
  case 0:
12713
12782
  if (e.value !== 0) s.value = undefined;
12714
12783
 
12715
12784
  case 1:
12716
12785
  case "end":
12717
- return _context12.stop();
12786
+ return _context15.stop();
12718
12787
  }
12719
12788
  }
12720
- }, _callee12);
12789
+ }, _callee15);
12721
12790
  }));
12722
12791
 
12723
12792
  return function (_x10) {
12724
- return _ref12.apply(this, arguments);
12793
+ return _ref13.apply(this, arguments);
12725
12794
  };
12726
12795
  }());
12727
12796
  }); // 是否享受优惠政策
@@ -12729,23 +12798,23 @@ var DrawerBody$3 = function DrawerBody(props) {
12729
12798
  antd.FormEffectHooks.onFieldValueChange$('favouredPolicyMark').subscribe(function (e) {
12730
12799
  setFavouredPolicyMark(e.value);
12731
12800
  actions.setFieldState('favouredPolicyName', /*#__PURE__*/function () {
12732
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
12733
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
12801
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
12802
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
12734
12803
  while (1) {
12735
- switch (_context13.prev = _context13.next) {
12804
+ switch (_context16.prev = _context16.next) {
12736
12805
  case 0:
12737
12806
  if (e.value === 0) s.value = undefined;
12738
12807
 
12739
12808
  case 1:
12740
12809
  case "end":
12741
- return _context13.stop();
12810
+ return _context16.stop();
12742
12811
  }
12743
12812
  }
12744
- }, _callee13);
12813
+ }, _callee16);
12745
12814
  }));
12746
12815
 
12747
12816
  return function (_x11) {
12748
- return _ref13.apply(this, arguments);
12817
+ return _ref14.apply(this, arguments);
12749
12818
  };
12750
12819
  }());
12751
12820
  });
@@ -12773,7 +12842,7 @@ var DrawerBody$3 = function DrawerBody(props) {
12773
12842
  }), React__default['default'].createElement(antd.SchemaMarkupField, {
12774
12843
  name: "shorthand",
12775
12844
  type: "string",
12776
- default: getShorthand(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.itemName),
12845
+ default: getShorthand((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxClassificationCode) ? defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.itemName : ''),
12777
12846
  title: "\u5546\u54C1\u548C\u670D\u52A1\u5206\u7C7B\u7B80\u79F0"
12778
12847
  }), React__default['default'].createElement(antd.SchemaMarkupField, {
12779
12848
  name: "taxRate",
@@ -12834,23 +12903,23 @@ var DrawerBody$3 = function DrawerBody(props) {
12834
12903
  }, "\u786E\u5B9A"), React__default['default'].createElement(ktsComponentsAntdX3.Button, {
12835
12904
  onClick: function onClick() {
12836
12905
  controller.pipeline( /*#__PURE__*/function () {
12837
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
12838
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
12906
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
12907
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
12839
12908
  while (1) {
12840
- switch (_context14.prev = _context14.next) {
12909
+ switch (_context17.prev = _context17.next) {
12841
12910
  case 0:
12842
- return _context14.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
12911
+ return _context17.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
12843
12912
 
12844
12913
  case 1:
12845
12914
  case "end":
12846
- return _context14.stop();
12915
+ return _context17.stop();
12847
12916
  }
12848
12917
  }
12849
- }, _callee14);
12918
+ }, _callee17);
12850
12919
  }));
12851
12920
 
12852
12921
  return function (_x12) {
12853
- return _ref14.apply(this, arguments);
12922
+ return _ref15.apply(this, arguments);
12854
12923
  };
12855
12924
  }())();
12856
12925
  }
@@ -12885,7 +12954,7 @@ var getItemName$1 = function getItemName(value, shorthand) {
12885
12954
 
12886
12955
  var arr = value.match(/\*[^*]+\*/);
12887
12956
 
12888
- if (arr) {
12957
+ if (arr && value.charAt(0) === '*') {
12889
12958
  return value.replace(/\*[^*]+\*/, "*".concat(shorthand, "*"));
12890
12959
  } else {
12891
12960
  return "*".concat(shorthand, "*").concat(value);
@@ -1,33 +1,33 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta
6
- name="viewport"
7
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
8
- />
9
- <link rel="stylesheet" href="/docs-dist/umi.css" />
10
- <script>
11
- window.routerBase = "/";
12
- </script>
13
- <script>
14
- //! umi version: 3.5.27
15
- </script>
16
- <script>
17
- !(function () {
18
- var e = localStorage.getItem("dumi:prefers-color"),
19
- t = window.matchMedia("(prefers-color-scheme: dark)").matches,
20
- r = ["light", "dark", "auto"];
21
- document.documentElement.setAttribute(
22
- "data-prefers-color",
23
- e === r[2] ? (t ? r[1] : r[0]) : r.indexOf(e) > -1 ? e : r[0]
24
- );
25
- })();
26
- </script>
27
- </head>
28
- <body>
29
- <div id="root"></div>
30
-
31
- <script src="/docs-dist/umi.js"></script>
32
- </body>
33
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
8
+ />
9
+ <link rel="stylesheet" href="/docs-dist/umi.css" />
10
+ <script>
11
+ window.routerBase = "/";
12
+ </script>
13
+ <script>
14
+ //! umi version: 3.5.27
15
+ </script>
16
+ <script>
17
+ !(function () {
18
+ var e = localStorage.getItem("dumi:prefers-color"),
19
+ t = window.matchMedia("(prefers-color-scheme: dark)").matches,
20
+ r = ["light", "dark", "auto"];
21
+ document.documentElement.setAttribute(
22
+ "data-prefers-color",
23
+ e === r[2] ? (t ? r[1] : r[0]) : r.indexOf(e) > -1 ? e : r[0]
24
+ );
25
+ })();
26
+ </script>
27
+ </head>
28
+ <body>
29
+ <div id="root"></div>
30
+
31
+ <script src="/docs-dist/umi.js"></script>
32
+ </body>
33
+ </html>
@@ -1,33 +1,33 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta
6
- name="viewport"
7
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
8
- />
9
- <link rel="stylesheet" href="/docs-dist/umi.css" />
10
- <script>
11
- window.routerBase = "/";
12
- </script>
13
- <script>
14
- //! umi version: 3.5.27
15
- </script>
16
- <script>
17
- !(function () {
18
- var e = localStorage.getItem("dumi:prefers-color"),
19
- t = window.matchMedia("(prefers-color-scheme: dark)").matches,
20
- r = ["light", "dark", "auto"];
21
- document.documentElement.setAttribute(
22
- "data-prefers-color",
23
- e === r[2] ? (t ? r[1] : r[0]) : r.indexOf(e) > -1 ? e : r[0]
24
- );
25
- })();
26
- </script>
27
- </head>
28
- <body>
29
- <div id="root"></div>
30
-
31
- <script src="/docs-dist/umi.js"></script>
32
- </body>
33
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
8
+ />
9
+ <link rel="stylesheet" href="/docs-dist/umi.css" />
10
+ <script>
11
+ window.routerBase = "/";
12
+ </script>
13
+ <script>
14
+ //! umi version: 3.5.27
15
+ </script>
16
+ <script>
17
+ !(function () {
18
+ var e = localStorage.getItem("dumi:prefers-color"),
19
+ t = window.matchMedia("(prefers-color-scheme: dark)").matches,
20
+ r = ["light", "dark", "auto"];
21
+ document.documentElement.setAttribute(
22
+ "data-prefers-color",
23
+ e === r[2] ? (t ? r[1] : r[0]) : r.indexOf(e) > -1 ? e : r[0]
24
+ );
25
+ })();
26
+ </script>
27
+ </head>
28
+ <body>
29
+ <div id="root"></div>
30
+
31
+ <script src="/docs-dist/umi.js"></script>
32
+ </body>
33
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -37,6 +37,14 @@ export default class EndowCode {
37
37
  DRAFT: draft,
38
38
  };
39
39
 
40
+ /**
41
+ * 自动截取商品名称(设置这个属性,截取就不会在提示用户)
42
+ * @param good 赋码的
43
+ * @param itemName 截取后的字符串
44
+ * @param cut 被截取的字符串
45
+ **/
46
+ onAutomaticInterception?: (good: IGood, itemName:string, cut:string) => Promise<void>
47
+
40
48
  /** 优惠政策类型列表 */
41
49
  favouredPolicyNameList: string[] = [
42
50
  '100%先征后退',
@@ -283,6 +283,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
283
283
  const onSubmit = React.useCallback(values => {
284
284
  controller.pipeline(async s => {
285
285
 
286
+ /** 准备赋码的货物索引列表 */
286
287
  const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
287
288
 
288
289
  // 赋码
@@ -307,43 +308,42 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
307
308
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
308
309
  good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
309
310
 
310
- // if (s.goodsListState.isTaxIncluded) {
311
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
312
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
313
-
314
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
315
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
316
- // } else {
317
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
318
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
319
-
320
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
321
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
322
- // }
323
-
324
311
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
325
312
  });
326
313
 
327
314
  //截取名称
328
315
  if (endowCodeGood.some(e => bytesLnegth(e?.itemName || '') > 92)) {
329
- await (() => new Promise<void>(resolve => {
330
- confirm({
331
- title: '温馨提示',
332
- content: '商品名称长度过长,是否截取名称',
333
- okText: '确定',
334
- cancelText: '取消',
335
- onOk() {
336
- endowCodeGood.forEach(e => {
337
- if (e && e.itemName) { e.itemName = cutStr(e.itemName, 91) }
338
- })
339
- message.success('商品名称截取成功!')
340
- resolve()
341
- },
342
- onCancel() {
343
- resolve()
344
- },
345
- });
346
- }))()
316
+
317
+ const onOk = async () => {
318
+ endowCodeGood.forEach(e => {
319
+ if (e && e.itemName) {
320
+ const itemName = e.itemName;
321
+ e.itemName = cutStr(e.itemName, 91);
322
+ s.goodsListState.endowCode.onAutomaticInterception && s.goodsListState.endowCode.onAutomaticInterception(e, e.itemName || '', itemName.replace(e.itemName || '', ''))
323
+ }
324
+ })
325
+ }
326
+
327
+ if (s.goodsListState.endowCode.onAutomaticInterception) {
328
+ await onOk();
329
+ } else {
330
+ await (() => new Promise<void>(resolve => {
331
+ confirm({
332
+ title: '温馨提示',
333
+ content: '商品名称长度过长,是否截取名称',
334
+ okText: '确定',
335
+ cancelText: '取消',
336
+ onOk: async () => {
337
+ await onOk();
338
+ message.success('商品名称截取成功!');
339
+ resolve();
340
+ },
341
+ onCancel: async () => {
342
+ resolve()
343
+ },
344
+ });
345
+ }))()
346
+ }
347
347
  }
348
348
 
349
349
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
@@ -390,7 +390,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
390
390
  <Field
391
391
  name="shorthand"
392
392
  type="string"
393
- default={getShorthand(defaultValue?.itemName)}
393
+ default={getShorthand(defaultValue?.taxClassificationCode ? defaultValue?.itemName : '')}
394
394
  title="商品和服务分类简称"
395
395
  />
396
396
  <Field
@@ -471,7 +471,7 @@ const getItemName = (value?: string, shorthand?: string) => {
471
471
  }
472
472
 
473
473
  const arr = value.match(/\*[^*]+\*/);
474
- if (arr) {
474
+ if (arr && value.charAt(0) === '*') {
475
475
  return value.replace(/\*[^*]+\*/, `*${shorthand}*`);
476
476
  } else {
477
477
  return `*${shorthand}*${value}`;