+
- handleFreightUnitPriceInput(item, value)">
-
+ handleFreightGroupUnitPriceInput(group, value)" @clear="() => handleFreightGroupUnitPriceInput(group, '')">
+ handleFreightGroupPriceUnitChange(group, value)">
-
- handleFreightQuantityUnitChange(route, item, value)">
+
+ handleFreightGroupQuantityUnitChange(route, group, value)">
- {{ currencyLabel(route.currency) }}
+ {{ currencyLabel(route.currency) }}
@@ -360,6 +360,42 @@ export default {
formatAmount(value) { return Number(value || 0).toFixed(2); },
dispatchWeight(route) { return (route.goods || []).reduce((sum, item) => sum + Number(item.dispatchQuantity || 0), 0); },
freightAmount(item = {}) { return Number(item.unitPrice || 0) * Number(item.quantity || 0); },
+ freightGroups(route = {}) {
+ const groups = [];
+ const groupMap = new Map();
+ (route.freightItems || []).forEach((item, index) => {
+ const quantityUnit = String(item.quantityUnit || '').trim();
+ const key = quantityUnit || `__empty_${index}`;
+ let group = groupMap.get(key);
+ if (!group) {
+ group = { key, quantityUnit, rows: [] };
+ groupMap.set(key, group);
+ groups.push(group);
+ }
+ group.rows.push(item);
+ });
+ return groups;
+ },
+ freightGroupQuantity(group = {}) { return (group.rows || []).reduce((sum, item) => sum + Number(item.quantity || 0), 0); },
+ freightGroupUnitPrice(group = {}) {
+ const prices = (group.rows || []).map(item => String(item.unitPrice ?? '').trim()).filter(Boolean);
+ return !prices.length || prices.some(price => price !== prices[0]) ? '' : prices[0];
+ },
+ freightGroupPriceUnit(group = {}) { return group.rows?.[0]?.priceUnit || (group.quantityUnit ? `元/${group.quantityUnit}` : ''); },
+ freightGroupAmount(group = {}) { return (group.rows || []).reduce((sum, item) => sum + this.freightAmount(item), 0); },
+ handleFreightGroupUnitPriceInput(group, value) {
+ const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
+ const normalized = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 2)}` : integer;
+ (group.rows || []).forEach(item => { item.unitPrice = normalized; });
+ },
+ handleFreightGroupPriceUnitChange(group, value) { (group.rows || []).forEach(item => { item.priceUnit = value || ''; }); },
+ handleFreightGroupQuantityUnitChange(route, group, value) {
+ (group.rows || []).forEach(item => {
+ item.quantityUnit = value || '';
+ const goods = (route.goods || []).find(row => String(row.sourceIndex) === String(item.sourceIndex));
+ if (goods) goods.quantityUnit = value || '';
+ });
+ },
freightTotal(route) {
const goodsFreight = (route.freightItems || []).reduce(
(sum, item) => sum + this.freightAmount(item),
diff --git a/src/views/business/components/transport-plan-page.vue b/src/views/business/components/transport-plan-page.vue
index 3c9f715..e75cff7 100644
--- a/src/views/business/components/transport-plan-page.vue
+++ b/src/views/business/components/transport-plan-page.vue
@@ -1708,18 +1708,20 @@
-
+
handleDispatchCargoNumberInput(cargo, 'unitPrice', value)"
+ @input="value => handleDispatchFreightGroupNumberInput(group, value)"
+ @clear="() => handleDispatchFreightGroupNumberInput(group, '')"
>
handleDispatchFreightGroupPriceUnitChange(group, value)"
@visible-change="visible => visible && loadTaskFeeUnitOptions()"
>
{{ cargo.quantityUnit || '吨' }}{{ group.quantityUnit || '吨' }}
{{ dispatchItemFreightCurrencyLabel }}
@@ -1786,8 +1788,22 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
- :label="item.label || item.customerName || item.carrierName || item.fullName || item.name"
- :value="dispatchIsCarrierMode ? item.carrierContractId : item.value || item.customerName || item.carrierName || item.fullName || item.name"
+ :label="
+ item.label ||
+ item.customerName ||
+ item.carrierName ||
+ item.fullName ||
+ item.name
+ "
+ :value="
+ dispatchIsCarrierMode
+ ? item.carrierContractId
+ : item.value ||
+ item.customerName ||
+ item.carrierName ||
+ item.fullName ||
+ item.name
+ "
/>
@@ -1998,8 +2014,18 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
- :label="item.label || item.customerName || item.carrierName || item.fullName || item.name"
- :value="dispatchIsCarrierMode ? item.carrierContractId : item.value || item.customerName || item.carrierName || item.fullName || item.name"
+ :label="
+ item.label || item.customerName || item.carrierName || item.fullName || item.name
+ "
+ :value="
+ dispatchIsCarrierMode
+ ? item.carrierContractId
+ : item.value ||
+ item.customerName ||
+ item.carrierName ||
+ item.fullName ||
+ item.name
+ "
/>
@@ -3448,8 +3474,8 @@ export default {
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(2)));
}
const otherFeeTotal = Number(this.dispatchItemForm.otherFeeTotal || 0);
- const freightTotal = this.dispatchItemCargoRows.reduce(
- (total, cargo) => total + Number(this.dispatchCargoFreightAmount(cargo) || 0),
+ const freightTotal = this.dispatchItemFreightGroups.reduce(
+ (total, group) => total + Number(this.dispatchFreightGroupAmount(group) || 0),
0
);
const hasOtherFee = this.dispatchItemForm.otherFeeTotal !== '';
@@ -3465,8 +3491,8 @@ export default {
const total = quantity * unitPrice;
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(2)));
}
- const total = this.dispatchItemCargoRows.reduce(
- (sum, cargo) => sum + Number(this.dispatchCargoFreightAmount(cargo) || 0),
+ const total = this.dispatchItemFreightGroups.reduce(
+ (sum, group) => sum + Number(this.dispatchFreightGroupAmount(group) || 0),
0
);
return total
@@ -3475,6 +3501,22 @@ export default {
: String(Number(total.toFixed(2)))
: '';
},
+ dispatchItemFreightGroups() {
+ const groups = [];
+ const groupMap = new Map();
+ (this.dispatchItemCargoRows || []).forEach((cargo, index) => {
+ const quantityUnit = String(cargo.quantityUnit || '').trim();
+ const key = quantityUnit || `__empty_${index}`;
+ let group = groupMap.get(key);
+ if (!group) {
+ group = { key, quantityUnit, rows: [] };
+ groupMap.set(key, group);
+ groups.push(group);
+ }
+ group.rows.push(cargo);
+ });
+ return groups;
+ },
dispatchItemFreightCurrencyLabel() {
const value = this.dispatchItemForm.freightCurrency || 'RMB';
return this.currencyRemark(value);
@@ -7321,7 +7363,8 @@ export default {
if (carrierTypeAtRequest === '承运商') {
this.dispatchCarrierOptions = carrierContracts || [];
const current = this.dispatchCarrierOptions.find(
- item => String(item.carrierContractId) === String(this.dispatchItemForm.carrierContractId)
+ item =>
+ String(item.carrierContractId) === String(this.dispatchItemForm.carrierContractId)
);
if (current) {
this.dispatchItemForm.carrierName = current.carrierName;
@@ -7446,13 +7489,47 @@ export default {
const amount = quantity * unitPrice;
return Number.isInteger(amount) ? String(amount) : String(Number(amount.toFixed(2)));
},
+ dispatchFreightGroupQuantity(group = {}) {
+ const quantity = (group.rows || []).reduce(
+ (sum, cargo) => sum + Number(cargo.quantity || 0),
+ 0
+ );
+ return this.formatDispatchQuantity(quantity);
+ },
+ dispatchFreightGroupUnitPrice(group = {}) {
+ const prices = (group.rows || [])
+ .map(cargo => String(cargo.unitPrice ?? '').trim())
+ .filter(Boolean);
+ if (!prices.length || prices.some(price => price !== prices[0])) return '';
+ return prices[0];
+ },
+ dispatchFreightGroupPriceUnit(group = {}) {
+ return group.rows?.[0]?.priceUnit || (group.quantityUnit ? `元/${group.quantityUnit}` : '');
+ },
+ dispatchFreightGroupAmount(group = {}) {
+ const amount = (group.rows || []).reduce(
+ (sum, cargo) => sum + Number(this.dispatchCargoFreightAmount(cargo) || 0),
+ 0
+ );
+ return Number.isInteger(amount) ? String(amount) : String(Number(amount.toFixed(2)));
+ },
+ handleDispatchFreightGroupNumberInput(group, value) {
+ this.handleFreightNumberInput(group.rows?.[0] || {}, 'unitPrice', value);
+ const unitPrice = group.rows?.[0]?.unitPrice || '';
+ (group.rows || []).forEach(cargo => {
+ cargo.unitPrice = unitPrice;
+ });
+ },
+ handleDispatchFreightGroupPriceUnitChange(group, value) {
+ (group.rows || []).forEach(cargo => {
+ cargo.priceUnit = value || '';
+ });
+ },
dispatchItemRemainingQuantity(row = {}) {
const unit = this.getDispatchQuantityUnit(row);
const hasCargoIdentity = Boolean(
String(row.cargoName || row.goodsName || row.name || '').trim() ||
- String(
- row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || ''
- ).trim()
+ String(row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || '').trim()
);
const planGoodsRows = this.dispatchPlanGoodsRows;
const cargoKey = this.getDispatchCargoIdentity(row);
@@ -7472,10 +7549,7 @@ export default {
0
);
const assigned = this.dispatchRows.reduce((sum, dispatchRow, index) => {
- if (
- index === this.dispatchItemIndex ||
- !this.hasDispatchVehicleIdentifier(dispatchRow)
- ) {
+ if (index === this.dispatchItemIndex || !this.hasDispatchVehicleIdentifier(dispatchRow)) {
return sum;
}
return (
diff --git a/src/views/business/components/waybill-manage-page.vue b/src/views/business/components/waybill-manage-page.vue
index 5f4cddc..7996b27 100644
--- a/src/views/business/components/waybill-manage-page.vue
+++ b/src/views/business/components/waybill-manage-page.vue
@@ -1041,21 +1041,25 @@
label-width="auto"
class="waybill-manage-page__freight-form waybill-manage-page__freight-form--road"
>
-
+
handleTaskFullFreightNumberInput(cargo, 'unitPrice', value)"
+ @input="
+ value => handleTaskFullFreightGroupNumberInput(group, 'unitPrice', value)
+ "
+ @clear="() => handleTaskFullFreightGroupNumberInput(group, 'unitPrice', '')"
>
handleTaskFullFreightGroupPriceUnitChange(group, value)"
@visible-change="visible => visible && loadTaskFeeUnitOptions()"
>
-
+
@@ -1087,10 +1091,11 @@
handleTaskFullFreightAmountInput(cargo, value)"
+ @input="value => handleTaskFullFreightGroupAmountInput(group, value)"
+ @clear="() => handleTaskFullFreightGroupAmountInput(group, '')"
>
{{ taskFreightCurrencyLabel }}
@@ -1520,11 +1525,7 @@
运费合计:¥{{ formatFooterFreightTotal }}
-
+
查看过程配置
@@ -3362,9 +3363,25 @@ export default {
const amount = quantity * unitPrice;
return Number.isInteger(amount) ? String(amount) : String(Number(amount.toFixed(2)));
},
+ taskFreightGroups() {
+ const groups = [];
+ const groupMap = new Map();
+ (this.transportCargoRows || []).forEach((cargo, index) => {
+ const quantityUnit = String(cargo.quantityUnit || '').trim();
+ const key = quantityUnit || `__empty_${index}`;
+ let group = groupMap.get(key);
+ if (!group) {
+ group = { key, quantityUnit, rows: [] };
+ groupMap.set(key, group);
+ groups.push(group);
+ }
+ group.rows.push(cargo);
+ });
+ return groups;
+ },
taskFullFreightTotal() {
- const total = this.transportCargoRows.reduce(
- (sum, cargo) => sum + Number(this.taskFullFreightAmount(cargo) || 0),
+ const total = this.taskFreightGroups.reduce(
+ (sum, group) => sum + Number(this.taskFullFreightGroupAmount(group) || 0),
0
);
return this.formatTaskFullFreightNumber(total);
@@ -3852,7 +3869,8 @@ export default {
fillCustomerNameFromProject(projectId = this.form.projectId) {
if (this.form.customerName || !projectId) return Promise.resolve(this.form.customerName);
const project = this.projectOptions.find(item => String(item.id) === String(projectId));
- const customerName = project?.customerNames || project?.customerName || project?.customer || '';
+ const customerName =
+ project?.customerNames || project?.customerName || project?.customer || '';
if (customerName) {
this.form.customerName = customerName;
return Promise.resolve(customerName);
@@ -5253,6 +5271,69 @@ export default {
Number(cargo.unitPrice || 0) * Number(cargo.quantity || 0)
);
},
+ taskFullFreightGroupQuantity(group = {}) {
+ const total = (group.rows || []).reduce((sum, cargo) => sum + Number(cargo.quantity || 0), 0);
+ return this.formatTaskFullFreightNumber(total);
+ },
+ taskFullFreightGroupUnitPrice(group = {}) {
+ const prices = (group.rows || [])
+ .map(cargo => String(cargo.unitPrice ?? '').trim())
+ .filter(Boolean);
+ if (!prices.length || prices.some(price => price !== prices[0])) return '';
+ return prices[0];
+ },
+ taskFullFreightGroupPriceUnit(group = {}) {
+ return group.rows?.[0]?.priceUnit || (group.quantityUnit ? `元/${group.quantityUnit}` : '');
+ },
+ taskFullFreightGroupAmount(group = {}) {
+ const total = (group.rows || []).reduce(
+ (sum, cargo) => sum + Number(this.taskFullFreightAmount(cargo) || 0),
+ 0
+ );
+ return this.formatTaskFullFreightNumber(total);
+ },
+ handleTaskFullFreightGroupNumberInput(group, prop, value) {
+ const text = String(value || '').replace(/[^\d.]/g, '');
+ const parts = text.split('.');
+ const normalized =
+ parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
+ (group.rows || []).forEach(cargo => {
+ cargo[prop] = normalized;
+ });
+ this.syncTransportCargoJson();
+ },
+ handleTaskFullFreightGroupPriceUnitChange(group, value) {
+ (group.rows || []).forEach(cargo => {
+ cargo.priceUnit = value || '';
+ });
+ this.syncTransportCargoJson();
+ },
+ handleTaskFullFreightGroupAmountInput(group, value) {
+ const text = String(value || '').replace(/[^\d.]/g, '');
+ const parts = text.split('.');
+ const normalized =
+ parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
+ const rows = group.rows || [];
+ const total = Number(normalized || 0);
+ const quantities = rows.map(cargo => Math.max(0, Number(cargo.quantity || 0)));
+ const quantityTotal = quantities.reduce((sum, quantity) => sum + quantity, 0);
+ let allocated = 0;
+ rows.forEach((cargo, index) => {
+ if (index === rows.length - 1) {
+ cargo.freightAmount = this.formatTaskFullFreightNumber(total - allocated);
+ return;
+ }
+ let amount = 0;
+ if (quantityTotal) {
+ amount = Number((total * (quantities[index] / quantityTotal)).toFixed(2));
+ } else if (index === 0) {
+ amount = total;
+ }
+ allocated += amount;
+ cargo.freightAmount = this.formatTaskFullFreightNumber(amount);
+ });
+ this.syncTransportCargoJson();
+ },
formatTaskFullFreightNumber(value) {
if (value === undefined || value === null || String(value).trim() === '') return '';
const number = Number(value || 0);
diff --git a/src/views/settlement/receivable-payable-detail.vue b/src/views/settlement/receivable-payable-detail.vue
index afa525a..60c8c52 100644
--- a/src/views/settlement/receivable-payable-detail.vue
+++ b/src/views/settlement/receivable-payable-detail.vue
@@ -438,20 +438,16 @@
class="settlement-detail-page__dialog-form"
>
-
-
-
+
+ 选择
+
+