kts-component-invoice-operate 1.0.104 → 1.0.105
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 +8 -0
- package/dist/Invoice/_test/deduction/index.d.ts +3 -0
- package/dist/Invoice/tools/calculate/index.d.ts +29 -1
- package/dist/Invoice/ui/GoodsList/hook/useDeduction/index.d.ts +8 -0
- package/dist/Invoice/ui/GoodsList/hook/useOnRow/index.d.ts +3 -0
- package/dist/Invoice/ui/GoodsList/hook/useWindowClick/index.d.ts +8 -0
- package/dist/Invoice/ui/GoodsList/index.d.ts +9 -0
- package/dist/index.esm.js +265 -55
- package/dist/index.js +265 -55
- package/package.json +1 -1
|
@@ -5,6 +5,14 @@ import EndowCode from './EndowCode';
|
|
|
5
5
|
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
6
6
|
import InvoiceController from '../..';
|
|
7
7
|
export default class GoodsListState {
|
|
8
|
+
/** 扣除额 */
|
|
9
|
+
deduction: number;
|
|
10
|
+
/** 产品最大数 */
|
|
11
|
+
goodMax?: number;
|
|
12
|
+
/** 是否可以切换(含税/不含税)状态 */
|
|
13
|
+
isSwitchTax?: boolean;
|
|
14
|
+
/** 是否能添加折扣行 */
|
|
15
|
+
isAddDiscount?: boolean;
|
|
8
16
|
/** 是否含税 */
|
|
9
17
|
isTaxIncluded: boolean;
|
|
10
18
|
/** 正在编辑的货物 */
|
|
@@ -2,4 +2,32 @@
|
|
|
2
2
|
export declare const format2: (value: number | string) => number | "";
|
|
3
3
|
/** 格式化 保留15位数字 */
|
|
4
4
|
export declare const format15: (value: number | string) => number | "";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* 金额(含税) = 数量 * 单价(含税)
|
|
7
|
+
* @param quantity 数量
|
|
8
|
+
* @param priceIncludeTax 单价(含税)
|
|
9
|
+
* @returns 金额(含税)
|
|
10
|
+
*/
|
|
11
|
+
export declare function countAmountIncludeTax(quantity?: number | string, priceIncludeTax?: number | string): number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* 不含税金额 = 含税金额-税额
|
|
14
|
+
* @param amountIncludeTax 含税金额
|
|
15
|
+
* @param taxAmount 税额
|
|
16
|
+
* @returns 不含税金额
|
|
17
|
+
*/
|
|
18
|
+
export declare function countAmountExcludeTax(amountIncludeTax: string | number, taxAmount: number): number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* 税额 = (含税金额-扣除额)/(1+税率)*税率
|
|
21
|
+
* @param amountIncludeTax 含税金额
|
|
22
|
+
* @param deduction 扣除额
|
|
23
|
+
* @param taxRate 税率
|
|
24
|
+
* @returns 税额
|
|
25
|
+
*/
|
|
26
|
+
export declare function countTaxAmount(amountIncludeTax: string | number, deduction: number, taxRate: number): number | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* 单价 = 金额/数量
|
|
29
|
+
* @param amount 金额
|
|
30
|
+
* @param quantity 数量
|
|
31
|
+
* @returns 单价
|
|
32
|
+
*/
|
|
33
|
+
export declare function countPrice(amount: string | number, quantity: string | number): number | undefined | '';
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
export interface IGoodsListProps {
|
|
4
|
+
/** 扩展部分 */
|
|
4
5
|
menuExpansion?: React.ReactNode;
|
|
6
|
+
/** 产品最大数 */
|
|
7
|
+
goodMax?: number;
|
|
8
|
+
/** 扣除额 */
|
|
9
|
+
deduction?: number;
|
|
10
|
+
/** 是否能添加折扣行 */
|
|
11
|
+
isAddDiscount?: boolean;
|
|
12
|
+
/** 是否可以切换(含税/不含税)状态 */
|
|
13
|
+
isSwitchTax?: boolean;
|
|
5
14
|
}
|
|
6
15
|
export default class GoodsList extends React.Component<IGoodsListProps> {
|
|
7
16
|
render(): JSX.Element;
|
package/dist/index.esm.js
CHANGED
|
@@ -627,6 +627,10 @@ function draft(value) {
|
|
|
627
627
|
var GoodsListState = function GoodsListState() {
|
|
628
628
|
_classCallCheck(this, GoodsListState);
|
|
629
629
|
|
|
630
|
+
this.deduction = 0;
|
|
631
|
+
this.goodMax = void 0;
|
|
632
|
+
this.isSwitchTax = void 0;
|
|
633
|
+
this.isAddDiscount = void 0;
|
|
630
634
|
this.isTaxIncluded = true;
|
|
631
635
|
this.editGood = void 0;
|
|
632
636
|
this.form = void 0;
|
|
@@ -1579,6 +1583,21 @@ var AddRowButton = (function () {
|
|
|
1579
1583
|
var model = controller.useMemo(function (s) {
|
|
1580
1584
|
return s.model;
|
|
1581
1585
|
}, []);
|
|
1586
|
+
/** 产品数据量 */
|
|
1587
|
+
|
|
1588
|
+
var goodsNum = controller.useMemo(function (s) {
|
|
1589
|
+
return s.goodsListState.goodsList.length;
|
|
1590
|
+
}, []);
|
|
1591
|
+
/** 产品最大数 */
|
|
1592
|
+
|
|
1593
|
+
var goodMax = controller.useMemo(function (s) {
|
|
1594
|
+
return s.goodsListState.goodMax;
|
|
1595
|
+
}, []);
|
|
1596
|
+
/** 按钮是否禁用 */
|
|
1597
|
+
|
|
1598
|
+
var disabled = React.useMemo(function () {
|
|
1599
|
+
return typeof goodMax === 'number' ? goodsNum >= goodMax : false;
|
|
1600
|
+
}, [goodMax, goodsNum]);
|
|
1582
1601
|
var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
1583
1602
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1584
1603
|
while (1) {
|
|
@@ -1643,7 +1662,8 @@ var AddRowButton = (function () {
|
|
|
1643
1662
|
if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
1644
1663
|
return /*#__PURE__*/React.createElement(Button, {
|
|
1645
1664
|
icon: "plus-circle",
|
|
1646
|
-
onClick: onClick
|
|
1665
|
+
onClick: onClick,
|
|
1666
|
+
disabled: disabled
|
|
1647
1667
|
}, "\u6DFB\u52A0\u884C");
|
|
1648
1668
|
});
|
|
1649
1669
|
|
|
@@ -1654,6 +1674,11 @@ var TaxIncludedSwitch = (function () {
|
|
|
1654
1674
|
var isTaxIncluded = controller.useMemo(function (e) {
|
|
1655
1675
|
return e.goodsListState.isTaxIncluded;
|
|
1656
1676
|
}, []);
|
|
1677
|
+
/** 是否可以切换(含税/不含税)状态 */
|
|
1678
|
+
|
|
1679
|
+
var isSwitchTax = controller.useMemo(function (e) {
|
|
1680
|
+
return e.goodsListState.isSwitchTax;
|
|
1681
|
+
}, []);
|
|
1657
1682
|
var onChange = React.useCallback(function (e) {
|
|
1658
1683
|
controller.pipeline( /*#__PURE__*/function () {
|
|
1659
1684
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s) {
|
|
@@ -1679,6 +1704,7 @@ var TaxIncludedSwitch = (function () {
|
|
|
1679
1704
|
}())();
|
|
1680
1705
|
}, []);
|
|
1681
1706
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "\u542B\u7A0E:"), /*#__PURE__*/React.createElement(Switch, {
|
|
1707
|
+
disabled: isSwitchTax === false,
|
|
1682
1708
|
checked: isTaxIncluded,
|
|
1683
1709
|
checkedChildren: "\u5F00",
|
|
1684
1710
|
unCheckedChildren: "\u5173",
|
|
@@ -1754,6 +1780,11 @@ var AddDiscountRowButton = decorator(Form.create())(function (props) {
|
|
|
1754
1780
|
var model = controller.useMemo(function (s) {
|
|
1755
1781
|
return s.model;
|
|
1756
1782
|
}, []);
|
|
1783
|
+
/** 是否能添加折扣行 */
|
|
1784
|
+
|
|
1785
|
+
var isAddDiscount = controller.useMemo(function (s) {
|
|
1786
|
+
return s.goodsListState.isAddDiscount;
|
|
1787
|
+
}, []);
|
|
1757
1788
|
/** 是否开启抽屉 */
|
|
1758
1789
|
|
|
1759
1790
|
var visible = controller.useMemo(function (s) {
|
|
@@ -1890,7 +1921,7 @@ var AddDiscountRowButton = decorator(Form.create())(function (props) {
|
|
|
1890
1921
|
}, _callee3);
|
|
1891
1922
|
})), [controller]);
|
|
1892
1923
|
if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
1893
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1924
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isAddDiscount !== false && /*#__PURE__*/React.createElement(Button, {
|
|
1894
1925
|
icon: "plus-circle",
|
|
1895
1926
|
disabled: disabled,
|
|
1896
1927
|
onClick: onClick
|
|
@@ -2443,14 +2474,59 @@ var format15 = function format15(value) {
|
|
|
2443
2474
|
if (typeof value === 'string') value = parseFloat(value);
|
|
2444
2475
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
2445
2476
|
return parseFloat(value.toFixed(fractionDigits > 8 ? 8 : fractionDigits));
|
|
2446
|
-
};
|
|
2477
|
+
};
|
|
2478
|
+
/**
|
|
2479
|
+
* 金额(含税) = 数量 * 单价(含税)
|
|
2480
|
+
* @param quantity 数量
|
|
2481
|
+
* @param priceIncludeTax 单价(含税)
|
|
2482
|
+
* @returns 金额(含税)
|
|
2483
|
+
*/
|
|
2447
2484
|
|
|
2448
|
-
function
|
|
2485
|
+
function countAmountIncludeTax(quantity, priceIncludeTax) {
|
|
2449
2486
|
if (!quantity && quantity !== 0) return undefined;
|
|
2450
2487
|
if (!priceIncludeTax && priceIncludeTax !== 0) return undefined;
|
|
2451
2488
|
quantity = format15(quantity);
|
|
2452
2489
|
priceIncludeTax = format15(priceIncludeTax);
|
|
2453
|
-
return parseFloat(
|
|
2490
|
+
return parseFloat(chain$1(bignumber(priceIncludeTax)).multiply(bignumber(quantity)).done().toNumber().toFixed(2)); // return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* 不含税金额 = 含税金额-税额
|
|
2494
|
+
* @param amountIncludeTax 含税金额
|
|
2495
|
+
* @param taxAmount 税额
|
|
2496
|
+
* @returns 不含税金额
|
|
2497
|
+
*/
|
|
2498
|
+
|
|
2499
|
+
function countAmountExcludeTax(amountIncludeTax, taxAmount) {
|
|
2500
|
+
if (!amountIncludeTax && amountIncludeTax !== 0) return undefined;
|
|
2501
|
+
if (!taxAmount && taxAmount !== 0) return undefined;
|
|
2502
|
+
return chain$1(bignumber(amountIncludeTax)).subtract(bignumber(taxAmount)).done().toNumber();
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* 税额 = (含税金额-扣除额)/(1+税率)*税率
|
|
2506
|
+
* @param amountIncludeTax 含税金额
|
|
2507
|
+
* @param deduction 扣除额
|
|
2508
|
+
* @param taxRate 税率
|
|
2509
|
+
* @returns 税额
|
|
2510
|
+
*/
|
|
2511
|
+
|
|
2512
|
+
function countTaxAmount(amountIncludeTax, deduction, taxRate) {
|
|
2513
|
+
if (!amountIncludeTax && amountIncludeTax !== 0) return undefined;
|
|
2514
|
+
if (!deduction && deduction !== 0) return undefined;
|
|
2515
|
+
if (!taxRate && taxRate !== 0) return undefined;
|
|
2516
|
+
var taxRateBu = chain$1(bignumber(taxRate)).divide(bignumber(100)).done();
|
|
2517
|
+
return parseFloat(chain$1(bignumber(amountIncludeTax)).subtract(bignumber(deduction)).divide(chain$1(bignumber(1)).add(taxRateBu).done()).multiply(taxRateBu).done().toNumber().toFixed(2));
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* 单价 = 金额/数量
|
|
2521
|
+
* @param amount 金额
|
|
2522
|
+
* @param quantity 数量
|
|
2523
|
+
* @returns 单价
|
|
2524
|
+
*/
|
|
2525
|
+
|
|
2526
|
+
function countPrice(amount, quantity) {
|
|
2527
|
+
if (!amount && amount !== 0) return undefined;
|
|
2528
|
+
if (!quantity && quantity !== 0) return undefined;
|
|
2529
|
+
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber());
|
|
2454
2530
|
}
|
|
2455
2531
|
|
|
2456
2532
|
/** 延迟函数 */
|
|
@@ -3076,64 +3152,55 @@ var onChangeTaxRate = lazyFn$1(function (controller, form, record) {
|
|
|
3076
3152
|
var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controller, form, record) {
|
|
3077
3153
|
form.validateFields( /*#__PURE__*/function () {
|
|
3078
3154
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(err, values) {
|
|
3079
|
-
var
|
|
3155
|
+
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
|
|
3080
3156
|
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
3081
3157
|
while (1) {
|
|
3082
3158
|
switch (_context7.prev = _context7.next) {
|
|
3083
3159
|
case 0:
|
|
3084
3160
|
err = err || {};
|
|
3161
|
+
/** 税额 */
|
|
3085
3162
|
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
break;
|
|
3089
|
-
}
|
|
3163
|
+
/** 扣除额 */
|
|
3164
|
+
deduction = controller.state.goodsListState.deduction; // 计算税额
|
|
3090
3165
|
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
_context7.next = 6;
|
|
3095
|
-
return controller.setEditGood({
|
|
3096
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
3097
|
-
});
|
|
3166
|
+
if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
|
|
3167
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
3168
|
+
}
|
|
3098
3169
|
|
|
3099
|
-
|
|
3100
|
-
// 税额 = 金额(含税)-金额(不含税)
|
|
3101
|
-
taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
|
|
3102
|
-
form.setFieldsValue({
|
|
3103
|
-
taxAmount: taxAmount
|
|
3104
|
-
});
|
|
3105
|
-
_context7.next = 10;
|
|
3170
|
+
_context7.next = 5;
|
|
3106
3171
|
return controller.setEditGood({
|
|
3107
3172
|
taxAmount: taxAmount
|
|
3108
3173
|
});
|
|
3109
3174
|
|
|
3110
|
-
case
|
|
3111
|
-
|
|
3112
|
-
|
|
3175
|
+
case 5:
|
|
3176
|
+
// 计算 金额(不含税)
|
|
3177
|
+
if (taxAmount && !promptErr(err.lineAmountIncludeTax)) {
|
|
3178
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
3179
|
+
}
|
|
3113
3180
|
|
|
3114
|
-
case 12:
|
|
3115
3181
|
form.setFieldsValue({
|
|
3116
|
-
|
|
3182
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
3117
3183
|
});
|
|
3118
|
-
_context7.next =
|
|
3184
|
+
_context7.next = 9;
|
|
3119
3185
|
return controller.setEditGood({
|
|
3120
|
-
|
|
3186
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
3121
3187
|
});
|
|
3122
3188
|
|
|
3123
|
-
case
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3189
|
+
case 9:
|
|
3190
|
+
// 单价(不含税)
|
|
3191
|
+
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
3192
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity);
|
|
3127
3193
|
}
|
|
3128
3194
|
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3195
|
+
form.setFieldsValue({
|
|
3196
|
+
priceExcludeTax: priceExcludeTax
|
|
3197
|
+
});
|
|
3198
|
+
_context7.next = 13;
|
|
3132
3199
|
return controller.setEditGood({
|
|
3133
3200
|
priceExcludeTax: priceExcludeTax
|
|
3134
3201
|
});
|
|
3135
3202
|
|
|
3136
|
-
case
|
|
3203
|
+
case 13:
|
|
3137
3204
|
case "end":
|
|
3138
3205
|
return _context7.stop();
|
|
3139
3206
|
}
|
|
@@ -3390,6 +3457,11 @@ var RowMenu = (function (props) {
|
|
|
3390
3457
|
var model = controller.useMemo(function (s) {
|
|
3391
3458
|
return s.model;
|
|
3392
3459
|
}, []);
|
|
3460
|
+
/** 是否能添加折扣行 */
|
|
3461
|
+
|
|
3462
|
+
var isAddDiscount = controller.useMemo(function (s) {
|
|
3463
|
+
return s.goodsListState.isAddDiscount;
|
|
3464
|
+
}, []);
|
|
3393
3465
|
var goodsMenuExpand = controller.useMemo(function (s) {
|
|
3394
3466
|
return s.goodsListState.goodsMenuExpand;
|
|
3395
3467
|
}, []);
|
|
@@ -3398,7 +3470,7 @@ var RowMenu = (function (props) {
|
|
|
3398
3470
|
var endowCode = useEndowCode(props.goods);
|
|
3399
3471
|
var itemList = React.useMemo(function () {
|
|
3400
3472
|
var arr = [];
|
|
3401
|
-
model !== 'prefab' && addDiscount && arr.push(addDiscount); // 添加折扣行
|
|
3473
|
+
model !== 'prefab' && isAddDiscount !== false && addDiscount && arr.push(addDiscount); // 添加折扣行
|
|
3402
3474
|
|
|
3403
3475
|
endowCode && arr.push(endowCode); // 赋码
|
|
3404
3476
|
|
|
@@ -3415,7 +3487,7 @@ var RowMenu = (function (props) {
|
|
|
3415
3487
|
}
|
|
3416
3488
|
|
|
3417
3489
|
return arr;
|
|
3418
|
-
}, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model]);
|
|
3490
|
+
}, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model, isAddDiscount]);
|
|
3419
3491
|
|
|
3420
3492
|
if (itemList.length === 0) {
|
|
3421
3493
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
@@ -4193,6 +4265,82 @@ var useOnRow = (function () {
|
|
|
4193
4265
|
};
|
|
4194
4266
|
});
|
|
4195
4267
|
|
|
4268
|
+
/**
|
|
4269
|
+
* 扣除额 相关业务
|
|
4270
|
+
*/
|
|
4271
|
+
|
|
4272
|
+
function useDeduction(controller) {
|
|
4273
|
+
var deduction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4274
|
+
// 更新 扣除额
|
|
4275
|
+
React.useEffect(function () {
|
|
4276
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4277
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s) {
|
|
4278
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4279
|
+
while (1) {
|
|
4280
|
+
switch (_context.prev = _context.next) {
|
|
4281
|
+
case 0:
|
|
4282
|
+
return _context.abrupt("return", s.goodsListState.deduction = deduction);
|
|
4283
|
+
|
|
4284
|
+
case 1:
|
|
4285
|
+
case "end":
|
|
4286
|
+
return _context.stop();
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
}, _callee);
|
|
4290
|
+
}));
|
|
4291
|
+
|
|
4292
|
+
return function (_x) {
|
|
4293
|
+
return _ref.apply(this, arguments);
|
|
4294
|
+
};
|
|
4295
|
+
}())();
|
|
4296
|
+
}, [controller, deduction]); // 重新计算
|
|
4297
|
+
|
|
4298
|
+
React.useEffect(function () {
|
|
4299
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4300
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(s) {
|
|
4301
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
4302
|
+
while (1) {
|
|
4303
|
+
switch (_context2.prev = _context2.next) {
|
|
4304
|
+
case 0:
|
|
4305
|
+
s.goodsListState.editGood = undefined;
|
|
4306
|
+
s.goodsListState.goodsList = [];
|
|
4307
|
+
|
|
4308
|
+
case 2:
|
|
4309
|
+
case "end":
|
|
4310
|
+
return _context2.stop();
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
}, _callee2);
|
|
4314
|
+
}));
|
|
4315
|
+
|
|
4316
|
+
return function (_x2) {
|
|
4317
|
+
return _ref2.apply(this, arguments);
|
|
4318
|
+
};
|
|
4319
|
+
}())();
|
|
4320
|
+
}, [controller, deduction]);
|
|
4321
|
+
}
|
|
4322
|
+
|
|
4323
|
+
/**
|
|
4324
|
+
* 点击组件外部 保存正在编辑的货物
|
|
4325
|
+
*/
|
|
4326
|
+
/**
|
|
4327
|
+
* 点击组件外部 保存正在编辑的货物
|
|
4328
|
+
*/
|
|
4329
|
+
|
|
4330
|
+
function useWindowClick(controller) {
|
|
4331
|
+
/** 点击组件外部 保存正在编辑的货物 */
|
|
4332
|
+
React.useEffect(function () {
|
|
4333
|
+
var click = function click() {
|
|
4334
|
+
setTimeout(controller.saveEditGood);
|
|
4335
|
+
};
|
|
4336
|
+
|
|
4337
|
+
window.addEventListener('click', click);
|
|
4338
|
+
return function () {
|
|
4339
|
+
window.removeEventListener('click', click);
|
|
4340
|
+
};
|
|
4341
|
+
}, [controller]);
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4196
4344
|
var useRowSelection = (function () {
|
|
4197
4345
|
/** 控制器 */
|
|
4198
4346
|
var controller = default_1.useInvoiceController();
|
|
@@ -4420,7 +4568,7 @@ var useRowSelection = (function () {
|
|
|
4420
4568
|
};
|
|
4421
4569
|
});
|
|
4422
4570
|
|
|
4423
|
-
var css_248z$6 = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n margin: 0 10px;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend label {\n margin-right: 5px;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table {\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import {\n display: flex;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import .ktsAnt3x-btn {\n display: block;\n line-height: 0;\n width: auto;\n padding-right: 5px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-table-body {\n height: 263px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-explain {\n position: absolute;\n right: 6px;\n top: 6px;\n}\n.kts-invoice-operate-goods-list-table table {\n border-bottom: 1px solid #d9d9d9 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td {\n padding: 0 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item {\n padding: 0;\n margin: 0;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: inherit;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-select-selection,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input:hover {\n border-right-width: 1px !important;\n border-top-width: 1px;\n border-left-width: 1px;\n border-bottom-width: 1px;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-selection--single,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-input {\n height: 30px;\n border-radius: 0;\n border-right-width: 0 !important;\n border-top-width: 0;\n border-left-width: 0;\n border-bottom-width: 0;\n box-shadow: none;\n}\n";
|
|
4571
|
+
var css_248z$6 = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n margin: 0 10px;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend label {\n margin-right: 5px;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table {\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import {\n display: flex;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import .ktsAnt3x-btn {\n display: block;\n line-height: 0;\n width: auto;\n padding-right: 5px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-table-body {\n height: 263px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-explain {\n position: absolute;\n right: 6px;\n top: 6px;\n}\n.kts-invoice-operate-goods-list-table table {\n border-bottom: 1px solid #d9d9d9 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td {\n padding: 0 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item {\n padding: 0;\n margin: 0;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: inherit;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-select-selection,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input:hover {\n border-right-width: 1px !important;\n border-top-width: 1px;\n border-left-width: 1px;\n border-bottom-width: 1px;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-selection--single,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-input {\n height: 30px;\n border-radius: 0;\n border-right-width: 0 !important;\n border-top-width: 0;\n border-left-width: 0;\n border-bottom-width: 0;\n box-shadow: none;\n}\n";
|
|
4424
4572
|
styleInject(css_248z$6);
|
|
4425
4573
|
|
|
4426
4574
|
var GoodsList = /*#__PURE__*/function (_React$Component) {
|
|
@@ -4455,8 +4603,10 @@ var Main = decorator(Form.create())(function (props) {
|
|
|
4455
4603
|
/** 表格行事件 */
|
|
4456
4604
|
|
|
4457
4605
|
var _onRow = useOnRow();
|
|
4458
|
-
/** 注册 from 对象 */
|
|
4459
4606
|
|
|
4607
|
+
useDeduction(controller, props.deduction);
|
|
4608
|
+
useWindowClick(controller);
|
|
4609
|
+
/** 注册 from 对象 */
|
|
4460
4610
|
|
|
4461
4611
|
React.useEffect(function () {
|
|
4462
4612
|
controller.pipeline( /*#__PURE__*/function () {
|
|
@@ -4481,7 +4631,7 @@ var Main = decorator(Form.create())(function (props) {
|
|
|
4481
4631
|
return _ref.apply(this, arguments);
|
|
4482
4632
|
};
|
|
4483
4633
|
}())(props.form);
|
|
4484
|
-
}, [controller, props.form]); // 跟新
|
|
4634
|
+
}, [controller, props.form]); // 跟新 货物
|
|
4485
4635
|
|
|
4486
4636
|
React.useEffect(function () {
|
|
4487
4637
|
controller.pipeline( /*#__PURE__*/function () {
|
|
@@ -4507,19 +4657,79 @@ var Main = decorator(Form.create())(function (props) {
|
|
|
4507
4657
|
return _ref2.apply(this, arguments);
|
|
4508
4658
|
};
|
|
4509
4659
|
}())();
|
|
4510
|
-
}, [
|
|
4511
|
-
/**
|
|
4660
|
+
}, [controller, goodsList]);
|
|
4661
|
+
/** props 产品最大数 更新 */
|
|
4512
4662
|
|
|
4513
4663
|
React.useEffect(function () {
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4664
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4665
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(s) {
|
|
4666
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
4667
|
+
while (1) {
|
|
4668
|
+
switch (_context3.prev = _context3.next) {
|
|
4669
|
+
case 0:
|
|
4670
|
+
s.goodsListState.goodMax = props.goodMax;
|
|
4517
4671
|
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4672
|
+
case 1:
|
|
4673
|
+
case "end":
|
|
4674
|
+
return _context3.stop();
|
|
4675
|
+
}
|
|
4676
|
+
}
|
|
4677
|
+
}, _callee3);
|
|
4678
|
+
}));
|
|
4679
|
+
|
|
4680
|
+
return function (_x4) {
|
|
4681
|
+
return _ref3.apply(this, arguments);
|
|
4682
|
+
};
|
|
4683
|
+
}())();
|
|
4684
|
+
}, [controller, props.goodMax]);
|
|
4685
|
+
/** props 是否能添加折扣行 更新 */
|
|
4686
|
+
|
|
4687
|
+
React.useEffect(function () {
|
|
4688
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4689
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(s) {
|
|
4690
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
4691
|
+
while (1) {
|
|
4692
|
+
switch (_context4.prev = _context4.next) {
|
|
4693
|
+
case 0:
|
|
4694
|
+
s.goodsListState.isAddDiscount = props.isAddDiscount;
|
|
4695
|
+
|
|
4696
|
+
case 1:
|
|
4697
|
+
case "end":
|
|
4698
|
+
return _context4.stop();
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
}, _callee4);
|
|
4702
|
+
}));
|
|
4703
|
+
|
|
4704
|
+
return function (_x5) {
|
|
4705
|
+
return _ref4.apply(this, arguments);
|
|
4706
|
+
};
|
|
4707
|
+
}())();
|
|
4708
|
+
}, [controller, props.goodMax]);
|
|
4709
|
+
/** props 是否可以切换(含税/不含税)状态 更新 */
|
|
4710
|
+
|
|
4711
|
+
React.useEffect(function () {
|
|
4712
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4713
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(s) {
|
|
4714
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
4715
|
+
while (1) {
|
|
4716
|
+
switch (_context5.prev = _context5.next) {
|
|
4717
|
+
case 0:
|
|
4718
|
+
s.goodsListState.isSwitchTax = props.isSwitchTax;
|
|
4719
|
+
|
|
4720
|
+
case 1:
|
|
4721
|
+
case "end":
|
|
4722
|
+
return _context5.stop();
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
}, _callee5);
|
|
4726
|
+
}));
|
|
4727
|
+
|
|
4728
|
+
return function (_x6) {
|
|
4729
|
+
return _ref5.apply(this, arguments);
|
|
4730
|
+
};
|
|
4731
|
+
}())();
|
|
4732
|
+
}, [controller, props.isSwitchTax]);
|
|
4523
4733
|
return /*#__PURE__*/React.createElement("div", {
|
|
4524
4734
|
className: "kts-invoice-operate-goods-list",
|
|
4525
4735
|
onClick: function onClick(e) {
|
|
@@ -5197,7 +5407,7 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
5197
5407
|
s.goodsListState.editGood.priceExcludeTax = getPriceExcludeTax(s.goodsListState.editGood, record);
|
|
5198
5408
|
}
|
|
5199
5409
|
|
|
5200
|
-
if (s.goodsListState.editGood.quantity && s.goodsListState.editGood.priceIncludeTax) s.goodsListState.editGood.lineAmountIncludeTax =
|
|
5410
|
+
if (s.goodsListState.editGood.quantity && s.goodsListState.editGood.priceIncludeTax) s.goodsListState.editGood.lineAmountIncludeTax = countAmountIncludeTax(s.goodsListState.editGood.quantity, s.goodsListState.editGood.priceIncludeTax);
|
|
5201
5411
|
s.goodsListState.editGood.itemName = getItemName(record);
|
|
5202
5412
|
s.goodsListState.form.setFieldsValue(s.goodsListState.editGood);
|
|
5203
5413
|
s.goodsListState.importGoods.isVisibleDrawer = false;
|
package/dist/index.js
CHANGED
|
@@ -637,6 +637,10 @@ function draft(value) {
|
|
|
637
637
|
var GoodsListState = function GoodsListState() {
|
|
638
638
|
_classCallCheck(this, GoodsListState);
|
|
639
639
|
|
|
640
|
+
this.deduction = 0;
|
|
641
|
+
this.goodMax = void 0;
|
|
642
|
+
this.isSwitchTax = void 0;
|
|
643
|
+
this.isAddDiscount = void 0;
|
|
640
644
|
this.isTaxIncluded = true;
|
|
641
645
|
this.editGood = void 0;
|
|
642
646
|
this.form = void 0;
|
|
@@ -1589,6 +1593,21 @@ var AddRowButton = (function () {
|
|
|
1589
1593
|
var model = controller.useMemo(function (s) {
|
|
1590
1594
|
return s.model;
|
|
1591
1595
|
}, []);
|
|
1596
|
+
/** 产品数据量 */
|
|
1597
|
+
|
|
1598
|
+
var goodsNum = controller.useMemo(function (s) {
|
|
1599
|
+
return s.goodsListState.goodsList.length;
|
|
1600
|
+
}, []);
|
|
1601
|
+
/** 产品最大数 */
|
|
1602
|
+
|
|
1603
|
+
var goodMax = controller.useMemo(function (s) {
|
|
1604
|
+
return s.goodsListState.goodMax;
|
|
1605
|
+
}, []);
|
|
1606
|
+
/** 按钮是否禁用 */
|
|
1607
|
+
|
|
1608
|
+
var disabled = React__default['default'].useMemo(function () {
|
|
1609
|
+
return typeof goodMax === 'number' ? goodsNum >= goodMax : false;
|
|
1610
|
+
}, [goodMax, goodsNum]);
|
|
1592
1611
|
var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
1593
1612
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1594
1613
|
while (1) {
|
|
@@ -1653,7 +1672,8 @@ var AddRowButton = (function () {
|
|
|
1653
1672
|
if (model === 'prefab') return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
1654
1673
|
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
1655
1674
|
icon: "plus-circle",
|
|
1656
|
-
onClick: onClick
|
|
1675
|
+
onClick: onClick,
|
|
1676
|
+
disabled: disabled
|
|
1657
1677
|
}, "\u6DFB\u52A0\u884C");
|
|
1658
1678
|
});
|
|
1659
1679
|
|
|
@@ -1664,6 +1684,11 @@ var TaxIncludedSwitch = (function () {
|
|
|
1664
1684
|
var isTaxIncluded = controller.useMemo(function (e) {
|
|
1665
1685
|
return e.goodsListState.isTaxIncluded;
|
|
1666
1686
|
}, []);
|
|
1687
|
+
/** 是否可以切换(含税/不含税)状态 */
|
|
1688
|
+
|
|
1689
|
+
var isSwitchTax = controller.useMemo(function (e) {
|
|
1690
|
+
return e.goodsListState.isSwitchTax;
|
|
1691
|
+
}, []);
|
|
1667
1692
|
var onChange = React__default['default'].useCallback(function (e) {
|
|
1668
1693
|
controller.pipeline( /*#__PURE__*/function () {
|
|
1669
1694
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s) {
|
|
@@ -1689,6 +1714,7 @@ var TaxIncludedSwitch = (function () {
|
|
|
1689
1714
|
}())();
|
|
1690
1715
|
}, []);
|
|
1691
1716
|
return /*#__PURE__*/React__default['default'].createElement("span", null, /*#__PURE__*/React__default['default'].createElement("label", null, "\u542B\u7A0E:"), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Switch, {
|
|
1717
|
+
disabled: isSwitchTax === false,
|
|
1692
1718
|
checked: isTaxIncluded,
|
|
1693
1719
|
checkedChildren: "\u5F00",
|
|
1694
1720
|
unCheckedChildren: "\u5173",
|
|
@@ -1764,6 +1790,11 @@ var AddDiscountRowButton = GreyReactBox.decorator(ktsComponentsAntdX3.Form.creat
|
|
|
1764
1790
|
var model = controller.useMemo(function (s) {
|
|
1765
1791
|
return s.model;
|
|
1766
1792
|
}, []);
|
|
1793
|
+
/** 是否能添加折扣行 */
|
|
1794
|
+
|
|
1795
|
+
var isAddDiscount = controller.useMemo(function (s) {
|
|
1796
|
+
return s.goodsListState.isAddDiscount;
|
|
1797
|
+
}, []);
|
|
1767
1798
|
/** 是否开启抽屉 */
|
|
1768
1799
|
|
|
1769
1800
|
var visible = controller.useMemo(function (s) {
|
|
@@ -1900,7 +1931,7 @@ var AddDiscountRowButton = GreyReactBox.decorator(ktsComponentsAntdX3.Form.creat
|
|
|
1900
1931
|
}, _callee3);
|
|
1901
1932
|
})), [controller]);
|
|
1902
1933
|
if (model === 'prefab') return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
1903
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
1934
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, isAddDiscount !== false && /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
1904
1935
|
icon: "plus-circle",
|
|
1905
1936
|
disabled: disabled,
|
|
1906
1937
|
onClick: onClick
|
|
@@ -2453,14 +2484,59 @@ var format15 = function format15(value) {
|
|
|
2453
2484
|
if (typeof value === 'string') value = parseFloat(value);
|
|
2454
2485
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
2455
2486
|
return parseFloat(value.toFixed(fractionDigits > 8 ? 8 : fractionDigits));
|
|
2456
|
-
};
|
|
2487
|
+
};
|
|
2488
|
+
/**
|
|
2489
|
+
* 金额(含税) = 数量 * 单价(含税)
|
|
2490
|
+
* @param quantity 数量
|
|
2491
|
+
* @param priceIncludeTax 单价(含税)
|
|
2492
|
+
* @returns 金额(含税)
|
|
2493
|
+
*/
|
|
2457
2494
|
|
|
2458
|
-
function
|
|
2495
|
+
function countAmountIncludeTax(quantity, priceIncludeTax) {
|
|
2459
2496
|
if (!quantity && quantity !== 0) return undefined;
|
|
2460
2497
|
if (!priceIncludeTax && priceIncludeTax !== 0) return undefined;
|
|
2461
2498
|
quantity = format15(quantity);
|
|
2462
2499
|
priceIncludeTax = format15(priceIncludeTax);
|
|
2463
|
-
return parseFloat(
|
|
2500
|
+
return parseFloat(mathjs.chain(mathjs.bignumber(priceIncludeTax)).multiply(mathjs.bignumber(quantity)).done().toNumber().toFixed(2)); // return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* 不含税金额 = 含税金额-税额
|
|
2504
|
+
* @param amountIncludeTax 含税金额
|
|
2505
|
+
* @param taxAmount 税额
|
|
2506
|
+
* @returns 不含税金额
|
|
2507
|
+
*/
|
|
2508
|
+
|
|
2509
|
+
function countAmountExcludeTax(amountIncludeTax, taxAmount) {
|
|
2510
|
+
if (!amountIncludeTax && amountIncludeTax !== 0) return undefined;
|
|
2511
|
+
if (!taxAmount && taxAmount !== 0) return undefined;
|
|
2512
|
+
return mathjs.chain(mathjs.bignumber(amountIncludeTax)).subtract(mathjs.bignumber(taxAmount)).done().toNumber();
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* 税额 = (含税金额-扣除额)/(1+税率)*税率
|
|
2516
|
+
* @param amountIncludeTax 含税金额
|
|
2517
|
+
* @param deduction 扣除额
|
|
2518
|
+
* @param taxRate 税率
|
|
2519
|
+
* @returns 税额
|
|
2520
|
+
*/
|
|
2521
|
+
|
|
2522
|
+
function countTaxAmount(amountIncludeTax, deduction, taxRate) {
|
|
2523
|
+
if (!amountIncludeTax && amountIncludeTax !== 0) return undefined;
|
|
2524
|
+
if (!deduction && deduction !== 0) return undefined;
|
|
2525
|
+
if (!taxRate && taxRate !== 0) return undefined;
|
|
2526
|
+
var taxRateBu = mathjs.chain(mathjs.bignumber(taxRate)).divide(mathjs.bignumber(100)).done();
|
|
2527
|
+
return parseFloat(mathjs.chain(mathjs.bignumber(amountIncludeTax)).subtract(mathjs.bignumber(deduction)).divide(mathjs.chain(mathjs.bignumber(1)).add(taxRateBu).done()).multiply(taxRateBu).done().toNumber().toFixed(2));
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* 单价 = 金额/数量
|
|
2531
|
+
* @param amount 金额
|
|
2532
|
+
* @param quantity 数量
|
|
2533
|
+
* @returns 单价
|
|
2534
|
+
*/
|
|
2535
|
+
|
|
2536
|
+
function countPrice(amount, quantity) {
|
|
2537
|
+
if (!amount && amount !== 0) return undefined;
|
|
2538
|
+
if (!quantity && quantity !== 0) return undefined;
|
|
2539
|
+
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(quantity)).done().toNumber());
|
|
2464
2540
|
}
|
|
2465
2541
|
|
|
2466
2542
|
/** 延迟函数 */
|
|
@@ -3086,64 +3162,55 @@ var onChangeTaxRate = lazyFn$1(function (controller, form, record) {
|
|
|
3086
3162
|
var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controller, form, record) {
|
|
3087
3163
|
form.validateFields( /*#__PURE__*/function () {
|
|
3088
3164
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(err, values) {
|
|
3089
|
-
var
|
|
3165
|
+
var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
|
|
3090
3166
|
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
3091
3167
|
while (1) {
|
|
3092
3168
|
switch (_context7.prev = _context7.next) {
|
|
3093
3169
|
case 0:
|
|
3094
3170
|
err = err || {};
|
|
3171
|
+
/** 税额 */
|
|
3095
3172
|
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
break;
|
|
3099
|
-
}
|
|
3173
|
+
/** 扣除额 */
|
|
3174
|
+
deduction = controller.state.goodsListState.deduction; // 计算税额
|
|
3100
3175
|
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
_context7.next = 6;
|
|
3105
|
-
return controller.setEditGood({
|
|
3106
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
3107
|
-
});
|
|
3176
|
+
if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
|
|
3177
|
+
taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
|
|
3178
|
+
}
|
|
3108
3179
|
|
|
3109
|
-
|
|
3110
|
-
// 税额 = 金额(含税)-金额(不含税)
|
|
3111
|
-
taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
|
|
3112
|
-
form.setFieldsValue({
|
|
3113
|
-
taxAmount: taxAmount
|
|
3114
|
-
});
|
|
3115
|
-
_context7.next = 10;
|
|
3180
|
+
_context7.next = 5;
|
|
3116
3181
|
return controller.setEditGood({
|
|
3117
3182
|
taxAmount: taxAmount
|
|
3118
3183
|
});
|
|
3119
3184
|
|
|
3120
|
-
case
|
|
3121
|
-
|
|
3122
|
-
|
|
3185
|
+
case 5:
|
|
3186
|
+
// 计算 金额(不含税)
|
|
3187
|
+
if (taxAmount && !promptErr(err.lineAmountIncludeTax)) {
|
|
3188
|
+
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
3189
|
+
}
|
|
3123
3190
|
|
|
3124
|
-
case 12:
|
|
3125
3191
|
form.setFieldsValue({
|
|
3126
|
-
|
|
3192
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
3127
3193
|
});
|
|
3128
|
-
_context7.next =
|
|
3194
|
+
_context7.next = 9;
|
|
3129
3195
|
return controller.setEditGood({
|
|
3130
|
-
|
|
3196
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
3131
3197
|
});
|
|
3132
3198
|
|
|
3133
|
-
case
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3199
|
+
case 9:
|
|
3200
|
+
// 单价(不含税)
|
|
3201
|
+
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
3202
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity);
|
|
3137
3203
|
}
|
|
3138
3204
|
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3205
|
+
form.setFieldsValue({
|
|
3206
|
+
priceExcludeTax: priceExcludeTax
|
|
3207
|
+
});
|
|
3208
|
+
_context7.next = 13;
|
|
3142
3209
|
return controller.setEditGood({
|
|
3143
3210
|
priceExcludeTax: priceExcludeTax
|
|
3144
3211
|
});
|
|
3145
3212
|
|
|
3146
|
-
case
|
|
3213
|
+
case 13:
|
|
3147
3214
|
case "end":
|
|
3148
3215
|
return _context7.stop();
|
|
3149
3216
|
}
|
|
@@ -3400,6 +3467,11 @@ var RowMenu = (function (props) {
|
|
|
3400
3467
|
var model = controller.useMemo(function (s) {
|
|
3401
3468
|
return s.model;
|
|
3402
3469
|
}, []);
|
|
3470
|
+
/** 是否能添加折扣行 */
|
|
3471
|
+
|
|
3472
|
+
var isAddDiscount = controller.useMemo(function (s) {
|
|
3473
|
+
return s.goodsListState.isAddDiscount;
|
|
3474
|
+
}, []);
|
|
3403
3475
|
var goodsMenuExpand = controller.useMemo(function (s) {
|
|
3404
3476
|
return s.goodsListState.goodsMenuExpand;
|
|
3405
3477
|
}, []);
|
|
@@ -3408,7 +3480,7 @@ var RowMenu = (function (props) {
|
|
|
3408
3480
|
var endowCode = useEndowCode(props.goods);
|
|
3409
3481
|
var itemList = React__default['default'].useMemo(function () {
|
|
3410
3482
|
var arr = [];
|
|
3411
|
-
model !== 'prefab' && addDiscount && arr.push(addDiscount); // 添加折扣行
|
|
3483
|
+
model !== 'prefab' && isAddDiscount !== false && addDiscount && arr.push(addDiscount); // 添加折扣行
|
|
3412
3484
|
|
|
3413
3485
|
endowCode && arr.push(endowCode); // 赋码
|
|
3414
3486
|
|
|
@@ -3425,7 +3497,7 @@ var RowMenu = (function (props) {
|
|
|
3425
3497
|
}
|
|
3426
3498
|
|
|
3427
3499
|
return arr;
|
|
3428
|
-
}, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model]);
|
|
3500
|
+
}, [controller, endowCode, addDiscount, delItem, goodsMenuExpand, props.goods, model, isAddDiscount]);
|
|
3429
3501
|
|
|
3430
3502
|
if (itemList.length === 0) {
|
|
3431
3503
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
@@ -4203,6 +4275,82 @@ var useOnRow = (function () {
|
|
|
4203
4275
|
};
|
|
4204
4276
|
});
|
|
4205
4277
|
|
|
4278
|
+
/**
|
|
4279
|
+
* 扣除额 相关业务
|
|
4280
|
+
*/
|
|
4281
|
+
|
|
4282
|
+
function useDeduction(controller) {
|
|
4283
|
+
var deduction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4284
|
+
// 更新 扣除额
|
|
4285
|
+
React__default['default'].useEffect(function () {
|
|
4286
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4287
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s) {
|
|
4288
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4289
|
+
while (1) {
|
|
4290
|
+
switch (_context.prev = _context.next) {
|
|
4291
|
+
case 0:
|
|
4292
|
+
return _context.abrupt("return", s.goodsListState.deduction = deduction);
|
|
4293
|
+
|
|
4294
|
+
case 1:
|
|
4295
|
+
case "end":
|
|
4296
|
+
return _context.stop();
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
}, _callee);
|
|
4300
|
+
}));
|
|
4301
|
+
|
|
4302
|
+
return function (_x) {
|
|
4303
|
+
return _ref.apply(this, arguments);
|
|
4304
|
+
};
|
|
4305
|
+
}())();
|
|
4306
|
+
}, [controller, deduction]); // 重新计算
|
|
4307
|
+
|
|
4308
|
+
React__default['default'].useEffect(function () {
|
|
4309
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4310
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(s) {
|
|
4311
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
4312
|
+
while (1) {
|
|
4313
|
+
switch (_context2.prev = _context2.next) {
|
|
4314
|
+
case 0:
|
|
4315
|
+
s.goodsListState.editGood = undefined;
|
|
4316
|
+
s.goodsListState.goodsList = [];
|
|
4317
|
+
|
|
4318
|
+
case 2:
|
|
4319
|
+
case "end":
|
|
4320
|
+
return _context2.stop();
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
}, _callee2);
|
|
4324
|
+
}));
|
|
4325
|
+
|
|
4326
|
+
return function (_x2) {
|
|
4327
|
+
return _ref2.apply(this, arguments);
|
|
4328
|
+
};
|
|
4329
|
+
}())();
|
|
4330
|
+
}, [controller, deduction]);
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
/**
|
|
4334
|
+
* 点击组件外部 保存正在编辑的货物
|
|
4335
|
+
*/
|
|
4336
|
+
/**
|
|
4337
|
+
* 点击组件外部 保存正在编辑的货物
|
|
4338
|
+
*/
|
|
4339
|
+
|
|
4340
|
+
function useWindowClick(controller) {
|
|
4341
|
+
/** 点击组件外部 保存正在编辑的货物 */
|
|
4342
|
+
React__default['default'].useEffect(function () {
|
|
4343
|
+
var click = function click() {
|
|
4344
|
+
setTimeout(controller.saveEditGood);
|
|
4345
|
+
};
|
|
4346
|
+
|
|
4347
|
+
window.addEventListener('click', click);
|
|
4348
|
+
return function () {
|
|
4349
|
+
window.removeEventListener('click', click);
|
|
4350
|
+
};
|
|
4351
|
+
}, [controller]);
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4206
4354
|
var useRowSelection = (function () {
|
|
4207
4355
|
/** 控制器 */
|
|
4208
4356
|
var controller = default_1.useInvoiceController();
|
|
@@ -4430,7 +4578,7 @@ var useRowSelection = (function () {
|
|
|
4430
4578
|
};
|
|
4431
4579
|
});
|
|
4432
4580
|
|
|
4433
|
-
var css_248z$6 = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n margin: 0 10px;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend label {\n margin-right: 5px;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table {\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import {\n display: flex;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import .ktsAnt3x-btn {\n display: block;\n line-height: 0;\n width: auto;\n padding-right: 5px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-table-body {\n height: 263px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-explain {\n position: absolute;\n right: 6px;\n top: 6px;\n}\n.kts-invoice-operate-goods-list-table table {\n border-bottom: 1px solid #d9d9d9 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td {\n padding: 0 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item {\n padding: 0;\n margin: 0;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: inherit;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-select-selection,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input:hover {\n border-right-width: 1px !important;\n border-top-width: 1px;\n border-left-width: 1px;\n border-bottom-width: 1px;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-selection--single,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-input {\n height: 30px;\n border-radius: 0;\n border-right-width: 0 !important;\n border-top-width: 0;\n border-left-width: 0;\n border-bottom-width: 0;\n box-shadow: none;\n}\n";
|
|
4581
|
+
var css_248z$6 = ".kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-table-tax-rate .ktsAnt3x-select-selection-selected-value {\n float: right;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able {\n display: flex;\n padding: 10px;\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list {\n flex: 1;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button {\n padding-left: 10px;\n padding-right: 10px;\n border-radius: 12px;\n color: #0074ff;\n border: 1px solid #0074ff;\n margin: 0 10px;\n height: 24px;\n line-height: 22px;\n cursor: pointer;\n font-size: 12px;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-list button[disabled] {\n color: rgba(0, 0, 0, 0.25);\n border: 1px solid;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend {\n flex: none;\n display: flex;\n}\n.kts-invoice-operate-goods-list .kts-invoice-operate-goods-list-able-extend label {\n margin-right: 5px;\n}\n.kts-invoice-operate-goods-list-table.kts-invoice-operate-prefab .ktsAnt3x-table-row {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table {\n border-bottom: 1px solid #dcdcdc;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-discount {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import {\n display: flex;\n}\n.kts-invoice-operate-goods-list-table .kts-invoice-operate-goods-list-able-list-itemName-import .ktsAnt3x-btn {\n display: block;\n line-height: 0;\n width: auto;\n padding-right: 5px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-item-children {\n height: 30px;\n display: block;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-table-body {\n height: 263px;\n}\n.kts-invoice-operate-goods-list-table .ktsAnt3x-form-explain {\n position: absolute;\n right: 6px;\n top: 6px;\n}\n.kts-invoice-operate-goods-list-table table {\n border-bottom: 1px solid #d9d9d9 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td {\n padding: 0 !important;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-explain {\n display: none;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item {\n padding: 0;\n margin: 0;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-form-item .ktsAnt3x-form-item-control {\n line-height: inherit;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-select-selection,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .has-error .ktsAnt3x-input:hover {\n border-right-width: 1px !important;\n border-top-width: 1px;\n border-left-width: 1px;\n border-bottom-width: 1px;\n}\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-selection--single,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-select-auto-complete.ktsAnt3x-select .ktsAnt3x-input:hover,\n.kts-invoice-operate-goods-list-table table > .ktsAnt3x-table-tbody > tr > td .ktsAnt3x-input {\n height: 30px;\n border-radius: 0;\n border-right-width: 0 !important;\n border-top-width: 0;\n border-left-width: 0;\n border-bottom-width: 0;\n box-shadow: none;\n}\n";
|
|
4434
4582
|
styleInject(css_248z$6);
|
|
4435
4583
|
|
|
4436
4584
|
var GoodsList = /*#__PURE__*/function (_React$Component) {
|
|
@@ -4465,8 +4613,10 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
|
|
|
4465
4613
|
/** 表格行事件 */
|
|
4466
4614
|
|
|
4467
4615
|
var _onRow = useOnRow();
|
|
4468
|
-
/** 注册 from 对象 */
|
|
4469
4616
|
|
|
4617
|
+
useDeduction(controller, props.deduction);
|
|
4618
|
+
useWindowClick(controller);
|
|
4619
|
+
/** 注册 from 对象 */
|
|
4470
4620
|
|
|
4471
4621
|
React__default['default'].useEffect(function () {
|
|
4472
4622
|
controller.pipeline( /*#__PURE__*/function () {
|
|
@@ -4491,7 +4641,7 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
|
|
|
4491
4641
|
return _ref.apply(this, arguments);
|
|
4492
4642
|
};
|
|
4493
4643
|
}())(props.form);
|
|
4494
|
-
}, [controller, props.form]); // 跟新
|
|
4644
|
+
}, [controller, props.form]); // 跟新 货物
|
|
4495
4645
|
|
|
4496
4646
|
React__default['default'].useEffect(function () {
|
|
4497
4647
|
controller.pipeline( /*#__PURE__*/function () {
|
|
@@ -4517,19 +4667,79 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
|
|
|
4517
4667
|
return _ref2.apply(this, arguments);
|
|
4518
4668
|
};
|
|
4519
4669
|
}())();
|
|
4520
|
-
}, [
|
|
4521
|
-
/**
|
|
4670
|
+
}, [controller, goodsList]);
|
|
4671
|
+
/** props 产品最大数 更新 */
|
|
4522
4672
|
|
|
4523
4673
|
React__default['default'].useEffect(function () {
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4674
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4675
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(s) {
|
|
4676
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
4677
|
+
while (1) {
|
|
4678
|
+
switch (_context3.prev = _context3.next) {
|
|
4679
|
+
case 0:
|
|
4680
|
+
s.goodsListState.goodMax = props.goodMax;
|
|
4527
4681
|
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4682
|
+
case 1:
|
|
4683
|
+
case "end":
|
|
4684
|
+
return _context3.stop();
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
}, _callee3);
|
|
4688
|
+
}));
|
|
4689
|
+
|
|
4690
|
+
return function (_x4) {
|
|
4691
|
+
return _ref3.apply(this, arguments);
|
|
4692
|
+
};
|
|
4693
|
+
}())();
|
|
4694
|
+
}, [controller, props.goodMax]);
|
|
4695
|
+
/** props 是否能添加折扣行 更新 */
|
|
4696
|
+
|
|
4697
|
+
React__default['default'].useEffect(function () {
|
|
4698
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4699
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(s) {
|
|
4700
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
4701
|
+
while (1) {
|
|
4702
|
+
switch (_context4.prev = _context4.next) {
|
|
4703
|
+
case 0:
|
|
4704
|
+
s.goodsListState.isAddDiscount = props.isAddDiscount;
|
|
4705
|
+
|
|
4706
|
+
case 1:
|
|
4707
|
+
case "end":
|
|
4708
|
+
return _context4.stop();
|
|
4709
|
+
}
|
|
4710
|
+
}
|
|
4711
|
+
}, _callee4);
|
|
4712
|
+
}));
|
|
4713
|
+
|
|
4714
|
+
return function (_x5) {
|
|
4715
|
+
return _ref4.apply(this, arguments);
|
|
4716
|
+
};
|
|
4717
|
+
}())();
|
|
4718
|
+
}, [controller, props.goodMax]);
|
|
4719
|
+
/** props 是否可以切换(含税/不含税)状态 更新 */
|
|
4720
|
+
|
|
4721
|
+
React__default['default'].useEffect(function () {
|
|
4722
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
4723
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(s) {
|
|
4724
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
4725
|
+
while (1) {
|
|
4726
|
+
switch (_context5.prev = _context5.next) {
|
|
4727
|
+
case 0:
|
|
4728
|
+
s.goodsListState.isSwitchTax = props.isSwitchTax;
|
|
4729
|
+
|
|
4730
|
+
case 1:
|
|
4731
|
+
case "end":
|
|
4732
|
+
return _context5.stop();
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
}, _callee5);
|
|
4736
|
+
}));
|
|
4737
|
+
|
|
4738
|
+
return function (_x6) {
|
|
4739
|
+
return _ref5.apply(this, arguments);
|
|
4740
|
+
};
|
|
4741
|
+
}())();
|
|
4742
|
+
}, [controller, props.isSwitchTax]);
|
|
4533
4743
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4534
4744
|
className: "kts-invoice-operate-goods-list",
|
|
4535
4745
|
onClick: function onClick(e) {
|
|
@@ -5207,7 +5417,7 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
5207
5417
|
s.goodsListState.editGood.priceExcludeTax = getPriceExcludeTax(s.goodsListState.editGood, record);
|
|
5208
5418
|
}
|
|
5209
5419
|
|
|
5210
|
-
if (s.goodsListState.editGood.quantity && s.goodsListState.editGood.priceIncludeTax) s.goodsListState.editGood.lineAmountIncludeTax =
|
|
5420
|
+
if (s.goodsListState.editGood.quantity && s.goodsListState.editGood.priceIncludeTax) s.goodsListState.editGood.lineAmountIncludeTax = countAmountIncludeTax(s.goodsListState.editGood.quantity, s.goodsListState.editGood.priceIncludeTax);
|
|
5211
5421
|
s.goodsListState.editGood.itemName = getItemName(record);
|
|
5212
5422
|
s.goodsListState.form.setFieldsValue(s.goodsListState.editGood);
|
|
5213
5423
|
s.goodsListState.importGoods.isVisibleDrawer = false;
|