kts-component-invoice-operate 3.2.86 → 3.2.88
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/index.esm.js +221 -78
- package/dist/index.js +221 -78
- package/package.json +1 -1
- package/src/Invoice/index.tsx +3 -2
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx +79 -36
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +0 -4
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -10350,10 +10350,6 @@ var useDelItem = (function (goods) {
|
|
|
10350
10350
|
controller.delGood(goods.$index);
|
|
10351
10351
|
}, [controller, goods.$index]);
|
|
10352
10352
|
|
|
10353
|
-
if (goods.lineAttribute === LineAttributeType$1.折让行) {
|
|
10354
|
-
return undefined;
|
|
10355
|
-
}
|
|
10356
|
-
|
|
10357
10353
|
if (goods.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
10358
10354
|
return undefined;
|
|
10359
10355
|
}
|
|
@@ -10394,82 +10390,42 @@ var useAddDiscount = (function (goods) {
|
|
|
10394
10390
|
while (1) {
|
|
10395
10391
|
switch (_context2.prev = _context2.next) {
|
|
10396
10392
|
case 0:
|
|
10393
|
+
_context2.prev = 0;
|
|
10397
10394
|
e.stopPropagation();
|
|
10398
|
-
_context2.next =
|
|
10395
|
+
_context2.next = 4;
|
|
10399
10396
|
return controller.wait();
|
|
10400
10397
|
|
|
10401
|
-
case
|
|
10402
|
-
_context2.next =
|
|
10398
|
+
case 4:
|
|
10399
|
+
_context2.next = 6;
|
|
10403
10400
|
return controller.saveEditGood();
|
|
10404
10401
|
|
|
10405
|
-
case
|
|
10406
|
-
_context2.next =
|
|
10402
|
+
case 6:
|
|
10403
|
+
_context2.next = 8;
|
|
10404
|
+
return checkDiscount(controller);
|
|
10405
|
+
|
|
10406
|
+
case 8:
|
|
10407
|
+
_context2.next = 10;
|
|
10408
|
+
return checkFieldsError(controller, goods);
|
|
10409
|
+
|
|
10410
|
+
case 10:
|
|
10411
|
+
_context2.next = 12;
|
|
10412
|
+
return checkDutyFree(controller, goods);
|
|
10413
|
+
|
|
10414
|
+
case 12:
|
|
10415
|
+
_context2.next = 14;
|
|
10416
|
+
return checkZeroAmount(controller, goods);
|
|
10417
|
+
|
|
10418
|
+
case 14:
|
|
10419
|
+
_context2.next = 16;
|
|
10407
10420
|
return controller.run( /*#__PURE__*/function () {
|
|
10408
10421
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
10409
|
-
var _s$goodsListState$edi, _goods;
|
|
10410
|
-
|
|
10411
|
-
var err, key;
|
|
10412
10422
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10413
10423
|
while (1) {
|
|
10414
10424
|
switch (_context.prev = _context.next) {
|
|
10415
10425
|
case 0:
|
|
10416
|
-
if (!(s.goodsListState.form && ((_s$goodsListState$edi = s.goodsListState.editGood) === null || _s$goodsListState$edi === void 0 ? void 0 : _s$goodsListState$edi.$index) === ((_goods = goods) === null || _goods === void 0 ? void 0 : _goods.$index))) {
|
|
10417
|
-
_context.next = 11;
|
|
10418
|
-
break;
|
|
10419
|
-
}
|
|
10420
|
-
|
|
10421
|
-
err = s.goodsListState.form.getFieldsError();
|
|
10422
|
-
_context.t0 = _regeneratorRuntime().keys(err);
|
|
10423
|
-
|
|
10424
|
-
case 3:
|
|
10425
|
-
if ((_context.t1 = _context.t0()).done) {
|
|
10426
|
-
_context.next = 11;
|
|
10427
|
-
break;
|
|
10428
|
-
}
|
|
10429
|
-
|
|
10430
|
-
key = _context.t1.value;
|
|
10431
|
-
|
|
10432
|
-
if (err[key]) {
|
|
10433
|
-
_context.next = 7;
|
|
10434
|
-
break;
|
|
10435
|
-
}
|
|
10436
|
-
|
|
10437
|
-
return _context.abrupt("continue", 3);
|
|
10438
|
-
|
|
10439
|
-
case 7:
|
|
10440
|
-
message.error(err[key][0]);
|
|
10441
|
-
return _context.abrupt("return");
|
|
10442
|
-
|
|
10443
|
-
case 11:
|
|
10444
|
-
goods = s.goodsListState.goodsMap.get(goods.$index);
|
|
10445
|
-
|
|
10446
|
-
if (!(goods.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType)) {
|
|
10447
|
-
_context.next = 15;
|
|
10448
|
-
break;
|
|
10449
|
-
}
|
|
10450
|
-
|
|
10451
|
-
message.error({
|
|
10452
|
-
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
10453
|
-
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
10454
|
-
});
|
|
10455
|
-
return _context.abrupt("return");
|
|
10456
|
-
|
|
10457
|
-
case 15:
|
|
10458
|
-
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
10459
|
-
_context.next = 18;
|
|
10460
|
-
break;
|
|
10461
|
-
}
|
|
10462
|
-
|
|
10463
|
-
message.error({
|
|
10464
|
-
content: '金额为0不能添加折扣行',
|
|
10465
|
-
key: '金额为0不能添加折扣行'
|
|
10466
|
-
});
|
|
10467
|
-
return _context.abrupt("return");
|
|
10468
|
-
|
|
10469
|
-
case 18:
|
|
10470
10426
|
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
10471
10427
|
|
|
10472
|
-
case
|
|
10428
|
+
case 1:
|
|
10473
10429
|
case "end":
|
|
10474
10430
|
return _context.stop();
|
|
10475
10431
|
}
|
|
@@ -10482,12 +10438,21 @@ var useAddDiscount = (function (goods) {
|
|
|
10482
10438
|
};
|
|
10483
10439
|
}());
|
|
10484
10440
|
|
|
10485
|
-
case
|
|
10441
|
+
case 16:
|
|
10442
|
+
_context2.next = 21;
|
|
10443
|
+
break;
|
|
10444
|
+
|
|
10445
|
+
case 18:
|
|
10446
|
+
_context2.prev = 18;
|
|
10447
|
+
_context2.t0 = _context2["catch"](0);
|
|
10448
|
+
console.error(_context2.t0);
|
|
10449
|
+
|
|
10450
|
+
case 21:
|
|
10486
10451
|
case "end":
|
|
10487
10452
|
return _context2.stop();
|
|
10488
10453
|
}
|
|
10489
10454
|
}
|
|
10490
|
-
}, _callee2);
|
|
10455
|
+
}, _callee2, null, [[0, 18]]);
|
|
10491
10456
|
}));
|
|
10492
10457
|
|
|
10493
10458
|
return function (_x) {
|
|
@@ -10515,15 +10480,193 @@ var useAddDiscount = (function (goods) {
|
|
|
10515
10480
|
key: 'addDiscount',
|
|
10516
10481
|
title: '折扣',
|
|
10517
10482
|
onClick: onClick
|
|
10518
|
-
};
|
|
10519
|
-
// if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
10520
|
-
// return undefined
|
|
10521
|
-
// }
|
|
10522
|
-
// return (
|
|
10523
|
-
// <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
|
|
10524
|
-
// );
|
|
10525
|
-
// }, [onClick, goods.lineAttribute]);
|
|
10483
|
+
};
|
|
10526
10484
|
});
|
|
10485
|
+
/**
|
|
10486
|
+
* 有折让行,不可以添加折扣
|
|
10487
|
+
* @param controller 组件控制器
|
|
10488
|
+
*/
|
|
10489
|
+
|
|
10490
|
+
function checkDiscount(_x3) {
|
|
10491
|
+
return _checkDiscount.apply(this, arguments);
|
|
10492
|
+
}
|
|
10493
|
+
/**
|
|
10494
|
+
* 零税率需要设置免税类型,请在赋码中设置!
|
|
10495
|
+
* @param controller 组件控制器
|
|
10496
|
+
* @param goods 当前行数据
|
|
10497
|
+
*/
|
|
10498
|
+
|
|
10499
|
+
|
|
10500
|
+
function _checkDiscount() {
|
|
10501
|
+
_checkDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(controller) {
|
|
10502
|
+
var goodsList;
|
|
10503
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
10504
|
+
while (1) {
|
|
10505
|
+
switch (_context3.prev = _context3.next) {
|
|
10506
|
+
case 0:
|
|
10507
|
+
goodsList = controller.state.goodsListState.goodsList;
|
|
10508
|
+
goodsList.forEach(function (e) {
|
|
10509
|
+
if (e.lineAttribute === LineAttributeType$1.折让行) {
|
|
10510
|
+
var content = '有折让行,不可以添加折扣';
|
|
10511
|
+
message$1.error({
|
|
10512
|
+
content: content,
|
|
10513
|
+
key: content
|
|
10514
|
+
});
|
|
10515
|
+
throw new Error(content);
|
|
10516
|
+
}
|
|
10517
|
+
});
|
|
10518
|
+
|
|
10519
|
+
case 2:
|
|
10520
|
+
case "end":
|
|
10521
|
+
return _context3.stop();
|
|
10522
|
+
}
|
|
10523
|
+
}
|
|
10524
|
+
}, _callee3);
|
|
10525
|
+
}));
|
|
10526
|
+
return _checkDiscount.apply(this, arguments);
|
|
10527
|
+
}
|
|
10528
|
+
|
|
10529
|
+
function checkDutyFree(_x4, _x5) {
|
|
10530
|
+
return _checkDutyFree.apply(this, arguments);
|
|
10531
|
+
}
|
|
10532
|
+
/**
|
|
10533
|
+
* 金额为0不能添加折扣行
|
|
10534
|
+
* @param controller 组件控制器
|
|
10535
|
+
* @param goods 当前行数据
|
|
10536
|
+
**/
|
|
10537
|
+
|
|
10538
|
+
|
|
10539
|
+
function _checkDutyFree() {
|
|
10540
|
+
_checkDutyFree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(controller, goods) {
|
|
10541
|
+
var content;
|
|
10542
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
10543
|
+
while (1) {
|
|
10544
|
+
switch (_context4.prev = _context4.next) {
|
|
10545
|
+
case 0:
|
|
10546
|
+
goods = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
10547
|
+
return e.$index === goods.$index;
|
|
10548
|
+
})[0];
|
|
10549
|
+
|
|
10550
|
+
if (!(goods.taxRate === 0 && controller.state.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType)) {
|
|
10551
|
+
_context4.next = 5;
|
|
10552
|
+
break;
|
|
10553
|
+
}
|
|
10554
|
+
|
|
10555
|
+
content = '零税率需要设置免税类型,请在赋码中设置!';
|
|
10556
|
+
message$1.error({
|
|
10557
|
+
content: content,
|
|
10558
|
+
key: content
|
|
10559
|
+
});
|
|
10560
|
+
throw new Error(content);
|
|
10561
|
+
|
|
10562
|
+
case 5:
|
|
10563
|
+
case "end":
|
|
10564
|
+
return _context4.stop();
|
|
10565
|
+
}
|
|
10566
|
+
}
|
|
10567
|
+
}, _callee4);
|
|
10568
|
+
}));
|
|
10569
|
+
return _checkDutyFree.apply(this, arguments);
|
|
10570
|
+
}
|
|
10571
|
+
|
|
10572
|
+
function checkZeroAmount(_x6, _x7) {
|
|
10573
|
+
return _checkZeroAmount.apply(this, arguments);
|
|
10574
|
+
}
|
|
10575
|
+
/**
|
|
10576
|
+
* 校验当前的表单
|
|
10577
|
+
* @param controller 组件控制器
|
|
10578
|
+
* @param goods 当前行数据
|
|
10579
|
+
* */
|
|
10580
|
+
|
|
10581
|
+
|
|
10582
|
+
function _checkZeroAmount() {
|
|
10583
|
+
_checkZeroAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(controller, goods) {
|
|
10584
|
+
var content;
|
|
10585
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
10586
|
+
while (1) {
|
|
10587
|
+
switch (_context5.prev = _context5.next) {
|
|
10588
|
+
case 0:
|
|
10589
|
+
goods = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
10590
|
+
return e.$index === goods.$index;
|
|
10591
|
+
})[0];
|
|
10592
|
+
|
|
10593
|
+
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
10594
|
+
_context5.next = 5;
|
|
10595
|
+
break;
|
|
10596
|
+
}
|
|
10597
|
+
|
|
10598
|
+
content = '金额为0不能添加折扣行';
|
|
10599
|
+
message$1.error({
|
|
10600
|
+
content: content,
|
|
10601
|
+
key: content
|
|
10602
|
+
});
|
|
10603
|
+
throw new Error(content);
|
|
10604
|
+
|
|
10605
|
+
case 5:
|
|
10606
|
+
case "end":
|
|
10607
|
+
return _context5.stop();
|
|
10608
|
+
}
|
|
10609
|
+
}
|
|
10610
|
+
}, _callee5);
|
|
10611
|
+
}));
|
|
10612
|
+
return _checkZeroAmount.apply(this, arguments);
|
|
10613
|
+
}
|
|
10614
|
+
|
|
10615
|
+
function checkFieldsError(_x8, _x9) {
|
|
10616
|
+
return _checkFieldsError.apply(this, arguments);
|
|
10617
|
+
}
|
|
10618
|
+
|
|
10619
|
+
function _checkFieldsError() {
|
|
10620
|
+
_checkFieldsError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(controller, goods) {
|
|
10621
|
+
var _s$goodsListState$edi;
|
|
10622
|
+
|
|
10623
|
+
var s, err, key, content;
|
|
10624
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
10625
|
+
while (1) {
|
|
10626
|
+
switch (_context6.prev = _context6.next) {
|
|
10627
|
+
case 0:
|
|
10628
|
+
s = controller.state;
|
|
10629
|
+
|
|
10630
|
+
if (!(s.goodsListState.form && ((_s$goodsListState$edi = s.goodsListState.editGood) === null || _s$goodsListState$edi === void 0 ? void 0 : _s$goodsListState$edi.$index) === (goods === null || goods === void 0 ? void 0 : goods.$index))) {
|
|
10631
|
+
_context6.next = 13;
|
|
10632
|
+
break;
|
|
10633
|
+
}
|
|
10634
|
+
|
|
10635
|
+
err = s.goodsListState.form.getFieldsError();
|
|
10636
|
+
_context6.t0 = _regeneratorRuntime().keys(err);
|
|
10637
|
+
|
|
10638
|
+
case 4:
|
|
10639
|
+
if ((_context6.t1 = _context6.t0()).done) {
|
|
10640
|
+
_context6.next = 13;
|
|
10641
|
+
break;
|
|
10642
|
+
}
|
|
10643
|
+
|
|
10644
|
+
key = _context6.t1.value;
|
|
10645
|
+
|
|
10646
|
+
if (err[key]) {
|
|
10647
|
+
_context6.next = 8;
|
|
10648
|
+
break;
|
|
10649
|
+
}
|
|
10650
|
+
|
|
10651
|
+
return _context6.abrupt("continue", 4);
|
|
10652
|
+
|
|
10653
|
+
case 8:
|
|
10654
|
+
content = err[key][0];
|
|
10655
|
+
message$1.error({
|
|
10656
|
+
content: content,
|
|
10657
|
+
key: content
|
|
10658
|
+
});
|
|
10659
|
+
throw new Error(content);
|
|
10660
|
+
|
|
10661
|
+
case 13:
|
|
10662
|
+
case "end":
|
|
10663
|
+
return _context6.stop();
|
|
10664
|
+
}
|
|
10665
|
+
}
|
|
10666
|
+
}, _callee6);
|
|
10667
|
+
}));
|
|
10668
|
+
return _checkFieldsError.apply(this, arguments);
|
|
10669
|
+
}
|
|
10527
10670
|
|
|
10528
10671
|
var useEndowCode = (function (goods) {
|
|
10529
10672
|
var controller = Invoice.useInvoiceController();
|
|
@@ -14153,7 +14296,7 @@ var useDelRowButton = (function () {
|
|
|
14153
14296
|
return s.goodsListState.selectedGoodIndex.some(function (e) {
|
|
14154
14297
|
var good = s.goodsListState.goodsMap.get(e);
|
|
14155
14298
|
if (!good) return true;
|
|
14156
|
-
return good.lineAttribute
|
|
14299
|
+
return good.lineAttribute === LineAttributeType$1.折扣行;
|
|
14157
14300
|
});
|
|
14158
14301
|
}, []);
|
|
14159
14302
|
var onClick = React.useCallback(function () {
|
package/dist/index.js
CHANGED
|
@@ -10360,10 +10360,6 @@ var useDelItem = (function (goods) {
|
|
|
10360
10360
|
controller.delGood(goods.$index);
|
|
10361
10361
|
}, [controller, goods.$index]);
|
|
10362
10362
|
|
|
10363
|
-
if (goods.lineAttribute === LineAttributeType$1.折让行) {
|
|
10364
|
-
return undefined;
|
|
10365
|
-
}
|
|
10366
|
-
|
|
10367
10363
|
if (goods.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
10368
10364
|
return undefined;
|
|
10369
10365
|
}
|
|
@@ -10404,82 +10400,42 @@ var useAddDiscount = (function (goods) {
|
|
|
10404
10400
|
while (1) {
|
|
10405
10401
|
switch (_context2.prev = _context2.next) {
|
|
10406
10402
|
case 0:
|
|
10403
|
+
_context2.prev = 0;
|
|
10407
10404
|
e.stopPropagation();
|
|
10408
|
-
_context2.next =
|
|
10405
|
+
_context2.next = 4;
|
|
10409
10406
|
return controller.wait();
|
|
10410
10407
|
|
|
10411
|
-
case
|
|
10412
|
-
_context2.next =
|
|
10408
|
+
case 4:
|
|
10409
|
+
_context2.next = 6;
|
|
10413
10410
|
return controller.saveEditGood();
|
|
10414
10411
|
|
|
10415
|
-
case
|
|
10416
|
-
_context2.next =
|
|
10412
|
+
case 6:
|
|
10413
|
+
_context2.next = 8;
|
|
10414
|
+
return checkDiscount(controller);
|
|
10415
|
+
|
|
10416
|
+
case 8:
|
|
10417
|
+
_context2.next = 10;
|
|
10418
|
+
return checkFieldsError(controller, goods);
|
|
10419
|
+
|
|
10420
|
+
case 10:
|
|
10421
|
+
_context2.next = 12;
|
|
10422
|
+
return checkDutyFree(controller, goods);
|
|
10423
|
+
|
|
10424
|
+
case 12:
|
|
10425
|
+
_context2.next = 14;
|
|
10426
|
+
return checkZeroAmount(controller, goods);
|
|
10427
|
+
|
|
10428
|
+
case 14:
|
|
10429
|
+
_context2.next = 16;
|
|
10417
10430
|
return controller.run( /*#__PURE__*/function () {
|
|
10418
10431
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
10419
|
-
var _s$goodsListState$edi, _goods;
|
|
10420
|
-
|
|
10421
|
-
var err, key;
|
|
10422
10432
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10423
10433
|
while (1) {
|
|
10424
10434
|
switch (_context.prev = _context.next) {
|
|
10425
10435
|
case 0:
|
|
10426
|
-
if (!(s.goodsListState.form && ((_s$goodsListState$edi = s.goodsListState.editGood) === null || _s$goodsListState$edi === void 0 ? void 0 : _s$goodsListState$edi.$index) === ((_goods = goods) === null || _goods === void 0 ? void 0 : _goods.$index))) {
|
|
10427
|
-
_context.next = 11;
|
|
10428
|
-
break;
|
|
10429
|
-
}
|
|
10430
|
-
|
|
10431
|
-
err = s.goodsListState.form.getFieldsError();
|
|
10432
|
-
_context.t0 = _regeneratorRuntime().keys(err);
|
|
10433
|
-
|
|
10434
|
-
case 3:
|
|
10435
|
-
if ((_context.t1 = _context.t0()).done) {
|
|
10436
|
-
_context.next = 11;
|
|
10437
|
-
break;
|
|
10438
|
-
}
|
|
10439
|
-
|
|
10440
|
-
key = _context.t1.value;
|
|
10441
|
-
|
|
10442
|
-
if (err[key]) {
|
|
10443
|
-
_context.next = 7;
|
|
10444
|
-
break;
|
|
10445
|
-
}
|
|
10446
|
-
|
|
10447
|
-
return _context.abrupt("continue", 3);
|
|
10448
|
-
|
|
10449
|
-
case 7:
|
|
10450
|
-
ktsComponentsAntdX3.message.error(err[key][0]);
|
|
10451
|
-
return _context.abrupt("return");
|
|
10452
|
-
|
|
10453
|
-
case 11:
|
|
10454
|
-
goods = s.goodsListState.goodsMap.get(goods.$index);
|
|
10455
|
-
|
|
10456
|
-
if (!(goods.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType)) {
|
|
10457
|
-
_context.next = 15;
|
|
10458
|
-
break;
|
|
10459
|
-
}
|
|
10460
|
-
|
|
10461
|
-
ktsComponentsAntdX3.message.error({
|
|
10462
|
-
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
10463
|
-
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
10464
|
-
});
|
|
10465
|
-
return _context.abrupt("return");
|
|
10466
|
-
|
|
10467
|
-
case 15:
|
|
10468
|
-
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
10469
|
-
_context.next = 18;
|
|
10470
|
-
break;
|
|
10471
|
-
}
|
|
10472
|
-
|
|
10473
|
-
ktsComponentsAntdX3.message.error({
|
|
10474
|
-
content: '金额为0不能添加折扣行',
|
|
10475
|
-
key: '金额为0不能添加折扣行'
|
|
10476
|
-
});
|
|
10477
|
-
return _context.abrupt("return");
|
|
10478
|
-
|
|
10479
|
-
case 18:
|
|
10480
10436
|
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
10481
10437
|
|
|
10482
|
-
case
|
|
10438
|
+
case 1:
|
|
10483
10439
|
case "end":
|
|
10484
10440
|
return _context.stop();
|
|
10485
10441
|
}
|
|
@@ -10492,12 +10448,21 @@ var useAddDiscount = (function (goods) {
|
|
|
10492
10448
|
};
|
|
10493
10449
|
}());
|
|
10494
10450
|
|
|
10495
|
-
case
|
|
10451
|
+
case 16:
|
|
10452
|
+
_context2.next = 21;
|
|
10453
|
+
break;
|
|
10454
|
+
|
|
10455
|
+
case 18:
|
|
10456
|
+
_context2.prev = 18;
|
|
10457
|
+
_context2.t0 = _context2["catch"](0);
|
|
10458
|
+
console.error(_context2.t0);
|
|
10459
|
+
|
|
10460
|
+
case 21:
|
|
10496
10461
|
case "end":
|
|
10497
10462
|
return _context2.stop();
|
|
10498
10463
|
}
|
|
10499
10464
|
}
|
|
10500
|
-
}, _callee2);
|
|
10465
|
+
}, _callee2, null, [[0, 18]]);
|
|
10501
10466
|
}));
|
|
10502
10467
|
|
|
10503
10468
|
return function (_x) {
|
|
@@ -10525,15 +10490,193 @@ var useAddDiscount = (function (goods) {
|
|
|
10525
10490
|
key: 'addDiscount',
|
|
10526
10491
|
title: '折扣',
|
|
10527
10492
|
onClick: onClick
|
|
10528
|
-
};
|
|
10529
|
-
// if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
10530
|
-
// return undefined
|
|
10531
|
-
// }
|
|
10532
|
-
// return (
|
|
10533
|
-
// <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
|
|
10534
|
-
// );
|
|
10535
|
-
// }, [onClick, goods.lineAttribute]);
|
|
10493
|
+
};
|
|
10536
10494
|
});
|
|
10495
|
+
/**
|
|
10496
|
+
* 有折让行,不可以添加折扣
|
|
10497
|
+
* @param controller 组件控制器
|
|
10498
|
+
*/
|
|
10499
|
+
|
|
10500
|
+
function checkDiscount(_x3) {
|
|
10501
|
+
return _checkDiscount.apply(this, arguments);
|
|
10502
|
+
}
|
|
10503
|
+
/**
|
|
10504
|
+
* 零税率需要设置免税类型,请在赋码中设置!
|
|
10505
|
+
* @param controller 组件控制器
|
|
10506
|
+
* @param goods 当前行数据
|
|
10507
|
+
*/
|
|
10508
|
+
|
|
10509
|
+
|
|
10510
|
+
function _checkDiscount() {
|
|
10511
|
+
_checkDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(controller) {
|
|
10512
|
+
var goodsList;
|
|
10513
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
10514
|
+
while (1) {
|
|
10515
|
+
switch (_context3.prev = _context3.next) {
|
|
10516
|
+
case 0:
|
|
10517
|
+
goodsList = controller.state.goodsListState.goodsList;
|
|
10518
|
+
goodsList.forEach(function (e) {
|
|
10519
|
+
if (e.lineAttribute === LineAttributeType$1.折让行) {
|
|
10520
|
+
var content = '有折让行,不可以添加折扣';
|
|
10521
|
+
ktsXui.message.error({
|
|
10522
|
+
content: content,
|
|
10523
|
+
key: content
|
|
10524
|
+
});
|
|
10525
|
+
throw new Error(content);
|
|
10526
|
+
}
|
|
10527
|
+
});
|
|
10528
|
+
|
|
10529
|
+
case 2:
|
|
10530
|
+
case "end":
|
|
10531
|
+
return _context3.stop();
|
|
10532
|
+
}
|
|
10533
|
+
}
|
|
10534
|
+
}, _callee3);
|
|
10535
|
+
}));
|
|
10536
|
+
return _checkDiscount.apply(this, arguments);
|
|
10537
|
+
}
|
|
10538
|
+
|
|
10539
|
+
function checkDutyFree(_x4, _x5) {
|
|
10540
|
+
return _checkDutyFree.apply(this, arguments);
|
|
10541
|
+
}
|
|
10542
|
+
/**
|
|
10543
|
+
* 金额为0不能添加折扣行
|
|
10544
|
+
* @param controller 组件控制器
|
|
10545
|
+
* @param goods 当前行数据
|
|
10546
|
+
**/
|
|
10547
|
+
|
|
10548
|
+
|
|
10549
|
+
function _checkDutyFree() {
|
|
10550
|
+
_checkDutyFree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(controller, goods) {
|
|
10551
|
+
var content;
|
|
10552
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
10553
|
+
while (1) {
|
|
10554
|
+
switch (_context4.prev = _context4.next) {
|
|
10555
|
+
case 0:
|
|
10556
|
+
goods = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
10557
|
+
return e.$index === goods.$index;
|
|
10558
|
+
})[0];
|
|
10559
|
+
|
|
10560
|
+
if (!(goods.taxRate === 0 && controller.state.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType)) {
|
|
10561
|
+
_context4.next = 5;
|
|
10562
|
+
break;
|
|
10563
|
+
}
|
|
10564
|
+
|
|
10565
|
+
content = '零税率需要设置免税类型,请在赋码中设置!';
|
|
10566
|
+
ktsXui.message.error({
|
|
10567
|
+
content: content,
|
|
10568
|
+
key: content
|
|
10569
|
+
});
|
|
10570
|
+
throw new Error(content);
|
|
10571
|
+
|
|
10572
|
+
case 5:
|
|
10573
|
+
case "end":
|
|
10574
|
+
return _context4.stop();
|
|
10575
|
+
}
|
|
10576
|
+
}
|
|
10577
|
+
}, _callee4);
|
|
10578
|
+
}));
|
|
10579
|
+
return _checkDutyFree.apply(this, arguments);
|
|
10580
|
+
}
|
|
10581
|
+
|
|
10582
|
+
function checkZeroAmount(_x6, _x7) {
|
|
10583
|
+
return _checkZeroAmount.apply(this, arguments);
|
|
10584
|
+
}
|
|
10585
|
+
/**
|
|
10586
|
+
* 校验当前的表单
|
|
10587
|
+
* @param controller 组件控制器
|
|
10588
|
+
* @param goods 当前行数据
|
|
10589
|
+
* */
|
|
10590
|
+
|
|
10591
|
+
|
|
10592
|
+
function _checkZeroAmount() {
|
|
10593
|
+
_checkZeroAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(controller, goods) {
|
|
10594
|
+
var content;
|
|
10595
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
10596
|
+
while (1) {
|
|
10597
|
+
switch (_context5.prev = _context5.next) {
|
|
10598
|
+
case 0:
|
|
10599
|
+
goods = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
10600
|
+
return e.$index === goods.$index;
|
|
10601
|
+
})[0];
|
|
10602
|
+
|
|
10603
|
+
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
10604
|
+
_context5.next = 5;
|
|
10605
|
+
break;
|
|
10606
|
+
}
|
|
10607
|
+
|
|
10608
|
+
content = '金额为0不能添加折扣行';
|
|
10609
|
+
ktsXui.message.error({
|
|
10610
|
+
content: content,
|
|
10611
|
+
key: content
|
|
10612
|
+
});
|
|
10613
|
+
throw new Error(content);
|
|
10614
|
+
|
|
10615
|
+
case 5:
|
|
10616
|
+
case "end":
|
|
10617
|
+
return _context5.stop();
|
|
10618
|
+
}
|
|
10619
|
+
}
|
|
10620
|
+
}, _callee5);
|
|
10621
|
+
}));
|
|
10622
|
+
return _checkZeroAmount.apply(this, arguments);
|
|
10623
|
+
}
|
|
10624
|
+
|
|
10625
|
+
function checkFieldsError(_x8, _x9) {
|
|
10626
|
+
return _checkFieldsError.apply(this, arguments);
|
|
10627
|
+
}
|
|
10628
|
+
|
|
10629
|
+
function _checkFieldsError() {
|
|
10630
|
+
_checkFieldsError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(controller, goods) {
|
|
10631
|
+
var _s$goodsListState$edi;
|
|
10632
|
+
|
|
10633
|
+
var s, err, key, content;
|
|
10634
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
10635
|
+
while (1) {
|
|
10636
|
+
switch (_context6.prev = _context6.next) {
|
|
10637
|
+
case 0:
|
|
10638
|
+
s = controller.state;
|
|
10639
|
+
|
|
10640
|
+
if (!(s.goodsListState.form && ((_s$goodsListState$edi = s.goodsListState.editGood) === null || _s$goodsListState$edi === void 0 ? void 0 : _s$goodsListState$edi.$index) === (goods === null || goods === void 0 ? void 0 : goods.$index))) {
|
|
10641
|
+
_context6.next = 13;
|
|
10642
|
+
break;
|
|
10643
|
+
}
|
|
10644
|
+
|
|
10645
|
+
err = s.goodsListState.form.getFieldsError();
|
|
10646
|
+
_context6.t0 = _regeneratorRuntime().keys(err);
|
|
10647
|
+
|
|
10648
|
+
case 4:
|
|
10649
|
+
if ((_context6.t1 = _context6.t0()).done) {
|
|
10650
|
+
_context6.next = 13;
|
|
10651
|
+
break;
|
|
10652
|
+
}
|
|
10653
|
+
|
|
10654
|
+
key = _context6.t1.value;
|
|
10655
|
+
|
|
10656
|
+
if (err[key]) {
|
|
10657
|
+
_context6.next = 8;
|
|
10658
|
+
break;
|
|
10659
|
+
}
|
|
10660
|
+
|
|
10661
|
+
return _context6.abrupt("continue", 4);
|
|
10662
|
+
|
|
10663
|
+
case 8:
|
|
10664
|
+
content = err[key][0];
|
|
10665
|
+
ktsXui.message.error({
|
|
10666
|
+
content: content,
|
|
10667
|
+
key: content
|
|
10668
|
+
});
|
|
10669
|
+
throw new Error(content);
|
|
10670
|
+
|
|
10671
|
+
case 13:
|
|
10672
|
+
case "end":
|
|
10673
|
+
return _context6.stop();
|
|
10674
|
+
}
|
|
10675
|
+
}
|
|
10676
|
+
}, _callee6);
|
|
10677
|
+
}));
|
|
10678
|
+
return _checkFieldsError.apply(this, arguments);
|
|
10679
|
+
}
|
|
10537
10680
|
|
|
10538
10681
|
var useEndowCode = (function (goods) {
|
|
10539
10682
|
var controller = Invoice.useInvoiceController();
|
|
@@ -14163,7 +14306,7 @@ var useDelRowButton = (function () {
|
|
|
14163
14306
|
return s.goodsListState.selectedGoodIndex.some(function (e) {
|
|
14164
14307
|
var good = s.goodsListState.goodsMap.get(e);
|
|
14165
14308
|
if (!good) return true;
|
|
14166
|
-
return good.lineAttribute
|
|
14309
|
+
return good.lineAttribute === LineAttributeType$1.折扣行;
|
|
14167
14310
|
});
|
|
14168
14311
|
}, []);
|
|
14169
14312
|
var onClick = React__default['default'].useCallback(function () {
|
package/package.json
CHANGED
package/src/Invoice/index.tsx
CHANGED
|
@@ -22,7 +22,6 @@ import ImportGoodsDrawer from './ui/default/ImportGoodsDrawer';
|
|
|
22
22
|
import EndowCodeDrawer from './ui/default/EndowCodeDrawer';
|
|
23
23
|
import AddComparisonDrawer from './ui/default/AddComparisonDrawer';
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
/** 发票组件的上下文 */
|
|
27
26
|
export const InvoiceContext = React.createContext<InvoiceController>(
|
|
28
27
|
undefined as any,
|
|
@@ -163,4 +162,6 @@ const Digtal = (props: IInvoiceProps) => {
|
|
|
163
162
|
<EndowCodeDrawer />{/* 给货品赋码的抽屉 */}
|
|
164
163
|
</InvoiceContext.Provider>
|
|
165
164
|
)
|
|
166
|
-
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useAddDiscount/index.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Typography } from 'kts-components-antd-x3';
|
|
4
|
+
import { message } from 'kts-xui';
|
|
5
|
+
import InvoiceController, { IGood, LineAttributeType } from '../../../../../../../../../InvoiceController';
|
|
5
6
|
import Invoice from '../../../../../../../../..';
|
|
6
7
|
|
|
7
8
|
const { Text } = Typography;
|
|
@@ -17,29 +18,20 @@ export default (goods: IGood) => {
|
|
|
17
18
|
|
|
18
19
|
/** 点击了 添加折扣行 按钮 */
|
|
19
20
|
const onClick = React.useCallback(async e => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
message.error({ content: '零税率需要设置免税类型,请在赋码中设置!', key: '零税率需要设置免税类型,请在赋码中设置!' });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (`${goods.lineAmountIncludeTax}` === '0') {
|
|
38
|
-
message.error({ content: '金额为0不能添加折扣行', key: '金额为0不能添加折扣行' });
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
42
|
-
})
|
|
21
|
+
try {
|
|
22
|
+
e.stopPropagation()
|
|
23
|
+
await controller.wait();
|
|
24
|
+
await controller.saveEditGood();
|
|
25
|
+
await checkDiscount(controller);
|
|
26
|
+
await checkFieldsError(controller, goods);
|
|
27
|
+
await checkDutyFree(controller, goods);
|
|
28
|
+
await checkZeroAmount(controller, goods);
|
|
29
|
+
await controller.run(async s => {
|
|
30
|
+
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
31
|
+
})
|
|
32
|
+
} catch (error: any) {
|
|
33
|
+
console.error(error);
|
|
34
|
+
}
|
|
43
35
|
}, [controller, goods.$index]);
|
|
44
36
|
|
|
45
37
|
if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
@@ -59,18 +51,69 @@ export default (goods: IGood) => {
|
|
|
59
51
|
}
|
|
60
52
|
|
|
61
53
|
return {
|
|
62
|
-
key:'addDiscount',
|
|
63
|
-
title:'折扣',
|
|
54
|
+
key: 'addDiscount',
|
|
55
|
+
title: '折扣',
|
|
64
56
|
onClick,
|
|
65
57
|
}
|
|
58
|
+
};
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
/**
|
|
61
|
+
* 有折让行,不可以添加折扣
|
|
62
|
+
* @param controller 组件控制器
|
|
63
|
+
*/
|
|
64
|
+
async function checkDiscount(controller: InvoiceController) {
|
|
65
|
+
const { goodsList } = controller.state.goodsListState;
|
|
66
|
+
goodsList.forEach(e => {
|
|
67
|
+
if (e.lineAttribute === LineAttributeType.折让行) {
|
|
68
|
+
const content = '有折让行,不可以添加折扣';
|
|
69
|
+
message.error({ content, key: content });
|
|
70
|
+
throw new Error(content)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
}
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
/**
|
|
76
|
+
* 零税率需要设置免税类型,请在赋码中设置!
|
|
77
|
+
* @param controller 组件控制器
|
|
78
|
+
* @param goods 当前行数据
|
|
79
|
+
*/
|
|
80
|
+
async function checkDutyFree(controller: InvoiceController, goods: IGood) {
|
|
81
|
+
goods = controller.state.goodsListState.goodsList.filter(e => e.$index === goods.$index)[0];
|
|
82
|
+
if (goods.taxRate === 0 && controller.state.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType) {
|
|
83
|
+
const content = '零税率需要设置免税类型,请在赋码中设置!'
|
|
84
|
+
message.error({ content, key: content });
|
|
85
|
+
throw new Error(content)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 金额为0不能添加折扣行
|
|
91
|
+
* @param controller 组件控制器
|
|
92
|
+
* @param goods 当前行数据
|
|
93
|
+
**/
|
|
94
|
+
async function checkZeroAmount(controller: InvoiceController, goods: IGood) {
|
|
95
|
+
goods = controller.state.goodsListState.goodsList.filter(e => e.$index === goods.$index)[0];
|
|
96
|
+
if (`${goods.lineAmountIncludeTax}` === '0') {
|
|
97
|
+
const content = '金额为0不能添加折扣行'
|
|
98
|
+
message.error({ content, key: content });
|
|
99
|
+
throw new Error(content)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 校验当前的表单
|
|
105
|
+
* @param controller 组件控制器
|
|
106
|
+
* @param goods 当前行数据
|
|
107
|
+
* */
|
|
108
|
+
async function checkFieldsError(controller: InvoiceController, goods: IGood) {
|
|
109
|
+
const s = controller.state;
|
|
110
|
+
if (s.goodsListState.form && s.goodsListState.editGood?.$index === goods?.$index) {
|
|
111
|
+
const err: any = s.goodsListState.form.getFieldsError();
|
|
112
|
+
for (let key in err) {
|
|
113
|
+
if (!err[key]) continue;
|
|
114
|
+
const content = err[key][0];
|
|
115
|
+
message.error({ content, key: content });
|
|
116
|
+
throw new Error(content)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx
CHANGED
|
@@ -17,10 +17,6 @@ export default (goods: IGood) => {
|
|
|
17
17
|
controller.delGood(goods.$index);
|
|
18
18
|
}, [controller, goods.$index]);
|
|
19
19
|
|
|
20
|
-
if (goods.lineAttribute === LineAttributeType.折让行) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
if (goods.lineAttribute === LineAttributeType.被折扣行) {
|
|
25
21
|
return undefined;
|
|
26
22
|
}
|
|
@@ -18,7 +18,7 @@ export default () => {
|
|
|
18
18
|
return s.goodsListState.selectedGoodIndex.some((e) => {
|
|
19
19
|
const good = s.goodsListState.goodsMap.get(e);
|
|
20
20
|
if (!good) return true;
|
|
21
|
-
return good.lineAttribute
|
|
21
|
+
return good.lineAttribute === LineAttributeType.折扣行;
|
|
22
22
|
});
|
|
23
23
|
}, []);
|
|
24
24
|
|