kts-component-invoice-operate 3.2.89 → 3.2.90
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/README.md
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -15210,34 +15210,24 @@ function useSalesGifts() {
|
|
|
15210
15210
|
}, _callee, null, [[1, 12, 15, 18]]);
|
|
15211
15211
|
})), [controller, giveaways]);
|
|
15212
15212
|
var onClickManual = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
15213
|
-
var _controller$state$goo, goodsMap,
|
|
15213
|
+
var _controller$state$goo, goodsMap, _selectedGoodIndex, _giveaways, _iterator2, _step2, g;
|
|
15214
15214
|
|
|
15215
15215
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
15216
15216
|
while (1) {
|
|
15217
15217
|
switch (_context2.prev = _context2.next) {
|
|
15218
15218
|
case 0:
|
|
15219
|
-
|
|
15220
|
-
|
|
15219
|
+
_context2.prev = 0;
|
|
15220
|
+
_controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, _selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
|
|
15221
|
+
_giveaways = _selectedGoodIndex.map(function (e) {
|
|
15221
15222
|
return goodsMap.get(e);
|
|
15222
15223
|
}).filter(function (e) {
|
|
15223
15224
|
return !!e;
|
|
15224
15225
|
});
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
return e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行;
|
|
15228
|
-
}) === false)) {
|
|
15229
|
-
_context2.next = 5;
|
|
15230
|
-
break;
|
|
15231
|
-
}
|
|
15232
|
-
|
|
15233
|
-
content = '只能选择‘赠品行’和‘正常行’';
|
|
15234
|
-
return _context2.abrupt("return", message.error({
|
|
15235
|
-
content: content,
|
|
15236
|
-
key: content
|
|
15237
|
-
}));
|
|
15226
|
+
_context2.next = 5;
|
|
15227
|
+
return checkLineAttribute(_giveaways);
|
|
15238
15228
|
|
|
15239
15229
|
case 5:
|
|
15240
|
-
_iterator2 = _createForOfIteratorHelper(
|
|
15230
|
+
_iterator2 = _createForOfIteratorHelper(_giveaways);
|
|
15241
15231
|
_context2.prev = 6;
|
|
15242
15232
|
|
|
15243
15233
|
_iterator2.s();
|
|
@@ -15278,13 +15268,19 @@ function useSalesGifts() {
|
|
|
15278
15268
|
|
|
15279
15269
|
case 22:
|
|
15280
15270
|
controller.state.goodsListState.selectedGoodIndex = [];
|
|
15271
|
+
_context2.next = 27;
|
|
15272
|
+
break;
|
|
15281
15273
|
|
|
15282
|
-
case
|
|
15274
|
+
case 25:
|
|
15275
|
+
_context2.prev = 25;
|
|
15276
|
+
_context2.t1 = _context2["catch"](0);
|
|
15277
|
+
|
|
15278
|
+
case 27:
|
|
15283
15279
|
case "end":
|
|
15284
15280
|
return _context2.stop();
|
|
15285
15281
|
}
|
|
15286
15282
|
}
|
|
15287
|
-
}, _callee2, null, [[6, 16, 19, 22]]);
|
|
15283
|
+
}, _callee2, null, [[0, 25], [6, 16, 19, 22]]);
|
|
15288
15284
|
})), [controller]);
|
|
15289
15285
|
var items = React.useMemo(function () {
|
|
15290
15286
|
return [{
|
|
@@ -15313,6 +15309,22 @@ function useSalesGifts() {
|
|
|
15313
15309
|
button: button
|
|
15314
15310
|
};
|
|
15315
15311
|
}
|
|
15312
|
+
/** 只能选择‘赠品行’和‘正常行’ */
|
|
15313
|
+
|
|
15314
|
+
function checkLineAttribute(giveaways) {
|
|
15315
|
+
giveaways.forEach(function (e) {
|
|
15316
|
+
if (e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行) {
|
|
15317
|
+
return;
|
|
15318
|
+
} else {
|
|
15319
|
+
var content = '只能选择‘赠品行’和‘正常行’';
|
|
15320
|
+
message.error({
|
|
15321
|
+
content: content,
|
|
15322
|
+
key: content
|
|
15323
|
+
});
|
|
15324
|
+
throw new Error(content);
|
|
15325
|
+
}
|
|
15326
|
+
});
|
|
15327
|
+
}
|
|
15316
15328
|
|
|
15317
15329
|
var GoodsList = /*#__PURE__*/function (_React$Component) {
|
|
15318
15330
|
_inherits(GoodsList, _React$Component);
|
package/dist/index.js
CHANGED
|
@@ -15220,34 +15220,24 @@ function useSalesGifts() {
|
|
|
15220
15220
|
}, _callee, null, [[1, 12, 15, 18]]);
|
|
15221
15221
|
})), [controller, giveaways]);
|
|
15222
15222
|
var onClickManual = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
15223
|
-
var _controller$state$goo, goodsMap,
|
|
15223
|
+
var _controller$state$goo, goodsMap, _selectedGoodIndex, _giveaways, _iterator2, _step2, g;
|
|
15224
15224
|
|
|
15225
15225
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
15226
15226
|
while (1) {
|
|
15227
15227
|
switch (_context2.prev = _context2.next) {
|
|
15228
15228
|
case 0:
|
|
15229
|
-
|
|
15230
|
-
|
|
15229
|
+
_context2.prev = 0;
|
|
15230
|
+
_controller$state$goo = controller.state.goodsListState, goodsMap = _controller$state$goo.goodsMap, _selectedGoodIndex = _controller$state$goo.selectedGoodIndex;
|
|
15231
|
+
_giveaways = _selectedGoodIndex.map(function (e) {
|
|
15231
15232
|
return goodsMap.get(e);
|
|
15232
15233
|
}).filter(function (e) {
|
|
15233
15234
|
return !!e;
|
|
15234
15235
|
});
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
return e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行;
|
|
15238
|
-
}) === false)) {
|
|
15239
|
-
_context2.next = 5;
|
|
15240
|
-
break;
|
|
15241
|
-
}
|
|
15242
|
-
|
|
15243
|
-
content = '只能选择‘赠品行’和‘正常行’';
|
|
15244
|
-
return _context2.abrupt("return", ktsComponentsAntdX3.message.error({
|
|
15245
|
-
content: content,
|
|
15246
|
-
key: content
|
|
15247
|
-
}));
|
|
15236
|
+
_context2.next = 5;
|
|
15237
|
+
return checkLineAttribute(_giveaways);
|
|
15248
15238
|
|
|
15249
15239
|
case 5:
|
|
15250
|
-
_iterator2 = _createForOfIteratorHelper(
|
|
15240
|
+
_iterator2 = _createForOfIteratorHelper(_giveaways);
|
|
15251
15241
|
_context2.prev = 6;
|
|
15252
15242
|
|
|
15253
15243
|
_iterator2.s();
|
|
@@ -15288,13 +15278,19 @@ function useSalesGifts() {
|
|
|
15288
15278
|
|
|
15289
15279
|
case 22:
|
|
15290
15280
|
controller.state.goodsListState.selectedGoodIndex = [];
|
|
15281
|
+
_context2.next = 27;
|
|
15282
|
+
break;
|
|
15291
15283
|
|
|
15292
|
-
case
|
|
15284
|
+
case 25:
|
|
15285
|
+
_context2.prev = 25;
|
|
15286
|
+
_context2.t1 = _context2["catch"](0);
|
|
15287
|
+
|
|
15288
|
+
case 27:
|
|
15293
15289
|
case "end":
|
|
15294
15290
|
return _context2.stop();
|
|
15295
15291
|
}
|
|
15296
15292
|
}
|
|
15297
|
-
}, _callee2, null, [[6, 16, 19, 22]]);
|
|
15293
|
+
}, _callee2, null, [[0, 25], [6, 16, 19, 22]]);
|
|
15298
15294
|
})), [controller]);
|
|
15299
15295
|
var items = React__default['default'].useMemo(function () {
|
|
15300
15296
|
return [{
|
|
@@ -15323,6 +15319,22 @@ function useSalesGifts() {
|
|
|
15323
15319
|
button: button
|
|
15324
15320
|
};
|
|
15325
15321
|
}
|
|
15322
|
+
/** 只能选择‘赠品行’和‘正常行’ */
|
|
15323
|
+
|
|
15324
|
+
function checkLineAttribute(giveaways) {
|
|
15325
|
+
giveaways.forEach(function (e) {
|
|
15326
|
+
if (e.lineAttribute === LineAttributeType$1.正常 || e.lineAttribute === LineAttributeType$1.赠品行) {
|
|
15327
|
+
return;
|
|
15328
|
+
} else {
|
|
15329
|
+
var content = '只能选择‘赠品行’和‘正常行’';
|
|
15330
|
+
ktsComponentsAntdX3.message.error({
|
|
15331
|
+
content: content,
|
|
15332
|
+
key: content
|
|
15333
|
+
});
|
|
15334
|
+
throw new Error(content);
|
|
15335
|
+
}
|
|
15336
|
+
});
|
|
15337
|
+
}
|
|
15326
15338
|
|
|
15327
15339
|
var GoodsList = /*#__PURE__*/function (_React$Component) {
|
|
15328
15340
|
_inherits(GoodsList, _React$Component);
|
package/package.json
CHANGED
|
@@ -67,6 +67,7 @@ class MyController1 extends Invoice.InvoiceController {
|
|
|
67
67
|
this.state.goodsListState.isMergeDetails = true;
|
|
68
68
|
this.state.goodsListState.isSalesDiscount = true;
|
|
69
69
|
this.state.goodsListState.isMergeDiscount = true;
|
|
70
|
+
this.state.goodsListState.isSalesGifts = true;
|
|
70
71
|
this.state.goodsListState.drag.isStart = true;
|
|
71
72
|
this.state.goodsListState.columnshide = [];
|
|
72
73
|
}
|
|
@@ -96,6 +97,7 @@ class MyController2 extends Invoice.InvoiceController {
|
|
|
96
97
|
this.state.goodsListState.isMergeDetails = true;
|
|
97
98
|
this.state.goodsListState.isSalesDiscount = true;
|
|
98
99
|
this.state.goodsListState.isMergeDiscount = true;
|
|
100
|
+
this.state.goodsListState.isSalesGifts = true;
|
|
99
101
|
this.state.goodsListState.drag.isStart = true;
|
|
100
102
|
this.state.goodsListState.columnshide = [];
|
|
101
103
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import React from "react"
|
|
3
3
|
import { Button, message } from "kts-components-antd-x3"
|
|
4
|
-
import { chain, bignumber } from 'mathjs';
|
|
5
4
|
import Invoice from '../../../../../../..'
|
|
6
5
|
import { IGood, LineAttributeType } from "../../../../../../../InvoiceController";
|
|
7
6
|
import { Dropdown, MenuProps } from "kts-xui";
|
|
@@ -27,19 +26,20 @@ export default function useSalesGifts() {
|
|
|
27
26
|
}, [controller, giveaways])
|
|
28
27
|
|
|
29
28
|
const onClickManual = React.useCallback(async () => {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
try {
|
|
30
|
+
const { goodsMap, selectedGoodIndex } = controller.state.goodsListState;
|
|
31
|
+
const giveaways = selectedGoodIndex.map(e => goodsMap.get(e) as IGood).filter(e => !!e);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
const content = '只能选择‘赠品行’和‘正常行’';
|
|
35
|
-
return message.error({ content, key: content });
|
|
36
|
-
}
|
|
33
|
+
await checkLineAttribute(giveaways);
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
for (let g of giveaways) {
|
|
36
|
+
await controller.addGoodDiscountV2([{ $index: g.$index, discolineAmountunt: g.lineAmountIncludeTax || 0 }]);
|
|
37
|
+
}
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
controller.state.goodsListState.selectedGoodIndex = [];
|
|
40
|
+
} catch (error) {
|
|
41
|
+
|
|
42
|
+
}
|
|
43
43
|
}, [controller])
|
|
44
44
|
|
|
45
45
|
const items: MenuProps['items'] = React.useMemo(() => {
|
|
@@ -73,4 +73,17 @@ export default function useSalesGifts() {
|
|
|
73
73
|
/** 按钮 */
|
|
74
74
|
button,
|
|
75
75
|
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 只能选择‘赠品行’和‘正常行’ */
|
|
79
|
+
function checkLineAttribute(giveaways: IGood[]) {
|
|
80
|
+
giveaways.forEach(e => {
|
|
81
|
+
if (e.lineAttribute === LineAttributeType.正常 || e.lineAttribute === LineAttributeType.赠品行) {
|
|
82
|
+
return;
|
|
83
|
+
} else {
|
|
84
|
+
const content = '只能选择‘赠品行’和‘正常行’';
|
|
85
|
+
message.error({ content, key: content });
|
|
86
|
+
throw new Error(content);
|
|
87
|
+
}
|
|
88
|
+
})
|
|
76
89
|
}
|