From 70bb972b03c0036c3699bbc561b32c5ec3cc8aef Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 17 四月 2026 14:49:56 +0800
Subject: [PATCH] 打印样式重构

---
 src/views/salesManagement/salesLedger/index.vue |  419 ++++++++++++++++++++---------------------------------------
 1 files changed, 146 insertions(+), 273 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 81a8313..91de07e 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -453,7 +453,7 @@
 						<div class="delivery-note">
 							<div class="header">
 								<div class="company-name">婀栧崡楣忓垱鐢靛瓙鏈夐檺鍏徃</div>
-								<div class="document-title">閫佽揣鍗�</div>
+								<div class="document-title">閫�     璐�     鍗�</div>
 							</div>
 
 							<div class="info-section">
@@ -466,6 +466,10 @@
 										<span class="label">閫佽揣鍦板潃锛�</span>
 										<span class="value">{{ item.companyAddress }}</span>
 									</div>
+                  <div>
+                    <span class="label">鑱旂郴鏂瑰紡锛�</span>
+                    <span class="value">{{ item.contactPerson }}   {{ item.contactPhone }}</span>
+                  </div>
 								</div>
 								<div class="info-row">
 									<div>
@@ -480,17 +484,14 @@
 
 									<div>
 										<span class="label">鑱旂郴鐢佃瘽锛�</span>
-										<span class="value">{{ item.contactPhone }}</span>
+										<span class="value">{{ item.companyPhone }}</span>
 									</div>
 								</div>
 							</div>
 
 							<div class="info-section">
 								<div class="info-row">
-									<div>
-										<span class="label">鑱旂郴鏂瑰紡锛�</span>
-										<span class="value"></span>
-									</div>
+
 									<div>
 										<span class="label">閫佽揣鍗曚綅锛�</span>
 										<span class="value">婀栧崡楣忓垱鐢靛瓙鏈夐檺鍏徃</span>
@@ -502,47 +503,56 @@
 								</div>
 							</div>
 
-							<span style="font-size: 16px;">璐х墿璇︾粏淇℃伅锛�</span>
+							<span style="font-size: 14px; margin-top: 5px;">璐х墿璇︾粏淇℃伅锛�</span>
 							<div class="table-section">
 								<table class="product-table">
 									<thead>
 										<tr>
 											<th>搴忓彿</th>
-											<th>鏂欏彿</th>
-											<th>鍝佸悕/瑙勬牸</th>
+											<th>鐗╂枡鍚嶇О</th>
+											<th>浜у搧鍚嶇О</th>
+											<th>浜у搧瑙勬牸</th>
 											<th>鍗曚綅</th>
 											<th>鏁伴噺</th>
-											<th>璁㈠崟鍙�</th>
+											<th>璁㈠崟缂栧彿</th>
 										</tr>
 									</thead>
 									<tbody>
 										<tr v-for="(product, index) in item.products" :key="product.id">
 											<td>{{ index + 1 }}</td>
 											<td>{{ product.materialCode || '' }}</td>
-											<td>{{ `${product.productCategory || ''}/${product.specificationModel || ''}`
-												}}</td>
+											<td>{{ product.productCategory || '' }}</td>
+											<td>{{ product.specificationModel || '' }}</td>
 											<td>{{ product.unit || '' }}</td>
 											<td>{{ product.quantity || '0' }}</td>
 											<td>{{ item.salesContractNo || '' }}</td>
 										</tr>
-										<tr v-if="!item.products || item.products.length === 0">
-											<td colspan="6" style="text-align: center; color: #999;">鏆傛棤浜у搧鏁版嵁</td>
+										<!-- 娣诲姞绌虹櫧琛屼互纭繚鑷冲皯5琛� -->
+										<tr v-for="n in Math.max(0, 5 - (item.products ? item.products.length : 0))" :key="'empty-' + n" style="height: 25px;">
+											<td style="height: 25px;"></td>
+											<td style="height: 25px;"></td>
+											<td style="height: 25px;"></td>
+											<td style="height: 25px;"></td>
+											<td style="height: 25px;"></td>
+											<td style="height: 25px;"></td>
+											<td style="height: 25px;"></td>
 										</tr>
 									</tbody>
 									<tfoot>
 										<tr>
-											<td class="label"></td>
-											<td class="label">鍚堣</td>
-											<td class="total-value"></td>
-											<td class="total-value"></td>
+                      <td class="label" colspan="5" style="text-align: right;">鍚堣</td>
 											<td class="total-value">{{ getTotalQuantity(item.products) }}</td>
 											<td class="total-value"></td>
 										</tr>
 									</tfoot>
 								</table>
 
-								<div style="width: 30px;">
-									鍏卞洓鑱斿瓨鏍瑰洖鍗曞鎴蜂粨搴�
+								<div style="width: 40px; display: flex; flex-direction: column; gap: 2px;">
+                  <div style="border-bottom: 1px dashed #000; padding-bottom: 2px; text-align: center;">鍏卞洓鑱�</div>
+                  <div style="border-bottom: 1px dashed #000; padding-bottom: 2px; text-align: center;">瀛樻牴</div>
+                  <div style="border-bottom: 1px dashed #000; padding-bottom: 2px; text-align: center;">瀹㈡埛</div>
+                  <div style="border-bottom: 1px dashed #000; padding-bottom: 2px; text-align: center;">璁拌处</div>
+                  <div style="text-align: center;">浠撳簱</div>
 								</div>
 							</div>
 
@@ -550,12 +560,32 @@
 								<el-descriptions-item
 									label="澶囨敞锛�">璐靛叕鍙稿湪鏀惰揣鍚庤鍗冲埢鏍稿疄鏁伴噺鍙婂搧璐紝鑻ユ湁寮傝锛岃鍦�3鏃ュ唴鎻愬嚭锛屽惁鍒欒涓烘敹濡ャ��</el-descriptions-item>
 							</el-descriptions>
-							<el-descriptions :column="2">
-								<el-descriptions-item label="閫佽揣鍗曚綅锛堢绔狅級锛�" />
-								<el-descriptions-item label="鏀惰揣鍗曚綅锛�" />
-								<el-descriptions-item label="閫佽揣浜猴細" />
-								<el-descriptions-item label="鏀惰揣浜猴細" />
-							</el-descriptions>
+              <div class="footer">
+                <div class="info-section">
+                  <div class="info-row">
+                    <div>
+                      <span class="label">閫佽揣鍗曚綅锛堢绔狅級锛�</span>
+                      <span class="value"></span>
+                    </div>
+                    <div>
+                      <span class="label">閫佽揣浜猴細</span>
+                      <span class="value"></span>
+                    </div>
+                  </div>
+                </div>
+
+                <div class="info-section">
+                  <div class="info-row">
+                    <div>
+                      <span class="label">鏀惰揣鍗曚綅锛�</span>
+                      <span class="value"></span>
+                    </div>
+                    <div>
+                      <span class="label">鏀惰揣浜猴細</span>
+                    </div>
+                  </div>
+                </div>
+              </div>
 						</div>
 					</div>
 				</div>
@@ -1498,6 +1528,9 @@
 	// 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
 	const printWindow = window.open('', '_blank', 'width=800,height=600');
 
+	// 鑾峰彇鎵撳嵃棰勮鍐呭
+	const previewContent = document.querySelector('.print-preview-content').innerHTML;
+
 	// 鏋勫缓鎵撳嵃鍐呭
 	let printContent = `
     <!DOCTYPE html>
@@ -1512,19 +1545,18 @@
           font-family: "SimSun", serif;
           background: white;
         }
-                                                     .print-page {
-            width: 200mm;
-            height: 75mm;
-            padding: 10mm;
-            padding-left: 20mm;
-            background: white;
-            box-sizing: border-box;
-            page-break-after: always;
-            page-break-inside: avoid;
-          }
-         .print-page:last-child {
-           page-break-after: avoid;
-         }
+        .print-page {
+          width: 241mm;
+          height: 75mm;
+          padding: 0mm 10mm;
+          background: white;
+          box-sizing: border-box;
+          page-break-after: always;
+          page-break-inside: avoid;
+        }
+        .print-page:last-child {
+          page-break-after: avoid;
+        }
         .delivery-note {
           width: 100%;
           height: 100%;
@@ -1539,16 +1571,16 @@
           margin-bottom: 8px;
         }
         .company-name {
-          font-size: 18px;
+          font-size: 28px;
           font-weight: bold;
           margin-bottom: 4px;
         }
         .document-title {
-          font-size: 16px;
+          font-size: 25px;
           font-weight: bold;
+          letter-spacing: 10px;
         }
         .info-section {
-          margin-bottom: 8px;
           display: flex;
           justify-content: space-between;
           align-items: center;
@@ -1576,249 +1608,68 @@
           border-collapse: collapse;
           border: 1px solid #000;
         }
-                 .product-table th, .product-table td {
-           border: 1px solid #000;
-           padding: 6px;
-           text-align: center;
-           font-size: 12px;
-           line-height: 1.4;
-         }
+        .product-table th, .product-table td {
+          border: 1px solid #000;
+          padding: 6px;
+          text-align: center;
+          font-size: 12px;
+          line-height: 1.4;
+        }
         .product-table th {
           font-weight: bold;
         }
         .total-value {
           font-weight: bold;
         }
-        .footer-section {
-          margin-top: auto;
-        }
-        .footer-row {
-          display: flex;
-          margin-bottom: 3px;
-          line-height: 22px;
-          justify-content: space-between;
-        }
         .remarks-section {
           margin: 10px 0;
-
-          .remark-item {
-            display: flex;
-            align-items: flex-start;
-
-            .label {
-              font-weight: bold;
-              min-width: 30px;
-              font-size: 14px;
-              margin-right: 10px;
-              white-space: nowrap;
-            }
-
-            .value {
-              flex: 1;
-              font-size: 14px;
-              line-height: 1.4;
-            }
-          }
         }
-
         .sign-section {
           margin-top: 15px;
-
-          .sign-row {
+        }
+        .footer {
+           display: flex;
+          .info-section {
             display: flex;
             justify-content: space-between;
-            margin-bottom: 10px;
-
-            .sign-item {
-              display: flex;
-              align-items: center;
-              width: 48%;
-
-              .label {
-                font-weight: bold;
-                font-size: 14px;
-                margin-right: 10px;
-                white-space: nowrap;
-              }
-
-              .value {
-                flex: 1;
-                min-height: 30px;
-                border-bottom: 1px solid #000;
-                font-size: 14px;
-              }
-            }
+            align-items: center;
+            width: 50%;
           }
-        }
-
-        .footer-item {
-          display: flex;
-          margin-right: 20px;
-        }
-        .footer-item .label {
-          font-weight: bold;
-          min-width: 80px;
-          font-size: 12px;
-        }
-        .footer-item .value {
-          min-width: 80px;
-          font-size: 12px;
-        }
-        .address-item .address-value {
-          min-width: 200px;
+          .info-row {
+            line-height: 20px;
+          }
+          .label {
+            font-weight: bold;
+            min-width: 60px;
+            font-size: 12px;
+          }
+          .value {
+            margin-right: 20px;
+            min-width: 80px;
+            font-size: 12px;
+          }
         }
         @media print {
           body {
             margin: 0;
             padding: 0;
           }
-                     .print-page {
-             margin: 0;
-             padding: 10mm;
-             /* padding-left: 20mm; */
-             page-break-inside: avoid;
-             page-break-after: always;
-           }
-           .print-page:last-child {
-             page-break-after: avoid;
-           }
+          .print-page {
+            box-shadow: none;
+            margin: 0;
+            padding: 10mm;
+            padding-left: 20mm;
+            page-break-inside: avoid;
+            page-break-after: always;
+          }
+          .print-page:last-child {
+            page-break-after: avoid;
+          }
         }
       </style>
     </head>
     <body>
-  `;
-
-	// 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
-	printData.value.forEach((item, index) => {
-		printContent += `
-      <div class="print-page">
-        <div class="delivery-note">
-          <div class="header">
-              <div class="company-name">婀栧崡楣忓垱鐢靛瓙鏈夐檺鍏徃</div>
-              <div class="document-title">閫佽揣鍗�</div>
-          </div>
-          <div class="info-section">
-              <div class="info-row">
-                <div>
-                  <span class="label">瀹㈡埛鍚嶇О锛�</span>
-                  <span class="value">${item.customerName || ''}</span>
-                </div>
-                <div>
-                  <span class="label">閫佽揣鍦板潃锛�</span>
-                  <span class="value">${item.companyAddress || ''}</span>
-                </div>
-              </div>
-              <div class="info-row">
-                <div>
-                  <span class="label">鍗曟嵁缂栧彿锛�</span>
-                  <span class="value">${item.salesContractNo || ''}</span>
-                </div>
-
-                <div>
-                  <span class="label">閫佽揣鏃ユ湡锛�</span>
-                  <span class="value">${formatDate(null)}</span>
-                </div>
-
-                <div>
-                  <span class="label">鑱旂郴鐢佃瘽锛�</span>
-                  <span class="value">${item.contactPhone || ''}</span>
-                </div>
-              </div>
-            </div>
-
-          <div class="info-section">
-              <div class="info-row">
-                <div>
-                  <span class="label">鑱旂郴鏂瑰紡锛�</span>
-                  <span class="value"></span>
-                </div>
-                <div>
-                  <span class="label">閫佽揣鍗曚綅锛�</span>
-                  <span class="value">婀栧崡楣忓垱鐢靛瓙鏈夐檺鍏徃</span>
-                </div>
-                <div>
-                  <span class="label">鍦板潃锛�</span>
-                  <span class="value">婀栧崡鑰掗槼甯傚垱鏂板垱涓氬洯A1鏍�</span>
-                </div>
-              </div>
-            </div>
-
-          <span style="font-size: 16px;">璐х墿璇︾粏淇℃伅锛�</span>
-          <div class="table-section">
-            <table class="product-table">
-              <thead>
-                <tr>
-                  <th>搴忓彿</th>
-                  <th>鏂欏彿</th>
-                  <th>鍝佸悕/瑙勬牸</th>
-                  <th>鍗曚綅</th>
-                  <th>鏁伴噺</th>
-                  <th>璁㈠崟鍙�</th>
-                </tr>
-              </thead>
-                  <tbody>
-                ${item.products && item.products.length > 0 ?
-				item.products.map((product, index) => `
-                    <tr>
-                      <td>${index + 1}</td>
-                      <td>${product.materialCode || ''}</td>
-                      <td>${product.productCategory || ''}/${product.specificationModel || ''}</td>
-                      <td>${product.unit || ''}</td>
-                      <td>${product.quantity || '0'}</td>
-                      <td>${item.salesContractNo || ''}</td>
-                    </tr>
-                  `).join('') :
-				'<tr><td colspan="6" style="text-align: center; color: #999;">鏆傛棤浜у搧鏁版嵁</td></tr>'
-			}
-              </tbody>
-              <tfoot>
-                <tr>
-                  <td></td>
-                  <td class="label">鍚堣</td>
-                  <td class="total-value"></td>
-                  <td class="total-value"></td>
-                  <td class="total-value">${getTotalQuantity(item.products) || '0'}</td>
-                  <td class="total-value"></td>
-                </tr>
-              </tfoot>
-            </table>
-
-            <div style="width: 30px;">
-              鍏卞洓鑱斿瓨鏍瑰洖鍗曞鎴蜂粨搴�
-            </div>
-          </div>
-
-          <div class="remarks-section">
-            <div class="remark-item">
-              <span class="label">澶囨敞锛�</span>
-              <span class="value">璐靛叕鍙稿湪鏀惰揣鍚庤鍗冲埢鏍稿疄鏁伴噺鍙婂搧璐紝鑻ユ湁寮傝锛岃鍦�3鏃ュ唴鎻愬嚭锛屽惁鍒欒涓烘敹濡ャ��</span>
-            </div>
-          </div>
-          <div class="sign-section">
-            <div class="sign-row">
-              <div class="sign-item">
-                <span class="label">閫佽揣鍗曚綅锛堢绔狅級锛�</span>
-              </div>
-              <div class="sign-item">
-                <span class="label">鏀惰揣鍗曚綅锛�</span>
-              </div>
-            </div>
-            <div class="sign-row">
-              <div class="sign-item">
-                <span class="label">閫佽揣浜猴細</span>
-              </div>
-              <div class="sign-item">
-                <span class="label">鏀惰揣浜猴細</span>
-              </div>
-            </div>
-          </div>
-
-        </div>
-      </div>
-    `;
-	});
-
-	printContent += `
+      ${previewContent}
     </body>
     </html>
   `;
@@ -2330,20 +2181,19 @@
 	text-align: center;
 	margin-bottom: 8px;
 
-	.company-name {
-		font-size: 18px;
-		font-weight: bold;
-		margin-bottom: 4px;
-	}
-
-	.document-title {
-		font-size: 16px;
-		font-weight: bold;
-	}
+  .company-name {
+    font-size: 28px;
+    font-weight: bold;
+    margin-bottom: 4px;
+  }
+  .document-title {
+    font-size: 25px;
+    font-weight: bold;
+    letter-spacing: 10px;
+  }
 }
 
 .info-section {
-	margin-bottom: 8px;
 	display: flex;
 	justify-content: space-between;
 	align-items: center;
@@ -2432,6 +2282,29 @@
 	}
 }
 
+.footer {
+  display: flex;
+  .info-section {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    width: 50%;
+  }
+  .info-row {
+    line-height: 20px;
+  }
+  .label {
+    font-weight: bold;
+    min-width: 60px;
+    font-size: 12px;
+  }
+  .value {
+    margin-right: 20px;
+    min-width: 80px;
+    font-size: 12px;
+  }
+}
+
 @media print {
 	.app-container {
 		display: none;
@@ -2450,4 +2323,4 @@
 		page-break-after: avoid;
 	}
 }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3