kts-component-invoice-operate 3.2.149 → 3.2.151
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/GoodsListState/index.d.ts +7 -0
- package/dist/index.esm.js +96 -49
- package/dist/index.js +96 -49
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +11 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +8 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +27 -10
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +23 -8
- package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +4 -5
|
@@ -24,6 +24,13 @@ export default class GoodsListState {
|
|
|
24
24
|
isRemRow: boolean;
|
|
25
25
|
/** 是否含税 */
|
|
26
26
|
isTaxIncluded: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 计算类型
|
|
29
|
+
* @param 1: 含税金额不变
|
|
30
|
+
* @param 2: 不含税金额不变
|
|
31
|
+
* @param 3: 自动(根据含税表现isTaxIncluded)
|
|
32
|
+
* */
|
|
33
|
+
calculateType: '1' | '2' | '3';
|
|
27
34
|
/** 是否显示我方 */
|
|
28
35
|
isMyShow: boolean;
|
|
29
36
|
/** 正在编辑的货物 */
|
package/dist/index.esm.js
CHANGED
|
@@ -1098,6 +1098,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1098
1098
|
this.isAddRow = true;
|
|
1099
1099
|
this.isRemRow = true;
|
|
1100
1100
|
this.isTaxIncluded = true;
|
|
1101
|
+
this.calculateType = '3';
|
|
1101
1102
|
this.isMyShow = false;
|
|
1102
1103
|
this.editGood = void 0;
|
|
1103
1104
|
this.form = void 0;
|
|
@@ -8799,30 +8800,51 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
|
|
|
8799
8800
|
record.taxFreeType = cache[record.$index].taxFreeType;
|
|
8800
8801
|
cache[record.$index] = undefined;
|
|
8801
8802
|
}
|
|
8802
|
-
})();
|
|
8803
|
+
})();
|
|
8803
8804
|
|
|
8805
|
+
_context8.t0 = controller.state.goodsListState.calculateType;
|
|
8806
|
+
_context8.next = _context8.t0 === '1' ? 10 : _context8.t0 === '2' ? 13 : _context8.t0 === '3' ? 16 : 16;
|
|
8807
|
+
break;
|
|
8808
|
+
|
|
8809
|
+
case 10:
|
|
8810
|
+
_context8.next = 12;
|
|
8811
|
+
return updateUnitPriceExcludingTax(controller, form, record);
|
|
8812
|
+
|
|
8813
|
+
case 12:
|
|
8814
|
+
return _context8.abrupt("break", 24);
|
|
8815
|
+
|
|
8816
|
+
case 13:
|
|
8817
|
+
_context8.next = 15;
|
|
8818
|
+
return updateUnitPriceTax(controller, form, record);
|
|
8819
|
+
|
|
8820
|
+
case 15:
|
|
8821
|
+
return _context8.abrupt("break", 24);
|
|
8804
8822
|
|
|
8823
|
+
case 16:
|
|
8805
8824
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
8806
|
-
_context8.next =
|
|
8825
|
+
_context8.next = 21;
|
|
8807
8826
|
break;
|
|
8808
8827
|
}
|
|
8809
8828
|
|
|
8810
|
-
_context8.next =
|
|
8829
|
+
_context8.next = 19;
|
|
8811
8830
|
return updateUnitPriceExcludingTax(controller, form, record);
|
|
8812
8831
|
|
|
8813
|
-
case
|
|
8814
|
-
_context8.next =
|
|
8832
|
+
case 19:
|
|
8833
|
+
_context8.next = 23;
|
|
8815
8834
|
break;
|
|
8816
8835
|
|
|
8817
|
-
case
|
|
8818
|
-
_context8.next =
|
|
8836
|
+
case 21:
|
|
8837
|
+
_context8.next = 23;
|
|
8819
8838
|
return updateUnitPriceTax(controller, form, record);
|
|
8820
8839
|
|
|
8821
|
-
case
|
|
8822
|
-
_context8.
|
|
8840
|
+
case 23:
|
|
8841
|
+
return _context8.abrupt("break", 24);
|
|
8842
|
+
|
|
8843
|
+
case 24:
|
|
8844
|
+
_context8.next = 26;
|
|
8823
8845
|
return clearCalculatingField(controller);
|
|
8824
8846
|
|
|
8825
|
-
case
|
|
8847
|
+
case 26:
|
|
8826
8848
|
case "end":
|
|
8827
8849
|
return _context8.stop();
|
|
8828
8850
|
}
|
|
@@ -8877,58 +8899,60 @@ var updateUnitPriceExcludingTax = /*#__PURE__*/function () {
|
|
|
8877
8899
|
return _context10.abrupt("return", new Promise(function (resolve) {
|
|
8878
8900
|
form.validateFields( /*#__PURE__*/function () {
|
|
8879
8901
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(err, values) {
|
|
8880
|
-
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
|
|
8902
|
+
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction, editGood;
|
|
8881
8903
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
8882
8904
|
while (1) {
|
|
8883
8905
|
switch (_context9.prev = _context9.next) {
|
|
8884
8906
|
case 0:
|
|
8907
|
+
debugger;
|
|
8885
8908
|
err = err || {};
|
|
8886
8909
|
/** 税额 */
|
|
8887
8910
|
|
|
8888
8911
|
/** 扣除额 */
|
|
8889
|
-
deduction = controller.state.goodsListState.deduction;
|
|
8912
|
+
deduction = controller.state.goodsListState.deduction;
|
|
8913
|
+
editGood = controller.state.goodsListState.editGood; // 计算税额
|
|
8890
8914
|
|
|
8891
8915
|
if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
|
|
8892
|
-
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
8916
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), deduction, values.taxRate);
|
|
8893
8917
|
}
|
|
8894
8918
|
|
|
8895
8919
|
form.setFieldsValue({
|
|
8896
8920
|
taxAmount: taxAmount
|
|
8897
8921
|
});
|
|
8898
|
-
_context9.next =
|
|
8922
|
+
_context9.next = 8;
|
|
8899
8923
|
return controller.setEditGood({
|
|
8900
8924
|
taxAmount: taxAmount
|
|
8901
8925
|
});
|
|
8902
8926
|
|
|
8903
|
-
case
|
|
8927
|
+
case 8:
|
|
8904
8928
|
// 计算 金额(不含税)
|
|
8905
8929
|
if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
|
|
8906
|
-
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
8930
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), taxAmount);
|
|
8907
8931
|
}
|
|
8908
8932
|
|
|
8909
8933
|
form.setFieldsValue({
|
|
8910
8934
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8911
8935
|
});
|
|
8912
|
-
_context9.next =
|
|
8936
|
+
_context9.next = 12;
|
|
8913
8937
|
return controller.setEditGood({
|
|
8914
8938
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8915
8939
|
});
|
|
8916
8940
|
|
|
8917
|
-
case
|
|
8941
|
+
case 12:
|
|
8918
8942
|
// 单价(不含税)
|
|
8919
8943
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
8920
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
8944
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity || (editGood === null || editGood === void 0 ? void 0 : editGood.quantity), controller.state.calculatingDigits);
|
|
8921
8945
|
}
|
|
8922
8946
|
|
|
8923
8947
|
form.setFieldsValue({
|
|
8924
8948
|
priceExcludeTax: priceExcludeTax
|
|
8925
8949
|
});
|
|
8926
|
-
_context9.next =
|
|
8950
|
+
_context9.next = 16;
|
|
8927
8951
|
return controller.setEditGood({
|
|
8928
8952
|
priceExcludeTax: priceExcludeTax
|
|
8929
8953
|
});
|
|
8930
8954
|
|
|
8931
|
-
case
|
|
8955
|
+
case 16:
|
|
8932
8956
|
case "end":
|
|
8933
8957
|
return _context9.stop();
|
|
8934
8958
|
}
|
|
@@ -18660,30 +18684,51 @@ var onChangeTaxRate$1 = lazyFn$2(function (controller, form, record) {
|
|
|
18660
18684
|
record.taxFreeType = cache[record.$index].taxFreeType;
|
|
18661
18685
|
cache[record.$index] = undefined;
|
|
18662
18686
|
}
|
|
18663
|
-
})();
|
|
18687
|
+
})();
|
|
18688
|
+
|
|
18689
|
+
_context8.t0 = controller.state.goodsListState.calculateType;
|
|
18690
|
+
_context8.next = _context8.t0 === '1' ? 10 : _context8.t0 === '2' ? 13 : _context8.t0 === '3' ? 16 : 16;
|
|
18691
|
+
break;
|
|
18692
|
+
|
|
18693
|
+
case 10:
|
|
18694
|
+
_context8.next = 12;
|
|
18695
|
+
return updateUnitPriceExcludingTax$1(controller, form, record);
|
|
18696
|
+
|
|
18697
|
+
case 12:
|
|
18698
|
+
return _context8.abrupt("break", 24);
|
|
18699
|
+
|
|
18700
|
+
case 13:
|
|
18701
|
+
_context8.next = 15;
|
|
18702
|
+
return updateUnitPriceTax$1(controller, form, record);
|
|
18664
18703
|
|
|
18704
|
+
case 15:
|
|
18705
|
+
return _context8.abrupt("break", 24);
|
|
18665
18706
|
|
|
18707
|
+
case 16:
|
|
18666
18708
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
18667
|
-
_context8.next =
|
|
18709
|
+
_context8.next = 21;
|
|
18668
18710
|
break;
|
|
18669
18711
|
}
|
|
18670
18712
|
|
|
18671
|
-
_context8.next =
|
|
18713
|
+
_context8.next = 19;
|
|
18672
18714
|
return updateUnitPriceExcludingTax$1(controller, form, record);
|
|
18673
18715
|
|
|
18674
|
-
case
|
|
18675
|
-
_context8.next =
|
|
18716
|
+
case 19:
|
|
18717
|
+
_context8.next = 23;
|
|
18676
18718
|
break;
|
|
18677
18719
|
|
|
18678
|
-
case
|
|
18679
|
-
_context8.next =
|
|
18720
|
+
case 21:
|
|
18721
|
+
_context8.next = 23;
|
|
18680
18722
|
return updateUnitPriceTax$1(controller, form, record);
|
|
18681
18723
|
|
|
18682
|
-
case
|
|
18683
|
-
_context8.
|
|
18724
|
+
case 23:
|
|
18725
|
+
return _context8.abrupt("break", 24);
|
|
18726
|
+
|
|
18727
|
+
case 24:
|
|
18728
|
+
_context8.next = 26;
|
|
18684
18729
|
return clearCalculatingField$1(controller);
|
|
18685
18730
|
|
|
18686
|
-
case
|
|
18731
|
+
case 26:
|
|
18687
18732
|
case "end":
|
|
18688
18733
|
return _context8.stop();
|
|
18689
18734
|
}
|
|
@@ -18707,7 +18752,7 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18707
18752
|
return _context10.abrupt("return", new Promise(function (resolve) {
|
|
18708
18753
|
form.validateFields( /*#__PURE__*/function () {
|
|
18709
18754
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(err, values) {
|
|
18710
|
-
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
|
|
18755
|
+
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction, editGood;
|
|
18711
18756
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
18712
18757
|
while (1) {
|
|
18713
18758
|
switch (_context9.prev = _context9.next) {
|
|
@@ -18717,49 +18762,50 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18717
18762
|
/** 税额 */
|
|
18718
18763
|
|
|
18719
18764
|
/** 扣除额 */
|
|
18720
|
-
deduction = controller.state.goodsListState.deduction;
|
|
18765
|
+
deduction = controller.state.goodsListState.deduction;
|
|
18766
|
+
editGood = controller.state.goodsListState.editGood; // 计算税额
|
|
18721
18767
|
|
|
18722
18768
|
if (!promptErr$1(err.lineAmountIncludeTax) && !promptErr$1(err.taxRate)) {
|
|
18723
|
-
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
18769
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), deduction, values.taxRate);
|
|
18724
18770
|
}
|
|
18725
18771
|
|
|
18726
18772
|
form.setFieldsValue({
|
|
18727
18773
|
taxAmount: taxAmount
|
|
18728
18774
|
});
|
|
18729
|
-
_context9.next =
|
|
18775
|
+
_context9.next = 8;
|
|
18730
18776
|
return controller.setEditGood({
|
|
18731
18777
|
taxAmount: taxAmount
|
|
18732
18778
|
});
|
|
18733
18779
|
|
|
18734
|
-
case
|
|
18780
|
+
case 8:
|
|
18735
18781
|
// 计算 金额(不含税)
|
|
18736
18782
|
if ((taxAmount || taxAmount === 0) && !promptErr$1(err.lineAmountIncludeTax)) {
|
|
18737
|
-
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
18783
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), taxAmount);
|
|
18738
18784
|
}
|
|
18739
18785
|
|
|
18740
18786
|
form.setFieldsValue({
|
|
18741
18787
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18742
18788
|
});
|
|
18743
|
-
_context9.next =
|
|
18789
|
+
_context9.next = 12;
|
|
18744
18790
|
return controller.setEditGood({
|
|
18745
18791
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18746
18792
|
});
|
|
18747
18793
|
|
|
18748
|
-
case
|
|
18794
|
+
case 12:
|
|
18749
18795
|
// 单价(不含税)
|
|
18750
18796
|
if (lineAmountExcludeTax && !promptErr$1(err.quantity)) {
|
|
18751
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
18797
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity || (editGood === null || editGood === void 0 ? void 0 : editGood.quantity), controller.state.calculatingDigits);
|
|
18752
18798
|
}
|
|
18753
18799
|
|
|
18754
18800
|
form.setFieldsValue({
|
|
18755
18801
|
priceExcludeTax: priceExcludeTax
|
|
18756
18802
|
});
|
|
18757
|
-
_context9.next =
|
|
18803
|
+
_context9.next = 16;
|
|
18758
18804
|
return controller.setEditGood({
|
|
18759
18805
|
priceExcludeTax: priceExcludeTax
|
|
18760
18806
|
});
|
|
18761
18807
|
|
|
18762
|
-
case
|
|
18808
|
+
case 16:
|
|
18763
18809
|
case "end":
|
|
18764
18810
|
return _context9.stop();
|
|
18765
18811
|
}
|
|
@@ -22969,15 +23015,16 @@ var MyArrMoment = /*#__PURE__*/function (_React$Component3) {
|
|
|
22969
23015
|
_createClass(MyArrMoment, [{
|
|
22970
23016
|
key: "render",
|
|
22971
23017
|
value: function render() {
|
|
22972
|
-
var _this$props$value2
|
|
22973
|
-
|
|
23018
|
+
var _this$props$value2 = this.props.value,
|
|
23019
|
+
value = _this$props$value2 === void 0 ? [] : _this$props$value2;
|
|
22974
23020
|
return /*#__PURE__*/React.createElement("div", {
|
|
22975
23021
|
style: this.props.style
|
|
22976
|
-
}, (
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
|
|
23022
|
+
}, /*#__PURE__*/React.createElement("span", null, hooks.isMoment(value[0]) && value[0].format('YYYY-MM-DD')), /*#__PURE__*/React.createElement("span", {
|
|
23023
|
+
style: {
|
|
23024
|
+
color: '#9F603D',
|
|
23025
|
+
fontWeight: 600
|
|
23026
|
+
}
|
|
23027
|
+
}, " - "), /*#__PURE__*/React.createElement("span", null, hooks.isMoment(value[1]) && value[0].format('YYYY-MM-DD')));
|
|
22981
23028
|
}
|
|
22982
23029
|
}]);
|
|
22983
23030
|
|
package/dist/index.js
CHANGED
|
@@ -1108,6 +1108,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1108
1108
|
this.isAddRow = true;
|
|
1109
1109
|
this.isRemRow = true;
|
|
1110
1110
|
this.isTaxIncluded = true;
|
|
1111
|
+
this.calculateType = '3';
|
|
1111
1112
|
this.isMyShow = false;
|
|
1112
1113
|
this.editGood = void 0;
|
|
1113
1114
|
this.form = void 0;
|
|
@@ -8809,30 +8810,51 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
|
|
|
8809
8810
|
record.taxFreeType = cache[record.$index].taxFreeType;
|
|
8810
8811
|
cache[record.$index] = undefined;
|
|
8811
8812
|
}
|
|
8812
|
-
})();
|
|
8813
|
+
})();
|
|
8813
8814
|
|
|
8815
|
+
_context8.t0 = controller.state.goodsListState.calculateType;
|
|
8816
|
+
_context8.next = _context8.t0 === '1' ? 10 : _context8.t0 === '2' ? 13 : _context8.t0 === '3' ? 16 : 16;
|
|
8817
|
+
break;
|
|
8818
|
+
|
|
8819
|
+
case 10:
|
|
8820
|
+
_context8.next = 12;
|
|
8821
|
+
return updateUnitPriceExcludingTax(controller, form, record);
|
|
8822
|
+
|
|
8823
|
+
case 12:
|
|
8824
|
+
return _context8.abrupt("break", 24);
|
|
8825
|
+
|
|
8826
|
+
case 13:
|
|
8827
|
+
_context8.next = 15;
|
|
8828
|
+
return updateUnitPriceTax(controller, form, record);
|
|
8829
|
+
|
|
8830
|
+
case 15:
|
|
8831
|
+
return _context8.abrupt("break", 24);
|
|
8814
8832
|
|
|
8833
|
+
case 16:
|
|
8815
8834
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
8816
|
-
_context8.next =
|
|
8835
|
+
_context8.next = 21;
|
|
8817
8836
|
break;
|
|
8818
8837
|
}
|
|
8819
8838
|
|
|
8820
|
-
_context8.next =
|
|
8839
|
+
_context8.next = 19;
|
|
8821
8840
|
return updateUnitPriceExcludingTax(controller, form, record);
|
|
8822
8841
|
|
|
8823
|
-
case
|
|
8824
|
-
_context8.next =
|
|
8842
|
+
case 19:
|
|
8843
|
+
_context8.next = 23;
|
|
8825
8844
|
break;
|
|
8826
8845
|
|
|
8827
|
-
case
|
|
8828
|
-
_context8.next =
|
|
8846
|
+
case 21:
|
|
8847
|
+
_context8.next = 23;
|
|
8829
8848
|
return updateUnitPriceTax(controller, form, record);
|
|
8830
8849
|
|
|
8831
|
-
case
|
|
8832
|
-
_context8.
|
|
8850
|
+
case 23:
|
|
8851
|
+
return _context8.abrupt("break", 24);
|
|
8852
|
+
|
|
8853
|
+
case 24:
|
|
8854
|
+
_context8.next = 26;
|
|
8833
8855
|
return clearCalculatingField(controller);
|
|
8834
8856
|
|
|
8835
|
-
case
|
|
8857
|
+
case 26:
|
|
8836
8858
|
case "end":
|
|
8837
8859
|
return _context8.stop();
|
|
8838
8860
|
}
|
|
@@ -8887,58 +8909,60 @@ var updateUnitPriceExcludingTax = /*#__PURE__*/function () {
|
|
|
8887
8909
|
return _context10.abrupt("return", new Promise(function (resolve) {
|
|
8888
8910
|
form.validateFields( /*#__PURE__*/function () {
|
|
8889
8911
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(err, values) {
|
|
8890
|
-
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
|
|
8912
|
+
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction, editGood;
|
|
8891
8913
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
8892
8914
|
while (1) {
|
|
8893
8915
|
switch (_context9.prev = _context9.next) {
|
|
8894
8916
|
case 0:
|
|
8917
|
+
debugger;
|
|
8895
8918
|
err = err || {};
|
|
8896
8919
|
/** 税额 */
|
|
8897
8920
|
|
|
8898
8921
|
/** 扣除额 */
|
|
8899
|
-
deduction = controller.state.goodsListState.deduction;
|
|
8922
|
+
deduction = controller.state.goodsListState.deduction;
|
|
8923
|
+
editGood = controller.state.goodsListState.editGood; // 计算税额
|
|
8900
8924
|
|
|
8901
8925
|
if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
|
|
8902
|
-
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
8926
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), deduction, values.taxRate);
|
|
8903
8927
|
}
|
|
8904
8928
|
|
|
8905
8929
|
form.setFieldsValue({
|
|
8906
8930
|
taxAmount: taxAmount
|
|
8907
8931
|
});
|
|
8908
|
-
_context9.next =
|
|
8932
|
+
_context9.next = 8;
|
|
8909
8933
|
return controller.setEditGood({
|
|
8910
8934
|
taxAmount: taxAmount
|
|
8911
8935
|
});
|
|
8912
8936
|
|
|
8913
|
-
case
|
|
8937
|
+
case 8:
|
|
8914
8938
|
// 计算 金额(不含税)
|
|
8915
8939
|
if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
|
|
8916
|
-
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
8940
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), taxAmount);
|
|
8917
8941
|
}
|
|
8918
8942
|
|
|
8919
8943
|
form.setFieldsValue({
|
|
8920
8944
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8921
8945
|
});
|
|
8922
|
-
_context9.next =
|
|
8946
|
+
_context9.next = 12;
|
|
8923
8947
|
return controller.setEditGood({
|
|
8924
8948
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8925
8949
|
});
|
|
8926
8950
|
|
|
8927
|
-
case
|
|
8951
|
+
case 12:
|
|
8928
8952
|
// 单价(不含税)
|
|
8929
8953
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
8930
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
8954
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity || (editGood === null || editGood === void 0 ? void 0 : editGood.quantity), controller.state.calculatingDigits);
|
|
8931
8955
|
}
|
|
8932
8956
|
|
|
8933
8957
|
form.setFieldsValue({
|
|
8934
8958
|
priceExcludeTax: priceExcludeTax
|
|
8935
8959
|
});
|
|
8936
|
-
_context9.next =
|
|
8960
|
+
_context9.next = 16;
|
|
8937
8961
|
return controller.setEditGood({
|
|
8938
8962
|
priceExcludeTax: priceExcludeTax
|
|
8939
8963
|
});
|
|
8940
8964
|
|
|
8941
|
-
case
|
|
8965
|
+
case 16:
|
|
8942
8966
|
case "end":
|
|
8943
8967
|
return _context9.stop();
|
|
8944
8968
|
}
|
|
@@ -18670,30 +18694,51 @@ var onChangeTaxRate$1 = lazyFn$2(function (controller, form, record) {
|
|
|
18670
18694
|
record.taxFreeType = cache[record.$index].taxFreeType;
|
|
18671
18695
|
cache[record.$index] = undefined;
|
|
18672
18696
|
}
|
|
18673
|
-
})();
|
|
18697
|
+
})();
|
|
18698
|
+
|
|
18699
|
+
_context8.t0 = controller.state.goodsListState.calculateType;
|
|
18700
|
+
_context8.next = _context8.t0 === '1' ? 10 : _context8.t0 === '2' ? 13 : _context8.t0 === '3' ? 16 : 16;
|
|
18701
|
+
break;
|
|
18702
|
+
|
|
18703
|
+
case 10:
|
|
18704
|
+
_context8.next = 12;
|
|
18705
|
+
return updateUnitPriceExcludingTax$1(controller, form, record);
|
|
18706
|
+
|
|
18707
|
+
case 12:
|
|
18708
|
+
return _context8.abrupt("break", 24);
|
|
18709
|
+
|
|
18710
|
+
case 13:
|
|
18711
|
+
_context8.next = 15;
|
|
18712
|
+
return updateUnitPriceTax$1(controller, form, record);
|
|
18674
18713
|
|
|
18714
|
+
case 15:
|
|
18715
|
+
return _context8.abrupt("break", 24);
|
|
18675
18716
|
|
|
18717
|
+
case 16:
|
|
18676
18718
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
18677
|
-
_context8.next =
|
|
18719
|
+
_context8.next = 21;
|
|
18678
18720
|
break;
|
|
18679
18721
|
}
|
|
18680
18722
|
|
|
18681
|
-
_context8.next =
|
|
18723
|
+
_context8.next = 19;
|
|
18682
18724
|
return updateUnitPriceExcludingTax$1(controller, form, record);
|
|
18683
18725
|
|
|
18684
|
-
case
|
|
18685
|
-
_context8.next =
|
|
18726
|
+
case 19:
|
|
18727
|
+
_context8.next = 23;
|
|
18686
18728
|
break;
|
|
18687
18729
|
|
|
18688
|
-
case
|
|
18689
|
-
_context8.next =
|
|
18730
|
+
case 21:
|
|
18731
|
+
_context8.next = 23;
|
|
18690
18732
|
return updateUnitPriceTax$1(controller, form, record);
|
|
18691
18733
|
|
|
18692
|
-
case
|
|
18693
|
-
_context8.
|
|
18734
|
+
case 23:
|
|
18735
|
+
return _context8.abrupt("break", 24);
|
|
18736
|
+
|
|
18737
|
+
case 24:
|
|
18738
|
+
_context8.next = 26;
|
|
18694
18739
|
return clearCalculatingField$1(controller);
|
|
18695
18740
|
|
|
18696
|
-
case
|
|
18741
|
+
case 26:
|
|
18697
18742
|
case "end":
|
|
18698
18743
|
return _context8.stop();
|
|
18699
18744
|
}
|
|
@@ -18717,7 +18762,7 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18717
18762
|
return _context10.abrupt("return", new Promise(function (resolve) {
|
|
18718
18763
|
form.validateFields( /*#__PURE__*/function () {
|
|
18719
18764
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(err, values) {
|
|
18720
|
-
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
|
|
18765
|
+
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction, editGood;
|
|
18721
18766
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
18722
18767
|
while (1) {
|
|
18723
18768
|
switch (_context9.prev = _context9.next) {
|
|
@@ -18727,49 +18772,50 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18727
18772
|
/** 税额 */
|
|
18728
18773
|
|
|
18729
18774
|
/** 扣除额 */
|
|
18730
|
-
deduction = controller.state.goodsListState.deduction;
|
|
18775
|
+
deduction = controller.state.goodsListState.deduction;
|
|
18776
|
+
editGood = controller.state.goodsListState.editGood; // 计算税额
|
|
18731
18777
|
|
|
18732
18778
|
if (!promptErr$1(err.lineAmountIncludeTax) && !promptErr$1(err.taxRate)) {
|
|
18733
|
-
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
18779
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), deduction, values.taxRate);
|
|
18734
18780
|
}
|
|
18735
18781
|
|
|
18736
18782
|
form.setFieldsValue({
|
|
18737
18783
|
taxAmount: taxAmount
|
|
18738
18784
|
});
|
|
18739
|
-
_context9.next =
|
|
18785
|
+
_context9.next = 8;
|
|
18740
18786
|
return controller.setEditGood({
|
|
18741
18787
|
taxAmount: taxAmount
|
|
18742
18788
|
});
|
|
18743
18789
|
|
|
18744
|
-
case
|
|
18790
|
+
case 8:
|
|
18745
18791
|
// 计算 金额(不含税)
|
|
18746
18792
|
if ((taxAmount || taxAmount === 0) && !promptErr$1(err.lineAmountIncludeTax)) {
|
|
18747
|
-
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
18793
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax || (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax), taxAmount);
|
|
18748
18794
|
}
|
|
18749
18795
|
|
|
18750
18796
|
form.setFieldsValue({
|
|
18751
18797
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18752
18798
|
});
|
|
18753
|
-
_context9.next =
|
|
18799
|
+
_context9.next = 12;
|
|
18754
18800
|
return controller.setEditGood({
|
|
18755
18801
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18756
18802
|
});
|
|
18757
18803
|
|
|
18758
|
-
case
|
|
18804
|
+
case 12:
|
|
18759
18805
|
// 单价(不含税)
|
|
18760
18806
|
if (lineAmountExcludeTax && !promptErr$1(err.quantity)) {
|
|
18761
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
18807
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity || (editGood === null || editGood === void 0 ? void 0 : editGood.quantity), controller.state.calculatingDigits);
|
|
18762
18808
|
}
|
|
18763
18809
|
|
|
18764
18810
|
form.setFieldsValue({
|
|
18765
18811
|
priceExcludeTax: priceExcludeTax
|
|
18766
18812
|
});
|
|
18767
|
-
_context9.next =
|
|
18813
|
+
_context9.next = 16;
|
|
18768
18814
|
return controller.setEditGood({
|
|
18769
18815
|
priceExcludeTax: priceExcludeTax
|
|
18770
18816
|
});
|
|
18771
18817
|
|
|
18772
|
-
case
|
|
18818
|
+
case 16:
|
|
18773
18819
|
case "end":
|
|
18774
18820
|
return _context9.stop();
|
|
18775
18821
|
}
|
|
@@ -22979,15 +23025,16 @@ var MyArrMoment = /*#__PURE__*/function (_React$Component3) {
|
|
|
22979
23025
|
_createClass(MyArrMoment, [{
|
|
22980
23026
|
key: "render",
|
|
22981
23027
|
value: function render() {
|
|
22982
|
-
var _this$props$value2
|
|
22983
|
-
|
|
23028
|
+
var _this$props$value2 = this.props.value,
|
|
23029
|
+
value = _this$props$value2 === void 0 ? [] : _this$props$value2;
|
|
22984
23030
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22985
23031
|
style: this.props.style
|
|
22986
|
-
}, (
|
|
22987
|
-
|
|
22988
|
-
|
|
22989
|
-
|
|
22990
|
-
|
|
23032
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", null, hooks.isMoment(value[0]) && value[0].format('YYYY-MM-DD')), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
23033
|
+
style: {
|
|
23034
|
+
color: '#9F603D',
|
|
23035
|
+
fontWeight: 600
|
|
23036
|
+
}
|
|
23037
|
+
}, " - "), /*#__PURE__*/React__default['default'].createElement("span", null, hooks.isMoment(value[1]) && value[0].format('YYYY-MM-DD')));
|
|
22991
23038
|
}
|
|
22992
23039
|
}]);
|
|
22993
23040
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Invoice from '../../..';
|
|
3
|
+
import moment from 'moment';
|
|
3
4
|
import 'antd/dist/antd.css';
|
|
4
5
|
|
|
5
6
|
export default () => {
|
|
7
|
+
|
|
8
|
+
const controller = React.useMemo(() => new Invoice.InvoiceController(), []);
|
|
9
|
+
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
controller.run(async s => {
|
|
12
|
+
s.model = 'readOnly'
|
|
13
|
+
})
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
6
16
|
return (
|
|
7
17
|
<Invoice
|
|
8
18
|
invoiceType='digtal'
|
|
19
|
+
controller={controller}
|
|
9
20
|
specialInfor={<Invoice.RealEstateInfo />}
|
|
10
21
|
/>
|
|
11
22
|
)
|
|
@@ -33,6 +33,14 @@ export default class GoodsListState {
|
|
|
33
33
|
/** 是否含税 */
|
|
34
34
|
isTaxIncluded = true;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 计算类型
|
|
38
|
+
* @param 1: 含税金额不变
|
|
39
|
+
* @param 2: 不含税金额不变
|
|
40
|
+
* @param 3: 自动(根据含税表现isTaxIncluded)
|
|
41
|
+
* */
|
|
42
|
+
calculateType: '1' | '2' | '3' = '3';
|
|
43
|
+
|
|
36
44
|
/** 是否显示我方 */
|
|
37
45
|
isMyShow = false;
|
|
38
46
|
|
|
@@ -311,11 +311,24 @@ export const onChangeTaxRate = lazyFn(
|
|
|
311
311
|
}
|
|
312
312
|
})()
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
314
|
+
switch (controller.state.goodsListState.calculateType) {
|
|
315
|
+
case '1':
|
|
316
|
+
await updateUnitPriceExcludingTax(controller, form, record);
|
|
317
|
+
break;
|
|
318
|
+
|
|
319
|
+
case '2':
|
|
320
|
+
await updateUnitPriceTax(controller, form, record);
|
|
321
|
+
break;
|
|
322
|
+
|
|
323
|
+
case '3':
|
|
324
|
+
default:
|
|
325
|
+
// 是否含税
|
|
326
|
+
if (controller.state.goodsListState.isTaxIncluded) {
|
|
327
|
+
await updateUnitPriceExcludingTax(controller, form, record);
|
|
328
|
+
} else {
|
|
329
|
+
await updateUnitPriceTax(controller, form, record);
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
319
332
|
}
|
|
320
333
|
|
|
321
334
|
// 清楚 计算中启动字段
|
|
@@ -358,6 +371,8 @@ export const updateUnitPriceExcludingTax = async (controller: InvoiceController,
|
|
|
358
371
|
return new Promise((resolve) => {
|
|
359
372
|
form.validateFields(async (err, values) => {
|
|
360
373
|
|
|
374
|
+
debugger
|
|
375
|
+
|
|
361
376
|
err = err || {};
|
|
362
377
|
|
|
363
378
|
/** 税额 */
|
|
@@ -372,23 +387,25 @@ export const updateUnitPriceExcludingTax = async (controller: InvoiceController,
|
|
|
372
387
|
/** 扣除额 */
|
|
373
388
|
const deduction = controller.state.goodsListState.deduction;
|
|
374
389
|
|
|
390
|
+
const { editGood } = controller.state.goodsListState
|
|
391
|
+
|
|
375
392
|
// 计算税额
|
|
376
393
|
if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
|
|
377
|
-
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
394
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax || editGood?.lineAmountIncludeTax, deduction, values.taxRate);
|
|
378
395
|
}
|
|
379
396
|
form.setFieldsValue({ taxAmount });
|
|
380
397
|
await controller.setEditGood({ taxAmount });
|
|
381
398
|
|
|
382
399
|
// 计算 金额(不含税)
|
|
383
400
|
if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
|
|
384
|
-
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
401
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax || editGood?.lineAmountIncludeTax, taxAmount);
|
|
385
402
|
}
|
|
386
403
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
387
404
|
await controller.setEditGood({ lineAmountExcludeTax });
|
|
388
405
|
|
|
389
406
|
// 单价(不含税)
|
|
390
407
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
391
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
408
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity || editGood?.quantity, controller.state.calculatingDigits);
|
|
392
409
|
}
|
|
393
410
|
form.setFieldsValue({ priceExcludeTax });
|
|
394
411
|
await controller.setEditGood({ priceExcludeTax });
|
|
@@ -551,7 +568,7 @@ export const onChangeSwitchTax = async (controller: InvoiceController, isTaxIncl
|
|
|
551
568
|
key: '你正在编辑一个货物',
|
|
552
569
|
});
|
|
553
570
|
|
|
554
|
-
return
|
|
571
|
+
return;
|
|
555
572
|
}
|
|
556
573
|
|
|
557
574
|
s.goodsListState.isTaxIncluded = isTaxIncluded;
|
|
@@ -625,7 +642,7 @@ export const onChangeSwitchTax = async (controller: InvoiceController, isTaxIncl
|
|
|
625
642
|
s.goodsListState.goodsList = newGoodsList;
|
|
626
643
|
}
|
|
627
644
|
}
|
|
628
|
-
} catch(e) {
|
|
645
|
+
} catch (e) {
|
|
629
646
|
console.error('切换税率重新计算出错', e, s.goodsListState)
|
|
630
647
|
}
|
|
631
648
|
})
|
|
@@ -315,11 +315,24 @@ export const onChangeTaxRate = lazyFn(
|
|
|
315
315
|
}
|
|
316
316
|
})()
|
|
317
317
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
318
|
+
switch (controller.state.goodsListState.calculateType) {
|
|
319
|
+
case '1':
|
|
320
|
+
await updateUnitPriceExcludingTax(controller, form, record);
|
|
321
|
+
break;
|
|
322
|
+
|
|
323
|
+
case '2':
|
|
324
|
+
await updateUnitPriceTax(controller, form, record);
|
|
325
|
+
break;
|
|
326
|
+
|
|
327
|
+
case '3':
|
|
328
|
+
default:
|
|
329
|
+
// 是否含税
|
|
330
|
+
if (controller.state.goodsListState.isTaxIncluded) {
|
|
331
|
+
await updateUnitPriceExcludingTax(controller, form, record);
|
|
332
|
+
} else {
|
|
333
|
+
await updateUnitPriceTax(controller, form, record);
|
|
334
|
+
}
|
|
335
|
+
break;
|
|
323
336
|
}
|
|
324
337
|
|
|
325
338
|
// 清楚 计算中启动字段
|
|
@@ -377,23 +390,25 @@ export const updateUnitPriceExcludingTax = async (controller: InvoiceController,
|
|
|
377
390
|
/** 扣除额 */
|
|
378
391
|
const deduction = controller.state.goodsListState.deduction;
|
|
379
392
|
|
|
393
|
+
const { editGood } = controller.state.goodsListState
|
|
394
|
+
|
|
380
395
|
// 计算税额
|
|
381
396
|
if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
|
|
382
|
-
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
397
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax || editGood?.lineAmountIncludeTax, deduction, values.taxRate);
|
|
383
398
|
}
|
|
384
399
|
form.setFieldsValue({ taxAmount });
|
|
385
400
|
await controller.setEditGood({ taxAmount });
|
|
386
401
|
|
|
387
402
|
// 计算 金额(不含税)
|
|
388
403
|
if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
|
|
389
|
-
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
404
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax || editGood?.lineAmountIncludeTax, taxAmount);
|
|
390
405
|
}
|
|
391
406
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
392
407
|
await controller.setEditGood({ lineAmountExcludeTax });
|
|
393
408
|
|
|
394
409
|
// 单价(不含税)
|
|
395
410
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
396
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
411
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity || editGood?.quantity, controller.state.calculatingDigits);
|
|
397
412
|
}
|
|
398
413
|
form.setFieldsValue({ priceExcludeTax });
|
|
399
414
|
await controller.setEditGood({ priceExcludeTax });
|
|
@@ -184,13 +184,12 @@ class MyArrString extends React.Component<{ value?: string[], style?: React.CSSP
|
|
|
184
184
|
|
|
185
185
|
class MyArrMoment extends React.Component<{ value?: moment.Moment[], style?: React.CSSProperties }> {
|
|
186
186
|
render(): React.ReactNode {
|
|
187
|
+
const { value = [] } = this.props
|
|
187
188
|
return (
|
|
188
189
|
<div style={this.props.style}>
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
.join(' - ')
|
|
193
|
-
}
|
|
190
|
+
<span>{moment.isMoment(value[0]) && value[0].format('YYYY-MM-DD')}</span>
|
|
191
|
+
<span style={{ color: '#9F603D', fontWeight: 600 }} > - </span>
|
|
192
|
+
<span>{moment.isMoment(value[1]) && value[0].format('YYYY-MM-DD')}</span>
|
|
194
193
|
</div>
|
|
195
194
|
)
|
|
196
195
|
}
|