kts-component-invoice-operate 3.1.4 → 3.1.6
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/index.d.ts +4 -0
- package/dist/Invoice/tools/calculate/index.d.ts +3 -3
- package/dist/index.esm.js +134 -122
- package/dist/index.js +134 -122
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +6 -0
- package/src/Invoice/tools/calculate/index.ts +7 -7
- package/src/Invoice/ui/EndowCodeDrawer/index.tsx +1 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +27 -21
- package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +7 -4
- package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -935,6 +935,8 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
935
935
|
this.buyerState = new BuyerState();
|
|
936
936
|
this.goodsListState = new GoodsListState();
|
|
937
937
|
this.calculating = void 0;
|
|
938
|
+
this.calculatingDigits = void 0;
|
|
939
|
+
this.priceIntegerDigit = void 0;
|
|
938
940
|
this.rootElement = null;
|
|
939
941
|
});
|
|
940
942
|
|
|
@@ -1074,11 +1076,12 @@ var format2 = function format2(value) {
|
|
|
1074
1076
|
};
|
|
1075
1077
|
/** 格式化 保留15位数字 */
|
|
1076
1078
|
var format15 = function format15(value) {
|
|
1079
|
+
var defaultFractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
|
|
1077
1080
|
if (value === Infinity) return '';
|
|
1078
1081
|
if ("".concat(value) === 'NaN') return '';
|
|
1079
1082
|
if (typeof value === 'string') value = parseFloat(value);
|
|
1080
1083
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
1081
|
-
return parseFloat(value.toFixed(fractionDigits >
|
|
1084
|
+
return parseFloat(value.toFixed(fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits));
|
|
1082
1085
|
};
|
|
1083
1086
|
/**
|
|
1084
1087
|
* 金额(含税) = 数量 * 单价(含税)
|
|
@@ -1086,11 +1089,11 @@ var format15 = function format15(value) {
|
|
|
1086
1089
|
* @param priceIncludeTax 单价(含税)
|
|
1087
1090
|
* @returns 金额(含税)
|
|
1088
1091
|
*/
|
|
1089
|
-
function countAmountIncludeTax(quantity, priceIncludeTax) {
|
|
1092
|
+
function countAmountIncludeTax(quantity, priceIncludeTax, calculatingDigits) {
|
|
1090
1093
|
if (!quantity && quantity !== 0) return undefined;
|
|
1091
1094
|
if (!priceIncludeTax && priceIncludeTax !== 0) return undefined;
|
|
1092
|
-
quantity = format15(quantity);
|
|
1093
|
-
priceIncludeTax = format15(priceIncludeTax);
|
|
1095
|
+
quantity = format15(quantity, calculatingDigits);
|
|
1096
|
+
priceIncludeTax = format15(priceIncludeTax, calculatingDigits);
|
|
1094
1097
|
return parseFloat(chain$1(bignumber(priceIncludeTax)).multiply(bignumber(quantity)).done().toNumber().toFixed(2));
|
|
1095
1098
|
// return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
|
|
1096
1099
|
}
|
|
@@ -1125,10 +1128,10 @@ function countTaxAmount(amountIncludeTax, deduction, taxRate) {
|
|
|
1125
1128
|
* @param quantity 数量
|
|
1126
1129
|
* @returns 单价
|
|
1127
1130
|
*/
|
|
1128
|
-
function countPrice(amount, quantity) {
|
|
1131
|
+
function countPrice(amount, quantity, calculatingDigits) {
|
|
1129
1132
|
if (!amount && amount !== 0) return undefined;
|
|
1130
1133
|
if (!quantity && quantity !== 0) return undefined;
|
|
1131
|
-
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber());
|
|
1134
|
+
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1132
1135
|
}
|
|
1133
1136
|
|
|
1134
1137
|
/**
|
|
@@ -8067,7 +8070,7 @@ var promptErr = function promptErr(err) {
|
|
|
8067
8070
|
var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
8068
8071
|
form.validateFields( /*#__PURE__*/function () {
|
|
8069
8072
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(err, values) {
|
|
8070
|
-
var quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
8073
|
+
var calculatingDigits, quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
8071
8074
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8072
8075
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8073
8076
|
case 0:
|
|
@@ -8089,94 +8092,95 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8089
8092
|
}
|
|
8090
8093
|
return _context2.abrupt("return");
|
|
8091
8094
|
case 7:
|
|
8092
|
-
|
|
8093
|
-
|
|
8095
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8096
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8097
|
+
_context2.next = 11;
|
|
8094
8098
|
return controller.setEditGood({
|
|
8095
8099
|
quantity: quantity
|
|
8096
8100
|
});
|
|
8097
|
-
case
|
|
8101
|
+
case 11:
|
|
8098
8102
|
form.setFieldsValue({
|
|
8099
8103
|
quantity: quantity
|
|
8100
8104
|
});
|
|
8101
8105
|
// 是否含税
|
|
8102
8106
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
8103
|
-
_context2.next =
|
|
8107
|
+
_context2.next = 30;
|
|
8104
8108
|
break;
|
|
8105
8109
|
}
|
|
8106
8110
|
if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
|
|
8107
|
-
_context2.next =
|
|
8111
|
+
_context2.next = 21;
|
|
8108
8112
|
break;
|
|
8109
8113
|
}
|
|
8110
8114
|
// 可以找到 单价(含税)
|
|
8111
|
-
priceIncludeTax = format15(values.priceIncludeTax);
|
|
8115
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8112
8116
|
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
8113
8117
|
form.setFieldsValue({
|
|
8114
8118
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8115
8119
|
});
|
|
8116
|
-
_context2.next =
|
|
8120
|
+
_context2.next = 19;
|
|
8117
8121
|
return controller.setEditGood({
|
|
8118
8122
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8119
8123
|
});
|
|
8120
|
-
case
|
|
8121
|
-
_context2.next =
|
|
8124
|
+
case 19:
|
|
8125
|
+
_context2.next = 27;
|
|
8122
8126
|
break;
|
|
8123
|
-
case
|
|
8127
|
+
case 21:
|
|
8124
8128
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8125
|
-
_context2.next =
|
|
8129
|
+
_context2.next = 27;
|
|
8126
8130
|
break;
|
|
8127
8131
|
}
|
|
8128
8132
|
// 可以找到 金额(含税)
|
|
8129
8133
|
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8130
|
-
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)));
|
|
8134
|
+
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8131
8135
|
form.setFieldsValue({
|
|
8132
8136
|
priceIncludeTax: _priceIncludeTax
|
|
8133
8137
|
});
|
|
8134
|
-
_context2.next =
|
|
8138
|
+
_context2.next = 27;
|
|
8135
8139
|
return controller.setEditGood({
|
|
8136
8140
|
priceIncludeTax: _priceIncludeTax
|
|
8137
8141
|
});
|
|
8138
|
-
case
|
|
8142
|
+
case 27:
|
|
8139
8143
|
// 更新不含税
|
|
8140
8144
|
updateUnitPriceExcludingTax(controller, form);
|
|
8141
|
-
_context2.next =
|
|
8145
|
+
_context2.next = 45;
|
|
8142
8146
|
break;
|
|
8143
|
-
case
|
|
8147
|
+
case 30:
|
|
8144
8148
|
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8145
|
-
_context2.next =
|
|
8149
|
+
_context2.next = 38;
|
|
8146
8150
|
break;
|
|
8147
8151
|
}
|
|
8148
|
-
priceExcludeTax = format15(values.priceExcludeTax);
|
|
8152
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8149
8153
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8150
8154
|
form.setFieldsValue({
|
|
8151
8155
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8152
8156
|
});
|
|
8153
|
-
_context2.next =
|
|
8157
|
+
_context2.next = 36;
|
|
8154
8158
|
return controller.setEditGood({
|
|
8155
8159
|
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
8156
8160
|
quantity: quantity
|
|
8157
8161
|
});
|
|
8158
|
-
case
|
|
8159
|
-
_context2.next =
|
|
8162
|
+
case 36:
|
|
8163
|
+
_context2.next = 44;
|
|
8160
8164
|
break;
|
|
8161
|
-
case
|
|
8165
|
+
case 38:
|
|
8162
8166
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8163
|
-
_context2.next =
|
|
8167
|
+
_context2.next = 44;
|
|
8164
8168
|
break;
|
|
8165
8169
|
}
|
|
8166
8170
|
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8167
|
-
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)));
|
|
8171
|
+
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8168
8172
|
form.setFieldsValue({
|
|
8169
8173
|
priceExcludeTax: _priceExcludeTax
|
|
8170
8174
|
});
|
|
8171
|
-
_context2.next =
|
|
8175
|
+
_context2.next = 44;
|
|
8172
8176
|
return controller.setEditGood({
|
|
8173
8177
|
priceExcludeTax: _priceExcludeTax,
|
|
8174
8178
|
quantity: quantity
|
|
8175
8179
|
});
|
|
8176
|
-
case
|
|
8180
|
+
case 44:
|
|
8177
8181
|
// 更新含税
|
|
8178
8182
|
updateUnitPriceTax(controller, form);
|
|
8179
|
-
case
|
|
8183
|
+
case 45:
|
|
8180
8184
|
// 清楚 计算中启动字段
|
|
8181
8185
|
controller.run( /*#__PURE__*/function () {
|
|
8182
8186
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
@@ -8194,7 +8198,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8194
8198
|
return _ref2.apply(this, arguments);
|
|
8195
8199
|
};
|
|
8196
8200
|
}());
|
|
8197
|
-
case
|
|
8201
|
+
case 46:
|
|
8198
8202
|
case "end":
|
|
8199
8203
|
return _context2.stop();
|
|
8200
8204
|
}
|
|
@@ -8209,7 +8213,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8209
8213
|
var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
8210
8214
|
form.validateFields( /*#__PURE__*/function () {
|
|
8211
8215
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
8212
|
-
var priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
8216
|
+
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
8213
8217
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8214
8218
|
while (1) switch (_context4.prev = _context4.next) {
|
|
8215
8219
|
case 0:
|
|
@@ -8232,47 +8236,48 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8232
8236
|
}
|
|
8233
8237
|
return _context4.abrupt("return");
|
|
8234
8238
|
case 7:
|
|
8235
|
-
|
|
8236
|
-
|
|
8239
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8240
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8241
|
+
_context4.next = 11;
|
|
8237
8242
|
return controller.setEditGood({
|
|
8238
8243
|
priceIncludeTax: priceIncludeTax
|
|
8239
8244
|
});
|
|
8240
|
-
case
|
|
8245
|
+
case 11:
|
|
8241
8246
|
form.setFieldsValue({
|
|
8242
8247
|
priceIncludeTax: priceIncludeTax
|
|
8243
8248
|
});
|
|
8244
8249
|
// 是否有数量
|
|
8245
8250
|
if (!(!err.quantity && values.quantity)) {
|
|
8246
|
-
_context4.next =
|
|
8251
|
+
_context4.next = 20;
|
|
8247
8252
|
break;
|
|
8248
8253
|
}
|
|
8249
|
-
quantity = format15(values.quantity);
|
|
8254
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8250
8255
|
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
8251
8256
|
form.setFieldsValue({
|
|
8252
8257
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8253
8258
|
});
|
|
8254
|
-
_context4.next =
|
|
8259
|
+
_context4.next = 18;
|
|
8255
8260
|
return controller.setEditGood({
|
|
8256
8261
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8257
8262
|
});
|
|
8258
|
-
case
|
|
8259
|
-
_context4.next =
|
|
8263
|
+
case 18:
|
|
8264
|
+
_context4.next = 26;
|
|
8260
8265
|
break;
|
|
8261
|
-
case
|
|
8266
|
+
case 20:
|
|
8262
8267
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8263
|
-
_context4.next =
|
|
8268
|
+
_context4.next = 26;
|
|
8264
8269
|
break;
|
|
8265
8270
|
}
|
|
8266
8271
|
_lineAmountIncludeTax2 = format2(values.lineAmountIncludeTax);
|
|
8267
|
-
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)));
|
|
8272
|
+
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)), calculatingDigits);
|
|
8268
8273
|
form.setFieldsValue({
|
|
8269
8274
|
quantity: _quantity
|
|
8270
8275
|
});
|
|
8271
|
-
_context4.next =
|
|
8276
|
+
_context4.next = 26;
|
|
8272
8277
|
return controller.setEditGood({
|
|
8273
8278
|
quantity: _quantity
|
|
8274
8279
|
});
|
|
8275
|
-
case
|
|
8280
|
+
case 26:
|
|
8276
8281
|
// 更新不含税
|
|
8277
8282
|
updateUnitPriceExcludingTax(controller, form);
|
|
8278
8283
|
// 清楚 计算中启动字段
|
|
@@ -8292,7 +8297,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8292
8297
|
return _ref4.apply(this, arguments);
|
|
8293
8298
|
};
|
|
8294
8299
|
}());
|
|
8295
|
-
case
|
|
8300
|
+
case 28:
|
|
8296
8301
|
case "end":
|
|
8297
8302
|
return _context4.stop();
|
|
8298
8303
|
}
|
|
@@ -8307,7 +8312,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8307
8312
|
var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
8308
8313
|
form.validateFields( /*#__PURE__*/function () {
|
|
8309
8314
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
|
|
8310
|
-
var priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
8315
|
+
var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
8311
8316
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8312
8317
|
while (1) switch (_context6.prev = _context6.next) {
|
|
8313
8318
|
case 0:
|
|
@@ -8330,47 +8335,48 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8330
8335
|
}
|
|
8331
8336
|
return _context6.abrupt("return");
|
|
8332
8337
|
case 7:
|
|
8333
|
-
|
|
8334
|
-
|
|
8338
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8339
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8340
|
+
_context6.next = 11;
|
|
8335
8341
|
return controller.setEditGood({
|
|
8336
8342
|
priceExcludeTax: priceExcludeTax
|
|
8337
8343
|
});
|
|
8338
|
-
case
|
|
8344
|
+
case 11:
|
|
8339
8345
|
form.setFieldsValue({
|
|
8340
8346
|
priceExcludeTax: priceExcludeTax
|
|
8341
8347
|
});
|
|
8342
8348
|
// 是否有数量
|
|
8343
8349
|
if (!(!err.quantity && values.quantity)) {
|
|
8344
|
-
_context6.next =
|
|
8350
|
+
_context6.next = 20;
|
|
8345
8351
|
break;
|
|
8346
8352
|
}
|
|
8347
|
-
quantity = format15(values.quantity);
|
|
8353
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8348
8354
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8349
8355
|
form.setFieldsValue({
|
|
8350
8356
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8351
8357
|
});
|
|
8352
|
-
_context6.next =
|
|
8358
|
+
_context6.next = 18;
|
|
8353
8359
|
return controller.setEditGood({
|
|
8354
8360
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8355
8361
|
});
|
|
8356
|
-
case
|
|
8357
|
-
_context6.next =
|
|
8362
|
+
case 18:
|
|
8363
|
+
_context6.next = 26;
|
|
8358
8364
|
break;
|
|
8359
|
-
case
|
|
8365
|
+
case 20:
|
|
8360
8366
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8361
|
-
_context6.next =
|
|
8367
|
+
_context6.next = 26;
|
|
8362
8368
|
break;
|
|
8363
8369
|
}
|
|
8364
8370
|
_lineAmountExcludeTax2 = format2(values.lineAmountExcludeTax);
|
|
8365
|
-
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)));
|
|
8371
|
+
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)), calculatingDigits);
|
|
8366
8372
|
form.setFieldsValue({
|
|
8367
8373
|
quantity: _quantity2
|
|
8368
8374
|
});
|
|
8369
|
-
_context6.next =
|
|
8375
|
+
_context6.next = 26;
|
|
8370
8376
|
return controller.setEditGood({
|
|
8371
8377
|
quantity: _quantity2
|
|
8372
8378
|
});
|
|
8373
|
-
case
|
|
8379
|
+
case 26:
|
|
8374
8380
|
// 更新含税
|
|
8375
8381
|
updateUnitPriceTax(controller, form);
|
|
8376
8382
|
// 清楚 计算中启动字段
|
|
@@ -8390,7 +8396,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8390
8396
|
return _ref6.apply(this, arguments);
|
|
8391
8397
|
};
|
|
8392
8398
|
}());
|
|
8393
|
-
case
|
|
8399
|
+
case 28:
|
|
8394
8400
|
case "end":
|
|
8395
8401
|
return _context6.stop();
|
|
8396
8402
|
}
|
|
@@ -8405,7 +8411,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8405
8411
|
var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
8406
8412
|
form.validateFields( /*#__PURE__*/function () {
|
|
8407
8413
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
|
|
8408
|
-
var lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
8414
|
+
var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
8409
8415
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
8410
8416
|
while (1) switch (_context8.prev = _context8.next) {
|
|
8411
8417
|
case 0:
|
|
@@ -8423,47 +8429,48 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8423
8429
|
updateUnitPriceExcludingTax(controller, form);
|
|
8424
8430
|
return _context8.abrupt("return");
|
|
8425
8431
|
case 6:
|
|
8432
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8426
8433
|
lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8427
|
-
_context8.next =
|
|
8434
|
+
_context8.next = 10;
|
|
8428
8435
|
return controller.setEditGood({
|
|
8429
8436
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8430
8437
|
});
|
|
8431
|
-
case
|
|
8438
|
+
case 10:
|
|
8432
8439
|
form.setFieldsValue({
|
|
8433
8440
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8434
8441
|
});
|
|
8435
8442
|
// 是否有数量
|
|
8436
8443
|
if (!(!err.quantity && values.quantity)) {
|
|
8437
|
-
_context8.next =
|
|
8444
|
+
_context8.next = 19;
|
|
8438
8445
|
break;
|
|
8439
8446
|
}
|
|
8440
|
-
quantity = format15(values.quantity);
|
|
8441
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)));
|
|
8447
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8448
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8442
8449
|
form.setFieldsValue({
|
|
8443
8450
|
priceIncludeTax: priceIncludeTax
|
|
8444
8451
|
});
|
|
8445
|
-
_context8.next =
|
|
8452
|
+
_context8.next = 17;
|
|
8446
8453
|
return controller.setEditGood({
|
|
8447
8454
|
priceIncludeTax: priceIncludeTax
|
|
8448
8455
|
});
|
|
8449
|
-
case
|
|
8450
|
-
_context8.next =
|
|
8456
|
+
case 17:
|
|
8457
|
+
_context8.next = 25;
|
|
8451
8458
|
break;
|
|
8452
|
-
case
|
|
8459
|
+
case 19:
|
|
8453
8460
|
if (!(!err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
|
|
8454
|
-
_context8.next =
|
|
8461
|
+
_context8.next = 25;
|
|
8455
8462
|
break;
|
|
8456
8463
|
}
|
|
8457
|
-
_priceIncludeTax2 = format15(values.priceIncludeTax);
|
|
8458
|
-
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)));
|
|
8464
|
+
_priceIncludeTax2 = format15(values.priceIncludeTax, calculatingDigits);
|
|
8465
|
+
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)), calculatingDigits);
|
|
8459
8466
|
form.setFieldsValue({
|
|
8460
8467
|
quantity: _quantity3
|
|
8461
8468
|
});
|
|
8462
|
-
_context8.next =
|
|
8469
|
+
_context8.next = 25;
|
|
8463
8470
|
return controller.setEditGood({
|
|
8464
8471
|
quantity: _quantity3
|
|
8465
8472
|
});
|
|
8466
|
-
case
|
|
8473
|
+
case 25:
|
|
8467
8474
|
// 更新不含税
|
|
8468
8475
|
updateUnitPriceExcludingTax(controller, form);
|
|
8469
8476
|
// 清楚 计算中启动字段
|
|
@@ -8483,7 +8490,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8483
8490
|
return _ref8.apply(this, arguments);
|
|
8484
8491
|
};
|
|
8485
8492
|
}());
|
|
8486
|
-
case
|
|
8493
|
+
case 27:
|
|
8487
8494
|
case "end":
|
|
8488
8495
|
return _context8.stop();
|
|
8489
8496
|
}
|
|
@@ -8498,7 +8505,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8498
8505
|
var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
8499
8506
|
form.validateFields( /*#__PURE__*/function () {
|
|
8500
8507
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(err, values) {
|
|
8501
|
-
var lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
8508
|
+
var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
8502
8509
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
8503
8510
|
while (1) switch (_context10.prev = _context10.next) {
|
|
8504
8511
|
case 0:
|
|
@@ -8516,47 +8523,48 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8516
8523
|
updateUnitPriceTax(controller, form);
|
|
8517
8524
|
return _context10.abrupt("return");
|
|
8518
8525
|
case 6:
|
|
8526
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8519
8527
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8520
|
-
_context10.next =
|
|
8528
|
+
_context10.next = 10;
|
|
8521
8529
|
return controller.setEditGood({
|
|
8522
8530
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8523
8531
|
});
|
|
8524
|
-
case
|
|
8532
|
+
case 10:
|
|
8525
8533
|
form.setFieldsValue({
|
|
8526
8534
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8527
8535
|
});
|
|
8528
8536
|
// 是否有数量
|
|
8529
8537
|
if (!(!err.quantity && values.quantity)) {
|
|
8530
|
-
_context10.next =
|
|
8538
|
+
_context10.next = 19;
|
|
8531
8539
|
break;
|
|
8532
8540
|
}
|
|
8533
|
-
quantity = format15(values.quantity);
|
|
8534
|
-
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)));
|
|
8541
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8542
|
+
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8535
8543
|
form.setFieldsValue({
|
|
8536
8544
|
priceExcludeTax: priceExcludeTax
|
|
8537
8545
|
});
|
|
8538
|
-
_context10.next =
|
|
8546
|
+
_context10.next = 17;
|
|
8539
8547
|
return controller.setEditGood({
|
|
8540
8548
|
priceExcludeTax: priceExcludeTax
|
|
8541
8549
|
});
|
|
8542
|
-
case
|
|
8543
|
-
_context10.next =
|
|
8550
|
+
case 17:
|
|
8551
|
+
_context10.next = 25;
|
|
8544
8552
|
break;
|
|
8545
|
-
case
|
|
8553
|
+
case 19:
|
|
8546
8554
|
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8547
|
-
_context10.next =
|
|
8555
|
+
_context10.next = 25;
|
|
8548
8556
|
break;
|
|
8549
8557
|
}
|
|
8550
|
-
_priceExcludeTax2 = format15(values.priceExcludeTax);
|
|
8551
|
-
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)));
|
|
8558
|
+
_priceExcludeTax2 = format15(values.priceExcludeTax, calculatingDigits);
|
|
8559
|
+
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)), calculatingDigits);
|
|
8552
8560
|
form.setFieldsValue({
|
|
8553
8561
|
quantity: _quantity4
|
|
8554
8562
|
});
|
|
8555
|
-
_context10.next =
|
|
8563
|
+
_context10.next = 25;
|
|
8556
8564
|
return controller.setEditGood({
|
|
8557
8565
|
quantity: _quantity4
|
|
8558
8566
|
});
|
|
8559
|
-
case
|
|
8567
|
+
case 25:
|
|
8560
8568
|
// 更新含税
|
|
8561
8569
|
updateUnitPriceTax(controller, form);
|
|
8562
8570
|
// 清楚 计算中启动字段
|
|
@@ -8576,7 +8584,7 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8576
8584
|
return _ref10.apply(this, arguments);
|
|
8577
8585
|
};
|
|
8578
8586
|
}());
|
|
8579
|
-
case
|
|
8587
|
+
case 27:
|
|
8580
8588
|
case "end":
|
|
8581
8589
|
return _context10.stop();
|
|
8582
8590
|
}
|
|
@@ -8716,7 +8724,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
|
|
|
8716
8724
|
case 9:
|
|
8717
8725
|
// 单价(不含税)
|
|
8718
8726
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
8719
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity);
|
|
8727
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
8720
8728
|
}
|
|
8721
8729
|
form.setFieldsValue({
|
|
8722
8730
|
priceExcludeTax: priceExcludeTax
|
|
@@ -8740,54 +8748,54 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
|
|
|
8740
8748
|
var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
|
|
8741
8749
|
form.validateFields( /*#__PURE__*/function () {
|
|
8742
8750
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(err, values) {
|
|
8743
|
-
var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
|
|
8751
|
+
var calculatingDigits, lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
|
|
8744
8752
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
8745
8753
|
while (1) switch (_context14.prev = _context14.next) {
|
|
8746
8754
|
case 0:
|
|
8747
8755
|
err = err || {};
|
|
8748
8756
|
if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
|
|
8749
|
-
_context14.next =
|
|
8757
|
+
_context14.next = 17;
|
|
8750
8758
|
break;
|
|
8751
8759
|
}
|
|
8752
|
-
// 金额(含税)= 金额(不含税)* (1+ 税率)
|
|
8760
|
+
calculatingDigits = controller.state.calculatingDigits; // 金额(含税)= 金额(不含税)* (1+ 税率)
|
|
8753
8761
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8754
8762
|
lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
|
|
8755
|
-
_context14.next =
|
|
8763
|
+
_context14.next = 7;
|
|
8756
8764
|
return controller.setEditGood({
|
|
8757
8765
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8758
8766
|
});
|
|
8759
|
-
case
|
|
8767
|
+
case 7:
|
|
8760
8768
|
if (!(!err.quantity && values.quantity)) {
|
|
8761
|
-
_context14.next =
|
|
8769
|
+
_context14.next = 11;
|
|
8762
8770
|
break;
|
|
8763
8771
|
}
|
|
8764
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
|
|
8765
|
-
_context14.next =
|
|
8772
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)), calculatingDigits);
|
|
8773
|
+
_context14.next = 11;
|
|
8766
8774
|
return controller.setEditGood({
|
|
8767
8775
|
priceIncludeTax: priceIncludeTax
|
|
8768
8776
|
});
|
|
8769
|
-
case
|
|
8777
|
+
case 11:
|
|
8770
8778
|
// 税额 = 金额(含税)-金额(不含税)
|
|
8771
8779
|
taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
|
|
8772
8780
|
form.setFieldsValue({
|
|
8773
8781
|
taxAmount: taxAmount
|
|
8774
8782
|
});
|
|
8775
|
-
_context14.next =
|
|
8783
|
+
_context14.next = 15;
|
|
8776
8784
|
return controller.setEditGood({
|
|
8777
8785
|
taxAmount: taxAmount
|
|
8778
8786
|
});
|
|
8779
|
-
case
|
|
8780
|
-
_context14.next =
|
|
8787
|
+
case 15:
|
|
8788
|
+
_context14.next = 20;
|
|
8781
8789
|
break;
|
|
8782
|
-
case
|
|
8790
|
+
case 17:
|
|
8783
8791
|
form.setFieldsValue({
|
|
8784
8792
|
taxAmount: undefined
|
|
8785
8793
|
});
|
|
8786
|
-
_context14.next =
|
|
8794
|
+
_context14.next = 20;
|
|
8787
8795
|
return controller.setEditGood({
|
|
8788
8796
|
taxAmount: undefined
|
|
8789
8797
|
});
|
|
8790
|
-
case
|
|
8798
|
+
case 20:
|
|
8791
8799
|
case "end":
|
|
8792
8800
|
return _context14.stop();
|
|
8793
8801
|
}
|
|
@@ -9183,6 +9191,10 @@ var useColumns = (function (form) {
|
|
|
9183
9191
|
var getReplenishRules = React.useCallback(function (id) {
|
|
9184
9192
|
return columnsReplenish[id] ? columnsReplenish[id].rules || [] : [];
|
|
9185
9193
|
}, [columnsReplenish]);
|
|
9194
|
+
/** 金额整数位限制,不传默认9位 */
|
|
9195
|
+
var priceIntegerDigit = controller.useMemo(function (e) {
|
|
9196
|
+
return e.priceIntegerDigit || 9;
|
|
9197
|
+
}, []);
|
|
9186
9198
|
/** 表头 */
|
|
9187
9199
|
var columns = React.useMemo(function () {
|
|
9188
9200
|
var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2, _columnsReplenish$tax;
|
|
@@ -9608,8 +9620,8 @@ var useColumns = (function (form) {
|
|
|
9608
9620
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
9609
9621
|
while (1) switch (_context10.prev = _context10.next) {
|
|
9610
9622
|
case 0:
|
|
9611
|
-
if ("".concat(value).split('.')[0].length >
|
|
9612
|
-
callback(
|
|
9623
|
+
if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
|
|
9624
|
+
callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
|
|
9613
9625
|
}
|
|
9614
9626
|
case 1:
|
|
9615
9627
|
case "end":
|
|
@@ -9685,8 +9697,8 @@ var useColumns = (function (form) {
|
|
|
9685
9697
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
9686
9698
|
while (1) switch (_context12.prev = _context12.next) {
|
|
9687
9699
|
case 0:
|
|
9688
|
-
if ("".concat(value).split('.')[0].length >
|
|
9689
|
-
callback(
|
|
9700
|
+
if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
|
|
9701
|
+
callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
|
|
9690
9702
|
}
|
|
9691
9703
|
case 1:
|
|
9692
9704
|
case "end":
|
|
@@ -11901,10 +11913,10 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11901
11913
|
editGood.priceIncludeTax = undefined;
|
|
11902
11914
|
editGood.priceExcludeTax = undefined;
|
|
11903
11915
|
} else {
|
|
11904
|
-
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record);
|
|
11916
|
+
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits);
|
|
11905
11917
|
}
|
|
11906
11918
|
if (editGood.quantity && editGood.priceIncludeTax) {
|
|
11907
|
-
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
|
|
11919
|
+
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
|
|
11908
11920
|
}
|
|
11909
11921
|
// 导入FORM里
|
|
11910
11922
|
if (s.goodsListState.isMyShow) {
|
|
@@ -11939,10 +11951,10 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11939
11951
|
// : record.itemName;
|
|
11940
11952
|
// };
|
|
11941
11953
|
/** 货物单价,不含税 */
|
|
11942
|
-
var getPriceExcludeTax = function getPriceExcludeTax(s, record) {
|
|
11954
|
+
var getPriceExcludeTax = function getPriceExcludeTax(s, record, calculatingDigits) {
|
|
11943
11955
|
if (!s.taxRate && s.taxRate !== 0 || !record.priceIncludeTax && record.priceIncludeTax !== 0) return;
|
|
11944
11956
|
// 单价(含税)/(1+税率) = 单价(不含税)
|
|
11945
|
-
return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")));
|
|
11957
|
+
return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")), calculatingDigits);
|
|
11946
11958
|
};
|
|
11947
11959
|
// 获取我方名称
|
|
11948
11960
|
var getItemName$1 = function getItemName(record, editGood) {
|
|
@@ -12423,7 +12435,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
12423
12435
|
var lineAmountExcludeTax = chain$1(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
|
|
12424
12436
|
var priceExcludeTax = good.priceIncludeTax ? chain$1(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
|
|
12425
12437
|
good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
|
|
12426
|
-
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
|
|
12438
|
+
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber(), s.calculatingDigits) : undefined) || undefined;
|
|
12427
12439
|
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
12428
12440
|
});
|
|
12429
12441
|
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|