kts-component-invoice-operate 3.2.83 → 3.2.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +59 -77
- package/dist/index.js +59 -77
- package/package.json +1 -1
- package/src/Invoice/_test/endowCode/index.tsx +84 -4
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx +9 -22
- package/src/Invoice/ui/default/GoodsList/hook/useRowSelection/index.tsx +4 -1
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useMergeDetails/index.tsx +2 -2
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesDiscount/index.tsx +18 -19
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesGifts/index.tsx +2 -2
- package/src/Invoice/ui/default/GoodsList/ui/Statistics/index.tsx +4 -0
- package/src/Invoice/ui/default/Seller/index.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9773,6 +9773,8 @@ var Statistics = (function () {
|
|
|
9773
9773
|
|
|
9774
9774
|
var err = (_s$goodsListState$for = (_s$goodsListState$for2 = s.goodsListState.form) === null || _s$goodsListState$for2 === void 0 ? void 0 : _s$goodsListState$for2.getFieldsError()) !== null && _s$goodsListState$for !== void 0 ? _s$goodsListState$for : {};
|
|
9775
9775
|
s.goodsListState.goodsList.forEach(function (e) {
|
|
9776
|
+
if (e.lineAttribute === LineAttributeType$1.赠品行) return;
|
|
9777
|
+
|
|
9776
9778
|
if (e.$index === (editGood === null || editGood === void 0 ? void 0 : editGood.$index)) {
|
|
9777
9779
|
if (!err.lineAmountIncludeTax) {
|
|
9778
9780
|
sum = sum.add(bignumber(editGood.lineAmountIncludeTax || 0));
|
|
@@ -9797,6 +9799,8 @@ var Statistics = (function () {
|
|
|
9797
9799
|
|
|
9798
9800
|
var err = (_s$goodsListState$for3 = (_s$goodsListState$for4 = s.goodsListState.form) === null || _s$goodsListState$for4 === void 0 ? void 0 : _s$goodsListState$for4.getFieldsError()) !== null && _s$goodsListState$for3 !== void 0 ? _s$goodsListState$for3 : {};
|
|
9799
9801
|
s.goodsListState.goodsList.forEach(function (e) {
|
|
9802
|
+
if (e.lineAttribute === LineAttributeType$1.赠品行) return;
|
|
9803
|
+
|
|
9800
9804
|
if (e.$index === (editGood === null || editGood === void 0 ? void 0 : editGood.$index)) {
|
|
9801
9805
|
if (!err.lineAmountExcludeTax) {
|
|
9802
9806
|
sum = sum.add(bignumber(editGood.lineAmountExcludeTax || 0));
|
|
@@ -9818,6 +9822,8 @@ var Statistics = (function () {
|
|
|
9818
9822
|
var editGood = s.goodsListState.editGood; // 正在编辑的货物
|
|
9819
9823
|
|
|
9820
9824
|
s.goodsListState.goodsList.forEach(function (e) {
|
|
9825
|
+
if (e.lineAttribute === LineAttributeType$1.赠品行) return;
|
|
9826
|
+
|
|
9821
9827
|
if (e.$index === (editGood === null || editGood === void 0 ? void 0 : editGood.$index)) {
|
|
9822
9828
|
sum = sum.add(bignumber(editGood.taxAmount || 0));
|
|
9823
9829
|
} else {
|
|
@@ -10536,24 +10542,15 @@ var useEndowCode = (function (goods) {
|
|
|
10536
10542
|
}, _callee);
|
|
10537
10543
|
})), [controller, goods]);
|
|
10538
10544
|
|
|
10539
|
-
if (
|
|
10545
|
+
if ([LineAttributeType$1.正常, LineAttributeType$1.被折扣行, LineAttributeType$1.折扣行].indexOf(goods.lineAttribute) >= 0) {
|
|
10546
|
+
return {
|
|
10547
|
+
key: 'endowCode',
|
|
10548
|
+
title: '赋码',
|
|
10549
|
+
onClick: onClick
|
|
10550
|
+
};
|
|
10551
|
+
} else {
|
|
10540
10552
|
return undefined;
|
|
10541
10553
|
}
|
|
10542
|
-
|
|
10543
|
-
return {
|
|
10544
|
-
key: 'endowCode',
|
|
10545
|
-
title: '赋码',
|
|
10546
|
-
onClick: onClick
|
|
10547
|
-
}; // return React.useMemo(() => {
|
|
10548
|
-
// return (
|
|
10549
|
-
// <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
|
|
10550
|
-
// );
|
|
10551
|
-
// }, [goods.lineAttribute, onClick])
|
|
10552
|
-
// return React.useMemo(() => {
|
|
10553
|
-
// return (
|
|
10554
|
-
// <Button key="endowCode" type="link" onClick={onClick} >赋码</Button>
|
|
10555
|
-
// );
|
|
10556
|
-
// }, [goods.lineAttribute, onClick])
|
|
10557
10554
|
});
|
|
10558
10555
|
|
|
10559
10556
|
var css_248z$6 = ".ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:focus,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu {\n font-size: 16px;\n color: #000;\n text-align: center;\n padding: 0;\n}\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu.ktsAnt3x-dropdown-open {\n background: #ebebeb;\n border-radius: 9999px;\n}\n";
|
|
@@ -14704,11 +14701,11 @@ function useMergeDetails() {
|
|
|
14704
14701
|
var items = React.useMemo(function () {
|
|
14705
14702
|
return [{
|
|
14706
14703
|
key: '0',
|
|
14707
|
-
label: '
|
|
14704
|
+
label: '处理全部行',
|
|
14708
14705
|
onClick: onClickAuto
|
|
14709
14706
|
}, {
|
|
14710
14707
|
key: '1',
|
|
14711
|
-
label: '
|
|
14708
|
+
label: '处理选中行',
|
|
14712
14709
|
disabled: selectedGoodIndex.length <= 1,
|
|
14713
14710
|
onClick: onClickManual
|
|
14714
14711
|
}];
|
|
@@ -14825,63 +14822,41 @@ function useSalesDiscount() {
|
|
|
14825
14822
|
var selectedGoodIndex = controller.useMemo(function (s) {
|
|
14826
14823
|
return s.goodsListState.selectedGoodIndex;
|
|
14827
14824
|
}, []);
|
|
14828
|
-
var
|
|
14829
|
-
return s.goodsListState.
|
|
14825
|
+
var goodsList = controller.useMemo(function (s) {
|
|
14826
|
+
return s.goodsListState.goodsList;
|
|
14830
14827
|
}, []);
|
|
14831
14828
|
var isSalesDiscount = controller.useMemo(function (s) {
|
|
14832
14829
|
return s.goodsListState.isSalesDiscount;
|
|
14833
14830
|
}, []);
|
|
14834
14831
|
var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
14835
|
-
var selectedGood,
|
|
14836
|
-
|
|
14832
|
+
var selectedGood, concessions, discountGood, totalDiscoline, discolinesSum, totalAmount, discolines, surplus, i;
|
|
14837
14833
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
14838
14834
|
while (1) {
|
|
14839
14835
|
switch (_context3.prev = _context3.next) {
|
|
14840
14836
|
case 0:
|
|
14841
|
-
selectedGood =
|
|
14842
|
-
return
|
|
14843
|
-
});
|
|
14844
|
-
|
|
14845
|
-
if (!(selectedGood.filter(function (e) {
|
|
14846
|
-
return (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.折扣行 || (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.被折扣行;
|
|
14847
|
-
}).length > 0)) {
|
|
14848
|
-
_context3.next = 5;
|
|
14849
|
-
break;
|
|
14850
|
-
}
|
|
14851
|
-
|
|
14852
|
-
content = '不能选择折扣行和被折扣行';
|
|
14853
|
-
message.error({
|
|
14854
|
-
content: content,
|
|
14855
|
-
key: content
|
|
14837
|
+
selectedGood = goodsList.filter(function (e) {
|
|
14838
|
+
return e.lineAttribute === LineAttributeType$1.折让行 || e.lineAttribute === LineAttributeType$1.正常;
|
|
14856
14839
|
});
|
|
14857
|
-
return _context3.abrupt("return");
|
|
14858
|
-
|
|
14859
|
-
case 5:
|
|
14860
14840
|
/** 折让行 */
|
|
14861
|
-
concession = selectedGood.filter(function (e) {
|
|
14862
|
-
return (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.折让行;
|
|
14863
|
-
})[0];
|
|
14864
|
-
|
|
14865
|
-
if (concession) {
|
|
14866
|
-
_context3.next = 10;
|
|
14867
|
-
break;
|
|
14868
|
-
}
|
|
14869
14841
|
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
content: _content,
|
|
14873
|
-
key: _content
|
|
14842
|
+
concessions = selectedGood.filter(function (e) {
|
|
14843
|
+
return (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.折让行;
|
|
14874
14844
|
});
|
|
14875
|
-
return _context3.abrupt("return");
|
|
14876
|
-
|
|
14877
|
-
case 10:
|
|
14878
14845
|
/** 准备添加折扣的货物列表 */
|
|
14846
|
+
|
|
14879
14847
|
discountGood = selectedGood.filter(function (e) {
|
|
14880
14848
|
return (e === null || e === void 0 ? void 0 : e.lineAttribute) !== LineAttributeType$1.折让行;
|
|
14881
14849
|
});
|
|
14882
14850
|
/** 折扣总金额 */
|
|
14883
14851
|
|
|
14884
|
-
totalDiscoline =
|
|
14852
|
+
totalDiscoline = function () {
|
|
14853
|
+
var sum = chain$1(bignumber(0));
|
|
14854
|
+
concessions.forEach(function (e) {
|
|
14855
|
+
sum = sum.add(bignumber(-1 * (e.lineAmountIncludeTax || 0)));
|
|
14856
|
+
});
|
|
14857
|
+
return sum;
|
|
14858
|
+
}();
|
|
14859
|
+
|
|
14885
14860
|
discolinesSum = chain$1(bignumber(0));
|
|
14886
14861
|
/** 总金额 */
|
|
14887
14862
|
|
|
@@ -14911,38 +14886,40 @@ function useSalesDiscount() {
|
|
|
14911
14886
|
|
|
14912
14887
|
i = 0;
|
|
14913
14888
|
|
|
14914
|
-
case
|
|
14889
|
+
case 9:
|
|
14915
14890
|
if (!(i < discolines.length)) {
|
|
14916
|
-
_context3.next =
|
|
14891
|
+
_context3.next = 17;
|
|
14917
14892
|
break;
|
|
14918
14893
|
}
|
|
14919
14894
|
|
|
14920
14895
|
if (!surplus.smaller(0.01).done()) {
|
|
14921
|
-
_context3.next =
|
|
14896
|
+
_context3.next = 12;
|
|
14922
14897
|
break;
|
|
14923
14898
|
}
|
|
14924
14899
|
|
|
14925
|
-
return _context3.abrupt("break",
|
|
14900
|
+
return _context3.abrupt("break", 17);
|
|
14926
14901
|
|
|
14927
|
-
case
|
|
14902
|
+
case 12:
|
|
14928
14903
|
discolines[i] = chain$1(bignumber(discolines[i])).add(bignumber(0.01)).done().toNumber();
|
|
14929
14904
|
surplus = surplus.subtract(bignumber(0.01));
|
|
14930
14905
|
|
|
14931
|
-
case
|
|
14906
|
+
case 14:
|
|
14932
14907
|
i++;
|
|
14933
|
-
_context3.next =
|
|
14908
|
+
_context3.next = 9;
|
|
14934
14909
|
break;
|
|
14935
14910
|
|
|
14936
|
-
case
|
|
14937
|
-
_context3.next =
|
|
14911
|
+
case 17:
|
|
14912
|
+
_context3.next = 19;
|
|
14938
14913
|
return controller.run( /*#__PURE__*/function () {
|
|
14939
14914
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
14940
14915
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
14941
14916
|
while (1) {
|
|
14942
14917
|
switch (_context.prev = _context.next) {
|
|
14943
14918
|
case 0:
|
|
14944
|
-
|
|
14945
|
-
|
|
14919
|
+
concessions.forEach(function (concession) {
|
|
14920
|
+
s.goodsListState.goodsList = s.goodsListState.goodsList.filter(function (e) {
|
|
14921
|
+
return e.$index !== concession.$index;
|
|
14922
|
+
});
|
|
14946
14923
|
});
|
|
14947
14924
|
|
|
14948
14925
|
case 1:
|
|
@@ -14958,8 +14935,8 @@ function useSalesDiscount() {
|
|
|
14958
14935
|
};
|
|
14959
14936
|
}());
|
|
14960
14937
|
|
|
14961
|
-
case
|
|
14962
|
-
_context3.next =
|
|
14938
|
+
case 19:
|
|
14939
|
+
_context3.next = 21;
|
|
14963
14940
|
return controller.run( /*#__PURE__*/function () {
|
|
14964
14941
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
14965
14942
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -14981,8 +14958,8 @@ function useSalesDiscount() {
|
|
|
14981
14958
|
};
|
|
14982
14959
|
}());
|
|
14983
14960
|
|
|
14984
|
-
case
|
|
14985
|
-
_context3.next =
|
|
14961
|
+
case 21:
|
|
14962
|
+
_context3.next = 23;
|
|
14986
14963
|
return controller.addGoodDiscountV2(discolines.map(function (e, i) {
|
|
14987
14964
|
var _discountGood$i;
|
|
14988
14965
|
|
|
@@ -14992,20 +14969,25 @@ function useSalesDiscount() {
|
|
|
14992
14969
|
};
|
|
14993
14970
|
}));
|
|
14994
14971
|
|
|
14995
|
-
case
|
|
14972
|
+
case 23:
|
|
14996
14973
|
case "end":
|
|
14997
14974
|
return _context3.stop();
|
|
14998
14975
|
}
|
|
14999
14976
|
}
|
|
15000
14977
|
}, _callee3);
|
|
15001
|
-
})), [controller, selectedGoodIndex,
|
|
14978
|
+
})), [controller, selectedGoodIndex, goodsList]);
|
|
14979
|
+
var disabled = React.useMemo(function () {
|
|
14980
|
+
return goodsList.filter(function (e) {
|
|
14981
|
+
return e.lineAttribute === LineAttributeType$1.折让行;
|
|
14982
|
+
}).length <= 0;
|
|
14983
|
+
}, [goodsList]);
|
|
15002
14984
|
var button = React.useMemo(function () {
|
|
15003
14985
|
if (!isSalesDiscount) return React.createElement(React.Fragment, null);
|
|
15004
14986
|
return React.createElement(Button, {
|
|
15005
14987
|
onClick: onClick,
|
|
15006
|
-
disabled:
|
|
14988
|
+
disabled: disabled
|
|
15007
14989
|
}, "\u9500\u552E\u6298\u8BA9");
|
|
15008
|
-
}, [selectedGoodIndex.length, isSalesDiscount]);
|
|
14990
|
+
}, [selectedGoodIndex.length, isSalesDiscount, disabled]);
|
|
15009
14991
|
return {
|
|
15010
14992
|
/** 按钮 */
|
|
15011
14993
|
button: button
|
|
@@ -15164,12 +15146,12 @@ function useSalesGifts() {
|
|
|
15164
15146
|
var items = React.useMemo(function () {
|
|
15165
15147
|
return [{
|
|
15166
15148
|
key: '0',
|
|
15167
|
-
label: '
|
|
15149
|
+
label: '处理全部行',
|
|
15168
15150
|
disabled: giveaways.length <= 0,
|
|
15169
15151
|
onClick: onClickAuto
|
|
15170
15152
|
}, {
|
|
15171
15153
|
key: '1',
|
|
15172
|
-
label: '
|
|
15154
|
+
label: '处理选中行',
|
|
15173
15155
|
disabled: selectedGoodIndex.length <= 0,
|
|
15174
15156
|
onClick: onClickManual
|
|
15175
15157
|
}];
|
package/dist/index.js
CHANGED
|
@@ -9783,6 +9783,8 @@ var Statistics = (function () {
|
|
|
9783
9783
|
|
|
9784
9784
|
var err = (_s$goodsListState$for = (_s$goodsListState$for2 = s.goodsListState.form) === null || _s$goodsListState$for2 === void 0 ? void 0 : _s$goodsListState$for2.getFieldsError()) !== null && _s$goodsListState$for !== void 0 ? _s$goodsListState$for : {};
|
|
9785
9785
|
s.goodsListState.goodsList.forEach(function (e) {
|
|
9786
|
+
if (e.lineAttribute === LineAttributeType$1.赠品行) return;
|
|
9787
|
+
|
|
9786
9788
|
if (e.$index === (editGood === null || editGood === void 0 ? void 0 : editGood.$index)) {
|
|
9787
9789
|
if (!err.lineAmountIncludeTax) {
|
|
9788
9790
|
sum = sum.add(mathjs.bignumber(editGood.lineAmountIncludeTax || 0));
|
|
@@ -9807,6 +9809,8 @@ var Statistics = (function () {
|
|
|
9807
9809
|
|
|
9808
9810
|
var err = (_s$goodsListState$for3 = (_s$goodsListState$for4 = s.goodsListState.form) === null || _s$goodsListState$for4 === void 0 ? void 0 : _s$goodsListState$for4.getFieldsError()) !== null && _s$goodsListState$for3 !== void 0 ? _s$goodsListState$for3 : {};
|
|
9809
9811
|
s.goodsListState.goodsList.forEach(function (e) {
|
|
9812
|
+
if (e.lineAttribute === LineAttributeType$1.赠品行) return;
|
|
9813
|
+
|
|
9810
9814
|
if (e.$index === (editGood === null || editGood === void 0 ? void 0 : editGood.$index)) {
|
|
9811
9815
|
if (!err.lineAmountExcludeTax) {
|
|
9812
9816
|
sum = sum.add(mathjs.bignumber(editGood.lineAmountExcludeTax || 0));
|
|
@@ -9828,6 +9832,8 @@ var Statistics = (function () {
|
|
|
9828
9832
|
var editGood = s.goodsListState.editGood; // 正在编辑的货物
|
|
9829
9833
|
|
|
9830
9834
|
s.goodsListState.goodsList.forEach(function (e) {
|
|
9835
|
+
if (e.lineAttribute === LineAttributeType$1.赠品行) return;
|
|
9836
|
+
|
|
9831
9837
|
if (e.$index === (editGood === null || editGood === void 0 ? void 0 : editGood.$index)) {
|
|
9832
9838
|
sum = sum.add(mathjs.bignumber(editGood.taxAmount || 0));
|
|
9833
9839
|
} else {
|
|
@@ -10546,24 +10552,15 @@ var useEndowCode = (function (goods) {
|
|
|
10546
10552
|
}, _callee);
|
|
10547
10553
|
})), [controller, goods]);
|
|
10548
10554
|
|
|
10549
|
-
if (
|
|
10555
|
+
if ([LineAttributeType$1.正常, LineAttributeType$1.被折扣行, LineAttributeType$1.折扣行].indexOf(goods.lineAttribute) >= 0) {
|
|
10556
|
+
return {
|
|
10557
|
+
key: 'endowCode',
|
|
10558
|
+
title: '赋码',
|
|
10559
|
+
onClick: onClick
|
|
10560
|
+
};
|
|
10561
|
+
} else {
|
|
10550
10562
|
return undefined;
|
|
10551
10563
|
}
|
|
10552
|
-
|
|
10553
|
-
return {
|
|
10554
|
-
key: 'endowCode',
|
|
10555
|
-
title: '赋码',
|
|
10556
|
-
onClick: onClick
|
|
10557
|
-
}; // return React.useMemo(() => {
|
|
10558
|
-
// return (
|
|
10559
|
-
// <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
|
|
10560
|
-
// );
|
|
10561
|
-
// }, [goods.lineAttribute, onClick])
|
|
10562
|
-
// return React.useMemo(() => {
|
|
10563
|
-
// return (
|
|
10564
|
-
// <Button key="endowCode" type="link" onClick={onClick} >赋码</Button>
|
|
10565
|
-
// );
|
|
10566
|
-
// }, [goods.lineAttribute, onClick])
|
|
10567
10564
|
});
|
|
10568
10565
|
|
|
10569
10566
|
var css_248z$6 = ".ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:focus,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu {\n font-size: 16px;\n color: #000;\n text-align: center;\n padding: 0;\n}\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu:hover,\n.ktsAnt3x-btn.kts-invoice-operate-goods-list-columns-row-menu.ktsAnt3x-dropdown-open {\n background: #ebebeb;\n border-radius: 9999px;\n}\n";
|
|
@@ -14714,11 +14711,11 @@ function useMergeDetails() {
|
|
|
14714
14711
|
var items = React__default['default'].useMemo(function () {
|
|
14715
14712
|
return [{
|
|
14716
14713
|
key: '0',
|
|
14717
|
-
label: '
|
|
14714
|
+
label: '处理全部行',
|
|
14718
14715
|
onClick: onClickAuto
|
|
14719
14716
|
}, {
|
|
14720
14717
|
key: '1',
|
|
14721
|
-
label: '
|
|
14718
|
+
label: '处理选中行',
|
|
14722
14719
|
disabled: selectedGoodIndex.length <= 1,
|
|
14723
14720
|
onClick: onClickManual
|
|
14724
14721
|
}];
|
|
@@ -14835,63 +14832,41 @@ function useSalesDiscount() {
|
|
|
14835
14832
|
var selectedGoodIndex = controller.useMemo(function (s) {
|
|
14836
14833
|
return s.goodsListState.selectedGoodIndex;
|
|
14837
14834
|
}, []);
|
|
14838
|
-
var
|
|
14839
|
-
return s.goodsListState.
|
|
14835
|
+
var goodsList = controller.useMemo(function (s) {
|
|
14836
|
+
return s.goodsListState.goodsList;
|
|
14840
14837
|
}, []);
|
|
14841
14838
|
var isSalesDiscount = controller.useMemo(function (s) {
|
|
14842
14839
|
return s.goodsListState.isSalesDiscount;
|
|
14843
14840
|
}, []);
|
|
14844
14841
|
var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
14845
|
-
var selectedGood,
|
|
14846
|
-
|
|
14842
|
+
var selectedGood, concessions, discountGood, totalDiscoline, discolinesSum, totalAmount, discolines, surplus, i;
|
|
14847
14843
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
14848
14844
|
while (1) {
|
|
14849
14845
|
switch (_context3.prev = _context3.next) {
|
|
14850
14846
|
case 0:
|
|
14851
|
-
selectedGood =
|
|
14852
|
-
return
|
|
14853
|
-
});
|
|
14854
|
-
|
|
14855
|
-
if (!(selectedGood.filter(function (e) {
|
|
14856
|
-
return (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.折扣行 || (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.被折扣行;
|
|
14857
|
-
}).length > 0)) {
|
|
14858
|
-
_context3.next = 5;
|
|
14859
|
-
break;
|
|
14860
|
-
}
|
|
14861
|
-
|
|
14862
|
-
content = '不能选择折扣行和被折扣行';
|
|
14863
|
-
ktsComponentsAntdX3.message.error({
|
|
14864
|
-
content: content,
|
|
14865
|
-
key: content
|
|
14847
|
+
selectedGood = goodsList.filter(function (e) {
|
|
14848
|
+
return e.lineAttribute === LineAttributeType$1.折让行 || e.lineAttribute === LineAttributeType$1.正常;
|
|
14866
14849
|
});
|
|
14867
|
-
return _context3.abrupt("return");
|
|
14868
|
-
|
|
14869
|
-
case 5:
|
|
14870
14850
|
/** 折让行 */
|
|
14871
|
-
concession = selectedGood.filter(function (e) {
|
|
14872
|
-
return (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.折让行;
|
|
14873
|
-
})[0];
|
|
14874
|
-
|
|
14875
|
-
if (concession) {
|
|
14876
|
-
_context3.next = 10;
|
|
14877
|
-
break;
|
|
14878
|
-
}
|
|
14879
14851
|
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
content: _content,
|
|
14883
|
-
key: _content
|
|
14852
|
+
concessions = selectedGood.filter(function (e) {
|
|
14853
|
+
return (e === null || e === void 0 ? void 0 : e.lineAttribute) === LineAttributeType$1.折让行;
|
|
14884
14854
|
});
|
|
14885
|
-
return _context3.abrupt("return");
|
|
14886
|
-
|
|
14887
|
-
case 10:
|
|
14888
14855
|
/** 准备添加折扣的货物列表 */
|
|
14856
|
+
|
|
14889
14857
|
discountGood = selectedGood.filter(function (e) {
|
|
14890
14858
|
return (e === null || e === void 0 ? void 0 : e.lineAttribute) !== LineAttributeType$1.折让行;
|
|
14891
14859
|
});
|
|
14892
14860
|
/** 折扣总金额 */
|
|
14893
14861
|
|
|
14894
|
-
totalDiscoline =
|
|
14862
|
+
totalDiscoline = function () {
|
|
14863
|
+
var sum = mathjs.chain(mathjs.bignumber(0));
|
|
14864
|
+
concessions.forEach(function (e) {
|
|
14865
|
+
sum = sum.add(mathjs.bignumber(-1 * (e.lineAmountIncludeTax || 0)));
|
|
14866
|
+
});
|
|
14867
|
+
return sum;
|
|
14868
|
+
}();
|
|
14869
|
+
|
|
14895
14870
|
discolinesSum = mathjs.chain(mathjs.bignumber(0));
|
|
14896
14871
|
/** 总金额 */
|
|
14897
14872
|
|
|
@@ -14921,38 +14896,40 @@ function useSalesDiscount() {
|
|
|
14921
14896
|
|
|
14922
14897
|
i = 0;
|
|
14923
14898
|
|
|
14924
|
-
case
|
|
14899
|
+
case 9:
|
|
14925
14900
|
if (!(i < discolines.length)) {
|
|
14926
|
-
_context3.next =
|
|
14901
|
+
_context3.next = 17;
|
|
14927
14902
|
break;
|
|
14928
14903
|
}
|
|
14929
14904
|
|
|
14930
14905
|
if (!surplus.smaller(0.01).done()) {
|
|
14931
|
-
_context3.next =
|
|
14906
|
+
_context3.next = 12;
|
|
14932
14907
|
break;
|
|
14933
14908
|
}
|
|
14934
14909
|
|
|
14935
|
-
return _context3.abrupt("break",
|
|
14910
|
+
return _context3.abrupt("break", 17);
|
|
14936
14911
|
|
|
14937
|
-
case
|
|
14912
|
+
case 12:
|
|
14938
14913
|
discolines[i] = mathjs.chain(mathjs.bignumber(discolines[i])).add(mathjs.bignumber(0.01)).done().toNumber();
|
|
14939
14914
|
surplus = surplus.subtract(mathjs.bignumber(0.01));
|
|
14940
14915
|
|
|
14941
|
-
case
|
|
14916
|
+
case 14:
|
|
14942
14917
|
i++;
|
|
14943
|
-
_context3.next =
|
|
14918
|
+
_context3.next = 9;
|
|
14944
14919
|
break;
|
|
14945
14920
|
|
|
14946
|
-
case
|
|
14947
|
-
_context3.next =
|
|
14921
|
+
case 17:
|
|
14922
|
+
_context3.next = 19;
|
|
14948
14923
|
return controller.run( /*#__PURE__*/function () {
|
|
14949
14924
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
14950
14925
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
14951
14926
|
while (1) {
|
|
14952
14927
|
switch (_context.prev = _context.next) {
|
|
14953
14928
|
case 0:
|
|
14954
|
-
|
|
14955
|
-
|
|
14929
|
+
concessions.forEach(function (concession) {
|
|
14930
|
+
s.goodsListState.goodsList = s.goodsListState.goodsList.filter(function (e) {
|
|
14931
|
+
return e.$index !== concession.$index;
|
|
14932
|
+
});
|
|
14956
14933
|
});
|
|
14957
14934
|
|
|
14958
14935
|
case 1:
|
|
@@ -14968,8 +14945,8 @@ function useSalesDiscount() {
|
|
|
14968
14945
|
};
|
|
14969
14946
|
}());
|
|
14970
14947
|
|
|
14971
|
-
case
|
|
14972
|
-
_context3.next =
|
|
14948
|
+
case 19:
|
|
14949
|
+
_context3.next = 21;
|
|
14973
14950
|
return controller.run( /*#__PURE__*/function () {
|
|
14974
14951
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
14975
14952
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -14991,8 +14968,8 @@ function useSalesDiscount() {
|
|
|
14991
14968
|
};
|
|
14992
14969
|
}());
|
|
14993
14970
|
|
|
14994
|
-
case
|
|
14995
|
-
_context3.next =
|
|
14971
|
+
case 21:
|
|
14972
|
+
_context3.next = 23;
|
|
14996
14973
|
return controller.addGoodDiscountV2(discolines.map(function (e, i) {
|
|
14997
14974
|
var _discountGood$i;
|
|
14998
14975
|
|
|
@@ -15002,20 +14979,25 @@ function useSalesDiscount() {
|
|
|
15002
14979
|
};
|
|
15003
14980
|
}));
|
|
15004
14981
|
|
|
15005
|
-
case
|
|
14982
|
+
case 23:
|
|
15006
14983
|
case "end":
|
|
15007
14984
|
return _context3.stop();
|
|
15008
14985
|
}
|
|
15009
14986
|
}
|
|
15010
14987
|
}, _callee3);
|
|
15011
|
-
})), [controller, selectedGoodIndex,
|
|
14988
|
+
})), [controller, selectedGoodIndex, goodsList]);
|
|
14989
|
+
var disabled = React__default['default'].useMemo(function () {
|
|
14990
|
+
return goodsList.filter(function (e) {
|
|
14991
|
+
return e.lineAttribute === LineAttributeType$1.折让行;
|
|
14992
|
+
}).length <= 0;
|
|
14993
|
+
}, [goodsList]);
|
|
15012
14994
|
var button = React__default['default'].useMemo(function () {
|
|
15013
14995
|
if (!isSalesDiscount) return React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
15014
14996
|
return React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
15015
14997
|
onClick: onClick,
|
|
15016
|
-
disabled:
|
|
14998
|
+
disabled: disabled
|
|
15017
14999
|
}, "\u9500\u552E\u6298\u8BA9");
|
|
15018
|
-
}, [selectedGoodIndex.length, isSalesDiscount]);
|
|
15000
|
+
}, [selectedGoodIndex.length, isSalesDiscount, disabled]);
|
|
15019
15001
|
return {
|
|
15020
15002
|
/** 按钮 */
|
|
15021
15003
|
button: button
|
|
@@ -15174,12 +15156,12 @@ function useSalesGifts() {
|
|
|
15174
15156
|
var items = React__default['default'].useMemo(function () {
|
|
15175
15157
|
return [{
|
|
15176
15158
|
key: '0',
|
|
15177
|
-
label: '
|
|
15159
|
+
label: '处理全部行',
|
|
15178
15160
|
disabled: giveaways.length <= 0,
|
|
15179
15161
|
onClick: onClickAuto
|
|
15180
15162
|
}, {
|
|
15181
15163
|
key: '1',
|
|
15182
|
-
label: '
|
|
15164
|
+
label: '处理选中行',
|
|
15183
15165
|
disabled: selectedGoodIndex.length <= 0,
|
|
15184
15166
|
onClick: onClickManual
|
|
15185
15167
|
}];
|
package/package.json
CHANGED
|
@@ -65,6 +65,7 @@ class MyController1 extends Invoice.InvoiceController {
|
|
|
65
65
|
super()
|
|
66
66
|
this.state.model = 'default'
|
|
67
67
|
this.state.goodsListState.isMergeDetails = true;
|
|
68
|
+
this.state.goodsListState.isSalesDiscount = true;
|
|
68
69
|
this.state.goodsListState.drag.isStart = true;
|
|
69
70
|
this.state.goodsListState.columnshide = [];
|
|
70
71
|
}
|
|
@@ -92,6 +93,7 @@ class MyController2 extends Invoice.InvoiceController {
|
|
|
92
93
|
super()
|
|
93
94
|
this.state.model = 'prefab'
|
|
94
95
|
this.state.goodsListState.isMergeDetails = true;
|
|
96
|
+
this.state.goodsListState.isSalesDiscount = true;
|
|
95
97
|
this.state.goodsListState.drag.isStart = true;
|
|
96
98
|
this.state.goodsListState.columnshide = [];
|
|
97
99
|
}
|
|
@@ -155,7 +157,8 @@ const lines: any[] = [
|
|
|
155
157
|
"favouredPolicyName": null,
|
|
156
158
|
"zeroTaxRateFlag": null,
|
|
157
159
|
"referenceLines": null,
|
|
158
|
-
"version": 0
|
|
160
|
+
"version": 0,
|
|
161
|
+
taxAmount:1
|
|
159
162
|
},
|
|
160
163
|
{
|
|
161
164
|
"serialNumber": "1714491422279110656",
|
|
@@ -179,7 +182,8 @@ const lines: any[] = [
|
|
|
179
182
|
"favouredPolicyName": null,
|
|
180
183
|
"zeroTaxRateFlag": null,
|
|
181
184
|
"referenceLines": null,
|
|
182
|
-
"version": 0
|
|
185
|
+
"version": 0,
|
|
186
|
+
taxAmount:1
|
|
183
187
|
},
|
|
184
188
|
{
|
|
185
189
|
"serialNumber": "1714491422279110656",
|
|
@@ -203,8 +207,84 @@ const lines: any[] = [
|
|
|
203
207
|
"favouredPolicyName": null,
|
|
204
208
|
"zeroTaxRateFlag": null,
|
|
205
209
|
"referenceLines": null,
|
|
206
|
-
"version": 0
|
|
207
|
-
|
|
210
|
+
"version": 0,
|
|
211
|
+
taxAmount:1
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"serialNumber": "1714491422279110656",
|
|
215
|
+
"lineNumber": 3,
|
|
216
|
+
"taxCode": "3070401000000000000",
|
|
217
|
+
"taxName": "信息技术服务",
|
|
218
|
+
"specification": null,
|
|
219
|
+
"itemName": "技术服务费",
|
|
220
|
+
"itemCode": null,
|
|
221
|
+
"unit": "套",
|
|
222
|
+
"quantity": 1,
|
|
223
|
+
"taxRate": 0.06,
|
|
224
|
+
"priceExcludeTax": 2,
|
|
225
|
+
"priceIncludeTax": 2.12,
|
|
226
|
+
"amountTax": 0.12,
|
|
227
|
+
"lineAmountExcludeTax": 5,
|
|
228
|
+
"lineAmountIncludeTax": 5.3,
|
|
229
|
+
"lineAttribute": LineAttributeType.折让行,
|
|
230
|
+
"discountGroup": null,
|
|
231
|
+
"favouredPolicyMark": false,
|
|
232
|
+
"favouredPolicyName": null,
|
|
233
|
+
"zeroTaxRateFlag": null,
|
|
234
|
+
"referenceLines": null,
|
|
235
|
+
"version": 0,
|
|
236
|
+
taxAmount:1
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"serialNumber": "1714491422279110656",
|
|
240
|
+
"lineNumber": 3,
|
|
241
|
+
"taxCode": "3070401000000000000",
|
|
242
|
+
"taxName": "信息技术服务",
|
|
243
|
+
"specification": null,
|
|
244
|
+
"itemName": "技术服务费",
|
|
245
|
+
"itemCode": null,
|
|
246
|
+
"unit": "套",
|
|
247
|
+
"quantity": 1,
|
|
248
|
+
"taxRate": 0.06,
|
|
249
|
+
"priceExcludeTax": 2,
|
|
250
|
+
"priceIncludeTax": 2.12,
|
|
251
|
+
"amountTax": 0.12,
|
|
252
|
+
"lineAmountExcludeTax": 5,
|
|
253
|
+
"lineAmountIncludeTax": 5.3,
|
|
254
|
+
"lineAttribute": LineAttributeType.折让行,
|
|
255
|
+
"discountGroup": null,
|
|
256
|
+
"favouredPolicyMark": false,
|
|
257
|
+
"favouredPolicyName": null,
|
|
258
|
+
"zeroTaxRateFlag": null,
|
|
259
|
+
"referenceLines": null,
|
|
260
|
+
"version": 0,
|
|
261
|
+
taxAmount:1
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"serialNumber": "1714491422279110656",
|
|
265
|
+
"lineNumber": 3,
|
|
266
|
+
"taxCode": "3070401000000000000",
|
|
267
|
+
"taxName": "信息技术服务",
|
|
268
|
+
"specification": null,
|
|
269
|
+
"itemName": "技术服务费",
|
|
270
|
+
"itemCode": null,
|
|
271
|
+
"unit": "套",
|
|
272
|
+
"quantity": 1,
|
|
273
|
+
"taxRate": 0.06,
|
|
274
|
+
"priceExcludeTax": 2,
|
|
275
|
+
"priceIncludeTax": 2.12,
|
|
276
|
+
"amountTax": 0.12,
|
|
277
|
+
"lineAmountExcludeTax": 5,
|
|
278
|
+
"lineAmountIncludeTax": 5.3,
|
|
279
|
+
"lineAttribute": LineAttributeType.赠品行,
|
|
280
|
+
"discountGroup": null,
|
|
281
|
+
"favouredPolicyMark": false,
|
|
282
|
+
"favouredPolicyName": null,
|
|
283
|
+
"zeroTaxRateFlag": null,
|
|
284
|
+
"referenceLines": null,
|
|
285
|
+
"version": 0,
|
|
286
|
+
taxAmount:1
|
|
287
|
+
}
|
|
208
288
|
]
|
|
209
289
|
|
|
210
290
|
const moke = [
|
package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/RowMenu/hook/useEndowCode/index.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
// import { Button } from 'kts-components-antd-x3';
|
|
3
2
|
import Invoice from '../../../../../../../../..';
|
|
4
|
-
import { IGood, LineAttributeType } from '../../../../../../../../../InvoiceController';
|
|
5
3
|
import { endowCode } from '../../../../autoFillFn';
|
|
4
|
+
import { IGood, LineAttributeType } from '../../../../../../../../../InvoiceController';
|
|
6
5
|
|
|
7
6
|
// const { Text } = Typography;
|
|
8
7
|
|
|
@@ -14,25 +13,13 @@ export default (goods: IGood) => {
|
|
|
14
13
|
endowCode(controller, goods);
|
|
15
14
|
}, [controller, goods]);
|
|
16
15
|
|
|
17
|
-
if (goods.lineAttribute
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
if ([LineAttributeType.正常, LineAttributeType.被折扣行, LineAttributeType.折扣行].indexOf(goods.lineAttribute) >= 0) {
|
|
17
|
+
return {
|
|
18
|
+
key: 'endowCode',
|
|
19
|
+
title: '赋码',
|
|
20
|
+
onClick,
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
return undefined
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
// return React.useMemo(() => {
|
|
28
|
-
// return (
|
|
29
|
-
// <Menu.Item key="endowCode" onClick={onClick} ><Text strong>赋码</Text></Menu.Item>
|
|
30
|
-
// );
|
|
31
|
-
// }, [goods.lineAttribute, onClick])
|
|
32
|
-
|
|
33
|
-
// return React.useMemo(() => {
|
|
34
|
-
// return (
|
|
35
|
-
// <Button key="endowCode" type="link" onClick={onClick} >赋码</Button>
|
|
36
|
-
// );
|
|
37
|
-
// }, [goods.lineAttribute, onClick])
|
|
38
25
|
};
|
|
@@ -40,7 +40,7 @@ export default () => {
|
|
|
40
40
|
await controller.pipeline(async s => {
|
|
41
41
|
const seeGoodsIndex = controller.getGoodsSearch(s.goodsListState.goodsList, s.goodsListState.searchValue, s.goodsListState.isTaxIncluded).map(e => e.$index)
|
|
42
42
|
|
|
43
|
-
s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e
|
|
43
|
+
s.goodsListState.selectedGoodIndex = s.goodsListState.selectedGoodIndex.filter(e => !seeGoodsIndex.some(t => e === t));
|
|
44
44
|
})()
|
|
45
45
|
} else {
|
|
46
46
|
await controller.pipeline(async s => {
|
|
@@ -84,12 +84,15 @@ export default () => {
|
|
|
84
84
|
await controller.pipeline(async s => {
|
|
85
85
|
s.goodsListState.selectedGoodIndex.forEach($index => {
|
|
86
86
|
const goods = s.goodsListState.goodsMap.get($index);
|
|
87
|
+
|
|
88
|
+
|
|
87
89
|
if (!goods || (goods.lineAttribute !== LineAttributeType.折扣行 && goods.lineAttribute !== LineAttributeType.被折扣行)) return;
|
|
88
90
|
|
|
89
91
|
// 数组位置
|
|
90
92
|
let t = s.goodsListState.goodsList.indexOf(goods);
|
|
91
93
|
goods.lineAttribute === LineAttributeType.折扣行 ? t-- : t++;
|
|
92
94
|
const i = s.goodsListState.goodsList[t].$index;
|
|
95
|
+
|
|
93
96
|
if (selected) {
|
|
94
97
|
if (s.goodsListState.selectedGoodIndex.indexOf(i) < 0) s.goodsListState.selectedGoodIndex = [...s.goodsListState.selectedGoodIndex, i];
|
|
95
98
|
} else {
|
|
@@ -36,11 +36,11 @@ export default function useMergeDetails() {
|
|
|
36
36
|
return [
|
|
37
37
|
{
|
|
38
38
|
key: '0',
|
|
39
|
-
label: '
|
|
39
|
+
label: '处理全部行',
|
|
40
40
|
onClick: onClickAuto,
|
|
41
41
|
}, {
|
|
42
42
|
key: '1',
|
|
43
|
-
label: '
|
|
43
|
+
label: '处理选中行',
|
|
44
44
|
disabled: selectedGoodIndex.length <= 1,
|
|
45
45
|
onClick: onClickManual,
|
|
46
46
|
},
|
|
@@ -12,32 +12,25 @@ export default function useSalesDiscount() {
|
|
|
12
12
|
|
|
13
13
|
const selectedGoodIndex = controller.useMemo(s => s.goodsListState.selectedGoodIndex, []);
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const goodsList = controller.useMemo(s => s.goodsListState.goodsList, []);
|
|
16
16
|
|
|
17
17
|
const isSalesDiscount = controller.useMemo(s => s.goodsListState.isSalesDiscount, []);
|
|
18
18
|
|
|
19
19
|
const onClick = React.useCallback(async () => {
|
|
20
|
-
const selectedGood =
|
|
21
|
-
|
|
22
|
-
if (selectedGood.filter(e => e?.lineAttribute === LineAttributeType.折扣行 || e?.lineAttribute === LineAttributeType.被折扣行).length > 0) {
|
|
23
|
-
const content = '不能选择折扣行和被折扣行';
|
|
24
|
-
message.error({ content, key: content });
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
20
|
+
const selectedGood = goodsList.filter(e => e.lineAttribute === LineAttributeType.折让行 || e.lineAttribute === LineAttributeType.正常);
|
|
27
21
|
|
|
28
22
|
/** 折让行 */
|
|
29
|
-
const
|
|
30
|
-
if (!concession) {
|
|
31
|
-
const content = '未选择折让行';
|
|
32
|
-
message.error({ content, key: content })
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
23
|
+
const concessions = selectedGood.filter(e => e?.lineAttribute === LineAttributeType.折让行);
|
|
35
24
|
|
|
36
25
|
/** 准备添加折扣的货物列表 */
|
|
37
26
|
const discountGood = selectedGood.filter(e => e?.lineAttribute !== LineAttributeType.折让行);
|
|
38
27
|
|
|
39
28
|
/** 折扣总金额 */
|
|
40
|
-
const totalDiscoline =
|
|
29
|
+
const totalDiscoline = (() => {
|
|
30
|
+
let sum = chain(bignumber(0));
|
|
31
|
+
concessions.forEach(e => { sum = sum.add(bignumber(-1 * (e.lineAmountIncludeTax || 0))) })
|
|
32
|
+
return sum;
|
|
33
|
+
})()
|
|
41
34
|
|
|
42
35
|
let discolinesSum = chain(bignumber(0));
|
|
43
36
|
|
|
@@ -79,7 +72,11 @@ export default function useSalesDiscount() {
|
|
|
79
72
|
}
|
|
80
73
|
|
|
81
74
|
// 清楚折让行
|
|
82
|
-
await controller.run(async s => {
|
|
75
|
+
await controller.run(async s => {
|
|
76
|
+
concessions.forEach(concession => {
|
|
77
|
+
s.goodsListState.goodsList = s.goodsListState.goodsList.filter(e => e.$index !== concession.$index)
|
|
78
|
+
})
|
|
79
|
+
})
|
|
83
80
|
await controller.run(async s => { s.goodsListState.selectedGoodIndex = [] });
|
|
84
81
|
|
|
85
82
|
// 给一组货物添加折扣行
|
|
@@ -89,19 +86,21 @@ export default function useSalesDiscount() {
|
|
|
89
86
|
discolineAmountunt: e as number,
|
|
90
87
|
}
|
|
91
88
|
}))
|
|
92
|
-
}, [controller, selectedGoodIndex,
|
|
89
|
+
}, [controller, selectedGoodIndex, goodsList])
|
|
90
|
+
|
|
91
|
+
const disabled = React.useMemo(() => goodsList.filter(e => e.lineAttribute === LineAttributeType.折让行).length <= 0, [goodsList])
|
|
93
92
|
|
|
94
93
|
const button = React.useMemo(() => {
|
|
95
94
|
if (!isSalesDiscount) return <></>;
|
|
96
95
|
return (
|
|
97
96
|
<Button
|
|
98
97
|
onClick={onClick}
|
|
99
|
-
disabled={
|
|
98
|
+
disabled={disabled}
|
|
100
99
|
>
|
|
101
100
|
销售折让
|
|
102
101
|
</Button>
|
|
103
102
|
)
|
|
104
|
-
}, [selectedGoodIndex.length, isSalesDiscount])
|
|
103
|
+
}, [selectedGoodIndex.length, isSalesDiscount, disabled])
|
|
105
104
|
|
|
106
105
|
return {
|
|
107
106
|
/** 按钮 */
|
|
@@ -46,12 +46,12 @@ export default function useSalesGifts() {
|
|
|
46
46
|
return [
|
|
47
47
|
{
|
|
48
48
|
key: '0',
|
|
49
|
-
label: '
|
|
49
|
+
label: '处理全部行',
|
|
50
50
|
disabled: giveaways.length <= 0,
|
|
51
51
|
onClick: onClickAuto,
|
|
52
52
|
}, {
|
|
53
53
|
key: '1',
|
|
54
|
-
label: '
|
|
54
|
+
label: '处理选中行',
|
|
55
55
|
disabled: selectedGoodIndex.length <= 0,
|
|
56
56
|
onClick: onClickManual,
|
|
57
57
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { } from 'kts-components-antd-x3';
|
|
3
3
|
import { chain, bignumber } from 'mathjs';
|
|
4
|
+
import { LineAttributeType } from '../../../../../../Invoice/InvoiceController';
|
|
4
5
|
import Invoice from '../../../../..';
|
|
5
6
|
import './index.less';
|
|
6
7
|
|
|
@@ -23,6 +24,7 @@ export default () => {
|
|
|
23
24
|
const err = s.goodsListState.form?.getFieldsError() ?? {};
|
|
24
25
|
|
|
25
26
|
s.goodsListState.goodsList.forEach((e) => {
|
|
27
|
+
if (e.lineAttribute === LineAttributeType.赠品行) return;
|
|
26
28
|
if (e.$index === editGood?.$index) {
|
|
27
29
|
if (!err.lineAmountIncludeTax) {
|
|
28
30
|
sum = sum.add(bignumber(editGood.lineAmountIncludeTax || 0));
|
|
@@ -45,6 +47,7 @@ export default () => {
|
|
|
45
47
|
const err = s.goodsListState.form?.getFieldsError() ?? {};
|
|
46
48
|
|
|
47
49
|
s.goodsListState.goodsList.forEach((e) => {
|
|
50
|
+
if (e.lineAttribute === LineAttributeType.赠品行) return;
|
|
48
51
|
if (e.$index === editGood?.$index) {
|
|
49
52
|
if (!err.lineAmountExcludeTax) {
|
|
50
53
|
sum = sum.add(bignumber(editGood.lineAmountExcludeTax || 0));
|
|
@@ -65,6 +68,7 @@ export default () => {
|
|
|
65
68
|
let sum = chain(bignumber(0));
|
|
66
69
|
const editGood = s.goodsListState.editGood; // 正在编辑的货物
|
|
67
70
|
s.goodsListState.goodsList.forEach((e) => {
|
|
71
|
+
if (e.lineAttribute === LineAttributeType.赠品行) return;
|
|
68
72
|
if (e.$index === editGood?.$index) {
|
|
69
73
|
sum = sum.add(bignumber(editGood.taxAmount || 0));
|
|
70
74
|
} else {
|
|
@@ -34,7 +34,7 @@ const Main = decorator<ISellerProps, ISellerProps & FormComponentProps>(Form.cre
|
|
|
34
34
|
const controller = Invoice.useInvoiceController();
|
|
35
35
|
|
|
36
36
|
/** 控制器 */
|
|
37
|
-
const model = controller.useMemo(s => s.model, [])
|
|
37
|
+
const model = controller.useMemo(s => s.model, []);
|
|
38
38
|
|
|
39
39
|
/** 注册 form 对象 */
|
|
40
40
|
controller.useForm('seller', form);
|