kts-component-invoice-operate 3.2.87 → 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
CHANGED
|
@@ -10390,82 +10390,42 @@ var useAddDiscount = (function (goods) {
|
|
|
10390
10390
|
while (1) {
|
|
10391
10391
|
switch (_context2.prev = _context2.next) {
|
|
10392
10392
|
case 0:
|
|
10393
|
+
_context2.prev = 0;
|
|
10393
10394
|
e.stopPropagation();
|
|
10394
|
-
_context2.next =
|
|
10395
|
+
_context2.next = 4;
|
|
10395
10396
|
return controller.wait();
|
|
10396
10397
|
|
|
10397
|
-
case
|
|
10398
|
-
_context2.next =
|
|
10398
|
+
case 4:
|
|
10399
|
+
_context2.next = 6;
|
|
10399
10400
|
return controller.saveEditGood();
|
|
10400
10401
|
|
|
10401
|
-
case
|
|
10402
|
-
_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;
|
|
10403
10420
|
return controller.run( /*#__PURE__*/function () {
|
|
10404
10421
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
10405
|
-
var _s$goodsListState$edi, _goods;
|
|
10406
|
-
|
|
10407
|
-
var err, key;
|
|
10408
10422
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10409
10423
|
while (1) {
|
|
10410
10424
|
switch (_context.prev = _context.next) {
|
|
10411
10425
|
case 0:
|
|
10412
|
-
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))) {
|
|
10413
|
-
_context.next = 11;
|
|
10414
|
-
break;
|
|
10415
|
-
}
|
|
10416
|
-
|
|
10417
|
-
err = s.goodsListState.form.getFieldsError();
|
|
10418
|
-
_context.t0 = _regeneratorRuntime().keys(err);
|
|
10419
|
-
|
|
10420
|
-
case 3:
|
|
10421
|
-
if ((_context.t1 = _context.t0()).done) {
|
|
10422
|
-
_context.next = 11;
|
|
10423
|
-
break;
|
|
10424
|
-
}
|
|
10425
|
-
|
|
10426
|
-
key = _context.t1.value;
|
|
10427
|
-
|
|
10428
|
-
if (err[key]) {
|
|
10429
|
-
_context.next = 7;
|
|
10430
|
-
break;
|
|
10431
|
-
}
|
|
10432
|
-
|
|
10433
|
-
return _context.abrupt("continue", 3);
|
|
10434
|
-
|
|
10435
|
-
case 7:
|
|
10436
|
-
message.error(err[key][0]);
|
|
10437
|
-
return _context.abrupt("return");
|
|
10438
|
-
|
|
10439
|
-
case 11:
|
|
10440
|
-
goods = s.goodsListState.goodsMap.get(goods.$index);
|
|
10441
|
-
|
|
10442
|
-
if (!(goods.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType)) {
|
|
10443
|
-
_context.next = 15;
|
|
10444
|
-
break;
|
|
10445
|
-
}
|
|
10446
|
-
|
|
10447
|
-
message.error({
|
|
10448
|
-
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
10449
|
-
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
10450
|
-
});
|
|
10451
|
-
return _context.abrupt("return");
|
|
10452
|
-
|
|
10453
|
-
case 15:
|
|
10454
|
-
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
10455
|
-
_context.next = 18;
|
|
10456
|
-
break;
|
|
10457
|
-
}
|
|
10458
|
-
|
|
10459
|
-
message.error({
|
|
10460
|
-
content: '金额为0不能添加折扣行',
|
|
10461
|
-
key: '金额为0不能添加折扣行'
|
|
10462
|
-
});
|
|
10463
|
-
return _context.abrupt("return");
|
|
10464
|
-
|
|
10465
|
-
case 18:
|
|
10466
10426
|
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
10467
10427
|
|
|
10468
|
-
case
|
|
10428
|
+
case 1:
|
|
10469
10429
|
case "end":
|
|
10470
10430
|
return _context.stop();
|
|
10471
10431
|
}
|
|
@@ -10478,12 +10438,21 @@ var useAddDiscount = (function (goods) {
|
|
|
10478
10438
|
};
|
|
10479
10439
|
}());
|
|
10480
10440
|
|
|
10481
|
-
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:
|
|
10482
10451
|
case "end":
|
|
10483
10452
|
return _context2.stop();
|
|
10484
10453
|
}
|
|
10485
10454
|
}
|
|
10486
|
-
}, _callee2);
|
|
10455
|
+
}, _callee2, null, [[0, 18]]);
|
|
10487
10456
|
}));
|
|
10488
10457
|
|
|
10489
10458
|
return function (_x) {
|
|
@@ -10511,15 +10480,193 @@ var useAddDiscount = (function (goods) {
|
|
|
10511
10480
|
key: 'addDiscount',
|
|
10512
10481
|
title: '折扣',
|
|
10513
10482
|
onClick: onClick
|
|
10514
|
-
};
|
|
10515
|
-
// if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
10516
|
-
// return undefined
|
|
10517
|
-
// }
|
|
10518
|
-
// return (
|
|
10519
|
-
// <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
|
|
10520
|
-
// );
|
|
10521
|
-
// }, [onClick, goods.lineAttribute]);
|
|
10483
|
+
};
|
|
10522
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
|
+
}
|
|
10523
10670
|
|
|
10524
10671
|
var useEndowCode = (function (goods) {
|
|
10525
10672
|
var controller = Invoice.useInvoiceController();
|
package/dist/index.js
CHANGED
|
@@ -10400,82 +10400,42 @@ var useAddDiscount = (function (goods) {
|
|
|
10400
10400
|
while (1) {
|
|
10401
10401
|
switch (_context2.prev = _context2.next) {
|
|
10402
10402
|
case 0:
|
|
10403
|
+
_context2.prev = 0;
|
|
10403
10404
|
e.stopPropagation();
|
|
10404
|
-
_context2.next =
|
|
10405
|
+
_context2.next = 4;
|
|
10405
10406
|
return controller.wait();
|
|
10406
10407
|
|
|
10407
|
-
case
|
|
10408
|
-
_context2.next =
|
|
10408
|
+
case 4:
|
|
10409
|
+
_context2.next = 6;
|
|
10409
10410
|
return controller.saveEditGood();
|
|
10410
10411
|
|
|
10411
|
-
case
|
|
10412
|
-
_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;
|
|
10413
10430
|
return controller.run( /*#__PURE__*/function () {
|
|
10414
10431
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
10415
|
-
var _s$goodsListState$edi, _goods;
|
|
10416
|
-
|
|
10417
|
-
var err, key;
|
|
10418
10432
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10419
10433
|
while (1) {
|
|
10420
10434
|
switch (_context.prev = _context.next) {
|
|
10421
10435
|
case 0:
|
|
10422
|
-
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))) {
|
|
10423
|
-
_context.next = 11;
|
|
10424
|
-
break;
|
|
10425
|
-
}
|
|
10426
|
-
|
|
10427
|
-
err = s.goodsListState.form.getFieldsError();
|
|
10428
|
-
_context.t0 = _regeneratorRuntime().keys(err);
|
|
10429
|
-
|
|
10430
|
-
case 3:
|
|
10431
|
-
if ((_context.t1 = _context.t0()).done) {
|
|
10432
|
-
_context.next = 11;
|
|
10433
|
-
break;
|
|
10434
|
-
}
|
|
10435
|
-
|
|
10436
|
-
key = _context.t1.value;
|
|
10437
|
-
|
|
10438
|
-
if (err[key]) {
|
|
10439
|
-
_context.next = 7;
|
|
10440
|
-
break;
|
|
10441
|
-
}
|
|
10442
|
-
|
|
10443
|
-
return _context.abrupt("continue", 3);
|
|
10444
|
-
|
|
10445
|
-
case 7:
|
|
10446
|
-
ktsComponentsAntdX3.message.error(err[key][0]);
|
|
10447
|
-
return _context.abrupt("return");
|
|
10448
|
-
|
|
10449
|
-
case 11:
|
|
10450
|
-
goods = s.goodsListState.goodsMap.get(goods.$index);
|
|
10451
|
-
|
|
10452
|
-
if (!(goods.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !goods.taxFreeType)) {
|
|
10453
|
-
_context.next = 15;
|
|
10454
|
-
break;
|
|
10455
|
-
}
|
|
10456
|
-
|
|
10457
|
-
ktsComponentsAntdX3.message.error({
|
|
10458
|
-
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
10459
|
-
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
10460
|
-
});
|
|
10461
|
-
return _context.abrupt("return");
|
|
10462
|
-
|
|
10463
|
-
case 15:
|
|
10464
|
-
if (!("".concat(goods.lineAmountIncludeTax) === '0')) {
|
|
10465
|
-
_context.next = 18;
|
|
10466
|
-
break;
|
|
10467
|
-
}
|
|
10468
|
-
|
|
10469
|
-
ktsComponentsAntdX3.message.error({
|
|
10470
|
-
content: '金额为0不能添加折扣行',
|
|
10471
|
-
key: '金额为0不能添加折扣行'
|
|
10472
|
-
});
|
|
10473
|
-
return _context.abrupt("return");
|
|
10474
|
-
|
|
10475
|
-
case 18:
|
|
10476
10436
|
s.goodsListState.discountGoodIndex = [goods.$index];
|
|
10477
10437
|
|
|
10478
|
-
case
|
|
10438
|
+
case 1:
|
|
10479
10439
|
case "end":
|
|
10480
10440
|
return _context.stop();
|
|
10481
10441
|
}
|
|
@@ -10488,12 +10448,21 @@ var useAddDiscount = (function (goods) {
|
|
|
10488
10448
|
};
|
|
10489
10449
|
}());
|
|
10490
10450
|
|
|
10491
|
-
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:
|
|
10492
10461
|
case "end":
|
|
10493
10462
|
return _context2.stop();
|
|
10494
10463
|
}
|
|
10495
10464
|
}
|
|
10496
|
-
}, _callee2);
|
|
10465
|
+
}, _callee2, null, [[0, 18]]);
|
|
10497
10466
|
}));
|
|
10498
10467
|
|
|
10499
10468
|
return function (_x) {
|
|
@@ -10521,15 +10490,193 @@ var useAddDiscount = (function (goods) {
|
|
|
10521
10490
|
key: 'addDiscount',
|
|
10522
10491
|
title: '折扣',
|
|
10523
10492
|
onClick: onClick
|
|
10524
|
-
};
|
|
10525
|
-
// if (goods.lineAttribute !== LineAttributeType.正常) {
|
|
10526
|
-
// return undefined
|
|
10527
|
-
// }
|
|
10528
|
-
// return (
|
|
10529
|
-
// <Menu.Item key="addDiscount" onClick={onClick}><Text strong>折扣</Text></Menu.Item>
|
|
10530
|
-
// );
|
|
10531
|
-
// }, [onClick, goods.lineAttribute]);
|
|
10493
|
+
};
|
|
10532
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
|
+
}
|
|
10533
10680
|
|
|
10534
10681
|
var useEndowCode = (function (goods) {
|
|
10535
10682
|
var controller = Invoice.useInvoiceController();
|
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
|
+
}
|