From bdfab89d8afbc60faeb89715a461f77e877d7f5d Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期一, 03 八月 2026 00:02:37 +0800
Subject: [PATCH] feat: 新增徐州什克金属制品有限公司配置文件

---
 src/views/salesManagement/salesQuotation/index.vue |  108 +++++++++++++++++++++++++++++------------------------
 1 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/src/views/salesManagement/salesQuotation/index.vue b/src/views/salesManagement/salesQuotation/index.vue
index 39cf160..455f686 100644
--- a/src/views/salesManagement/salesQuotation/index.vue
+++ b/src/views/salesManagement/salesQuotation/index.vue
@@ -65,7 +65,7 @@
         </el-table-column>
         <el-table-column prop="totalAmount" label="鎶ヤ环閲戦" width="120">
           <template #default="scope">
-            楼{{ scope.row.totalAmount.toFixed(2) }}
+            楼{{ formatDecimal(scope.row.totalAmount) }}
           </template>
         </el-table-column>
         <el-table-column label="鎿嶄綔" width="200" fixed="right" align="center">
@@ -187,9 +187,9 @@
             </el-table-column>
             <el-table-column prop="specification" label="瑙勬牸鍨嬪彿" width="200">
               <template #default="scope">
-                <el-form-item :prop="`products.${scope.$index}.specificationId`" class="product-table-form-item">
+                <el-form-item :prop="`products.${scope.$index}.productModelId`" class="product-table-form-item">
                   <el-select
-                    v-model="scope.row.specificationId"
+                    v-model="scope.row.productModelId"
                     placeholder="璇烽�夋嫨"
                     clearable
                     @change="getProductModel($event, scope.row)"
@@ -215,7 +215,7 @@
             <el-table-column prop="unitPrice" label="鍗曚环">
               <template #default="scope">
                 <el-form-item :prop="`products.${scope.$index}.unitPrice`" class="product-table-form-item">
-                  <el-input-number v-model="scope.row.unitPrice" :min="0" :precision="2" style="width: 100%" />
+                  <el-input-number v-model="scope.row.unitPrice" :min="0" :precision="6" :step="0.000001" style="width: 100%" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -239,10 +239,10 @@
           </template>
           <div class="form-content">
             <el-form-item label="澶囨敞" prop="remark">
-              <el-input 
-                type="textarea" 
-                v-model="form.remark" 
-                placeholder="璇疯緭鍏ュ娉ㄤ俊鎭紙閫夊~锛�" 
+              <el-input
+                type="textarea"
+                v-model="form.remark"
+                placeholder="璇疯緭鍏ュ娉ㄤ俊鎭紙閫夊~锛�"
                 :rows="4"
                 maxlength="500"
                 show-word-limit
@@ -267,10 +267,10 @@
 <!--          <el-tag :type="getStatusType(currentQuotation.status)">{{ currentQuotation.status }}</el-tag>-->
 <!--        </el-descriptions-item>-->
         <el-descriptions-item label="鎶ヤ环鎬婚" :span="2">
-          <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">楼{{ currentQuotation.totalAmount?.toFixed(2) }}</span>
+          <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">楼{{ formatDecimal(currentQuotation.totalAmount) }}</span>
         </el-descriptions-item>
       </el-descriptions>
-      
+
       <div style="margin: 20px 0;">
         <h4>浜у搧鏄庣粏</h4>
         <el-table :data="currentQuotation.products" border style="width: 100%">
@@ -279,7 +279,7 @@
           <el-table-column prop="unit" label="鍗曚綅" />
           <el-table-column prop="unitPrice" label="鍗曚环">
             <template #default="scope">
-              楼{{ scope.row.unitPrice.toFixed(2) }}
+              楼{{ formatDecimal(scope.row.unitPrice) }}
             </template>
           </el-table-column>
         </el-table>
@@ -300,10 +300,10 @@
 import Pagination from '@/components/PIMTable/Pagination.vue'
 import FormDialog from '@/components/Dialog/FormDialog.vue'
 import {getQuotationList,addQuotation,updateQuotation,deleteQuotation} from '@/api/salesManagement/salesQuotation.js'
-import {customerList} from "@/api/salesManagement/salesLedger.js";
 import {modelList, productTreeList} from "@/api/basicData/product.js";
 import {listCustomer} from "@/api/basicData/customer.js";
 import { userListNoPage } from "@/api/system/user.js";
+import { formatDecimal, roundAmount } from '@/utils/numberFormat';
 
 // 鍝嶅簲寮忔暟鎹�
 const loading = ref(false)
@@ -316,7 +316,7 @@
 const quotationList = ref([])
 const userList = ref([])
 const productOptions = ref([]);
-const modelOptions = ref([]);
+const modelOptions  = ref([]);
 const pagination = reactive({
   total: 3,
   currentPage: 1,
@@ -328,7 +328,8 @@
 const dialogTitle = ref('鏂板鎶ヤ环')
 const form = reactive({
   quotationNo: '',
-  customerId: '',
+  customerId: undefined,
+  customer: '',
   salesperson: '',
   quotationDate: '',
   validDate: '',
@@ -346,6 +347,7 @@
 
 const baseRules = {
   customer: [{ required: true, message: '璇烽�夋嫨瀹㈡埛', trigger: 'change' }],
+  customerId: [{ required: true, message: '璇烽�夋嫨瀹㈡埛', trigger: 'change' }],
   salesperson: [{ required: true, message: '璇烽�夋嫨涓氬姟鍛�', trigger: 'change' }],
   quotationDate: [{ required: true, message: '璇烽�夋嫨鎶ヤ环鏃ユ湡', trigger: 'change' }],
   validDate: [{ required: true, message: '璇烽�夋嫨鏈夋晥鏈�', trigger: 'change' }],
@@ -354,7 +356,7 @@
 
 const productRowRules = {
   productId: [{ required: true, message: '璇烽�夋嫨浜у搧鍚嶇О', trigger: 'change' }],
-  specificationId: [{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }],
+  productModelId: [{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }],
   unit: [{ required: true, message: '璇峰~鍐欏崟浣�', trigger: 'blur' }],
   unitPrice: [{ required: true, message: '璇峰~鍐欏崟浠�', trigger: 'change' }]
 }
@@ -362,7 +364,7 @@
   const r = { ...baseRules }
   ;(form.products || []).forEach((_, i) => {
     r[`products.${i}.productId`] = productRowRules.productId
-    r[`products.${i}.specificationId`] = productRowRules.specificationId
+    r[`products.${i}.productModelId`] = productRowRules.productModelId
     r[`products.${i}.unit`] = productRowRules.unit
     r[`products.${i}.unitPrice`] = productRowRules.unitPrice
   })
@@ -407,6 +409,11 @@
   resetForm()
   dialogVisible.value = true
   getProductOptions();
+  fetchCustomerOptions()
+}
+
+const fetchCustomerOptions = () => {
+  if (customerOption.value.length > 0) return
   listCustomer({current: -1,size:-1, type: 0}).then((res) => {
     customerOption.value = res.data.records;
   });
@@ -428,7 +435,7 @@
 		if (children && children.length > 0) {
 			newItem.children = convertIdToValue(children);
 		}
-		
+
 		return newItem;
 	});
 }
@@ -452,7 +459,7 @@
 		row.productId = '';
 		row.product = '';
 		row.modelOptions = [];
-		row.specificationId = '';
+		row.productModelId = '';
 		row.specification = '';
 		row.unit = '';
 		return;
@@ -473,13 +480,13 @@
 	if (!row) return;
 	// 濡傛灉娓呯┖閫夋嫨锛屽垯娓呯┖鐩稿叧瀛楁
 	if (!value) {
-		row.specificationId = '';
+		row.productModelId = '';
 		row.specification = '';
 		row.unit = '';
 		return;
 	}
-	// 鏇存柊 specificationId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
-	row.specificationId = value;
+	// 鏇存柊 productModelId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
+	row.productModelId = value;
 	const modelOptions = row.modelOptions || [];
 	const index = modelOptions.findIndex((item) => item.id === value);
 	if (index !== -1) {
@@ -518,7 +525,7 @@
     products: row.products ? row.products.map(product => ({
       productId: product.productId || '',
       product: product.product || product.productName || '',
-      specificationId: product.specificationId || '',
+      productModelId: product.productModelId || '',
       specification: product.specification || '',
       quantity: product.quantity || 0,
       unit: product.unit || '',
@@ -537,10 +544,12 @@
   form.id = row.id || form.id || null
   // 鍏堝姞杞戒骇鍝佹爲鏁版嵁锛屽惁鍒� el-tree-select 鏃犳硶鍙嶆樉浜у搧鍚嶇О
   await getProductOptions()
+  await fetchCustomerOptions()
 
   // 鍙鍒堕渶瑕佺殑瀛楁锛岄伩鍏嶅皢缁勪欢寮曠敤鏀惧叆鍝嶅簲寮忓璞�
   form.quotationNo = row.quotationNo || ''
   form.customer = row.customer || ''
+  form.customerId = row.customerId || undefined
   form.salesperson = row.salesperson || ''
   form.quotationDate = row.quotationDate || ''
   form.validDate = row.validDate || ''
@@ -553,32 +562,32 @@
     const resolvedProductId = product.productId
       ? Number(product.productId)
       : findNodeIdByLabel(productOptions.value, productName) || ''
-    
+
     // 濡傛灉鏈変骇鍝両D锛屽姞杞藉搴旂殑瑙勬牸鍨嬪彿鍒楄〃
     let modelOptions = [];
-    let resolvedSpecificationId = product.specificationId || '';
-    
+    let resolvedProductModelId = product.productModelId || '';
+
     if (resolvedProductId) {
       try {
         const res = await modelList({ id: resolvedProductId });
         modelOptions = res || [];
-        
-        // 濡傛灉杩斿洖鐨勬暟鎹病鏈� specificationId锛屼絾鏈� specification 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
-        if (!resolvedSpecificationId && product.specification) {
+
+        // 濡傛灉杩斿洖鐨勬暟鎹病鏈� productModelId锛屼絾鏈� specification 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
+        if (!resolvedProductModelId && product.specification) {
           const foundModel = modelOptions.find(item => item.model === product.specification);
           if (foundModel) {
-            resolvedSpecificationId = foundModel.id;
+            resolvedProductModelId = foundModel.id;
           }
         }
       } catch (error) {
         console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
       }
     }
-    
+
     return {
       productId: resolvedProductId,
       product: productName,
-      specificationId: resolvedSpecificationId,
+      productModelId: resolvedProductModelId,
       specification: product.specification || '',
       quantity: product.quantity || 0,
       unit: product.unit || '',
@@ -642,8 +651,7 @@
     productId: '',
     product: '',
     productName: '',
-    specificationId: '',
-    specification: '',
+    productModelId: '',
     quantity: 1,
     unit: '',
     unitPrice: 0,
@@ -680,11 +688,11 @@
         return
       }
 
-      // 璁$畻鎵�鏈変骇鍝佺殑鍗曚环鎬诲拰
-      form.totalAmount = form.products.reduce((sum, product) => {
+      // 璁$畻鎵�鏈変骇鍝佺殑鍗曚环鎬诲拰锛屼繚鐣欏叚浣嶅皬鏁�
+      form.totalAmount = roundAmount(form.products.reduce((sum, product) => {
         const price = Number(product.unitPrice) || 0
         return sum + price
-      }, 0)
+      }, 0))
 
       form.customer = customerOption.value.find(item => item.id === form.customerId)?.customerName || ''
       if (isEdit.value) {
@@ -736,6 +744,7 @@
         id: item.id,
         quotationNo: item.quotationNo || '',
         customer: item.customer || '',
+        customerId: item.customerId || undefined,
         salesperson: item.salesperson || '',
         quotationDate: item.quotationDate || '',
         validDate: item.validDate || '',
@@ -747,7 +756,7 @@
         products: item.products ? item.products.map(product => ({
           productId: product.productId || '',
           product: product.product || product.productName || '',
-          specificationId: product.specificationId || '',
+          productModelId: product.productModelId || '',
           specification: product.specification || '',
           quantity: product.quantity || 0,
           unit: product.unit || '',
@@ -782,6 +791,7 @@
 onMounted(()=>{
   getUserList()
   handleSearch()
+  fetchCustomerOptions()
 })
 </script>
 
@@ -794,16 +804,16 @@
   padding: 10px 0;
   max-height: calc(100vh - 200px);
   overflow-y: auto;
-  
+
   &::-webkit-scrollbar {
     width: 6px;
     height: 6px;
   }
-  
+
   &::-webkit-scrollbar-thumb {
     background: #c1c1c1;
     border-radius: 3px;
-    
+
     &:hover {
       background: #a8a8a8;
     }
@@ -820,17 +830,17 @@
   margin-bottom: 24px;
   border-radius: 8px;
   transition: all 0.3s ease;
-  
+
   &:hover {
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
   }
-  
+
   :deep(.el-card__header) {
     padding: 16px 20px;
     background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
     border-bottom: 1px solid #ebeef5;
   }
-  
+
   :deep(.el-card__body) {
     padding: 20px;
   }
@@ -840,19 +850,19 @@
   display: flex;
   align-items: center;
   gap: 8px;
-  
+
   .card-icon {
     font-size: 18px;
     color: #409eff;
   }
-  
+
   .card-title {
     font-weight: 600;
     font-size: 16px;
     color: #303133;
     flex: 1;
   }
-  
+
   .header-btn {
     margin-left: auto;
   }
@@ -876,20 +886,20 @@
 .product-table {
   :deep(.el-table__header) {
     background-color: #f5f7fa;
-    
+
     th {
       background-color: #f5f7fa !important;
       color: #606266;
       font-weight: 600;
     }
   }
-  
+
   :deep(.el-table__row) {
     &:hover {
       background-color: #f5f7fa;
     }
   }
-  
+
   :deep(.el-table__cell) {
     padding: 12px 0;
   }

--
Gitblit v1.9.3