From ac00bb7b8eae1bf6aabb7f1ae67c2e5aa5b8ae90 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 12 六月 2026 10:21:12 +0800
Subject: [PATCH] 宝东 1.样式问题
---
src/views/salesManagement/salesLedger/index.vue | 135 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 124 insertions(+), 11 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 3d88828..37eb815 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -158,6 +158,10 @@
</el-table-column>
<el-table-column label="鏁伴噺"
prop="quantity" />
+ <el-table-column label="姣忎欢鏁伴噺"
+ prop="singleQuantity" />
+ <el-table-column label="鎬绘暟"
+ prop="totalQuantity" />
<el-table-column label="寰呭彂璐ф暟閲�"
prop="noQuantity" />
<el-table-column label="绋庣巼(%)"
@@ -243,7 +247,7 @@
<el-button link
type="primary"
@click="openForm('edit', scope.row)"
- :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫
+ :disabled="!canEditLedger(scope.row)">缂栬緫
</el-button>
<el-button link
type="primary"
@@ -287,10 +291,15 @@
<el-col :span="12">
<el-form-item label="閿�鍞悎鍚屽彿锛�"
prop="salesContractNo">
- <el-input v-model="form.salesContractNo"
- placeholder="鑷姩鐢熸垚"
- clearable
- disabled />
+ <div style="display: flex; align-items: center; gap: 12px;width: 100%;">
+ <el-checkbox v-model="form.autoGenerateContractNo" v-if="operationType === 'add'">鑷姩鐢熸垚
+ </el-checkbox>
+ <el-input v-model="form.salesContractNo"
+ :placeholder="form.autoGenerateContractNo ? '鑷姩鐢熸垚' : '璇疯緭鍏�'"
+ clearable
+ :disabled="form.autoGenerateContractNo" />
+
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -443,6 +452,10 @@
prop="unit" />
<el-table-column label="鏁伴噺"
prop="quantity" />
+ <el-table-column label="姣忎欢鏁伴噺"
+ prop="singleQuantity" />
+ <el-table-column label="鎬绘暟"
+ prop="totalQuantity" />
<el-table-column label="绋庣巼(%)"
prop="taxRate" />
<el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -679,6 +692,30 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="姣忎欢鏁伴噺锛�"
+ prop="singleQuantity">
+ <el-input-number :step="1"
+ :min="1"
+ v-model="productForm.singleQuantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :precision="0"
+ @change="calculateFromSingleQuantity"
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎬绘暟锛�"
+ prop="totalQuantity">
+ <el-input v-model="productForm.totalQuantity"
+ placeholder="鑷姩璁$畻"
+ disabled
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
<el-form-item label="鍚◣鎬讳环(鍏�)锛�"
prop="taxInclusiveTotalPrice">
<el-input v-model="productForm.taxInclusiveTotalPrice"
@@ -888,7 +925,7 @@
<!-- 鍙戣揣寮规 -->
<el-dialog v-model="deliveryFormVisible"
title="鍙戣揣淇℃伅"
- width="40%"
+ width="70%"
@close="closeDeliveryDia">
<el-form :model="deliveryForm"
label-width="120px"
@@ -954,7 +991,7 @@
</el-row>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="鎵瑰彿锛�"
+ <el-form-item label="搴撳瓨锛�"
prop="batchNo">
<el-table :data="deliveryForm.batchNoList"
border
@@ -964,6 +1001,15 @@
<el-table-column label="鎵瑰彿"
prop="batchNo"
min-width="180" />
+ <el-table-column label="浜у搧澶х被"
+ prop="productName"
+ min-width="100" />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="model"
+ min-width="100" />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ min-width="100" />
<el-table-column label="搴撳瓨鏁伴噺"
min-width="120"
align="center">
@@ -1072,6 +1118,7 @@
},
form: {
salesContractNo: "",
+ autoGenerateContractNo: true,
salesman: "",
customerId: "",
entryPerson: "",
@@ -1080,7 +1127,6 @@
maintenanceTime: "",
productData: [],
executionDate: "",
- hasProductionRecord: false,
},
rules: {
salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -1103,6 +1149,8 @@
specificationModel: "",
unit: "",
quantity: "",
+ singleQuantity: 1,
+ totalQuantity: "",
taxInclusiveUnitPrice: "",
taxRate: "",
taxInclusiveTotalPrice: "",
@@ -1590,6 +1638,8 @@
form.value.entryDate = getCurrentDate();
// 绛捐鏃ユ湡榛樿涓哄綋澶�
form.value.executionDate = getCurrentDate();
+ // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
+ form.value.autoGenerateContractNo = true;
} else {
currentId.value = row.id;
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
@@ -1597,6 +1647,8 @@
form.value.entryPerson = Number(res.entryPerson);
productData.value = form.value.productData;
fileList.value = form.value.storageBlobVOs;
+ // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
+ form.value.autoGenerateContractNo = false;
});
}
// let userAll = await userStore.getInfo()
@@ -1690,6 +1742,7 @@
productData.value = products.map(p => {
const quantity = Number(p.quantity ?? 0) || 0;
const unitPrice = Number(p.unitPrice ?? 0) || 0;
+ const singleQuantity = 1;
const taxRate = "13"; // 榛樿 13%锛屼究浜庣洿鎺ユ彁浜わ紙濡傞渶鍙湪浜у搧涓嚜琛屼慨鏀癸級
const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
@@ -1702,12 +1755,16 @@
specificationModel: p.specification || "",
unit: p.unit || "",
quantity: quantity,
+ singleQuantity: singleQuantity,
+ totalQuantity: String(quantity * singleQuantity),
taxRate: taxRate,
taxInclusiveUnitPrice: unitPrice.toFixed(2),
taxInclusiveTotalPrice: taxInclusiveTotalPrice,
taxExclusiveTotalPrice: taxExclusiveTotalPrice,
invoiceType: "澧炴櫘绁�",
isProduction: true,
+ productId: p.productId,
+ productModelId: p.productModelId
};
});
@@ -1731,6 +1788,9 @@
}
form.value.storageBlobDTOs = fileList;
form.value.type = 1;
+ if (form.value.autoGenerateContractNo) {
+ form.value.salesContractNo = '';
+ }
addOrUpdateSalesLedger(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -1764,6 +1824,12 @@
if (type === "edit") {
productForm.value = { ...row };
productIndex.value = index;
+ // 濡傛灉娌℃湁 totalQuantity锛岃嚜鍔ㄨ绠楋細鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ if (!productForm.value.totalQuantity && productForm.value.quantity) {
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ const quantity = parseFloat(productForm.value.quantity);
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+ }
// 缂栬緫鏃舵牴鎹骇鍝佸ぇ绫诲悕绉板弽鏌� tree 鑺傜偣 id锛屽苟鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
try {
const options =
@@ -2445,6 +2511,10 @@
);
}
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+
isCalculating.value = false;
};
@@ -2478,6 +2548,10 @@
inclusiveTotalPrice / quantity
).toFixed(2);
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+
isCalculating.value = false;
};
@@ -2498,7 +2572,7 @@
isCalculating.value = true;
- // 璁$畻鍚◣鎬讳环
+ // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
@@ -2509,6 +2583,10 @@
productForm.value.taxRate
);
}
+
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
isCalculating.value = false;
};
@@ -2530,7 +2608,7 @@
isCalculating.value = true;
- // 璁$畻鍚◣鎬讳环
+ // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
@@ -2541,6 +2619,25 @@
productForm.value.taxRate
);
}
+
+ isCalculating.value = false;
+ };
+
+ // 鏍规嵁姣忎欢鏁伴噺鍙樺寲璁$畻鎬绘暟
+ const calculateFromSingleQuantity = () => {
+ if (isCalculating.value) return;
+
+ const quantity = parseFloat(productForm.value.quantity);
+
+ if (!quantity || quantity <= 0) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
isCalculating.value = false;
};
@@ -2715,6 +2812,22 @@
const batchNoList = await getDeliveryBatchNoList(
row.productModelId || row.modelId
);
+
+ // 鑷姩鍒嗛厤鍙戣揣鏁伴噺锛氭寜鐓у緟鍙戣揣鏁伴噺锛屼粠涓婂埌涓嬩緷娆″垎閰�
+ const noQuantity = Number(row?.noQuantity || 0);
+ let remainingQuantity = noQuantity;
+ batchNoList.forEach(item => {
+ if (remainingQuantity <= 0) {
+ item.deliveryQuantity = 0;
+ return;
+ }
+ const batchStockQuantity = getDeliveryBatchQuantity(item);
+ // 褰撳墠鎵规鍙垎閰嶇殑鏁伴噺锛氬彇鍓╀綑寰呭彂璐ф暟閲忓拰搴撳瓨鏁伴噺鐨勮緝灏忓��
+ const assignQuantity = Math.min(remainingQuantity, batchStockQuantity);
+ item.deliveryQuantity = assignQuantity;
+ remainingQuantity -= assignQuantity;
+ });
+
deliveryForm.value = {
shippingCarNumber: "",
expressCompany: "",
@@ -3041,4 +3154,4 @@
page-break-after: avoid;
}
}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.3