huminmin
4 天以前 5bea8c0f7b92afa947b4de6ecf4cb94741afedb5
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,13 @@
   // 创建一个新的打印窗口
   const printWindow = window.open('', '_blank', 'width=800,height=600');
   // 获取打印预览内容,只提取实际的打印页面
   const printPages = document.querySelectorAll('.print-page');
   let previewContent = '';
   printPages.forEach(page => {
      previewContent += page.outerHTML;
   });
   // 构建打印内容
   let printContent = `
    <!DOCTYPE html>
@@ -1512,19 +1549,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 +1575,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 +1612,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 +2185,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 +2286,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 +2327,4 @@
      page-break-after: avoid;
   }
}
</style>
</style>