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.
- package/dist/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.d.ts +1 -1
- package/dist/index.esm.js +92 -84
- package/dist/index.js +92 -84
- package/package.json +1 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +2 -1
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__*/
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
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
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2430
|
+
case 3:
|
|
2431
|
+
_context2.next = 5;
|
|
2432
|
+
return controller.saveEditGood();
|
|
2431
2433
|
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
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
|
-
|
|
2447
|
-
|
|
2448
|
+
err = s.goodsListState.form.getFieldsError();
|
|
2449
|
+
_context.t0 = _regeneratorRuntime().keys(err);
|
|
2448
2450
|
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2451
|
+
case 3:
|
|
2452
|
+
if ((_context.t1 = _context.t0()).done) {
|
|
2453
|
+
_context.next = 11;
|
|
2454
|
+
break;
|
|
2455
|
+
}
|
|
2454
2456
|
|
|
2455
|
-
|
|
2457
|
+
key = _context.t1.value;
|
|
2456
2458
|
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2459
|
+
if (err[key]) {
|
|
2460
|
+
_context.next = 7;
|
|
2461
|
+
break;
|
|
2462
|
+
}
|
|
2461
2463
|
|
|
2462
|
-
|
|
2464
|
+
return _context.abrupt("continue", 3);
|
|
2463
2465
|
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2466
|
+
case 7:
|
|
2467
|
+
message.error(err[key][0]);
|
|
2468
|
+
return _context.abrupt("return");
|
|
2467
2469
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
+
case 11:
|
|
2471
|
+
goods = s.goodsListState.goodsMap.get(goods.$index);
|
|
2470
2472
|
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2473
|
+
if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
|
|
2474
|
+
_context.next = 15;
|
|
2475
|
+
break;
|
|
2476
|
+
}
|
|
2475
2477
|
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2478
|
+
message.error({
|
|
2479
|
+
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
2480
|
+
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
2481
|
+
});
|
|
2482
|
+
return _context.abrupt("return");
|
|
2481
2483
|
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2484
|
+
case 15:
|
|
2485
|
+
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
2486
|
+
_context.next = 18;
|
|
2487
|
+
break;
|
|
2488
|
+
}
|
|
2487
2489
|
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2490
|
+
message.error({
|
|
2491
|
+
content: '金额为0不能添加折扣行',
|
|
2492
|
+
key: '金额为0不能添加折扣行'
|
|
2493
|
+
});
|
|
2494
|
+
return _context.abrupt("return");
|
|
2493
2495
|
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
+
case 18:
|
|
2497
|
+
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
2496
2498
|
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2499
|
+
case 19:
|
|
2500
|
+
case "end":
|
|
2501
|
+
return _context.stop();
|
|
2502
|
+
}
|
|
2500
2503
|
}
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
}));
|
|
2504
|
+
}, _callee);
|
|
2505
|
+
}));
|
|
2504
2506
|
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2507
|
+
return function (_x2) {
|
|
2508
|
+
return _ref2.apply(this, arguments);
|
|
2509
|
+
};
|
|
2510
|
+
}());
|
|
2509
2511
|
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2512
|
+
case 7:
|
|
2513
|
+
case "end":
|
|
2514
|
+
return _context2.stop();
|
|
2515
|
+
}
|
|
2513
2516
|
}
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
|
|
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 =
|
|
8861
|
+
_context6.next = 4;
|
|
8854
8862
|
break;
|
|
8855
8863
|
}
|
|
8856
8864
|
|
|
8857
8865
|
return _context6.abrupt("return");
|
|
8858
8866
|
|
|
8859
|
-
case
|
|
8867
|
+
case 4:
|
|
8860
8868
|
taxRate = parseFloat(values.taxRate);
|
|
8861
|
-
_context6.next =
|
|
8869
|
+
_context6.next = 7;
|
|
8862
8870
|
return controller.setEditGood({
|
|
8863
8871
|
taxRate: taxRate
|
|
8864
8872
|
});
|
|
8865
8873
|
|
|
8866
|
-
case
|
|
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
|
|
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__*/
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
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
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2440
|
+
case 3:
|
|
2441
|
+
_context2.next = 5;
|
|
2442
|
+
return controller.saveEditGood();
|
|
2441
2443
|
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
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
|
-
|
|
2457
|
-
|
|
2458
|
+
err = s.goodsListState.form.getFieldsError();
|
|
2459
|
+
_context.t0 = _regeneratorRuntime().keys(err);
|
|
2458
2460
|
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2461
|
+
case 3:
|
|
2462
|
+
if ((_context.t1 = _context.t0()).done) {
|
|
2463
|
+
_context.next = 11;
|
|
2464
|
+
break;
|
|
2465
|
+
}
|
|
2464
2466
|
|
|
2465
|
-
|
|
2467
|
+
key = _context.t1.value;
|
|
2466
2468
|
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
if (err[key]) {
|
|
2470
|
+
_context.next = 7;
|
|
2471
|
+
break;
|
|
2472
|
+
}
|
|
2471
2473
|
|
|
2472
|
-
|
|
2474
|
+
return _context.abrupt("continue", 3);
|
|
2473
2475
|
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2476
|
+
case 7:
|
|
2477
|
+
ktsComponentsAntdX3.message.error(err[key][0]);
|
|
2478
|
+
return _context.abrupt("return");
|
|
2477
2479
|
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
+
case 11:
|
|
2481
|
+
goods = s.goodsListState.goodsMap.get(goods.$index);
|
|
2480
2482
|
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2483
|
+
if (!(goods.taxRate === 0 && !goods.taxFreeType)) {
|
|
2484
|
+
_context.next = 15;
|
|
2485
|
+
break;
|
|
2486
|
+
}
|
|
2485
2487
|
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2488
|
+
ktsComponentsAntdX3.message.error({
|
|
2489
|
+
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
2490
|
+
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
2491
|
+
});
|
|
2492
|
+
return _context.abrupt("return");
|
|
2491
2493
|
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2494
|
+
case 15:
|
|
2495
|
+
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
2496
|
+
_context.next = 18;
|
|
2497
|
+
break;
|
|
2498
|
+
}
|
|
2497
2499
|
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2500
|
+
ktsComponentsAntdX3.message.error({
|
|
2501
|
+
content: '金额为0不能添加折扣行',
|
|
2502
|
+
key: '金额为0不能添加折扣行'
|
|
2503
|
+
});
|
|
2504
|
+
return _context.abrupt("return");
|
|
2503
2505
|
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
+
case 18:
|
|
2507
|
+
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
2506
2508
|
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2509
|
+
case 19:
|
|
2510
|
+
case "end":
|
|
2511
|
+
return _context.stop();
|
|
2512
|
+
}
|
|
2510
2513
|
}
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
}));
|
|
2514
|
+
}, _callee);
|
|
2515
|
+
}));
|
|
2514
2516
|
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2517
|
+
return function (_x2) {
|
|
2518
|
+
return _ref2.apply(this, arguments);
|
|
2519
|
+
};
|
|
2520
|
+
}());
|
|
2519
2521
|
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2522
|
+
case 7:
|
|
2523
|
+
case "end":
|
|
2524
|
+
return _context2.stop();
|
|
2525
|
+
}
|
|
2523
2526
|
}
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
|
|
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 =
|
|
8871
|
+
_context6.next = 4;
|
|
8864
8872
|
break;
|
|
8865
8873
|
}
|
|
8866
8874
|
|
|
8867
8875
|
return _context6.abrupt("return");
|
|
8868
8876
|
|
|
8869
|
-
case
|
|
8877
|
+
case 4:
|
|
8870
8878
|
taxRate = parseFloat(values.taxRate);
|
|
8871
|
-
_context6.next =
|
|
8879
|
+
_context6.next = 7;
|
|
8872
8880
|
return controller.setEditGood({
|
|
8873
8881
|
taxRate: taxRate
|
|
8874
8882
|
});
|
|
8875
8883
|
|
|
8876
|
-
case
|
|
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
|
|
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
|
@@ -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 => {
|