kts-component-invoice-operate 3.2.181-2 → 3.2.181-21
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/InvoiceController/InvoiceControllerState/BuyerState/index.d.ts +1 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +1 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
- package/dist/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.d.ts +1 -1
- package/dist/index.esm.js +961 -387
- package/dist/index.js +952 -378
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/BuyerState/index.tsx +7 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +2 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +2 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +1 -1
- package/src/Invoice/InvoiceController/fns/importGoodsDrawer.ts +2 -3
- package/src/Invoice/tools/calculate/index.ts +1 -1
- package/src/Invoice/ui/default/Buyer/ui/BuyerNameInput/index.tsx +2 -2
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +1 -2
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +92 -36
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +43 -14
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useDelItem/index.tsx +4 -1
- package/src/Invoice/ui/default/GoodsList/index.tsx +6 -6
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +449 -139
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +3 -3
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/index.tsx +1 -1
- package/src/Invoice/ui/default/ImportBuyerDrawer/index.tsx +1 -1
- package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +27 -14
- package/src/Invoice/ui/digtal/GoodsList/ui/BulkMenu/hooks/useAddDiscountRowButton/index.tsx +9 -2
- package/src/Invoice/ui/digtal/Sign/index.tsx +2 -2
- package/src/Invoice/ui/digtal/Stakeholder/index.tsx +28 -17
package/dist/index.js
CHANGED
|
@@ -1131,6 +1131,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1131
1131
|
this.isAddDiscount = void 0;
|
|
1132
1132
|
this.isAddRow = true;
|
|
1133
1133
|
this.isRemRow = true;
|
|
1134
|
+
this.isBatchRemRow = true;
|
|
1134
1135
|
this.isTaxIncluded = true;
|
|
1135
1136
|
this.calculateType = '3';
|
|
1136
1137
|
this.isMyShow = false;
|
|
@@ -1190,6 +1191,10 @@ var BuyerState = /*#__PURE__*/_createClass(function BuyerState() {
|
|
|
1190
1191
|
title: '公司名称',
|
|
1191
1192
|
dataIndex: 'buyerName',
|
|
1192
1193
|
key: 'buyerName'
|
|
1194
|
+
}, {
|
|
1195
|
+
title: '客户代码',
|
|
1196
|
+
dataIndex: 'customerCode',
|
|
1197
|
+
key: 'customerCode'
|
|
1193
1198
|
}, {
|
|
1194
1199
|
title: '纳税人识别号',
|
|
1195
1200
|
dataIndex: 'buyerNo',
|
|
@@ -8497,12 +8502,70 @@ var clearCalculatingField = /*#__PURE__*/function () {
|
|
|
8497
8502
|
};
|
|
8498
8503
|
}();
|
|
8499
8504
|
/** 数量改变了 */
|
|
8505
|
+
// export const onChangeQuantity = lazyFn(
|
|
8506
|
+
// (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
|
|
8507
|
+
// form.validateFields(async (err, values) => {
|
|
8508
|
+
// err = err || {};
|
|
8509
|
+
// if (!values.quantity && values.quantity !== 0) {
|
|
8510
|
+
// await controller.setEditGood({ quantity: undefined });
|
|
8511
|
+
// await clearCalculatingField(controller);
|
|
8512
|
+
// return;
|
|
8513
|
+
// }
|
|
8514
|
+
// if (err.quantity) {
|
|
8515
|
+
// await clearCalculatingField(controller);
|
|
8516
|
+
// return
|
|
8517
|
+
// };
|
|
8518
|
+
// const calculatingDigits = controller.state.calculatingDigits;
|
|
8519
|
+
// const quantity = format15(values.quantity, calculatingDigits);
|
|
8520
|
+
// await controller.setEditGood({ quantity });
|
|
8521
|
+
// form.setFieldsValue({ quantity });
|
|
8522
|
+
// // 是否含税
|
|
8523
|
+
// if (controller.state.goodsListState.isTaxIncluded) {
|
|
8524
|
+
// // 含税
|
|
8525
|
+
// if (!err.priceIncludeTax && values.priceIncludeTax) {
|
|
8526
|
+
// // 可以找到 单价(含税)
|
|
8527
|
+
// const priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8528
|
+
// const lineAmountIncludeTax = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
|
|
8529
|
+
// form.setFieldsValue({ lineAmountIncludeTax });
|
|
8530
|
+
// await controller.setEditGood({ lineAmountIncludeTax });
|
|
8531
|
+
// } else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
8532
|
+
// // 可以找到 金额(含税)
|
|
8533
|
+
// const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8534
|
+
// const priceIncludeTax = format15(
|
|
8535
|
+
// evaluate(`${lineAmountIncludeTax} / ${quantity}`),
|
|
8536
|
+
// calculatingDigits);
|
|
8537
|
+
// form.setFieldsValue({ priceIncludeTax });
|
|
8538
|
+
// await controller.setEditGood({ priceIncludeTax });
|
|
8539
|
+
// }
|
|
8540
|
+
// // 更新不含税
|
|
8541
|
+
// await updateUnitPriceExcludingTax(controller, form, record);
|
|
8542
|
+
// } else {
|
|
8543
|
+
// // 不含税
|
|
8544
|
+
// if (!err.priceExcludeTax && values.priceExcludeTax) {
|
|
8545
|
+
// const priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8546
|
+
// const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
8547
|
+
// form.setFieldsValue({ lineAmountExcludeTax });
|
|
8548
|
+
// await controller.setEditGood({ lineAmountExcludeTax, quantity });
|
|
8549
|
+
// } else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
8550
|
+
// const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8551
|
+
// const priceExcludeTax = format15(evaluate(`${lineAmountExcludeTax} / ${quantity}`), calculatingDigits);
|
|
8552
|
+
// form.setFieldsValue({ priceExcludeTax });
|
|
8553
|
+
// await controller.setEditGood({ priceExcludeTax, quantity });
|
|
8554
|
+
// }
|
|
8555
|
+
// // 更新含税
|
|
8556
|
+
// await updateUnitPriceTax(controller, form, record);
|
|
8557
|
+
// }
|
|
8558
|
+
// // 清楚 计算中启动字段
|
|
8559
|
+
// await clearCalculatingField(controller);
|
|
8560
|
+
// });
|
|
8561
|
+
// },
|
|
8562
|
+
// 1000,
|
|
8563
|
+
// );
|
|
8500
8564
|
|
|
8501
8565
|
var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
8502
8566
|
form.validateFields( /*#__PURE__*/function () {
|
|
8503
8567
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err, values) {
|
|
8504
|
-
var calculatingDigits, quantity,
|
|
8505
|
-
|
|
8568
|
+
var calculatingDigits, quantity, lineAmountIncludeTax, priceIncludeTax, lineAmountExcludeTax, priceExcludeTax;
|
|
8506
8569
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8507
8570
|
while (1) {
|
|
8508
8571
|
switch (_context3.prev = _context3.next) {
|
|
@@ -8541,113 +8604,69 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8541
8604
|
case 11:
|
|
8542
8605
|
calculatingDigits = controller.state.calculatingDigits;
|
|
8543
8606
|
quantity = format15(values.quantity, calculatingDigits);
|
|
8544
|
-
_context3.next =
|
|
8607
|
+
_context3.next = 15;
|
|
8545
8608
|
return controller.setEditGood({
|
|
8546
8609
|
quantity: quantity
|
|
8547
8610
|
});
|
|
8548
8611
|
|
|
8549
|
-
case
|
|
8612
|
+
case 15:
|
|
8550
8613
|
form.setFieldsValue({
|
|
8551
8614
|
quantity: quantity
|
|
8552
8615
|
}); // 是否含税
|
|
8553
8616
|
|
|
8554
8617
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
8555
|
-
_context3.next =
|
|
8556
|
-
break;
|
|
8557
|
-
}
|
|
8558
|
-
|
|
8559
|
-
if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
|
|
8560
|
-
_context3.next = 26;
|
|
8618
|
+
_context3.next = 27;
|
|
8561
8619
|
break;
|
|
8562
8620
|
}
|
|
8563
8621
|
|
|
8564
|
-
// 可以找到 单价(含税)
|
|
8565
|
-
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8566
|
-
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
8567
|
-
form.setFieldsValue({
|
|
8568
|
-
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8569
|
-
});
|
|
8570
|
-
_context3.next = 24;
|
|
8571
|
-
return controller.setEditGood({
|
|
8572
|
-
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8573
|
-
});
|
|
8574
|
-
|
|
8575
|
-
case 24:
|
|
8576
|
-
_context3.next = 32;
|
|
8577
|
-
break;
|
|
8578
|
-
|
|
8579
|
-
case 26:
|
|
8580
8622
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8581
|
-
_context3.next =
|
|
8623
|
+
_context3.next = 23;
|
|
8582
8624
|
break;
|
|
8583
8625
|
}
|
|
8584
8626
|
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8627
|
+
lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8628
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)), 8);
|
|
8588
8629
|
form.setFieldsValue({
|
|
8589
|
-
priceIncludeTax:
|
|
8630
|
+
priceIncludeTax: priceIncludeTax
|
|
8590
8631
|
});
|
|
8591
|
-
_context3.next =
|
|
8632
|
+
_context3.next = 23;
|
|
8592
8633
|
return controller.setEditGood({
|
|
8593
|
-
priceIncludeTax:
|
|
8634
|
+
priceIncludeTax: priceIncludeTax
|
|
8594
8635
|
});
|
|
8595
8636
|
|
|
8596
|
-
case
|
|
8597
|
-
_context3.next =
|
|
8637
|
+
case 23:
|
|
8638
|
+
_context3.next = 25;
|
|
8598
8639
|
return updateUnitPriceExcludingTax(controller, form, record);
|
|
8599
8640
|
|
|
8600
|
-
case
|
|
8601
|
-
_context3.next =
|
|
8602
|
-
break;
|
|
8603
|
-
|
|
8604
|
-
case 36:
|
|
8605
|
-
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8606
|
-
_context3.next = 44;
|
|
8607
|
-
break;
|
|
8608
|
-
}
|
|
8609
|
-
|
|
8610
|
-
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8611
|
-
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8612
|
-
form.setFieldsValue({
|
|
8613
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8614
|
-
});
|
|
8615
|
-
_context3.next = 42;
|
|
8616
|
-
return controller.setEditGood({
|
|
8617
|
-
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
8618
|
-
quantity: quantity
|
|
8619
|
-
});
|
|
8620
|
-
|
|
8621
|
-
case 42:
|
|
8622
|
-
_context3.next = 50;
|
|
8641
|
+
case 25:
|
|
8642
|
+
_context3.next = 35;
|
|
8623
8643
|
break;
|
|
8624
8644
|
|
|
8625
|
-
case
|
|
8645
|
+
case 27:
|
|
8626
8646
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8627
|
-
_context3.next =
|
|
8647
|
+
_context3.next = 33;
|
|
8628
8648
|
break;
|
|
8629
8649
|
}
|
|
8630
8650
|
|
|
8631
|
-
|
|
8632
|
-
|
|
8651
|
+
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8652
|
+
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)), 8);
|
|
8633
8653
|
form.setFieldsValue({
|
|
8634
|
-
priceExcludeTax:
|
|
8654
|
+
priceExcludeTax: priceExcludeTax
|
|
8635
8655
|
});
|
|
8636
|
-
_context3.next =
|
|
8656
|
+
_context3.next = 33;
|
|
8637
8657
|
return controller.setEditGood({
|
|
8638
|
-
priceExcludeTax:
|
|
8639
|
-
quantity: quantity
|
|
8658
|
+
priceExcludeTax: priceExcludeTax
|
|
8640
8659
|
});
|
|
8641
8660
|
|
|
8642
|
-
case
|
|
8643
|
-
_context3.next =
|
|
8661
|
+
case 33:
|
|
8662
|
+
_context3.next = 35;
|
|
8644
8663
|
return updateUnitPriceTax(controller, form, record);
|
|
8645
8664
|
|
|
8646
|
-
case
|
|
8647
|
-
_context3.next =
|
|
8665
|
+
case 35:
|
|
8666
|
+
_context3.next = 37;
|
|
8648
8667
|
return clearCalculatingField(controller);
|
|
8649
8668
|
|
|
8650
|
-
case
|
|
8669
|
+
case 37:
|
|
8651
8670
|
case "end":
|
|
8652
8671
|
return _context3.stop();
|
|
8653
8672
|
}
|
|
@@ -8665,7 +8684,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8665
8684
|
var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
8666
8685
|
form.validateFields( /*#__PURE__*/function () {
|
|
8667
8686
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
8668
|
-
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax,
|
|
8687
|
+
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax, _quantity;
|
|
8669
8688
|
|
|
8670
8689
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8671
8690
|
while (1) {
|
|
@@ -8705,7 +8724,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8705
8724
|
|
|
8706
8725
|
case 11:
|
|
8707
8726
|
calculatingDigits = controller.state.calculatingDigits;
|
|
8708
|
-
priceIncludeTax = format15(values.priceIncludeTax,
|
|
8727
|
+
priceIncludeTax = format15(values.priceIncludeTax, 8);
|
|
8709
8728
|
_context4.next = 15;
|
|
8710
8729
|
return controller.setEditGood({
|
|
8711
8730
|
priceIncludeTax: priceIncludeTax
|
|
@@ -8741,8 +8760,8 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8741
8760
|
break;
|
|
8742
8761
|
}
|
|
8743
8762
|
|
|
8744
|
-
|
|
8745
|
-
_quantity = format15(evaluate("".concat(
|
|
8763
|
+
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8764
|
+
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(priceIncludeTax)), calculatingDigits);
|
|
8746
8765
|
form.setFieldsValue({
|
|
8747
8766
|
quantity: _quantity
|
|
8748
8767
|
});
|
|
@@ -8777,7 +8796,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8777
8796
|
var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
8778
8797
|
form.validateFields( /*#__PURE__*/function () {
|
|
8779
8798
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(err, values) {
|
|
8780
|
-
var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax,
|
|
8799
|
+
var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax, _quantity2;
|
|
8781
8800
|
|
|
8782
8801
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
8783
8802
|
while (1) {
|
|
@@ -8817,7 +8836,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8817
8836
|
|
|
8818
8837
|
case 11:
|
|
8819
8838
|
calculatingDigits = controller.state.calculatingDigits;
|
|
8820
|
-
priceExcludeTax = format15(values.priceExcludeTax,
|
|
8839
|
+
priceExcludeTax = format15(values.priceExcludeTax, 8);
|
|
8821
8840
|
_context5.next = 15;
|
|
8822
8841
|
return controller.setEditGood({
|
|
8823
8842
|
priceExcludeTax: priceExcludeTax
|
|
@@ -8853,8 +8872,8 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8853
8872
|
break;
|
|
8854
8873
|
}
|
|
8855
8874
|
|
|
8856
|
-
|
|
8857
|
-
_quantity2 = format15(evaluate("".concat(
|
|
8875
|
+
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8876
|
+
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(priceExcludeTax)), calculatingDigits);
|
|
8858
8877
|
form.setFieldsValue({
|
|
8859
8878
|
quantity: _quantity2
|
|
8860
8879
|
});
|
|
@@ -8889,7 +8908,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8889
8908
|
var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
8890
8909
|
form.validateFields( /*#__PURE__*/function () {
|
|
8891
8910
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
|
|
8892
|
-
var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax,
|
|
8911
|
+
var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax, _quantity3;
|
|
8893
8912
|
|
|
8894
8913
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8895
8914
|
while (1) {
|
|
@@ -8938,7 +8957,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8938
8957
|
}
|
|
8939
8958
|
|
|
8940
8959
|
quantity = format15(values.quantity, calculatingDigits);
|
|
8941
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)),
|
|
8960
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)), 8);
|
|
8942
8961
|
form.setFieldsValue({
|
|
8943
8962
|
priceIncludeTax: priceIncludeTax
|
|
8944
8963
|
});
|
|
@@ -8957,8 +8976,8 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8957
8976
|
break;
|
|
8958
8977
|
}
|
|
8959
8978
|
|
|
8960
|
-
|
|
8961
|
-
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(
|
|
8979
|
+
_priceIncludeTax = format15(values.priceIncludeTax, 8);
|
|
8980
|
+
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax)), calculatingDigits);
|
|
8962
8981
|
form.setFieldsValue({
|
|
8963
8982
|
quantity: _quantity3
|
|
8964
8983
|
});
|
|
@@ -8993,7 +9012,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8993
9012
|
var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
8994
9013
|
form.validateFields( /*#__PURE__*/function () {
|
|
8995
9014
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(err, values) {
|
|
8996
|
-
var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax,
|
|
9015
|
+
var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax, _quantity4;
|
|
8997
9016
|
|
|
8998
9017
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
8999
9018
|
while (1) {
|
|
@@ -9042,7 +9061,7 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
9042
9061
|
}
|
|
9043
9062
|
|
|
9044
9063
|
quantity = format15(values.quantity, calculatingDigits);
|
|
9045
|
-
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)),
|
|
9064
|
+
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)), 8);
|
|
9046
9065
|
form.setFieldsValue({
|
|
9047
9066
|
priceExcludeTax: priceExcludeTax
|
|
9048
9067
|
});
|
|
@@ -9061,8 +9080,8 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
9061
9080
|
break;
|
|
9062
9081
|
}
|
|
9063
9082
|
|
|
9064
|
-
|
|
9065
|
-
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(
|
|
9083
|
+
_priceExcludeTax = format15(values.priceExcludeTax, 8);
|
|
9084
|
+
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax)), calculatingDigits);
|
|
9066
9085
|
form.setFieldsValue({
|
|
9067
9086
|
quantity: _quantity4
|
|
9068
9087
|
});
|
|
@@ -9346,7 +9365,7 @@ var updateUnitPriceTax = /*#__PURE__*/function () {
|
|
|
9346
9365
|
break;
|
|
9347
9366
|
}
|
|
9348
9367
|
|
|
9349
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)),
|
|
9368
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)), 8);
|
|
9350
9369
|
_context11.next = 11;
|
|
9351
9370
|
return controller.setEditGood({
|
|
9352
9371
|
priceIncludeTax: priceIncludeTax
|
|
@@ -9784,11 +9803,11 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
|
|
|
9784
9803
|
}
|
|
9785
9804
|
|
|
9786
9805
|
var quantity = format15(sourceQuantity, calculatingDigits);
|
|
9787
|
-
var priceIncludeTax = format15(sourcePriceIncludeTax,
|
|
9806
|
+
var priceIncludeTax = format15(sourcePriceIncludeTax, 8);
|
|
9788
9807
|
var lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
9789
9808
|
var taxAmount = countTaxAmount(lineAmountIncludeTax, controller.state.goodsListState.deduction, taxRate);
|
|
9790
9809
|
var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount);
|
|
9791
|
-
var priceExcludeTax = countPrice(lineAmountExcludeTax, quantity,
|
|
9810
|
+
var priceExcludeTax = countPrice(lineAmountExcludeTax, quantity, 8);
|
|
9792
9811
|
return _objectSpread2(_objectSpread2({}, good), {}, {
|
|
9793
9812
|
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
9794
9813
|
lineAmountIncludeTax: lineAmountIncludeTax,
|
|
@@ -9808,21 +9827,21 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
|
|
|
9808
9827
|
|
|
9809
9828
|
var _quantity5 = format15(sourceQuantity, calculatingDigits);
|
|
9810
9829
|
|
|
9811
|
-
var
|
|
9830
|
+
var _priceExcludeTax2 = format15(sourcePriceExcludeTax, 8);
|
|
9812
9831
|
|
|
9813
|
-
var
|
|
9832
|
+
var _lineAmountExcludeTax2 = format2(evaluate("".concat(_priceExcludeTax2, " * ").concat(_quantity5)));
|
|
9814
9833
|
|
|
9815
|
-
var
|
|
9834
|
+
var _lineAmountIncludeTax2 = format2(evaluate("".concat(_lineAmountExcludeTax2, " * (1+(").concat(taxRate, "/100))")));
|
|
9816
9835
|
|
|
9817
|
-
var
|
|
9836
|
+
var _priceIncludeTax2 = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(_quantity5)), 8);
|
|
9818
9837
|
|
|
9819
|
-
var _taxAmount = evaluate("".concat(
|
|
9838
|
+
var _taxAmount = evaluate("".concat(_lineAmountIncludeTax2, " - ").concat(_lineAmountExcludeTax2));
|
|
9820
9839
|
|
|
9821
9840
|
return _objectSpread2(_objectSpread2({}, good), {}, {
|
|
9822
|
-
lineAmountExcludeTax:
|
|
9823
|
-
lineAmountIncludeTax:
|
|
9841
|
+
lineAmountExcludeTax: _lineAmountExcludeTax2,
|
|
9842
|
+
lineAmountIncludeTax: _lineAmountIncludeTax2,
|
|
9824
9843
|
taxAmount: _taxAmount,
|
|
9825
|
-
priceIncludeTax:
|
|
9844
|
+
priceIncludeTax: _priceIncludeTax2
|
|
9826
9845
|
});
|
|
9827
9846
|
}
|
|
9828
9847
|
});
|
|
@@ -11110,6 +11129,8 @@ function SvgSpot(props) {
|
|
|
11110
11129
|
}
|
|
11111
11130
|
|
|
11112
11131
|
var useDelItem = (function (goods) {
|
|
11132
|
+
var _goods$referenceLines;
|
|
11133
|
+
|
|
11113
11134
|
var controller = Invoice.useInvoiceController();
|
|
11114
11135
|
var model = controller.useMemo(function (s) {
|
|
11115
11136
|
return s.model;
|
|
@@ -11121,6 +11142,10 @@ var useDelItem = (function (goods) {
|
|
|
11121
11142
|
controller.delGood(goods.$index);
|
|
11122
11143
|
}, [controller, goods.$index]);
|
|
11123
11144
|
|
|
11145
|
+
if (goods.lineAttribute === LineAttributeType$1.正常 && (goods === null || goods === void 0 ? void 0 : goods.referenceLines) && (goods === null || goods === void 0 ? void 0 : (_goods$referenceLines = goods.referenceLines) === null || _goods$referenceLines === void 0 ? void 0 : _goods$referenceLines.length) > 0) {
|
|
11146
|
+
return undefined;
|
|
11147
|
+
}
|
|
11148
|
+
|
|
11124
11149
|
if (goods.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
11125
11150
|
return undefined;
|
|
11126
11151
|
}
|
|
@@ -14005,15 +14030,17 @@ var useColumns = (function (form) {
|
|
|
14005
14030
|
render: function render(value, record) {
|
|
14006
14031
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
|
|
14007
14032
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceIncludeTax', {
|
|
14008
|
-
initialValue: nonScientificNotation(editGood.priceIncludeTax),
|
|
14033
|
+
initialValue: nonScientificNotation(editGood.priceIncludeTax, 8),
|
|
14009
14034
|
getValueFromEvent: onNumberValueChange,
|
|
14010
|
-
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
|
|
14011
|
-
|
|
14012
|
-
|
|
14035
|
+
rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
14036
|
+
// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
|
|
14037
|
+
{
|
|
14038
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d{1,8})?$/,
|
|
14039
|
+
message: '单价必须为数字且最多保留8位小数'
|
|
14013
14040
|
}, {
|
|
14014
14041
|
validator: function () {
|
|
14015
14042
|
var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
|
|
14016
|
-
var
|
|
14043
|
+
var quantity, isQuantityValid, isValueValid;
|
|
14017
14044
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
14018
14045
|
while (1) {
|
|
14019
14046
|
switch (_context9.prev = _context9.next) {
|
|
@@ -14022,20 +14049,39 @@ var useColumns = (function (form) {
|
|
|
14022
14049
|
return controller.wait();
|
|
14023
14050
|
|
|
14024
14051
|
case 2:
|
|
14025
|
-
isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
14026
|
-
isvalue = !!value || value === 0;
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14052
|
+
// const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
14053
|
+
// const isvalue = !!value || value === 0;
|
|
14054
|
+
// if (isvalue || isQuantity === isvalue) return;
|
|
14055
|
+
// callback('请输入单价');
|
|
14056
|
+
quantity = getFieldValue('quantity');
|
|
14057
|
+
isQuantityValid = quantity !== undefined && quantity !== null && quantity !== '';
|
|
14058
|
+
isValueValid = value !== undefined && value !== null && value !== ''; // if (isValueValid && isQuantityValid) return;
|
|
14059
|
+
// 允许两者都为空
|
|
14060
|
+
|
|
14061
|
+
if (!(!isValueValid && !isQuantityValid)) {
|
|
14062
|
+
_context9.next = 7;
|
|
14030
14063
|
break;
|
|
14031
14064
|
}
|
|
14032
14065
|
|
|
14033
14066
|
return _context9.abrupt("return");
|
|
14034
14067
|
|
|
14035
|
-
case 6:
|
|
14036
|
-
callback('请输入单价');
|
|
14037
|
-
|
|
14038
14068
|
case 7:
|
|
14069
|
+
if (isValueValid) {
|
|
14070
|
+
_context9.next = 9;
|
|
14071
|
+
break;
|
|
14072
|
+
}
|
|
14073
|
+
|
|
14074
|
+
return _context9.abrupt("return", callback('金额不能为空'));
|
|
14075
|
+
|
|
14076
|
+
case 9:
|
|
14077
|
+
if (isQuantityValid) {
|
|
14078
|
+
_context9.next = 11;
|
|
14079
|
+
break;
|
|
14080
|
+
}
|
|
14081
|
+
|
|
14082
|
+
return _context9.abrupt("return", callback('数量不能为空'));
|
|
14083
|
+
|
|
14084
|
+
case 11:
|
|
14039
14085
|
case "end":
|
|
14040
14086
|
return _context9.stop();
|
|
14041
14087
|
}
|
|
@@ -14066,7 +14112,7 @@ var useColumns = (function (form) {
|
|
|
14066
14112
|
style: {
|
|
14067
14113
|
padding: '0 10px'
|
|
14068
14114
|
}
|
|
14069
|
-
}, nonScientificNotation(value));
|
|
14115
|
+
}, nonScientificNotation(value, 8));
|
|
14070
14116
|
}
|
|
14071
14117
|
}
|
|
14072
14118
|
}, {
|
|
@@ -14080,15 +14126,16 @@ var useColumns = (function (form) {
|
|
|
14080
14126
|
render: function render(value, record) {
|
|
14081
14127
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
|
|
14082
14128
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('priceExcludeTax', {
|
|
14083
|
-
initialValue: nonScientificNotation(editGood.priceExcludeTax),
|
|
14129
|
+
initialValue: nonScientificNotation(editGood.priceExcludeTax, 8),
|
|
14084
14130
|
getValueFromEvent: onNumberValueChange,
|
|
14085
|
-
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [{
|
|
14086
|
-
|
|
14087
|
-
|
|
14131
|
+
rules: [].concat(_toConsumableArray(getReplenishRules('priceExcludeTax')), [// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
|
|
14132
|
+
{
|
|
14133
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d{1,8})?$/,
|
|
14134
|
+
message: '单价必须为数字且最多保留8位小数'
|
|
14088
14135
|
}, {
|
|
14089
14136
|
validator: function () {
|
|
14090
14137
|
var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
|
|
14091
|
-
var
|
|
14138
|
+
var quantity, isQuantityValid, isValueValid;
|
|
14092
14139
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
14093
14140
|
while (1) {
|
|
14094
14141
|
switch (_context10.prev = _context10.next) {
|
|
@@ -14097,20 +14144,39 @@ var useColumns = (function (form) {
|
|
|
14097
14144
|
return controller.wait();
|
|
14098
14145
|
|
|
14099
14146
|
case 2:
|
|
14100
|
-
isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
14101
|
-
isvalue = !!value || value === 0;
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14147
|
+
// const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
|
|
14148
|
+
// const isvalue = !!value || value === 0;
|
|
14149
|
+
// if (isvalue || isQuantity === isvalue) return;
|
|
14150
|
+
// callback('请输入单价');
|
|
14151
|
+
quantity = getFieldValue('quantity');
|
|
14152
|
+
isQuantityValid = quantity !== undefined && quantity !== null && quantity !== '';
|
|
14153
|
+
isValueValid = value !== undefined && value !== null && value !== ''; // if (isValueValid && isQuantityValid) return;
|
|
14154
|
+
// 允许两者都为空
|
|
14155
|
+
|
|
14156
|
+
if (!(!isValueValid && !isQuantityValid)) {
|
|
14157
|
+
_context10.next = 7;
|
|
14105
14158
|
break;
|
|
14106
14159
|
}
|
|
14107
14160
|
|
|
14108
14161
|
return _context10.abrupt("return");
|
|
14109
14162
|
|
|
14110
|
-
case 6:
|
|
14111
|
-
callback('请输入单价');
|
|
14112
|
-
|
|
14113
14163
|
case 7:
|
|
14164
|
+
if (isValueValid) {
|
|
14165
|
+
_context10.next = 9;
|
|
14166
|
+
break;
|
|
14167
|
+
}
|
|
14168
|
+
|
|
14169
|
+
return _context10.abrupt("return", callback('金额不能为空'));
|
|
14170
|
+
|
|
14171
|
+
case 9:
|
|
14172
|
+
if (isQuantityValid) {
|
|
14173
|
+
_context10.next = 11;
|
|
14174
|
+
break;
|
|
14175
|
+
}
|
|
14176
|
+
|
|
14177
|
+
return _context10.abrupt("return", callback('数量不能为空'));
|
|
14178
|
+
|
|
14179
|
+
case 11:
|
|
14114
14180
|
case "end":
|
|
14115
14181
|
return _context10.stop();
|
|
14116
14182
|
}
|
|
@@ -14141,7 +14207,7 @@ var useColumns = (function (form) {
|
|
|
14141
14207
|
style: {
|
|
14142
14208
|
padding: '0 10px'
|
|
14143
14209
|
}
|
|
14144
|
-
}, nonScientificNotation(value));
|
|
14210
|
+
}, nonScientificNotation(value, 8));
|
|
14145
14211
|
}
|
|
14146
14212
|
}
|
|
14147
14213
|
}, {
|
|
@@ -15318,6 +15384,9 @@ var useDelRowButton = (function () {
|
|
|
15318
15384
|
var isRemRow = controller.useMemo(function (s) {
|
|
15319
15385
|
return s.goodsListState.isRemRow;
|
|
15320
15386
|
}, []);
|
|
15387
|
+
var isBatchRemRow = controller.useMemo(function (s) {
|
|
15388
|
+
return s.goodsListState.isBatchRemRow;
|
|
15389
|
+
}, []);
|
|
15321
15390
|
/** 是否禁用 */
|
|
15322
15391
|
|
|
15323
15392
|
var disabled = controller.useMemo(function (s) {
|
|
@@ -15374,6 +15443,7 @@ var useDelRowButton = (function () {
|
|
|
15374
15443
|
}, " \u5220\u9664\u884C ");
|
|
15375
15444
|
}, [model, onClick, disabled]);
|
|
15376
15445
|
var button = React__default['default'].useMemo(function () {
|
|
15446
|
+
if (isBatchRemRow === false) return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
15377
15447
|
if (isRemRow === false) return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
15378
15448
|
if (model === 'prefab') return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
15379
15449
|
if (model === 'readOnly') return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
@@ -15381,39 +15451,13 @@ var useDelRowButton = (function () {
|
|
|
15381
15451
|
onClick: onClick,
|
|
15382
15452
|
disabled: disabled
|
|
15383
15453
|
}, "\u6279\u91CF\u5220\u9664");
|
|
15384
|
-
}, [model, onClick, disabled, isRemRow]);
|
|
15454
|
+
}, [model, onClick, disabled, isRemRow, isBatchRemRow]);
|
|
15385
15455
|
return {
|
|
15386
15456
|
button: button,
|
|
15387
15457
|
menuItem: menuItem
|
|
15388
15458
|
};
|
|
15389
15459
|
});
|
|
15390
15460
|
|
|
15391
|
-
/** 延迟函数 */
|
|
15392
|
-
var lazyFn$1 = (function (fn) {
|
|
15393
|
-
var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
15394
|
-
// let timer: any = 0;
|
|
15395
|
-
// return (...par: any[]) => {
|
|
15396
|
-
// if (timer === 0) {
|
|
15397
|
-
// timer = setTimeout(() => {
|
|
15398
|
-
// fn.apply(null, par);
|
|
15399
|
-
// timer = 0;
|
|
15400
|
-
// }, delayed);
|
|
15401
|
-
// }
|
|
15402
|
-
// }
|
|
15403
|
-
var timer;
|
|
15404
|
-
return function () {
|
|
15405
|
-
for (var _len = arguments.length, par = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15406
|
-
par[_key] = arguments[_key];
|
|
15407
|
-
}
|
|
15408
|
-
|
|
15409
|
-
if (timer) return;
|
|
15410
|
-
timer = setTimeout(function () {
|
|
15411
|
-
timer = undefined;
|
|
15412
|
-
fn.apply(null, par);
|
|
15413
|
-
}, delayed);
|
|
15414
|
-
};
|
|
15415
|
-
});
|
|
15416
|
-
|
|
15417
15461
|
var css_248z$b = ".kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-body {\n flex: 1;\n overflow: auto;\n}\n.kts-invoice-operate-goods-list-add-discount-row .ktsAnt3x-drawer-wrapper-body .ktsAnt3x-drawer-body .add-discount-row-footer {\n flex: none;\n}\n";
|
|
15418
15462
|
styleInject(css_248z$b);
|
|
15419
15463
|
|
|
@@ -15437,10 +15481,8 @@ var useAddDiscountRowButton = (function () {
|
|
|
15437
15481
|
return s.goodsListState.isAddDiscount;
|
|
15438
15482
|
}, []);
|
|
15439
15483
|
/** 是否开启抽屉 */
|
|
15484
|
+
// const visible = controller.useMemo(s => s.goodsListState.discountGoodIndex.length > 0, []);
|
|
15440
15485
|
|
|
15441
|
-
var visible = controller.useMemo(function (s) {
|
|
15442
|
-
return s.goodsListState.discountGoodIndex.length > 0;
|
|
15443
|
-
}, []);
|
|
15444
15486
|
/** 是否禁用 按钮 */
|
|
15445
15487
|
|
|
15446
15488
|
var disabled = controller.useMemo(function (s) {
|
|
@@ -15577,221 +15619,692 @@ var useAddDiscountRowButton = (function () {
|
|
|
15577
15619
|
onClick: onClick,
|
|
15578
15620
|
disabled: disabled
|
|
15579
15621
|
}, "\u6DFB\u52A0\u6298\u6263\u884C") : undefined;
|
|
15580
|
-
}, [isAddDiscount, disabled, onClick]);
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
});
|
|
15597
|
-
var DrawerBody = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (props) {
|
|
15598
|
-
var form = props.form;
|
|
15599
|
-
var getFieldDecorator = form.getFieldDecorator;
|
|
15600
|
-
var controller = Invoice.useInvoiceController();
|
|
15601
|
-
/** 选中的货物索引列表 */
|
|
15622
|
+
}, [isAddDiscount, disabled, onClick]); // const drawer = React.useMemo(() => {
|
|
15623
|
+
// return (
|
|
15624
|
+
// <Drawer
|
|
15625
|
+
// className="kts-invoice-operate-goods-list-add-discount-row"
|
|
15626
|
+
// width={540}
|
|
15627
|
+
// title="添加折扣行"
|
|
15628
|
+
// placement="right"
|
|
15629
|
+
// destroyOnClose={true}
|
|
15630
|
+
// onClose={onClose}
|
|
15631
|
+
// visible={visible}
|
|
15632
|
+
// >
|
|
15633
|
+
// <DrawerBody />
|
|
15634
|
+
// </Drawer>
|
|
15635
|
+
// )
|
|
15636
|
+
// }, [visible, onClose])
|
|
15637
|
+
// 添加折扣(批量)
|
|
15602
15638
|
|
|
15603
|
-
|
|
15604
|
-
return s.goodsListState.discountGoodIndex;
|
|
15605
|
-
}, []);
|
|
15606
|
-
/** 金额合计 */
|
|
15639
|
+
/** 是否启用 */
|
|
15607
15640
|
|
|
15608
|
-
var
|
|
15609
|
-
|
|
15641
|
+
var isEnable = React__default['default'].useMemo(function () {
|
|
15642
|
+
if (model === 'readOnly') return false;
|
|
15643
|
+
if (model === 'prefab') return false;
|
|
15644
|
+
return !(isAddDiscount === false);
|
|
15645
|
+
}, [isAddDiscount, model]);
|
|
15646
|
+
/** 准备添加折扣的货物索引列表 */
|
|
15610
15647
|
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountIncludeTax) || 0);
|
|
15615
|
-
});
|
|
15616
|
-
} else {
|
|
15617
|
-
s.goodsListState.discountGoodIndex.forEach(function (e) {
|
|
15618
|
-
var goods = s.goodsListState.goodsMap.get(e);
|
|
15619
|
-
sum = sum.add((goods === null || goods === void 0 ? void 0 : goods.lineAmountExcludeTax) || 0);
|
|
15620
|
-
});
|
|
15621
|
-
}
|
|
15648
|
+
var discountGoodIndex = controller.useMemo(function (s) {
|
|
15649
|
+
return s.goodsListState.discountGoodIndex || [];
|
|
15650
|
+
}, []); // 抽屉开启状态
|
|
15622
15651
|
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15652
|
+
var open = React__default['default'].useMemo(function () {
|
|
15653
|
+
return discountGoodIndex.length > 0;
|
|
15654
|
+
}, [discountGoodIndex]);
|
|
15655
|
+
/** 打开抽屉 */
|
|
15626
15656
|
|
|
15627
|
-
var
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
s.goodsListState.discountGoodIndex = [];
|
|
15657
|
+
var onOpen = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
15658
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
15659
|
+
while (1) {
|
|
15660
|
+
switch (_context5.prev = _context5.next) {
|
|
15661
|
+
case 0:
|
|
15662
|
+
_context5.next = 2;
|
|
15663
|
+
return controller.saveEditGood();
|
|
15635
15664
|
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
}
|
|
15640
|
-
}
|
|
15641
|
-
}, _callee4);
|
|
15642
|
-
}));
|
|
15665
|
+
case 2:
|
|
15666
|
+
_context5.next = 4;
|
|
15667
|
+
return controller.wait();
|
|
15643
15668
|
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15654
|
-
|
|
15655
|
-
var discount = parseFloat(parseFloat(values.discount).toFixed(4));
|
|
15656
|
-
var indexList = discountGoodIndex;
|
|
15657
|
-
controller.pipeline( /*#__PURE__*/function () {
|
|
15658
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(s) {
|
|
15659
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
15660
|
-
while (1) {
|
|
15661
|
-
switch (_context5.prev = _context5.next) {
|
|
15662
|
-
case 0:
|
|
15663
|
-
s.goodsListState.discountGoodIndex = [];
|
|
15669
|
+
case 4:
|
|
15670
|
+
_context5.next = 6;
|
|
15671
|
+
return controller.run( /*#__PURE__*/function () {
|
|
15672
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
|
|
15673
|
+
var isOk;
|
|
15674
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
15675
|
+
while (1) {
|
|
15676
|
+
switch (_context4.prev = _context4.next) {
|
|
15677
|
+
case 0:
|
|
15678
|
+
// 不能给编辑状态的行增加折扣!
|
|
15679
|
+
isOk = s.goodsListState.editGood && s.goodsListState.selectedGoodIndex.indexOf(s.goodsListState.editGood.$index) >= 0;
|
|
15664
15680
|
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
}
|
|
15670
|
-
}, _callee5);
|
|
15671
|
-
}));
|
|
15681
|
+
if (!isOk) {
|
|
15682
|
+
_context4.next = 4;
|
|
15683
|
+
break;
|
|
15684
|
+
}
|
|
15672
15685
|
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15686
|
+
ktsComponentsAntdX3.message.error({
|
|
15687
|
+
content: '不能给编辑状态的行增加折扣!',
|
|
15688
|
+
key: '不能给编辑状态的行增加折扣!'
|
|
15689
|
+
});
|
|
15690
|
+
return _context4.abrupt("return");
|
|
15691
|
+
|
|
15692
|
+
case 4:
|
|
15693
|
+
if (isContinuityNum(s.goodsListState.selectedGoodIndex.map(function (e) {
|
|
15694
|
+
var _s$goodsListState$goo;
|
|
15695
|
+
|
|
15696
|
+
return ((_s$goodsListState$goo = s.goodsListState.goodsMap.get(e)) === null || _s$goodsListState$goo === void 0 ? void 0 : _s$goodsListState$goo.serialNo) || -2;
|
|
15697
|
+
}).sort(function (a, b) {
|
|
15698
|
+
return a - b;
|
|
15699
|
+
}))) {
|
|
15700
|
+
_context4.next = 7;
|
|
15701
|
+
break;
|
|
15702
|
+
}
|
|
15703
|
+
|
|
15704
|
+
ktsComponentsAntdX3.message.error({
|
|
15705
|
+
content: '项目不连续,不允许添加折扣',
|
|
15706
|
+
key: '项目不连续,不允许添加折扣'
|
|
15707
|
+
});
|
|
15708
|
+
return _context4.abrupt("return");
|
|
15709
|
+
|
|
15710
|
+
case 7:
|
|
15711
|
+
// 不允许重复添加折扣
|
|
15712
|
+
isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
|
|
15713
|
+
var _s$goodsListState$goo2;
|
|
15714
|
+
|
|
15715
|
+
return ((_s$goodsListState$goo2 = s.goodsListState.goodsMap.get($index)) === null || _s$goodsListState$goo2 === void 0 ? void 0 : _s$goodsListState$goo2.lineAttribute) !== LineAttributeType$1.正常;
|
|
15716
|
+
});
|
|
15717
|
+
|
|
15718
|
+
if (!isOk) {
|
|
15719
|
+
_context4.next = 11;
|
|
15720
|
+
break;
|
|
15721
|
+
}
|
|
15722
|
+
|
|
15723
|
+
ktsComponentsAntdX3.message.error({
|
|
15724
|
+
content: '不允许重复添加折扣',
|
|
15725
|
+
key: '不允许重复添加折扣'
|
|
15726
|
+
});
|
|
15727
|
+
return _context4.abrupt("return");
|
|
15728
|
+
|
|
15729
|
+
case 11:
|
|
15730
|
+
if (!(areAllValuesEqual(s.goodsListState.selectedGoodIndex.map(function (e) {
|
|
15731
|
+
var _s$goodsListState$goo3;
|
|
15732
|
+
|
|
15733
|
+
return (_s$goodsListState$goo3 = s.goodsListState.goodsMap.get(e)) === null || _s$goodsListState$goo3 === void 0 ? void 0 : _s$goodsListState$goo3.taxRate;
|
|
15734
|
+
})) === false)) {
|
|
15735
|
+
_context4.next = 14;
|
|
15736
|
+
break;
|
|
15737
|
+
}
|
|
15738
|
+
|
|
15739
|
+
ktsComponentsAntdX3.message.error({
|
|
15740
|
+
content: '存在不同税率,不允许同时添加折扣',
|
|
15741
|
+
key: '存在不同税率,不允许同时添加折扣'
|
|
15742
|
+
});
|
|
15743
|
+
return _context4.abrupt("return");
|
|
15744
|
+
|
|
15745
|
+
case 14:
|
|
15746
|
+
// 添加折扣时项目金额不能为空或零
|
|
15747
|
+
isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
|
|
15748
|
+
var good = s.goodsListState.goodsMap.get($index);
|
|
15749
|
+
return "".concat(good === null || good === void 0 ? void 0 : good.lineAmountIncludeTax) === '0';
|
|
15750
|
+
});
|
|
15751
|
+
|
|
15752
|
+
if (!isOk) {
|
|
15753
|
+
_context4.next = 18;
|
|
15754
|
+
break;
|
|
15755
|
+
}
|
|
15756
|
+
|
|
15757
|
+
ktsComponentsAntdX3.message.error({
|
|
15758
|
+
content: '添加折扣时项目金额不能为空或零',
|
|
15759
|
+
key: '添加折扣时项目金额不能为空或零'
|
|
15760
|
+
});
|
|
15761
|
+
return _context4.abrupt("return");
|
|
15762
|
+
|
|
15763
|
+
case 18:
|
|
15764
|
+
// 零税率需要设置免税类型,请在赋码中设置!
|
|
15765
|
+
isOk = s.goodsListState.selectedGoodIndex.some(function ($index) {
|
|
15766
|
+
var good = s.goodsListState.goodsMap.get($index);
|
|
15767
|
+
return !good || good.taxRate === 0 && s.goodsListState.endowCode.isTaxFreeTypeNeeded && !good.taxFreeType;
|
|
15768
|
+
});
|
|
15769
|
+
|
|
15770
|
+
if (!isOk) {
|
|
15771
|
+
_context4.next = 22;
|
|
15772
|
+
break;
|
|
15773
|
+
}
|
|
15774
|
+
|
|
15775
|
+
ktsComponentsAntdX3.message.error({
|
|
15776
|
+
content: '零税率需要设置免税类型,请在赋码中设置!',
|
|
15777
|
+
key: '零税率需要设置免税类型,请在赋码中设置!'
|
|
15778
|
+
});
|
|
15779
|
+
return _context4.abrupt("return");
|
|
15780
|
+
|
|
15781
|
+
case 22:
|
|
15782
|
+
s.goodsListState.discountGoodIndex = s.goodsListState.selectedGoodIndex.slice();
|
|
15783
|
+
|
|
15784
|
+
case 23:
|
|
15785
|
+
case "end":
|
|
15786
|
+
return _context4.stop();
|
|
15787
|
+
}
|
|
15788
|
+
}
|
|
15789
|
+
}, _callee4);
|
|
15790
|
+
}));
|
|
15791
|
+
|
|
15792
|
+
return function (_x3) {
|
|
15793
|
+
return _ref5.apply(this, arguments);
|
|
15794
|
+
};
|
|
15795
|
+
}());
|
|
15796
|
+
|
|
15797
|
+
case 6:
|
|
15798
|
+
case "end":
|
|
15799
|
+
return _context5.stop();
|
|
15800
|
+
}
|
|
15801
|
+
}
|
|
15802
|
+
}, _callee5);
|
|
15803
|
+
})), [controller]);
|
|
15804
|
+
var button = React__default['default'].useMemo(function () {
|
|
15805
|
+
if (isEnable) {
|
|
15806
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
15807
|
+
size: 'small',
|
|
15808
|
+
onClick: onOpen,
|
|
15809
|
+
disabled: disabled
|
|
15810
|
+
}, "\u6DFB\u52A0\u6298\u6263"), /*#__PURE__*/React__default['default'].createElement(AddDiscountRowDrawer, {
|
|
15811
|
+
open: open,
|
|
15812
|
+
onClose: onClose
|
|
15813
|
+
}));
|
|
15814
|
+
} else {
|
|
15815
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
15816
|
+
}
|
|
15817
|
+
}, [open, onOpen, onClose, isEnable, disabled]);
|
|
15818
|
+
return {
|
|
15819
|
+
menuItem: menuItem,
|
|
15820
|
+
button: button
|
|
15821
|
+
};
|
|
15822
|
+
}); // 批量折扣弹窗
|
|
15823
|
+
|
|
15824
|
+
/** 添加折扣行的抽屉 */
|
|
15825
|
+
|
|
15826
|
+
function AddDiscountRowDrawer(props) {
|
|
15827
|
+
var open = props.open,
|
|
15828
|
+
onClose = props.onClose;
|
|
15829
|
+
|
|
15830
|
+
var _Form1$useForm = ktsXui.Form.useForm(),
|
|
15831
|
+
_Form1$useForm2 = _slicedToArray(_Form1$useForm, 1),
|
|
15832
|
+
form = _Form1$useForm2[0];
|
|
15833
|
+
|
|
15834
|
+
var _React$useState = React__default['default'].useState(),
|
|
15835
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
15836
|
+
formValues = _React$useState2[0],
|
|
15837
|
+
setFormValues = _React$useState2[1];
|
|
15838
|
+
/** 控制器 */
|
|
15839
|
+
|
|
15840
|
+
|
|
15841
|
+
var controller = Invoice.useInvoiceController();
|
|
15842
|
+
/** 货物字典 */
|
|
15843
|
+
|
|
15844
|
+
var goodsMap = controller.useMemo(function (s) {
|
|
15845
|
+
return s.goodsListState.goodsMap;
|
|
15846
|
+
}, []);
|
|
15847
|
+
/** 准备添加折扣的货物索引列表 */
|
|
15848
|
+
|
|
15849
|
+
var discountGoodIndex = controller.useMemo(function (s) {
|
|
15850
|
+
return s.goodsListState.discountGoodIndex || [];
|
|
15851
|
+
}, []);
|
|
15852
|
+
/** 准备添加折扣的货物列表 */
|
|
15853
|
+
|
|
15854
|
+
var discountGood = React__default['default'].useMemo(function () {
|
|
15855
|
+
return discountGoodIndex.map(function (e) {
|
|
15856
|
+
return goodsMap.get(e);
|
|
15682
15857
|
});
|
|
15683
|
-
}, [
|
|
15684
|
-
/**
|
|
15858
|
+
}, [discountGoodIndex, goodsMap]);
|
|
15859
|
+
/** 总金额 */
|
|
15685
15860
|
|
|
15686
|
-
var
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
var
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
});
|
|
15861
|
+
var totalAmount = React__default['default'].useMemo(function () {
|
|
15862
|
+
var sum = 0;
|
|
15863
|
+
discountGood.forEach(function (e) {
|
|
15864
|
+
var _e$lineAmountIncludeT;
|
|
15865
|
+
|
|
15866
|
+
sum += (_e$lineAmountIncludeT = e === null || e === void 0 ? void 0 : e.lineAmountIncludeTax) !== null && _e$lineAmountIncludeT !== void 0 ? _e$lineAmountIncludeT : 0;
|
|
15693
15867
|
});
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15868
|
+
return sum;
|
|
15869
|
+
}, [discountGood]);
|
|
15870
|
+
/** 表单变化 */
|
|
15871
|
+
|
|
15872
|
+
var onChangeForm = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
15873
|
+
var values;
|
|
15874
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
15875
|
+
while (1) {
|
|
15876
|
+
switch (_context6.prev = _context6.next) {
|
|
15877
|
+
case 0:
|
|
15878
|
+
_context6.next = 2;
|
|
15879
|
+
return form.getFieldsValue();
|
|
15880
|
+
|
|
15881
|
+
case 2:
|
|
15882
|
+
values = _context6.sent;
|
|
15883
|
+
setFormValues(values);
|
|
15884
|
+
|
|
15885
|
+
case 4:
|
|
15886
|
+
case "end":
|
|
15887
|
+
return _context6.stop();
|
|
15888
|
+
}
|
|
15889
|
+
}
|
|
15890
|
+
}, _callee6);
|
|
15891
|
+
})), [form]);
|
|
15892
|
+
/** 点击了确认 */
|
|
15893
|
+
|
|
15894
|
+
var onDefine = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
15895
|
+
var values, totalDiscoline, discolinesSum, discolines, surplus, i;
|
|
15896
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
15897
|
+
while (1) {
|
|
15898
|
+
switch (_context8.prev = _context8.next) {
|
|
15899
|
+
case 0:
|
|
15900
|
+
_context8.next = 2;
|
|
15901
|
+
return form.validateFields();
|
|
15902
|
+
|
|
15903
|
+
case 2:
|
|
15904
|
+
values = _context8.sent;
|
|
15905
|
+
// 折扣总金额
|
|
15906
|
+
totalDiscoline = values.discolineType === '1' ? chain(mathjs.bignumber(values.discolineValue)) : chain(mathjs.bignumber(totalAmount)).multiply(mathjs.bignumber(values.discolineValue)).multiply(mathjs.bignumber(0.01));
|
|
15907
|
+
discolinesSum = chain(mathjs.bignumber(0)); // 每行的折扣金额
|
|
15908
|
+
|
|
15909
|
+
discolines = discountGood.map(function (e, i) {
|
|
15910
|
+
var _e$lineAmountIncludeT2;
|
|
15911
|
+
|
|
15912
|
+
// 折扣金额占比
|
|
15913
|
+
var share = chain(mathjs.bignumber((_e$lineAmountIncludeT2 = e === null || e === void 0 ? void 0 : e.lineAmountIncludeTax) !== null && _e$lineAmountIncludeT2 !== void 0 ? _e$lineAmountIncludeT2 : 0)).divide(mathjs.bignumber(totalAmount)); // 折扣金额
|
|
15914
|
+
|
|
15915
|
+
var value = totalDiscoline.multiply(share.done()).multiply(mathjs.bignumber(100)).round().divide(mathjs.bignumber(100)).done();
|
|
15916
|
+
discolinesSum = discolinesSum.add(value);
|
|
15917
|
+
return value.toNumber();
|
|
15918
|
+
}); // 剩余折扣金额
|
|
15919
|
+
|
|
15920
|
+
surplus = totalDiscoline.subtract(discolinesSum.done()); // 补充剩余折扣金
|
|
15921
|
+
|
|
15922
|
+
i = 0;
|
|
15923
|
+
|
|
15924
|
+
case 8:
|
|
15925
|
+
if (!(i < discolines.length)) {
|
|
15926
|
+
_context8.next = 16;
|
|
15927
|
+
break;
|
|
15928
|
+
}
|
|
15929
|
+
|
|
15930
|
+
if (!surplus.smaller(0.01).done()) {
|
|
15931
|
+
_context8.next = 11;
|
|
15932
|
+
break;
|
|
15933
|
+
}
|
|
15934
|
+
|
|
15935
|
+
return _context8.abrupt("break", 16);
|
|
15936
|
+
|
|
15937
|
+
case 11:
|
|
15938
|
+
discolines[i] = chain(mathjs.bignumber(discolines[i])).add(mathjs.bignumber(0.01)).done().toNumber();
|
|
15939
|
+
surplus = surplus.subtract(mathjs.bignumber(0.01));
|
|
15940
|
+
|
|
15941
|
+
case 13:
|
|
15942
|
+
i++;
|
|
15943
|
+
_context8.next = 8;
|
|
15944
|
+
break;
|
|
15945
|
+
|
|
15946
|
+
case 16:
|
|
15947
|
+
_context8.next = 18;
|
|
15948
|
+
return controller.addGoodDiscountV2(discolines.map(function (e, i) {
|
|
15949
|
+
var _discountGood$i;
|
|
15950
|
+
|
|
15951
|
+
return {
|
|
15952
|
+
$index: (_discountGood$i = discountGood[i]) === null || _discountGood$i === void 0 ? void 0 : _discountGood$i.$index,
|
|
15953
|
+
discolineAmountunt: e
|
|
15954
|
+
};
|
|
15955
|
+
}));
|
|
15956
|
+
|
|
15957
|
+
case 18:
|
|
15958
|
+
_context8.next = 20;
|
|
15959
|
+
return controller.run( /*#__PURE__*/function () {
|
|
15960
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(s) {
|
|
15961
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
15962
|
+
while (1) {
|
|
15963
|
+
switch (_context7.prev = _context7.next) {
|
|
15964
|
+
case 0:
|
|
15965
|
+
s.goodsListState.selectedGoodIndex = [];
|
|
15966
|
+
|
|
15967
|
+
case 1:
|
|
15968
|
+
case "end":
|
|
15969
|
+
return _context7.stop();
|
|
15970
|
+
}
|
|
15971
|
+
}
|
|
15972
|
+
}, _callee7);
|
|
15973
|
+
}));
|
|
15974
|
+
|
|
15975
|
+
return function (_x4) {
|
|
15976
|
+
return _ref8.apply(this, arguments);
|
|
15977
|
+
};
|
|
15978
|
+
}());
|
|
15979
|
+
|
|
15980
|
+
case 20:
|
|
15981
|
+
// 关闭抽屉
|
|
15982
|
+
onClose();
|
|
15983
|
+
|
|
15984
|
+
case 21:
|
|
15985
|
+
case "end":
|
|
15986
|
+
return _context8.stop();
|
|
15987
|
+
}
|
|
15988
|
+
}
|
|
15989
|
+
}, _callee8);
|
|
15990
|
+
})), [discountGood, form, totalAmount, onClose, controller]); // 打开抽屉时 重置form
|
|
15991
|
+
|
|
15992
|
+
React__default['default'].useEffect(function () {
|
|
15993
|
+
if (open) {
|
|
15994
|
+
form.resetFields();
|
|
15702
15995
|
form.setFieldsValue({
|
|
15703
|
-
|
|
15996
|
+
discolineType: '1',
|
|
15997
|
+
discolineValue: undefined
|
|
15998
|
+
}); // 强制设置初始值
|
|
15999
|
+
|
|
16000
|
+
setFormValues({
|
|
16001
|
+
discolineType: '1'
|
|
15704
16002
|
});
|
|
15705
|
-
}
|
|
15706
|
-
},
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
16003
|
+
}
|
|
16004
|
+
}, [open]); // 切换 折扣方式 清空折扣值
|
|
16005
|
+
|
|
16006
|
+
React__default['default'].useEffect(function () {
|
|
16007
|
+
form.setFieldsValue(_objectSpread2(_objectSpread2({}, formValues), {}, {
|
|
16008
|
+
discolineValue: undefined
|
|
16009
|
+
}));
|
|
16010
|
+
}, [formValues === null || formValues === void 0 ? void 0 : formValues.discolineType]);
|
|
16011
|
+
return /*#__PURE__*/React__default['default'].createElement(ktsXui.Drawer, {
|
|
16012
|
+
title: "\u6DFB\u52A0\u6298\u6263",
|
|
16013
|
+
placement: "right",
|
|
16014
|
+
width: 350,
|
|
16015
|
+
onClose: onClose,
|
|
16016
|
+
open: open,
|
|
16017
|
+
footer: /*#__PURE__*/React__default['default'].createElement(ktsXui.Space, {
|
|
16018
|
+
size: "middle",
|
|
16019
|
+
style: {
|
|
16020
|
+
display: 'flex',
|
|
16021
|
+
justifyContent: 'end'
|
|
16022
|
+
}
|
|
16023
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
16024
|
+
onClick: onDefine,
|
|
16025
|
+
type: 'primary'
|
|
16026
|
+
}, "\u786E\u5B9A"), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
16027
|
+
onClick: onClose
|
|
16028
|
+
}, "\u53D6\u6D88"))
|
|
16029
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Form, {
|
|
16030
|
+
form: form,
|
|
16031
|
+
layout: 'vertical',
|
|
16032
|
+
onChange: onChangeForm
|
|
16033
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Form.Item, {
|
|
16034
|
+
label: "\u5546\u54C1\u91D1\u989D\uFF08\u542B\u7A0E\uFF09"
|
|
16035
|
+
}, totalAmount.toFixed(2), "\uFF08\u5171 ", discountGood.length, " \u884C\uFF09"), /*#__PURE__*/React__default['default'].createElement(ktsXui.Form.Item, {
|
|
16036
|
+
label: "\u6298\u6263\u65B9\u5F0F",
|
|
16037
|
+
name: 'discolineType',
|
|
16038
|
+
initialValue: '1'
|
|
16039
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Radio.Group, {
|
|
16040
|
+
options: [{
|
|
16041
|
+
label: '按金额折扣',
|
|
16042
|
+
value: '1'
|
|
16043
|
+
}, {
|
|
16044
|
+
label: '按比例折扣',
|
|
16045
|
+
value: '2'
|
|
16046
|
+
}]
|
|
16047
|
+
})), (formValues === null || formValues === void 0 ? void 0 : formValues.discolineType) === '2' ? /*#__PURE__*/React__default['default'].createElement(ktsXui.Form.Item, {
|
|
16048
|
+
label: "\u6298\u6263\u6BD4\u4F8B\uFF08%\uFF09\uFF08\u542B\u7A0E\uFF09",
|
|
16049
|
+
name: 'discolineValue',
|
|
15716
16050
|
rules: [{
|
|
15717
16051
|
required: true,
|
|
15718
|
-
message: '
|
|
15719
|
-
}, {
|
|
15720
|
-
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
15721
|
-
message: '请输入数字'
|
|
16052
|
+
message: '必填'
|
|
15722
16053
|
}, {
|
|
15723
|
-
validator: function
|
|
15724
|
-
var
|
|
16054
|
+
validator: function () {
|
|
16055
|
+
var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value) {
|
|
16056
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
16057
|
+
while (1) {
|
|
16058
|
+
switch (_context9.prev = _context9.next) {
|
|
16059
|
+
case 0:
|
|
16060
|
+
if (!isNaN(parseFloat(value))) {
|
|
16061
|
+
_context9.next = 2;
|
|
16062
|
+
break;
|
|
16063
|
+
}
|
|
15725
16064
|
|
|
15726
|
-
|
|
15727
|
-
callback();
|
|
15728
|
-
return;
|
|
15729
|
-
}
|
|
16065
|
+
return _context9.abrupt("return");
|
|
15730
16066
|
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
16067
|
+
case 2:
|
|
16068
|
+
if (!(value <= 0)) {
|
|
16069
|
+
_context9.next = 4;
|
|
16070
|
+
break;
|
|
16071
|
+
}
|
|
16072
|
+
|
|
16073
|
+
throw new Error('需大于0');
|
|
16074
|
+
|
|
16075
|
+
case 4:
|
|
16076
|
+
if (!(value > 100)) {
|
|
16077
|
+
_context9.next = 6;
|
|
16078
|
+
break;
|
|
16079
|
+
}
|
|
16080
|
+
|
|
16081
|
+
throw new Error('不可以大于100');
|
|
15735
16082
|
|
|
15736
|
-
|
|
15737
|
-
|
|
16083
|
+
case 6:
|
|
16084
|
+
case "end":
|
|
16085
|
+
return _context9.stop();
|
|
16086
|
+
}
|
|
16087
|
+
}
|
|
16088
|
+
}, _callee9);
|
|
16089
|
+
}));
|
|
16090
|
+
|
|
16091
|
+
function validator(_x5, _x6) {
|
|
16092
|
+
return _validator.apply(this, arguments);
|
|
15738
16093
|
}
|
|
15739
16094
|
|
|
15740
|
-
|
|
15741
|
-
}
|
|
16095
|
+
return validator;
|
|
16096
|
+
}()
|
|
15742
16097
|
}]
|
|
15743
|
-
}
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
}))
|
|
15748
|
-
label: "\u6298\u6263\u91D1\u989D\
|
|
15749
|
-
|
|
16098
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.InputNumber, {
|
|
16099
|
+
style: {
|
|
16100
|
+
width: '100%'
|
|
16101
|
+
}
|
|
16102
|
+
})) : /*#__PURE__*/React__default['default'].createElement(ktsXui.Form.Item, {
|
|
16103
|
+
label: "\u6298\u6263\u91D1\u989D\uFF08\u5143\uFF09\uFF08\u542B\u7A0E\uFF09",
|
|
16104
|
+
name: 'discolineValue',
|
|
15750
16105
|
rules: [{
|
|
15751
16106
|
required: true,
|
|
15752
|
-
message: '
|
|
15753
|
-
}, {
|
|
15754
|
-
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
15755
|
-
message: '请输入数字'
|
|
16107
|
+
message: '必填'
|
|
15756
16108
|
}, {
|
|
15757
|
-
validator: function
|
|
15758
|
-
var
|
|
16109
|
+
validator: function () {
|
|
16110
|
+
var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value) {
|
|
16111
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
16112
|
+
while (1) {
|
|
16113
|
+
switch (_context10.prev = _context10.next) {
|
|
16114
|
+
case 0:
|
|
16115
|
+
if (!isNaN(parseFloat(value))) {
|
|
16116
|
+
_context10.next = 2;
|
|
16117
|
+
break;
|
|
16118
|
+
}
|
|
15759
16119
|
|
|
15760
|
-
|
|
15761
|
-
callback();
|
|
15762
|
-
return;
|
|
15763
|
-
}
|
|
16120
|
+
return _context10.abrupt("return");
|
|
15764
16121
|
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
15768
|
-
|
|
16122
|
+
case 2:
|
|
16123
|
+
if (!(value <= 0)) {
|
|
16124
|
+
_context10.next = 4;
|
|
16125
|
+
break;
|
|
16126
|
+
}
|
|
16127
|
+
|
|
16128
|
+
throw new Error('需大于0');
|
|
16129
|
+
|
|
16130
|
+
case 4:
|
|
16131
|
+
if (!(value > totalAmount)) {
|
|
16132
|
+
_context10.next = 6;
|
|
16133
|
+
break;
|
|
16134
|
+
}
|
|
16135
|
+
|
|
16136
|
+
throw new Error('不可以大于商品金额');
|
|
16137
|
+
|
|
16138
|
+
case 6:
|
|
16139
|
+
case "end":
|
|
16140
|
+
return _context10.stop();
|
|
16141
|
+
}
|
|
16142
|
+
}
|
|
16143
|
+
}, _callee10);
|
|
16144
|
+
}));
|
|
15769
16145
|
|
|
15770
|
-
|
|
15771
|
-
|
|
16146
|
+
function validator(_x7, _x8) {
|
|
16147
|
+
return _validator2.apply(this, arguments);
|
|
15772
16148
|
}
|
|
15773
16149
|
|
|
15774
|
-
|
|
15775
|
-
}
|
|
16150
|
+
return validator;
|
|
16151
|
+
}()
|
|
15776
16152
|
}]
|
|
15777
|
-
}
|
|
15778
|
-
placeholder: "\u8BF7\u8F93\u5165\u5927\u4E8E0\u5C0F\u4E8E\u91D1\u989D\u5408\u8BA1\u7684\u6570\u5B57",
|
|
15779
|
-
suffix: "\xA5",
|
|
15780
|
-
onChange: onChangeDiscolineAmountunt
|
|
15781
|
-
})))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15782
|
-
className: "add-discount-row-footer"
|
|
15783
|
-
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
15784
|
-
block: true,
|
|
16153
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.InputNumber, {
|
|
15785
16154
|
style: {
|
|
15786
|
-
|
|
15787
|
-
}
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
16155
|
+
width: '100%'
|
|
16156
|
+
}
|
|
16157
|
+
}))));
|
|
16158
|
+
}
|
|
16159
|
+
/** 判断数组是否连续 */
|
|
16160
|
+
|
|
16161
|
+
|
|
16162
|
+
function isContinuityNum(array) {
|
|
16163
|
+
var i = array[0];
|
|
16164
|
+
var isContinuation = true;
|
|
16165
|
+
|
|
16166
|
+
for (var e in array) {
|
|
16167
|
+
if (array[e] != i) {
|
|
16168
|
+
isContinuation = false;
|
|
16169
|
+
break;
|
|
16170
|
+
}
|
|
16171
|
+
|
|
16172
|
+
i++;
|
|
16173
|
+
}
|
|
16174
|
+
|
|
16175
|
+
return isContinuation;
|
|
16176
|
+
}
|
|
16177
|
+
/** 数组的值是否相等 */
|
|
16178
|
+
|
|
16179
|
+
|
|
16180
|
+
function areAllValuesEqual(arr) {
|
|
16181
|
+
for (var i = 1; i < arr.length; i++) {
|
|
16182
|
+
if (arr[i] !== arr[0]) {
|
|
16183
|
+
return false;
|
|
16184
|
+
}
|
|
16185
|
+
}
|
|
16186
|
+
|
|
16187
|
+
return true;
|
|
16188
|
+
} // const DrawerBody = decorator<{}, FormComponentProps>(Form.create())((props) => {
|
|
16189
|
+
// const { form } = props;
|
|
16190
|
+
// const { getFieldDecorator } = form;
|
|
16191
|
+
// const controller = Invoice.useInvoiceController();
|
|
16192
|
+
// /** 选中的货物索引列表 */
|
|
16193
|
+
// const discountGoodIndex = controller.useMemo(s => s.goodsListState.discountGoodIndex, []);
|
|
16194
|
+
// /** 金额合计 */
|
|
16195
|
+
// const lineAmountSum = controller.useMemo((s) => {
|
|
16196
|
+
// let sum = chain(0);
|
|
16197
|
+
// if (s.goodsListState.isTaxIncluded) {
|
|
16198
|
+
// s.goodsListState.discountGoodIndex.forEach((e) => {
|
|
16199
|
+
// const goods = s.goodsListState.goodsMap.get(e);
|
|
16200
|
+
// sum = sum.add(goods?.lineAmountIncludeTax || 0);
|
|
16201
|
+
// });
|
|
16202
|
+
// } else {
|
|
16203
|
+
// s.goodsListState.discountGoodIndex.forEach((e) => {
|
|
16204
|
+
// const goods = s.goodsListState.goodsMap.get(e);
|
|
16205
|
+
// sum = sum.add(goods?.lineAmountExcludeTax || 0);
|
|
16206
|
+
// });
|
|
16207
|
+
// }
|
|
16208
|
+
// return sum.done();
|
|
16209
|
+
// }, []);
|
|
16210
|
+
// /** 关闭抽屉 */
|
|
16211
|
+
// const onClose = React.useCallback(() => {
|
|
16212
|
+
// controller.pipeline(async (s) => { s.goodsListState.discountGoodIndex = [] })();
|
|
16213
|
+
// }, []);
|
|
16214
|
+
// /** 点击了保存 */
|
|
16215
|
+
// const onClickSave = React.useCallback(() => {
|
|
16216
|
+
// form.validateFields((err, values) => {
|
|
16217
|
+
// if (err) return;
|
|
16218
|
+
// const discolineAmountunt = parseFloat(parseFloat(values.discolineAmountunt).toFixed(2));
|
|
16219
|
+
// const discount = parseFloat(parseFloat(values.discount).toFixed(4));
|
|
16220
|
+
// const indexList = discountGoodIndex;
|
|
16221
|
+
// controller.pipeline(async s => { s.goodsListState.discountGoodIndex = []; })();
|
|
16222
|
+
// controller.addGoodDiscount({ indexList, discount, discolineAmountunt });
|
|
16223
|
+
// });
|
|
16224
|
+
// }, [controller, form, discountGoodIndex]);
|
|
16225
|
+
// /** 折扣率变化 */
|
|
16226
|
+
// const onChangeDiscount = React.useCallback(
|
|
16227
|
+
// lazyFn((e: React.ChangeEvent<HTMLInputElement>) => {
|
|
16228
|
+
// form.validateFields((err, values) => {
|
|
16229
|
+
// if (err && err.discount) return;
|
|
16230
|
+
// const discolineAmountunt = evaluate(`${lineAmountSum} * (${values.discount}/100)`).toFixed(2);
|
|
16231
|
+
// form.setFieldsValue({ discolineAmountunt });
|
|
16232
|
+
// });
|
|
16233
|
+
// }, 300),
|
|
16234
|
+
// [form, lineAmountSum],
|
|
16235
|
+
// );
|
|
16236
|
+
// /** 折扣变化 */
|
|
16237
|
+
// const onChangeDiscolineAmountunt = React.useCallback(
|
|
16238
|
+
// lazyFn((e: React.ChangeEvent<HTMLInputElement>) => {
|
|
16239
|
+
// form.validateFields((err, values) => {
|
|
16240
|
+
// if (err && err.discolineAmountunt) return;
|
|
16241
|
+
// const discolineAmountunt = parseFloat(values.discolineAmountunt).toFixed(2);
|
|
16242
|
+
// const discount = evaluate(`(${discolineAmountunt} / ${lineAmountSum}) * 100`).toFixed(4);
|
|
16243
|
+
// form.setFieldsValue({ discount });
|
|
16244
|
+
// });
|
|
16245
|
+
// }, 300),
|
|
16246
|
+
// [form, lineAmountSum],
|
|
16247
|
+
// );
|
|
16248
|
+
// return (
|
|
16249
|
+
// <>
|
|
16250
|
+
// <div className="add-discount-row-body">
|
|
16251
|
+
// <p>
|
|
16252
|
+
// 当前选择<Text type="danger">{discountGoodIndex.length}</Text>
|
|
16253
|
+
// 行被折扣商品行,金额合计¥
|
|
16254
|
+
// <Text type="danger">{lineAmountSum.toFixed(2)}</Text>
|
|
16255
|
+
// </p>
|
|
16256
|
+
// <Form.Item label="折扣率:">
|
|
16257
|
+
// {getFieldDecorator('discount', {
|
|
16258
|
+
// rules: [
|
|
16259
|
+
// { required: true, message: '请输入折扣金额' },
|
|
16260
|
+
// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请输入数字' },
|
|
16261
|
+
// {
|
|
16262
|
+
// validator: (_, value: string, callback) => {
|
|
16263
|
+
// if (!value) { callback(); return; }
|
|
16264
|
+
// if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) { callback(); return; }
|
|
16265
|
+
// if (parseFloat(value) > 100 || parseFloat(value) < 0) { callback('请输入大于0小于100的数字'); }
|
|
16266
|
+
// callback();
|
|
16267
|
+
// },
|
|
16268
|
+
// },
|
|
16269
|
+
// ],
|
|
16270
|
+
// })(
|
|
16271
|
+
// <Input
|
|
16272
|
+
// placeholder="请输入大于0小于100的数字"
|
|
16273
|
+
// suffix="%"
|
|
16274
|
+
// onChange={onChangeDiscount}
|
|
16275
|
+
// />,
|
|
16276
|
+
// )}
|
|
16277
|
+
// </Form.Item>
|
|
16278
|
+
// <Form.Item label="折扣金额:">
|
|
16279
|
+
// {getFieldDecorator('discolineAmountunt', {
|
|
16280
|
+
// rules: [
|
|
16281
|
+
// { required: true, message: '请输入折扣金额' },
|
|
16282
|
+
// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '请输入数字' },
|
|
16283
|
+
// {
|
|
16284
|
+
// validator: (_, value: string, callback) => {
|
|
16285
|
+
// if (!value) { callback(); return; }
|
|
16286
|
+
// if (!value.match(/^[+-]?(0|([1-9]\d*))(\.\d+)?$/)?.length) { callback(); return; }
|
|
16287
|
+
// if (parseFloat(value) > lineAmountSum || parseFloat(value) <= 0) { callback('请输入大于0小于金额合计的数字'); }
|
|
16288
|
+
// callback();
|
|
16289
|
+
// },
|
|
16290
|
+
// },
|
|
16291
|
+
// ],
|
|
16292
|
+
// })(
|
|
16293
|
+
// <Input
|
|
16294
|
+
// placeholder="请输入大于0小于金额合计的数字"
|
|
16295
|
+
// suffix="¥"
|
|
16296
|
+
// onChange={onChangeDiscolineAmountunt}
|
|
16297
|
+
// />,
|
|
16298
|
+
// )}
|
|
16299
|
+
// </Form.Item>
|
|
16300
|
+
// </div>
|
|
16301
|
+
// <div className="add-discount-row-footer">
|
|
16302
|
+
// <Button block style={{ marginBottom: 12 }} onClick={onClose}>取消</Button>
|
|
16303
|
+
// <Button type="primary" block onClick={onClickSave}>保存</Button>
|
|
16304
|
+
// </div>
|
|
16305
|
+
// </>
|
|
16306
|
+
// );
|
|
16307
|
+
// });
|
|
15795
16308
|
|
|
15796
16309
|
/** 全单合并明细 */
|
|
15797
16310
|
|
|
@@ -16612,7 +17125,7 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
|
|
|
16612
17125
|
className: "kts-invoice-operate-goods-list-able"
|
|
16613
17126
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
16614
17127
|
className: "kts-invoice-operate-goods-list-able-list"
|
|
16615
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button,
|
|
17128
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddRowButton, null), endowCodeButton.button, delRowButton.button, addDiscountRowButton.button, mergeDetails.button, mergeDiscount.button, salesDiscount.button, salesGifts.button, /*#__PURE__*/React__default['default'].createElement(Search, null)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
16616
17129
|
className: "kts-invoice-operate-goods-list-able-extend"
|
|
16617
17130
|
}, props.menuExpansion, /*#__PURE__*/React__default['default'].createElement(DescribeSwitch, null), /*#__PURE__*/React__default['default'].createElement(TaxIncludedSwitch, null))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
16618
17131
|
className: classnames__default['default']('kts-invoice-operate-goods-list-table', {
|
|
@@ -17559,18 +18072,41 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
|
|
|
17559
18072
|
className: "digtal-stakeholder-expand-button",
|
|
17560
18073
|
component: isExpand ? SvgArrowUp : SvgArrowDown,
|
|
17561
18074
|
onClick: onExpand
|
|
17562
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(
|
|
18075
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form, {
|
|
18076
|
+
className: "digtal-stakeholder-form"
|
|
18077
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Row, {
|
|
18078
|
+
gutter: [16, 0],
|
|
18079
|
+
className: 'natural-person-flag',
|
|
17563
18080
|
style: {
|
|
17564
|
-
|
|
17565
|
-
}
|
|
17566
|
-
|
|
18081
|
+
paddingRight: 0
|
|
18082
|
+
}
|
|
18083
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Col, {
|
|
18084
|
+
span: 24,
|
|
18085
|
+
style: {
|
|
18086
|
+
display: 'flex',
|
|
18087
|
+
marginBottom: '15px'
|
|
18088
|
+
}
|
|
17567
18089
|
}, props.isNaturalPerson === true && /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
17568
18090
|
colon: false
|
|
17569
18091
|
}, getFieldDecorator('naturalPersonFlag', {})( /*#__PURE__*/React__default['default'].createElement(NaturalPersonFlag, {
|
|
17570
18092
|
readOnly: isReadOnly('naturalPersonFlag')
|
|
17571
|
-
})))
|
|
17572
|
-
|
|
17573
|
-
|
|
18093
|
+
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18094
|
+
style: {
|
|
18095
|
+
flex: 1
|
|
18096
|
+
}
|
|
18097
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
18098
|
+
label: "\u5BA2\u6237\u4EE3\u7801",
|
|
18099
|
+
colon: false
|
|
18100
|
+
}, getFieldDecorator('buyerCode', {
|
|
18101
|
+
rules: [{
|
|
18102
|
+
required: true,
|
|
18103
|
+
message: '客户代码必填'
|
|
18104
|
+
}]
|
|
18105
|
+
})( /*#__PURE__*/React__default['default'].createElement(ktsXui.Input, {
|
|
18106
|
+
style: {
|
|
18107
|
+
width: '100%'
|
|
18108
|
+
}
|
|
18109
|
+
})))))), /*#__PURE__*/React__default['default'].createElement(ktsXui.Row, {
|
|
17574
18110
|
gutter: [16, 0]
|
|
17575
18111
|
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Col, {
|
|
17576
18112
|
span: 24
|
|
@@ -19285,7 +19821,7 @@ function _rollBottom$1() {
|
|
|
19285
19821
|
|
|
19286
19822
|
/** 延迟函数 */
|
|
19287
19823
|
|
|
19288
|
-
var lazyFn$
|
|
19824
|
+
var lazyFn$1 = function lazyFn(fn) {
|
|
19289
19825
|
var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
19290
19826
|
var timer;
|
|
19291
19827
|
return function () {
|
|
@@ -19366,7 +19902,7 @@ var clearCalculatingField$1 = /*#__PURE__*/function () {
|
|
|
19366
19902
|
}();
|
|
19367
19903
|
/** 数量改变了 */
|
|
19368
19904
|
|
|
19369
|
-
var onChangeQuantity$1 = lazyFn$
|
|
19905
|
+
var onChangeQuantity$1 = lazyFn$1(function (controller, form, record) {
|
|
19370
19906
|
form.validateFields( /*#__PURE__*/function () {
|
|
19371
19907
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err, values) {
|
|
19372
19908
|
var calculatingDigits, quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
@@ -19532,7 +20068,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19532
20068
|
}, 1000);
|
|
19533
20069
|
/** 单价(含税) */
|
|
19534
20070
|
|
|
19535
|
-
var onChangePriceIncludeTax$1 = lazyFn$
|
|
20071
|
+
var onChangePriceIncludeTax$1 = lazyFn$1(function (controller, form, record) {
|
|
19536
20072
|
form.validateFields( /*#__PURE__*/function () {
|
|
19537
20073
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
19538
20074
|
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
@@ -19644,7 +20180,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19644
20180
|
}, 1000);
|
|
19645
20181
|
/** 单价(不含税) */
|
|
19646
20182
|
|
|
19647
|
-
var onChangePriceExcludeTax$1 = lazyFn$
|
|
20183
|
+
var onChangePriceExcludeTax$1 = lazyFn$1(function (controller, form, record) {
|
|
19648
20184
|
form.validateFields( /*#__PURE__*/function () {
|
|
19649
20185
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(err, values) {
|
|
19650
20186
|
var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
@@ -19756,7 +20292,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19756
20292
|
}, 1000);
|
|
19757
20293
|
/** 金额(含税) */
|
|
19758
20294
|
|
|
19759
|
-
var onChangeLineAmountIncludeTax$1 = lazyFn$
|
|
20295
|
+
var onChangeLineAmountIncludeTax$1 = lazyFn$1(function (controller, form, record) {
|
|
19760
20296
|
form.validateFields( /*#__PURE__*/function () {
|
|
19761
20297
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
|
|
19762
20298
|
var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
@@ -19860,7 +20396,7 @@ var onChangeLineAmountIncludeTax$1 = lazyFn$2(function (controller, form, record
|
|
|
19860
20396
|
}, 1000);
|
|
19861
20397
|
/** 金额(不含税) */
|
|
19862
20398
|
|
|
19863
|
-
var onChangeLineAmountExcludeTax$1 = lazyFn$
|
|
20399
|
+
var onChangeLineAmountExcludeTax$1 = lazyFn$1(function (controller, form, record) {
|
|
19864
20400
|
form.validateFields( /*#__PURE__*/function () {
|
|
19865
20401
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(err, values) {
|
|
19866
20402
|
var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
@@ -19964,7 +20500,7 @@ var onChangeLineAmountExcludeTax$1 = lazyFn$2(function (controller, form, record
|
|
|
19964
20500
|
}, 1000);
|
|
19965
20501
|
/** 税率 */
|
|
19966
20502
|
|
|
19967
|
-
var onChangeTaxRate$1 = lazyFn$
|
|
20503
|
+
var onChangeTaxRate$1 = lazyFn$1(function (controller, form, record) {
|
|
19968
20504
|
form.validateFields( /*#__PURE__*/function () {
|
|
19969
20505
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
|
|
19970
20506
|
var taxRate;
|
|
@@ -20059,7 +20595,7 @@ var onChangeTaxRate$1 = lazyFn$2(function (controller, form, record) {
|
|
|
20059
20595
|
}, 1000);
|
|
20060
20596
|
/** 税额 */
|
|
20061
20597
|
|
|
20062
|
-
var onChangeTaxAmount = lazyFn$
|
|
20598
|
+
var onChangeTaxAmount = lazyFn$1(function (controller, form, record) {
|
|
20063
20599
|
/** 金额(不含税) */
|
|
20064
20600
|
var lineAmountExcludeTax;
|
|
20065
20601
|
form.validateFields( /*#__PURE__*/function () {
|
|
@@ -23147,7 +23683,7 @@ var useAddDiscountRowButton$1 = (function () {
|
|
|
23147
23683
|
return _context.abrupt("return");
|
|
23148
23684
|
|
|
23149
23685
|
case 4:
|
|
23150
|
-
if (isContinuityNum(s.goodsListState.selectedGoodIndex.map(function (e) {
|
|
23686
|
+
if (isContinuityNum$1(s.goodsListState.selectedGoodIndex.map(function (e) {
|
|
23151
23687
|
var _s$goodsListState$goo;
|
|
23152
23688
|
|
|
23153
23689
|
return ((_s$goodsListState$goo = s.goodsListState.goodsMap.get(e)) === null || _s$goodsListState$goo === void 0 ? void 0 : _s$goodsListState$goo.serialNo) || -2;
|
|
@@ -23184,7 +23720,7 @@ var useAddDiscountRowButton$1 = (function () {
|
|
|
23184
23720
|
return _context.abrupt("return");
|
|
23185
23721
|
|
|
23186
23722
|
case 11:
|
|
23187
|
-
if (!(areAllValuesEqual(s.goodsListState.selectedGoodIndex.map(function (e) {
|
|
23723
|
+
if (!(areAllValuesEqual$1(s.goodsListState.selectedGoodIndex.map(function (e) {
|
|
23188
23724
|
var _s$goodsListState$goo3;
|
|
23189
23725
|
|
|
23190
23726
|
return (_s$goodsListState$goo3 = s.goodsListState.goodsMap.get(e)) === null || _s$goodsListState$goo3 === void 0 ? void 0 : _s$goodsListState$goo3.taxRate;
|
|
@@ -23300,7 +23836,7 @@ var useAddDiscountRowButton$1 = (function () {
|
|
|
23300
23836
|
size: 'small',
|
|
23301
23837
|
onClick: onOpen,
|
|
23302
23838
|
disabled: disabled
|
|
23303
|
-
}, "\u6DFB\u52A0\u6298\u6263"), /*#__PURE__*/React__default['default'].createElement(AddDiscountRowDrawer, {
|
|
23839
|
+
}, "\u6DFB\u52A0\u6298\u6263"), /*#__PURE__*/React__default['default'].createElement(AddDiscountRowDrawer$1, {
|
|
23304
23840
|
open: open,
|
|
23305
23841
|
onClose: onClose
|
|
23306
23842
|
}));
|
|
@@ -23314,7 +23850,7 @@ var useAddDiscountRowButton$1 = (function () {
|
|
|
23314
23850
|
});
|
|
23315
23851
|
/** 添加折扣行的抽屉 */
|
|
23316
23852
|
|
|
23317
|
-
function AddDiscountRowDrawer(props) {
|
|
23853
|
+
function AddDiscountRowDrawer$1(props) {
|
|
23318
23854
|
var open = props.open,
|
|
23319
23855
|
onClose = props.onClose;
|
|
23320
23856
|
|
|
@@ -23361,13 +23897,19 @@ function AddDiscountRowDrawer(props) {
|
|
|
23361
23897
|
/** 表单变化 */
|
|
23362
23898
|
|
|
23363
23899
|
var onChangeForm = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
23900
|
+
var values;
|
|
23364
23901
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
23365
23902
|
while (1) {
|
|
23366
23903
|
switch (_context4.prev = _context4.next) {
|
|
23367
23904
|
case 0:
|
|
23368
|
-
|
|
23905
|
+
_context4.next = 2;
|
|
23906
|
+
return form.getFieldsValue();
|
|
23369
23907
|
|
|
23370
|
-
case
|
|
23908
|
+
case 2:
|
|
23909
|
+
values = _context4.sent;
|
|
23910
|
+
setFormValues(values);
|
|
23911
|
+
|
|
23912
|
+
case 4:
|
|
23371
23913
|
case "end":
|
|
23372
23914
|
return _context4.stop();
|
|
23373
23915
|
}
|
|
@@ -23477,7 +24019,14 @@ function AddDiscountRowDrawer(props) {
|
|
|
23477
24019
|
React__default['default'].useEffect(function () {
|
|
23478
24020
|
if (open) {
|
|
23479
24021
|
form.resetFields();
|
|
23480
|
-
|
|
24022
|
+
form.setFieldsValue({
|
|
24023
|
+
discolineType: '1',
|
|
24024
|
+
discolineValue: undefined
|
|
24025
|
+
}); // 强制设置初始值
|
|
24026
|
+
|
|
24027
|
+
setFormValues({
|
|
24028
|
+
discolineType: '1'
|
|
24029
|
+
}); // 强制设置formValues的初始状态
|
|
23481
24030
|
}
|
|
23482
24031
|
}, [open]); // 切换 折扣方式 清空折扣值
|
|
23483
24032
|
|
|
@@ -23507,7 +24056,10 @@ function AddDiscountRowDrawer(props) {
|
|
|
23507
24056
|
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Form, {
|
|
23508
24057
|
form: form,
|
|
23509
24058
|
layout: 'vertical',
|
|
23510
|
-
onChange: onChangeForm
|
|
24059
|
+
onChange: onChangeForm,
|
|
24060
|
+
initialValues: {
|
|
24061
|
+
discolineType: '1'
|
|
24062
|
+
}
|
|
23511
24063
|
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Form.Item, {
|
|
23512
24064
|
label: "\u5546\u54C1\u91D1\u989D\uFF08\u542B\u7A0E\uFF09"
|
|
23513
24065
|
}, totalAmount.toFixed(2), "\uFF08\u5171 ", discountGood.length, " \u884C\uFF09"), /*#__PURE__*/React__default['default'].createElement(ktsXui.Form.Item, {
|
|
@@ -23637,7 +24189,7 @@ function AddDiscountRowDrawer(props) {
|
|
|
23637
24189
|
/** 判断数组是否连续 */
|
|
23638
24190
|
|
|
23639
24191
|
|
|
23640
|
-
function isContinuityNum(array) {
|
|
24192
|
+
function isContinuityNum$1(array) {
|
|
23641
24193
|
var i = array[0];
|
|
23642
24194
|
var isContinuation = true;
|
|
23643
24195
|
|
|
@@ -23655,7 +24207,7 @@ function isContinuityNum(array) {
|
|
|
23655
24207
|
/** 数组的值是否相等 */
|
|
23656
24208
|
|
|
23657
24209
|
|
|
23658
|
-
function areAllValuesEqual(arr) {
|
|
24210
|
+
function areAllValuesEqual$1(arr) {
|
|
23659
24211
|
for (var i = 1; i < arr.length; i++) {
|
|
23660
24212
|
if (arr[i] !== arr[0]) {
|
|
23661
24213
|
return false;
|
|
@@ -26242,10 +26794,10 @@ var ImportBuyerDrawer = (function () {
|
|
|
26242
26794
|
width: 983,
|
|
26243
26795
|
onClose: onClose,
|
|
26244
26796
|
visible: visible
|
|
26245
|
-
}, topExpand, /*#__PURE__*/React__default['default'].createElement(DrawerBody
|
|
26797
|
+
}, topExpand, /*#__PURE__*/React__default['default'].createElement(DrawerBody, null));
|
|
26246
26798
|
});
|
|
26247
26799
|
|
|
26248
|
-
var DrawerBody
|
|
26800
|
+
var DrawerBody = function DrawerBody() {
|
|
26249
26801
|
var controller = Invoice.useInvoiceController();
|
|
26250
26802
|
var columns = controller.useMemo(function (e) {
|
|
26251
26803
|
return e.buyerState.columns;
|
|
@@ -26375,10 +26927,10 @@ var ImportGoodsDrawer = (function () {
|
|
|
26375
26927
|
style: {
|
|
26376
26928
|
marginBottom: 10
|
|
26377
26929
|
}
|
|
26378
|
-
}, topExpand), /*#__PURE__*/React__default['default'].createElement(DrawerBody$
|
|
26930
|
+
}, topExpand), /*#__PURE__*/React__default['default'].createElement(DrawerBody$1, null));
|
|
26379
26931
|
});
|
|
26380
26932
|
|
|
26381
|
-
var DrawerBody$
|
|
26933
|
+
var DrawerBody$1 = function DrawerBody() {
|
|
26382
26934
|
var controller = Invoice.useInvoiceController();
|
|
26383
26935
|
var columns = controller.useMemo(function (s) {
|
|
26384
26936
|
return s.goodsListState.importGoods.columns;
|
|
@@ -26397,6 +26949,11 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
26397
26949
|
}
|
|
26398
26950
|
});
|
|
26399
26951
|
}, [controller]);
|
|
26952
|
+
|
|
26953
|
+
var roundTo8Decimals = function roundTo8Decimals(num) {
|
|
26954
|
+
return Math.round(num * 1e8) / 1e8;
|
|
26955
|
+
};
|
|
26956
|
+
|
|
26400
26957
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Table, {
|
|
26401
26958
|
bordered: true,
|
|
26402
26959
|
size: "small",
|
|
@@ -26413,6 +26970,8 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
26413
26970
|
onClick: function onClick() {
|
|
26414
26971
|
controller.run( /*#__PURE__*/function () {
|
|
26415
26972
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
26973
|
+
var _s$goodsListState$edi, _s$goodsListState$edi2, _s$goodsListState$edi3, _s$goodsListState$edi4, _s$goodsListState$edi5, _s$goodsListState$edi6, _s$goodsListState$edi7, _s$goodsListState$edi8, _s$goodsListState$edi9, _s$goodsListState$edi10, _s$goodsListState$edi11, _s$goodsListState$edi12, _s$goodsListState$edi13, _s$goodsListState$edi14, _s$goodsListState$edi15, _s$goodsListState$edi16;
|
|
26974
|
+
|
|
26416
26975
|
var between, editGood;
|
|
26417
26976
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
26418
26977
|
while (1) {
|
|
@@ -26449,17 +27008,32 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
26449
27008
|
// 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
|
|
26450
27009
|
record.quantity = undefined;
|
|
26451
27010
|
record.lineAmountExcludeTax = undefined;
|
|
26452
|
-
record.lineAmountIncludeTax = undefined; //
|
|
27011
|
+
record.lineAmountIncludeTax = undefined; // console.log('s.goodsListState.editGood1:', s.goodsListState.editGood);
|
|
27012
|
+
// 光电定制化功能:无论是否有值都替换 itemCode, itemName, shorthand, taxCategoryCode, taxClassificationCode;
|
|
27013
|
+
// 如果其他输入框有值就不替换,没值就替换:itemModelName, lineAmountExcludeTax, lineAmountIncludeTax,lineAttribute,priceExcludeTax,
|
|
27014
|
+
// priceIncludeTax,quantity, serialNo, taxAmount, taxRate, unit
|
|
27015
|
+
// 中间数据
|
|
27016
|
+
|
|
27017
|
+
between = _objectSpread2({}, record); // console.log(':between:', between);
|
|
26453
27018
|
|
|
26454
|
-
between = _objectSpread2({}, record);
|
|
26455
27019
|
between.itemName = getItemName(record, s.goodsListState.editGood);
|
|
26456
27020
|
between.itemCode = getItemCode(record, s.goodsListState.editGood);
|
|
26457
27021
|
between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood); // 设置编辑货物
|
|
26458
27022
|
|
|
26459
|
-
editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), {}, {
|
|
26460
|
-
itemModelName:
|
|
26461
|
-
itemModelNameSelf:
|
|
26462
|
-
|
|
27023
|
+
editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between), {}, {
|
|
27024
|
+
itemModelName: (_s$goodsListState$edi = (_s$goodsListState$edi2 = s.goodsListState.editGood) === null || _s$goodsListState$edi2 === void 0 ? void 0 : _s$goodsListState$edi2.itemModelName) !== null && _s$goodsListState$edi !== void 0 ? _s$goodsListState$edi : between.itemModelName,
|
|
27025
|
+
itemModelNameSelf: (_s$goodsListState$edi3 = (_s$goodsListState$edi4 = s.goodsListState.editGood) === null || _s$goodsListState$edi4 === void 0 ? void 0 : _s$goodsListState$edi4.itemModelNameSelf) !== null && _s$goodsListState$edi3 !== void 0 ? _s$goodsListState$edi3 : between.itemModelNameSelf,
|
|
27026
|
+
lineAmountExcludeTax: (_s$goodsListState$edi5 = (_s$goodsListState$edi6 = s.goodsListState.editGood) === null || _s$goodsListState$edi6 === void 0 ? void 0 : _s$goodsListState$edi6.lineAmountExcludeTax) !== null && _s$goodsListState$edi5 !== void 0 ? _s$goodsListState$edi5 : between.lineAmountExcludeTax,
|
|
27027
|
+
lineAmountIncludeTax: (_s$goodsListState$edi7 = (_s$goodsListState$edi8 = s.goodsListState.editGood) === null || _s$goodsListState$edi8 === void 0 ? void 0 : _s$goodsListState$edi8.lineAmountIncludeTax) !== null && _s$goodsListState$edi7 !== void 0 ? _s$goodsListState$edi7 : between.lineAmountIncludeTax,
|
|
27028
|
+
priceExcludeTax: roundTo8Decimals((_s$goodsListState$edi9 = (_s$goodsListState$edi10 = s.goodsListState.editGood) === null || _s$goodsListState$edi10 === void 0 ? void 0 : _s$goodsListState$edi10.priceExcludeTax) !== null && _s$goodsListState$edi9 !== void 0 ? _s$goodsListState$edi9 : between.priceExcludeTax),
|
|
27029
|
+
priceIncludeTax: roundTo8Decimals((_s$goodsListState$edi11 = (_s$goodsListState$edi12 = s.goodsListState.editGood) === null || _s$goodsListState$edi12 === void 0 ? void 0 : _s$goodsListState$edi12.priceIncludeTax) !== null && _s$goodsListState$edi11 !== void 0 ? _s$goodsListState$edi11 : between.priceIncludeTax),
|
|
27030
|
+
quantity: (_s$goodsListState$edi13 = (_s$goodsListState$edi14 = s.goodsListState.editGood) === null || _s$goodsListState$edi14 === void 0 ? void 0 : _s$goodsListState$edi14.quantity) !== null && _s$goodsListState$edi13 !== void 0 ? _s$goodsListState$edi13 : between.quantity,
|
|
27031
|
+
unit: (_s$goodsListState$edi15 = (_s$goodsListState$edi16 = s.goodsListState.editGood) === null || _s$goodsListState$edi16 === void 0 ? void 0 : _s$goodsListState$edi16.unit) !== null && _s$goodsListState$edi15 !== void 0 ? _s$goodsListState$edi15 : between.unit // serialNo:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
|
|
27032
|
+
// taxAmount:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
|
|
27033
|
+
// taxRate:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
|
|
27034
|
+
// lineAttribute:s.goodsListState.editGood?.lineAttribute,
|
|
27035
|
+
|
|
27036
|
+
});
|
|
26463
27037
|
|
|
26464
27038
|
if (editGood.taxRate) {
|
|
26465
27039
|
editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood);
|
|
@@ -26469,7 +27043,7 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
26469
27043
|
editGood.priceIncludeTax = undefined;
|
|
26470
27044
|
editGood.priceExcludeTax = undefined;
|
|
26471
27045
|
} else {
|
|
26472
|
-
editGood.priceExcludeTax = getPriceExcludeTax$1(editGood, record,
|
|
27046
|
+
editGood.priceExcludeTax = editGood.priceExcludeTax || getPriceExcludeTax$1(editGood, record, 8);
|
|
26473
27047
|
}
|
|
26474
27048
|
|
|
26475
27049
|
if (editGood.quantity && editGood.priceIncludeTax) {
|
|
@@ -26487,7 +27061,7 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
26487
27061
|
// s.goodsListState.form.setFieldsValue({
|
|
26488
27062
|
// ...editGood,
|
|
26489
27063
|
// });
|
|
26490
|
-
// }
|
|
27064
|
+
// }
|
|
26491
27065
|
|
|
26492
27066
|
s.goodsListState.importGoods.isVisibleDrawer = false;
|
|
26493
27067
|
|
|
@@ -26719,12 +27293,12 @@ var EndowCodeDrawer = (function () {
|
|
|
26719
27293
|
width: 383,
|
|
26720
27294
|
onClose: onClose,
|
|
26721
27295
|
visible: visible
|
|
26722
|
-
}, defaultValue && /*#__PURE__*/React__default['default'].createElement(DrawerBody$
|
|
27296
|
+
}, defaultValue && /*#__PURE__*/React__default['default'].createElement(DrawerBody$2, {
|
|
26723
27297
|
defaultValue: defaultValue
|
|
26724
27298
|
}));
|
|
26725
27299
|
});
|
|
26726
27300
|
|
|
26727
|
-
var DrawerBody$
|
|
27301
|
+
var DrawerBody$2 = function DrawerBody(props) {
|
|
26728
27302
|
var _defaultValue$taxRate, _defaultValue$favoure;
|
|
26729
27303
|
|
|
26730
27304
|
var controller = Invoice.useInvoiceController();
|