kts-component-invoice-operate 3.2.70 → 3.2.72
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 +2 -0
- package/dist/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesGifts/index.d.ts +1 -1
- package/dist/index.esm.js +137 -8
- package/dist/index.js +136 -7
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
- package/src/Invoice/ui/default/GoodsList/ui/BulkMenu/hooks/useSalesGifts/index.tsx +46 -7
- package/src/Invoice/ui/digtal/Stakeholder/index.tsx +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import GreyReactBox, { decorator } from 'grey-react-box';
|
|
|
4
4
|
import { chain as chain$1, bignumber, create, all } from 'mathjs';
|
|
5
5
|
import { message, Form, Input, Icon as Icon$1, Tag as Tag$1, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete as AutoComplete$2, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover as Popover$1, Table as Table$1, Tree, Modal as Modal$1, Row as Row$1, Col as Col$1 } from 'kts-components-antd-x3';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
|
-
import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Popover, Dropdown as Dropdown$1, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal } from 'kts-xui';
|
|
7
|
+
import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Popover, Dropdown as Dropdown$1, Row, Col, Button as Button$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Input as Input$1, Select as Select$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal } from 'kts-xui';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { Table } from 'kts-components-antd-x4-v4';
|
|
10
10
|
import { render } from 'react-dom';
|
|
@@ -1089,6 +1089,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1089
1089
|
this.isMergeDetails = false;
|
|
1090
1090
|
this.isMergeDiscount = false;
|
|
1091
1091
|
this.isSalesDiscount = false;
|
|
1092
|
+
this.isSalesGifts = false;
|
|
1092
1093
|
this.addComparisonIndex = void 0;
|
|
1093
1094
|
this.drag = new Drag();
|
|
1094
1095
|
});
|
|
@@ -14965,6 +14966,12 @@ function useSalesDiscount() {
|
|
|
14965
14966
|
|
|
14966
14967
|
function useSalesGifts() {
|
|
14967
14968
|
var controller = Invoice.useInvoiceController();
|
|
14969
|
+
var isSalesGifts = controller.useMemo(function (s) {
|
|
14970
|
+
return s.goodsListState.isSalesGifts;
|
|
14971
|
+
}, []);
|
|
14972
|
+
var selectedGoodIndex = controller.useMemo(function (s) {
|
|
14973
|
+
return s.goodsListState.selectedGoodIndex;
|
|
14974
|
+
}, []);
|
|
14968
14975
|
var goodsList = controller.useMemo(function (s) {
|
|
14969
14976
|
return s.goodsListState.goodsList;
|
|
14970
14977
|
}, []);
|
|
@@ -14973,7 +14980,7 @@ function useSalesGifts() {
|
|
|
14973
14980
|
return e.lineAttribute === LineAttributeType$1.赠品行;
|
|
14974
14981
|
});
|
|
14975
14982
|
}, [goodsList]);
|
|
14976
|
-
var
|
|
14983
|
+
var onClickAuto = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
14977
14984
|
var _iterator, _step, g;
|
|
14978
14985
|
|
|
14979
14986
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -15027,12 +15034,105 @@ function useSalesGifts() {
|
|
|
15027
15034
|
}
|
|
15028
15035
|
}, _callee, null, [[1, 12, 15, 18]]);
|
|
15029
15036
|
})), [controller, giveaways]);
|
|
15037
|
+
var onClickManual = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
15038
|
+
var _controller$state$goo, goodsMap, selectedGoodIndex, giveaways, content, _iterator2, _step2, g;
|
|
15039
|
+
|
|
15040
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
15041
|
+
while (1) {
|
|
15042
|
+
switch (_context2.prev = _context2.next) {
|
|
15043
|
+
case 0:
|
|
15044
|
+
_controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
|
|
15045
|
+
giveaways = selectedGoodIndex.map(function (e) {
|
|
15046
|
+
return goodsMap.get(e);
|
|
15047
|
+
}).filter(function (e) {
|
|
15048
|
+
return !!e;
|
|
15049
|
+
});
|
|
15050
|
+
|
|
15051
|
+
if (!(giveaways.some(function (e) {
|
|
15052
|
+
return e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行;
|
|
15053
|
+
}) === false)) {
|
|
15054
|
+
_context2.next = 5;
|
|
15055
|
+
break;
|
|
15056
|
+
}
|
|
15057
|
+
|
|
15058
|
+
content = '只能选择‘赠品行’和‘正常行’';
|
|
15059
|
+
return _context2.abrupt("return", message.error({
|
|
15060
|
+
content: content,
|
|
15061
|
+
key: content
|
|
15062
|
+
}));
|
|
15063
|
+
|
|
15064
|
+
case 5:
|
|
15065
|
+
_iterator2 = _createForOfIteratorHelper(giveaways);
|
|
15066
|
+
_context2.prev = 6;
|
|
15067
|
+
|
|
15068
|
+
_iterator2.s();
|
|
15069
|
+
|
|
15070
|
+
case 8:
|
|
15071
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
15072
|
+
_context2.next = 14;
|
|
15073
|
+
break;
|
|
15074
|
+
}
|
|
15075
|
+
|
|
15076
|
+
g = _step2.value;
|
|
15077
|
+
_context2.next = 12;
|
|
15078
|
+
return controller.addGoodDiscountV2([{
|
|
15079
|
+
$index: g.$index,
|
|
15080
|
+
discolineAmountunt: g.lineAmountIncludeTax || 0
|
|
15081
|
+
}]);
|
|
15082
|
+
|
|
15083
|
+
case 12:
|
|
15084
|
+
_context2.next = 8;
|
|
15085
|
+
break;
|
|
15086
|
+
|
|
15087
|
+
case 14:
|
|
15088
|
+
_context2.next = 19;
|
|
15089
|
+
break;
|
|
15090
|
+
|
|
15091
|
+
case 16:
|
|
15092
|
+
_context2.prev = 16;
|
|
15093
|
+
_context2.t0 = _context2["catch"](6);
|
|
15094
|
+
|
|
15095
|
+
_iterator2.e(_context2.t0);
|
|
15096
|
+
|
|
15097
|
+
case 19:
|
|
15098
|
+
_context2.prev = 19;
|
|
15099
|
+
|
|
15100
|
+
_iterator2.f();
|
|
15101
|
+
|
|
15102
|
+
return _context2.finish(19);
|
|
15103
|
+
|
|
15104
|
+
case 22:
|
|
15105
|
+
controller.state.goodsListState.selectedGoodIndex = [];
|
|
15106
|
+
|
|
15107
|
+
case 23:
|
|
15108
|
+
case "end":
|
|
15109
|
+
return _context2.stop();
|
|
15110
|
+
}
|
|
15111
|
+
}
|
|
15112
|
+
}, _callee2, null, [[6, 16, 19, 22]]);
|
|
15113
|
+
})), [controller]);
|
|
15114
|
+
var items = React.useMemo(function () {
|
|
15115
|
+
return [{
|
|
15116
|
+
key: '0',
|
|
15117
|
+
label: '自动转换',
|
|
15118
|
+
disabled: giveaways.length <= 0,
|
|
15119
|
+
onClick: onClickAuto
|
|
15120
|
+
}, {
|
|
15121
|
+
key: '1',
|
|
15122
|
+
label: '手动转换',
|
|
15123
|
+
disabled: selectedGoodIndex.length <= 0,
|
|
15124
|
+
onClick: onClickManual
|
|
15125
|
+
}];
|
|
15126
|
+
}, [selectedGoodIndex, onClickManual, onClickAuto]);
|
|
15030
15127
|
var button = React.useMemo(function () {
|
|
15031
|
-
if (
|
|
15032
|
-
return React.createElement(
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15128
|
+
if (!isSalesGifts) return;
|
|
15129
|
+
return React.createElement(Dropdown$1, {
|
|
15130
|
+
menu: {
|
|
15131
|
+
items: items
|
|
15132
|
+
},
|
|
15133
|
+
trigger: ['click']
|
|
15134
|
+
}, React.createElement(Button, null, "\u9500\u552E\u8D60\u54C1"));
|
|
15135
|
+
}, [items, isSalesGifts]);
|
|
15036
15136
|
return {
|
|
15037
15137
|
/** 按钮 */
|
|
15038
15138
|
button: button
|
|
@@ -16195,6 +16295,13 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
|
|
|
16195
16295
|
gutter: [16, 0]
|
|
16196
16296
|
}, React.createElement(Col, {
|
|
16197
16297
|
span: 24
|
|
16298
|
+
}, React.createElement(Form.Item, {
|
|
16299
|
+
label: "\u8D2D\u4E70\u65B9\u4FE1\u606F",
|
|
16300
|
+
colon: false
|
|
16301
|
+
}, getFieldDecorator('naturalPersonFlag', {})(React.createElement(NaturalPersonFlag, {
|
|
16302
|
+
readOnly: isReadOnly('naturalPersonFlag')
|
|
16303
|
+
})))), React.createElement(Col, {
|
|
16304
|
+
span: 24
|
|
16198
16305
|
}, React.createElement(Form.Item, {
|
|
16199
16306
|
label: "\u540D\u79F0",
|
|
16200
16307
|
colon: false
|
|
@@ -16210,7 +16317,8 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
|
|
|
16210
16317
|
type: 'link',
|
|
16211
16318
|
style: {
|
|
16212
16319
|
padding: 0,
|
|
16213
|
-
width: 20
|
|
16320
|
+
width: 20,
|
|
16321
|
+
height: '100%'
|
|
16214
16322
|
},
|
|
16215
16323
|
icon: React.createElement(Icon, {
|
|
16216
16324
|
component: SvgPlus
|
|
@@ -16377,6 +16485,27 @@ var Stakeholder$1 = decorator(Form.create())(function (props) {
|
|
|
16377
16485
|
})))))))));
|
|
16378
16486
|
});
|
|
16379
16487
|
|
|
16488
|
+
function NaturalPersonFlag(props) {
|
|
16489
|
+
var _React$useState3 = React.useState(props.value || 0),
|
|
16490
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
16491
|
+
value = _React$useState4[0],
|
|
16492
|
+
setValue = _React$useState4[1];
|
|
16493
|
+
|
|
16494
|
+
var onChange = React.useCallback(function (e) {
|
|
16495
|
+
if (props.readOnly) return;
|
|
16496
|
+
setValue(e.target.checked ? 1 : 0);
|
|
16497
|
+
props.onChange && props.onChange(e.target.checked ? 1 : 0);
|
|
16498
|
+
}, [props.onChange, props.readOnly]);
|
|
16499
|
+
React.useEffect(function () {
|
|
16500
|
+
setValue(props.value || 0);
|
|
16501
|
+
}, [props.value]);
|
|
16502
|
+
return React.createElement(Checkbox$1, {
|
|
16503
|
+
disabled: props.readOnly,
|
|
16504
|
+
checked: value === 1,
|
|
16505
|
+
onChange: onChange
|
|
16506
|
+
}, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
|
|
16507
|
+
}
|
|
16508
|
+
|
|
16380
16509
|
function BuyerNameInput$1(props) {
|
|
16381
16510
|
var fieldName = props.fieldName,
|
|
16382
16511
|
form = props.myform;
|
package/dist/index.js
CHANGED
|
@@ -1099,6 +1099,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1099
1099
|
this.isMergeDetails = false;
|
|
1100
1100
|
this.isMergeDiscount = false;
|
|
1101
1101
|
this.isSalesDiscount = false;
|
|
1102
|
+
this.isSalesGifts = false;
|
|
1102
1103
|
this.addComparisonIndex = void 0;
|
|
1103
1104
|
this.drag = new Drag();
|
|
1104
1105
|
});
|
|
@@ -14975,6 +14976,12 @@ function useSalesDiscount() {
|
|
|
14975
14976
|
|
|
14976
14977
|
function useSalesGifts() {
|
|
14977
14978
|
var controller = Invoice.useInvoiceController();
|
|
14979
|
+
var isSalesGifts = controller.useMemo(function (s) {
|
|
14980
|
+
return s.goodsListState.isSalesGifts;
|
|
14981
|
+
}, []);
|
|
14982
|
+
var selectedGoodIndex = controller.useMemo(function (s) {
|
|
14983
|
+
return s.goodsListState.selectedGoodIndex;
|
|
14984
|
+
}, []);
|
|
14978
14985
|
var goodsList = controller.useMemo(function (s) {
|
|
14979
14986
|
return s.goodsListState.goodsList;
|
|
14980
14987
|
}, []);
|
|
@@ -14983,7 +14990,7 @@ function useSalesGifts() {
|
|
|
14983
14990
|
return e.lineAttribute === LineAttributeType$1.赠品行;
|
|
14984
14991
|
});
|
|
14985
14992
|
}, [goodsList]);
|
|
14986
|
-
var
|
|
14993
|
+
var onClickAuto = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
14987
14994
|
var _iterator, _step, g;
|
|
14988
14995
|
|
|
14989
14996
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -15037,12 +15044,105 @@ function useSalesGifts() {
|
|
|
15037
15044
|
}
|
|
15038
15045
|
}, _callee, null, [[1, 12, 15, 18]]);
|
|
15039
15046
|
})), [controller, giveaways]);
|
|
15047
|
+
var onClickManual = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
15048
|
+
var _controller$state$goo, goodsMap, selectedGoodIndex, giveaways, content, _iterator2, _step2, g;
|
|
15049
|
+
|
|
15050
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
15051
|
+
while (1) {
|
|
15052
|
+
switch (_context2.prev = _context2.next) {
|
|
15053
|
+
case 0:
|
|
15054
|
+
_controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
|
|
15055
|
+
giveaways = selectedGoodIndex.map(function (e) {
|
|
15056
|
+
return goodsMap.get(e);
|
|
15057
|
+
}).filter(function (e) {
|
|
15058
|
+
return !!e;
|
|
15059
|
+
});
|
|
15060
|
+
|
|
15061
|
+
if (!(giveaways.some(function (e) {
|
|
15062
|
+
return e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行;
|
|
15063
|
+
}) === false)) {
|
|
15064
|
+
_context2.next = 5;
|
|
15065
|
+
break;
|
|
15066
|
+
}
|
|
15067
|
+
|
|
15068
|
+
content = '只能选择‘赠品行’和‘正常行’';
|
|
15069
|
+
return _context2.abrupt("return", ktsComponentsAntdX3.message.error({
|
|
15070
|
+
content: content,
|
|
15071
|
+
key: content
|
|
15072
|
+
}));
|
|
15073
|
+
|
|
15074
|
+
case 5:
|
|
15075
|
+
_iterator2 = _createForOfIteratorHelper(giveaways);
|
|
15076
|
+
_context2.prev = 6;
|
|
15077
|
+
|
|
15078
|
+
_iterator2.s();
|
|
15079
|
+
|
|
15080
|
+
case 8:
|
|
15081
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
15082
|
+
_context2.next = 14;
|
|
15083
|
+
break;
|
|
15084
|
+
}
|
|
15085
|
+
|
|
15086
|
+
g = _step2.value;
|
|
15087
|
+
_context2.next = 12;
|
|
15088
|
+
return controller.addGoodDiscountV2([{
|
|
15089
|
+
$index: g.$index,
|
|
15090
|
+
discolineAmountunt: g.lineAmountIncludeTax || 0
|
|
15091
|
+
}]);
|
|
15092
|
+
|
|
15093
|
+
case 12:
|
|
15094
|
+
_context2.next = 8;
|
|
15095
|
+
break;
|
|
15096
|
+
|
|
15097
|
+
case 14:
|
|
15098
|
+
_context2.next = 19;
|
|
15099
|
+
break;
|
|
15100
|
+
|
|
15101
|
+
case 16:
|
|
15102
|
+
_context2.prev = 16;
|
|
15103
|
+
_context2.t0 = _context2["catch"](6);
|
|
15104
|
+
|
|
15105
|
+
_iterator2.e(_context2.t0);
|
|
15106
|
+
|
|
15107
|
+
case 19:
|
|
15108
|
+
_context2.prev = 19;
|
|
15109
|
+
|
|
15110
|
+
_iterator2.f();
|
|
15111
|
+
|
|
15112
|
+
return _context2.finish(19);
|
|
15113
|
+
|
|
15114
|
+
case 22:
|
|
15115
|
+
controller.state.goodsListState.selectedGoodIndex = [];
|
|
15116
|
+
|
|
15117
|
+
case 23:
|
|
15118
|
+
case "end":
|
|
15119
|
+
return _context2.stop();
|
|
15120
|
+
}
|
|
15121
|
+
}
|
|
15122
|
+
}, _callee2, null, [[6, 16, 19, 22]]);
|
|
15123
|
+
})), [controller]);
|
|
15124
|
+
var items = React__default['default'].useMemo(function () {
|
|
15125
|
+
return [{
|
|
15126
|
+
key: '0',
|
|
15127
|
+
label: '自动转换',
|
|
15128
|
+
disabled: giveaways.length <= 0,
|
|
15129
|
+
onClick: onClickAuto
|
|
15130
|
+
}, {
|
|
15131
|
+
key: '1',
|
|
15132
|
+
label: '手动转换',
|
|
15133
|
+
disabled: selectedGoodIndex.length <= 0,
|
|
15134
|
+
onClick: onClickManual
|
|
15135
|
+
}];
|
|
15136
|
+
}, [selectedGoodIndex, onClickManual, onClickAuto]);
|
|
15040
15137
|
var button = React__default['default'].useMemo(function () {
|
|
15041
|
-
if (
|
|
15042
|
-
return React__default['default'].createElement(
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15138
|
+
if (!isSalesGifts) return;
|
|
15139
|
+
return React__default['default'].createElement(ktsXui.Dropdown, {
|
|
15140
|
+
menu: {
|
|
15141
|
+
items: items
|
|
15142
|
+
},
|
|
15143
|
+
trigger: ['click']
|
|
15144
|
+
}, React__default['default'].createElement(ktsComponentsAntdX3.Button, null, "\u9500\u552E\u8D60\u54C1"));
|
|
15145
|
+
}, [items, isSalesGifts]);
|
|
15046
15146
|
return {
|
|
15047
15147
|
/** 按钮 */
|
|
15048
15148
|
button: button
|
|
@@ -16205,6 +16305,13 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
|
|
|
16205
16305
|
gutter: [16, 0]
|
|
16206
16306
|
}, React__default['default'].createElement(ktsXui.Col, {
|
|
16207
16307
|
span: 24
|
|
16308
|
+
}, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
16309
|
+
label: "\u8D2D\u4E70\u65B9\u4FE1\u606F",
|
|
16310
|
+
colon: false
|
|
16311
|
+
}, getFieldDecorator('naturalPersonFlag', {})(React__default['default'].createElement(NaturalPersonFlag, {
|
|
16312
|
+
readOnly: isReadOnly('naturalPersonFlag')
|
|
16313
|
+
})))), React__default['default'].createElement(ktsXui.Col, {
|
|
16314
|
+
span: 24
|
|
16208
16315
|
}, React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
16209
16316
|
label: "\u540D\u79F0",
|
|
16210
16317
|
colon: false
|
|
@@ -16220,7 +16327,8 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
|
|
|
16220
16327
|
type: 'link',
|
|
16221
16328
|
style: {
|
|
16222
16329
|
padding: 0,
|
|
16223
|
-
width: 20
|
|
16330
|
+
width: 20,
|
|
16331
|
+
height: '100%'
|
|
16224
16332
|
},
|
|
16225
16333
|
icon: React__default['default'].createElement(Icon, {
|
|
16226
16334
|
component: SvgPlus
|
|
@@ -16387,6 +16495,27 @@ var Stakeholder$1 = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(fu
|
|
|
16387
16495
|
})))))))));
|
|
16388
16496
|
});
|
|
16389
16497
|
|
|
16498
|
+
function NaturalPersonFlag(props) {
|
|
16499
|
+
var _React$useState3 = React__default['default'].useState(props.value || 0),
|
|
16500
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
16501
|
+
value = _React$useState4[0],
|
|
16502
|
+
setValue = _React$useState4[1];
|
|
16503
|
+
|
|
16504
|
+
var onChange = React__default['default'].useCallback(function (e) {
|
|
16505
|
+
if (props.readOnly) return;
|
|
16506
|
+
setValue(e.target.checked ? 1 : 0);
|
|
16507
|
+
props.onChange && props.onChange(e.target.checked ? 1 : 0);
|
|
16508
|
+
}, [props.onChange, props.readOnly]);
|
|
16509
|
+
React__default['default'].useEffect(function () {
|
|
16510
|
+
setValue(props.value || 0);
|
|
16511
|
+
}, [props.value]);
|
|
16512
|
+
return React__default['default'].createElement(ktsXui.Checkbox, {
|
|
16513
|
+
disabled: props.readOnly,
|
|
16514
|
+
checked: value === 1,
|
|
16515
|
+
onChange: onChange
|
|
16516
|
+
}, "\u662F\u5426\u5F00\u7968\u7ED9\u81EA\u7136\u4EBA");
|
|
16517
|
+
}
|
|
16518
|
+
|
|
16390
16519
|
function BuyerNameInput$1(props) {
|
|
16391
16520
|
var fieldName = props.fieldName,
|
|
16392
16521
|
form = props.myform;
|
package/package.json
CHANGED
|
@@ -3,32 +3,71 @@ import React from "react"
|
|
|
3
3
|
import { Button, message } from "kts-components-antd-x3"
|
|
4
4
|
import { chain, bignumber } from 'mathjs';
|
|
5
5
|
import Invoice from '../../../../../../..'
|
|
6
|
-
import { LineAttributeType } from "../../../../../../../InvoiceController";
|
|
6
|
+
import { IGood, LineAttributeType } from "../../../../../../../InvoiceController";
|
|
7
|
+
import { Dropdown, MenuProps } from "kts-xui";
|
|
7
8
|
|
|
8
9
|
/** 销售赠品 */
|
|
9
10
|
export default function useSalesGifts() {
|
|
10
11
|
|
|
11
12
|
const controller = Invoice.useInvoiceController();
|
|
12
13
|
|
|
14
|
+
const isSalesGifts = controller.useMemo(s => s.goodsListState.isSalesGifts, []);
|
|
15
|
+
|
|
16
|
+
const selectedGoodIndex = controller.useMemo(s => s.goodsListState.selectedGoodIndex, []);
|
|
17
|
+
|
|
13
18
|
const goodsList = controller.useMemo(s => s.goodsListState.goodsList, [])
|
|
14
19
|
|
|
15
20
|
const giveaways = React.useMemo(() => goodsList.filter(e => e.lineAttribute === LineAttributeType.赠品行), [goodsList])
|
|
16
21
|
|
|
17
|
-
const
|
|
22
|
+
const onClickAuto = React.useCallback(async () => {
|
|
18
23
|
for (let g of giveaways) {
|
|
19
24
|
g.lineAttribute = LineAttributeType.正常;
|
|
20
25
|
await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
|
|
21
26
|
}
|
|
22
27
|
}, [controller, giveaways])
|
|
23
28
|
|
|
29
|
+
const onClickManual = React.useCallback(async () => {
|
|
30
|
+
const { goodsMap, selectedGoodIndex } = controller.state.goodsListState;
|
|
31
|
+
const giveaways = selectedGoodIndex.map(e => goodsMap.get(e) as IGood).filter(e => !!e);
|
|
32
|
+
|
|
33
|
+
if (giveaways.some(e => e.lineAttribute === LineAttributeType.正常 || e.lineAttribute === LineAttributeType.赠品行) === false) {
|
|
34
|
+
const content = '只能选择‘赠品行’和‘正常行’';
|
|
35
|
+
return message.error({ content, key: content });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (let g of giveaways) {
|
|
39
|
+
await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
controller.state.goodsListState.selectedGoodIndex = [];
|
|
43
|
+
}, [controller])
|
|
44
|
+
|
|
45
|
+
const items: MenuProps['items'] = React.useMemo(() => {
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
key: '0',
|
|
49
|
+
label: '自动转换',
|
|
50
|
+
disabled: giveaways.length <= 0,
|
|
51
|
+
onClick: onClickAuto,
|
|
52
|
+
}, {
|
|
53
|
+
key: '1',
|
|
54
|
+
label: '手动转换',
|
|
55
|
+
disabled: selectedGoodIndex.length <= 0,
|
|
56
|
+
onClick: onClickManual,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}, [selectedGoodIndex, onClickManual, onClickAuto])
|
|
60
|
+
|
|
24
61
|
const button = React.useMemo(() => {
|
|
25
|
-
if (
|
|
62
|
+
if (!isSalesGifts) return;
|
|
26
63
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
64
|
+
<Dropdown menu={{ items }} trigger={['click']} >
|
|
65
|
+
<Button>
|
|
66
|
+
销售赠品
|
|
67
|
+
</Button>
|
|
68
|
+
</Dropdown>
|
|
30
69
|
)
|
|
31
|
-
}, [
|
|
70
|
+
}, [items, isSalesGifts])
|
|
32
71
|
|
|
33
72
|
return {
|
|
34
73
|
/** 按钮 */
|
|
@@ -114,14 +114,14 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
|
|
|
114
114
|
<div>
|
|
115
115
|
<Form className="digtal-stakeholder-form" >
|
|
116
116
|
<Row gutter={[16, 0]}>
|
|
117
|
-
|
|
117
|
+
<Col span={24} >
|
|
118
118
|
<Form.Item label='购买方信息' colon={false}>
|
|
119
119
|
{getFieldDecorator('naturalPersonFlag', {
|
|
120
120
|
})(
|
|
121
121
|
<NaturalPersonFlag readOnly={isReadOnly('naturalPersonFlag')} />
|
|
122
122
|
)}
|
|
123
123
|
</Form.Item>
|
|
124
|
-
</Col>
|
|
124
|
+
</Col>
|
|
125
125
|
|
|
126
126
|
<Col span={24} >
|
|
127
127
|
<Form.Item label='名称' colon={false}>
|
|
@@ -138,7 +138,7 @@ export default decorator<IStakeholder, IStakeholder & FormComponentProps>(Form.c
|
|
|
138
138
|
isShowImportButton === true &&
|
|
139
139
|
<Button
|
|
140
140
|
type='link'
|
|
141
|
-
style={{ padding: 0, width: 20 }}
|
|
141
|
+
style={{ padding: 0, width: 20, height: '100%' }}
|
|
142
142
|
icon={<Icon component={PlusSvg} />}
|
|
143
143
|
onClick={() => { onClickImportButton && onClickImportButton(controller) }}
|
|
144
144
|
/>
|