kts-component-invoice-operate 3.0.9 → 3.0.11

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,6 @@ import { IGood } from '../../../../../../../../InvoiceController';
2
2
  declare const _default: (goods: IGood) => {
3
3
  key: string;
4
4
  title: string;
5
- onClick: () => Promise<void>;
5
+ onClick: (e: any) => Promise<void>;
6
6
  } | undefined;
7
7
  export default _default;
package/dist/index.esm.js CHANGED
@@ -2417,103 +2417,110 @@ var useAddDiscount = (function (goods) {
2417
2417
  }, []);
2418
2418
  /** 点击了 添加折扣行 按钮 */
2419
2419
 
2420
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2421
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2422
- while (1) {
2423
- switch (_context2.prev = _context2.next) {
2424
- case 0:
2425
- _context2.next = 2;
2426
- return controller.wait();
2420
+ var onClick = React.useCallback( /*#__PURE__*/function () {
2421
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
2422
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2423
+ while (1) {
2424
+ switch (_context2.prev = _context2.next) {
2425
+ case 0:
2426
+ e.stopPropagation();
2427
+ _context2.next = 3;
2428
+ return controller.wait();
2427
2429
 
2428
- case 2:
2429
- _context2.next = 4;
2430
- return controller.saveEditGood();
2430
+ case 3:
2431
+ _context2.next = 5;
2432
+ return controller.saveEditGood();
2431
2433
 
2432
- case 4:
2433
- _context2.next = 6;
2434
- return controller.run( /*#__PURE__*/function () {
2435
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2436
- var err, key;
2437
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2438
- while (1) {
2439
- switch (_context.prev = _context.next) {
2440
- case 0:
2441
- if (!s.goodsListState.form) {
2442
- _context.next = 11;
2443
- break;
2444
- }
2434
+ case 5:
2435
+ _context2.next = 7;
2436
+ return controller.run( /*#__PURE__*/function () {
2437
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2438
+ var err, key;
2439
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2440
+ while (1) {
2441
+ switch (_context.prev = _context.next) {
2442
+ case 0:
2443
+ if (!s.goodsListState.form) {
2444
+ _context.next = 11;
2445
+ break;
2446
+ }
2445
2447
 
2446
- err = s.goodsListState.form.getFieldsError();
2447
- _context.t0 = _regeneratorRuntime().keys(err);
2448
+ err = s.goodsListState.form.getFieldsError();
2449
+ _context.t0 = _regeneratorRuntime().keys(err);
2448
2450
 
2449
- case 3:
2450
- if ((_context.t1 = _context.t0()).done) {
2451
- _context.next = 11;
2452
- break;
2453
- }
2451
+ case 3:
2452
+ if ((_context.t1 = _context.t0()).done) {
2453
+ _context.next = 11;
2454
+ break;
2455
+ }
2454
2456
 
2455
- key = _context.t1.value;
2457
+ key = _context.t1.value;
2456
2458
 
2457
- if (err[key]) {
2458
- _context.next = 7;
2459
- break;
2460
- }
2459
+ if (err[key]) {
2460
+ _context.next = 7;
2461
+ break;
2462
+ }
2461
2463
 
2462
- return _context.abrupt("continue", 3);
2464
+ return _context.abrupt("continue", 3);
2463
2465
 
2464
- case 7:
2465
- message.error(err[key][0]);
2466
- return _context.abrupt("return");
2466
+ case 7:
2467
+ message.error(err[key][0]);
2468
+ return _context.abrupt("return");
2467
2469
 
2468
- case 11:
2469
- goods = s.goodsListState.goodsMap.get(goods.$index);
2470
+ case 11:
2471
+ goods = s.goodsListState.goodsMap.get(goods.$index);
2470
2472
 
2471
- if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
2472
- _context.next = 15;
2473
- break;
2474
- }
2473
+ if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
2474
+ _context.next = 15;
2475
+ break;
2476
+ }
2475
2477
 
2476
- message.error({
2477
- content: '零税率需要设置免税类型,请在赋码中设置!',
2478
- key: '零税率需要设置免税类型,请在赋码中设置!'
2479
- });
2480
- return _context.abrupt("return");
2478
+ message.error({
2479
+ content: '零税率需要设置免税类型,请在赋码中设置!',
2480
+ key: '零税率需要设置免税类型,请在赋码中设置!'
2481
+ });
2482
+ return _context.abrupt("return");
2481
2483
 
2482
- case 15:
2483
- if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
2484
- _context.next = 18;
2485
- break;
2486
- }
2484
+ case 15:
2485
+ if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
2486
+ _context.next = 18;
2487
+ break;
2488
+ }
2487
2489
 
2488
- message.error({
2489
- content: '金额为0不能添加折扣行',
2490
- key: '金额为0不能添加折扣行'
2491
- });
2492
- return _context.abrupt("return");
2490
+ message.error({
2491
+ content: '金额为0不能添加折扣行',
2492
+ key: '金额为0不能添加折扣行'
2493
+ });
2494
+ return _context.abrupt("return");
2493
2495
 
2494
- case 18:
2495
- s.goodsListState.discountGoodIndex = [goods.$index];
2496
+ case 18:
2497
+ s.goodsListState.discountGoodIndex = [goods.$index];
2496
2498
 
2497
- case 19:
2498
- case "end":
2499
- return _context.stop();
2499
+ case 19:
2500
+ case "end":
2501
+ return _context.stop();
2502
+ }
2500
2503
  }
2501
- }
2502
- }, _callee);
2503
- }));
2504
+ }, _callee);
2505
+ }));
2504
2506
 
2505
- return function (_x) {
2506
- return _ref2.apply(this, arguments);
2507
- };
2508
- }());
2507
+ return function (_x2) {
2508
+ return _ref2.apply(this, arguments);
2509
+ };
2510
+ }());
2509
2511
 
2510
- case 6:
2511
- case "end":
2512
- return _context2.stop();
2512
+ case 7:
2513
+ case "end":
2514
+ return _context2.stop();
2515
+ }
2513
2516
  }
2514
- }
2515
- }, _callee2);
2516
- })), [controller, goods.$index]);
2517
+ }, _callee2);
2518
+ }));
2519
+
2520
+ return function (_x) {
2521
+ return _ref.apply(this, arguments);
2522
+ };
2523
+ }(), [controller, goods.$index]);
2517
2524
 
2518
2525
  if (goods.lineAttribute !== LineAttributeType$1.正常) {
2519
2526
  return undefined;
@@ -8848,22 +8855,23 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8848
8855
  switch (_context6.prev = _context6.next) {
8849
8856
  case 0:
8850
8857
  err = err || {};
8858
+ debugger;
8851
8859
 
8852
8860
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8853
- _context6.next = 3;
8861
+ _context6.next = 4;
8854
8862
  break;
8855
8863
  }
8856
8864
 
8857
8865
  return _context6.abrupt("return");
8858
8866
 
8859
- case 3:
8867
+ case 4:
8860
8868
  taxRate = parseFloat(values.taxRate);
8861
- _context6.next = 6;
8869
+ _context6.next = 7;
8862
8870
  return controller.setEditGood({
8863
8871
  taxRate: taxRate
8864
8872
  });
8865
8873
 
8866
- case 6:
8874
+ case 7:
8867
8875
  // 去掉赋码
8868
8876
  (function () {
8869
8877
  var cache = controller.state.goodsListState.endowCode.cache;
@@ -8884,7 +8892,7 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8884
8892
  updateUnitPriceTax(controller, form);
8885
8893
  }
8886
8894
 
8887
- case 8:
8895
+ case 9:
8888
8896
  case "end":
8889
8897
  return _context6.stop();
8890
8898
  }
@@ -8955,7 +8963,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
8955
8963
 
8956
8964
  case 5:
8957
8965
  // 计算 金额(不含税)
8958
- if (taxAmount && !promptErr(err.lineAmountIncludeTax)) {
8966
+ if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
8959
8967
  lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
8960
8968
  }
8961
8969
 
package/dist/index.js CHANGED
@@ -2427,103 +2427,110 @@ var useAddDiscount = (function (goods) {
2427
2427
  }, []);
2428
2428
  /** 点击了 添加折扣行 按钮 */
2429
2429
 
2430
- var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2431
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2432
- while (1) {
2433
- switch (_context2.prev = _context2.next) {
2434
- case 0:
2435
- _context2.next = 2;
2436
- return controller.wait();
2430
+ var onClick = React__default['default'].useCallback( /*#__PURE__*/function () {
2431
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
2432
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2433
+ while (1) {
2434
+ switch (_context2.prev = _context2.next) {
2435
+ case 0:
2436
+ e.stopPropagation();
2437
+ _context2.next = 3;
2438
+ return controller.wait();
2437
2439
 
2438
- case 2:
2439
- _context2.next = 4;
2440
- return controller.saveEditGood();
2440
+ case 3:
2441
+ _context2.next = 5;
2442
+ return controller.saveEditGood();
2441
2443
 
2442
- case 4:
2443
- _context2.next = 6;
2444
- return controller.run( /*#__PURE__*/function () {
2445
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2446
- var err, key;
2447
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2448
- while (1) {
2449
- switch (_context.prev = _context.next) {
2450
- case 0:
2451
- if (!s.goodsListState.form) {
2452
- _context.next = 11;
2453
- break;
2454
- }
2444
+ case 5:
2445
+ _context2.next = 7;
2446
+ return controller.run( /*#__PURE__*/function () {
2447
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
2448
+ var err, key;
2449
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2450
+ while (1) {
2451
+ switch (_context.prev = _context.next) {
2452
+ case 0:
2453
+ if (!s.goodsListState.form) {
2454
+ _context.next = 11;
2455
+ break;
2456
+ }
2455
2457
 
2456
- err = s.goodsListState.form.getFieldsError();
2457
- _context.t0 = _regeneratorRuntime().keys(err);
2458
+ err = s.goodsListState.form.getFieldsError();
2459
+ _context.t0 = _regeneratorRuntime().keys(err);
2458
2460
 
2459
- case 3:
2460
- if ((_context.t1 = _context.t0()).done) {
2461
- _context.next = 11;
2462
- break;
2463
- }
2461
+ case 3:
2462
+ if ((_context.t1 = _context.t0()).done) {
2463
+ _context.next = 11;
2464
+ break;
2465
+ }
2464
2466
 
2465
- key = _context.t1.value;
2467
+ key = _context.t1.value;
2466
2468
 
2467
- if (err[key]) {
2468
- _context.next = 7;
2469
- break;
2470
- }
2469
+ if (err[key]) {
2470
+ _context.next = 7;
2471
+ break;
2472
+ }
2471
2473
 
2472
- return _context.abrupt("continue", 3);
2474
+ return _context.abrupt("continue", 3);
2473
2475
 
2474
- case 7:
2475
- ktsComponentsAntdX3.message.error(err[key][0]);
2476
- return _context.abrupt("return");
2476
+ case 7:
2477
+ ktsComponentsAntdX3.message.error(err[key][0]);
2478
+ return _context.abrupt("return");
2477
2479
 
2478
- case 11:
2479
- goods = s.goodsListState.goodsMap.get(goods.$index);
2480
+ case 11:
2481
+ goods = s.goodsListState.goodsMap.get(goods.$index);
2480
2482
 
2481
- if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
2482
- _context.next = 15;
2483
- break;
2484
- }
2483
+ if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
2484
+ _context.next = 15;
2485
+ break;
2486
+ }
2485
2487
 
2486
- ktsComponentsAntdX3.message.error({
2487
- content: '零税率需要设置免税类型,请在赋码中设置!',
2488
- key: '零税率需要设置免税类型,请在赋码中设置!'
2489
- });
2490
- return _context.abrupt("return");
2488
+ ktsComponentsAntdX3.message.error({
2489
+ content: '零税率需要设置免税类型,请在赋码中设置!',
2490
+ key: '零税率需要设置免税类型,请在赋码中设置!'
2491
+ });
2492
+ return _context.abrupt("return");
2491
2493
 
2492
- case 15:
2493
- if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
2494
- _context.next = 18;
2495
- break;
2496
- }
2494
+ case 15:
2495
+ if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
2496
+ _context.next = 18;
2497
+ break;
2498
+ }
2497
2499
 
2498
- ktsComponentsAntdX3.message.error({
2499
- content: '金额为0不能添加折扣行',
2500
- key: '金额为0不能添加折扣行'
2501
- });
2502
- return _context.abrupt("return");
2500
+ ktsComponentsAntdX3.message.error({
2501
+ content: '金额为0不能添加折扣行',
2502
+ key: '金额为0不能添加折扣行'
2503
+ });
2504
+ return _context.abrupt("return");
2503
2505
 
2504
- case 18:
2505
- s.goodsListState.discountGoodIndex = [goods.$index];
2506
+ case 18:
2507
+ s.goodsListState.discountGoodIndex = [goods.$index];
2506
2508
 
2507
- case 19:
2508
- case "end":
2509
- return _context.stop();
2509
+ case 19:
2510
+ case "end":
2511
+ return _context.stop();
2512
+ }
2510
2513
  }
2511
- }
2512
- }, _callee);
2513
- }));
2514
+ }, _callee);
2515
+ }));
2514
2516
 
2515
- return function (_x) {
2516
- return _ref2.apply(this, arguments);
2517
- };
2518
- }());
2517
+ return function (_x2) {
2518
+ return _ref2.apply(this, arguments);
2519
+ };
2520
+ }());
2519
2521
 
2520
- case 6:
2521
- case "end":
2522
- return _context2.stop();
2522
+ case 7:
2523
+ case "end":
2524
+ return _context2.stop();
2525
+ }
2523
2526
  }
2524
- }
2525
- }, _callee2);
2526
- })), [controller, goods.$index]);
2527
+ }, _callee2);
2528
+ }));
2529
+
2530
+ return function (_x) {
2531
+ return _ref.apply(this, arguments);
2532
+ };
2533
+ }(), [controller, goods.$index]);
2527
2534
 
2528
2535
  if (goods.lineAttribute !== LineAttributeType$1.正常) {
2529
2536
  return undefined;
@@ -8858,22 +8865,23 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8858
8865
  switch (_context6.prev = _context6.next) {
8859
8866
  case 0:
8860
8867
  err = err || {};
8868
+ debugger;
8861
8869
 
8862
8870
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8863
- _context6.next = 3;
8871
+ _context6.next = 4;
8864
8872
  break;
8865
8873
  }
8866
8874
 
8867
8875
  return _context6.abrupt("return");
8868
8876
 
8869
- case 3:
8877
+ case 4:
8870
8878
  taxRate = parseFloat(values.taxRate);
8871
- _context6.next = 6;
8879
+ _context6.next = 7;
8872
8880
  return controller.setEditGood({
8873
8881
  taxRate: taxRate
8874
8882
  });
8875
8883
 
8876
- case 6:
8884
+ case 7:
8877
8885
  // 去掉赋码
8878
8886
  (function () {
8879
8887
  var cache = controller.state.goodsListState.endowCode.cache;
@@ -8894,7 +8902,7 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8894
8902
  updateUnitPriceTax(controller, form);
8895
8903
  }
8896
8904
 
8897
- case 8:
8905
+ case 9:
8898
8906
  case "end":
8899
8907
  return _context6.stop();
8900
8908
  }
@@ -8965,7 +8973,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
8965
8973
 
8966
8974
  case 5:
8967
8975
  // 计算 金额(不含税)
8968
- if (taxAmount && !promptErr(err.lineAmountIncludeTax)) {
8976
+ if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
8969
8977
  lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
8970
8978
  }
8971
8979
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -257,6 +257,7 @@ export const onChangeTaxRate = lazyFn(
257
257
 
258
258
  form.validateFields(async (err, values) => {
259
259
  err = err || {};
260
+ debugger;
260
261
  if (promptErr(err.taxRate) || (!values.taxRate && values.taxRate !== 0)) return;
261
262
 
262
263
  let taxRate = parseFloat(values.taxRate);
@@ -338,7 +339,7 @@ export const updateUnitPriceExcludingTax = (controller: InvoiceController, form:
338
339
  await controller.setEditGood({ taxAmount });
339
340
 
340
341
  // 计算 金额(不含税)
341
- if (taxAmount && !promptErr(err.lineAmountIncludeTax)) {
342
+ if ((taxAmount || taxAmount===0) && !promptErr(err.lineAmountIncludeTax)) {
342
343
  lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
343
344
  }
344
345
  form.setFieldsValue({ lineAmountExcludeTax });
@@ -16,7 +16,8 @@ export default (goods: IGood) => {
16
16
  const isAddDiscount = controller.useMemo(s => s.goodsListState.isAddDiscount, [])
17
17
 
18
18
  /** 点击了 添加折扣行 按钮 */
19
- const onClick = React.useCallback(async () => {
19
+ const onClick = React.useCallback(async e => {
20
+ e.stopPropagation()
20
21
  await controller.wait();
21
22
  await controller.saveEditGood();
22
23
  await controller.run(async s => {