zhangwencui
9 天以前 7ffd709598b1e44289d9f7bb23ae6b8583aebc3a
src/views/salesManagement/salesLedger/index.vue
@@ -720,8 +720,11 @@
              <el-form-item label="税率(%):"
                            prop="taxRate">
                <el-select v-model="productForm.taxRate"
                           placeholder="请选择"
                           placeholder="请选择或输入"
                           clearable
                           filterable
                           remote
                           :remote-method="handleTaxRateRemote"
                           @change="calculateFromTaxRate">
                  <el-option label="1"
                             value="1" />
@@ -729,6 +732,9 @@
                             value="6" />
                  <el-option label="13"
                             value="13" />
                  <el-option v-if="customTaxRate"
                             :label="customTaxRate"
                             :value="customTaxRate" />
                </el-select>
              </el-form-item>
            </el-col>
@@ -1157,6 +1163,7 @@
  const productFormVisible = ref(false);
  const productOperationType = ref("");
  const currentId = ref("");
  const customTaxRate = ref("");
  const productFormData = reactive({
    productForm: {
      productCategory: "",
@@ -2510,15 +2517,25 @@
                                <tr>
                                  <td>${index + 1}</td>
                                  <td>${product.productName || ""}</td>
                                  <td>${product.specificationModel || ""}</td>
                                            <td>${
                                              product.specificationModel || ""
                                            }</td>
                                  <td>${product.unit || ""}</td>
                                  <td>${formatNumber(product.unitPrice)}</td>
                                            <td>${formatNumber(
                                              product.unitPrice
                                            )}</td>
                                  <td>${product.quantity || 0}</td>
                                  <td>${formatNumber(product.totalPrice)}</td>
                                  <td>${formatDate(product.deliveryDate)}</td>
                                            <td>${formatNumber(
                                              product.totalPrice
                                            )}</td>
                                            <td>${formatDate(
                                              product.deliveryDate
                                            )}</td>
                                  <td>${product.licensePlate || ""}</td>
                                  <td>${product.customerName || ""}</td>
                                  <td>${product.salesContractNo || ""}</td>
                                            <td>${
                                              product.salesContractNo || ""
                                            }</td>
                                </tr>
                              `;
    });
@@ -2537,7 +2554,9 @@
                                      <tr class="total-row">
                                        <td colspan="5">合计</td>
                                        <td>${totalQuantity}</td>
                                        <td>${formatNumber(totalAmount)}</td>
                                                  <td>${formatNumber(
                                                    totalAmount
                                                  )}</td>
                                        <td colspan="4"></td>
                                      </tr>
                                    </tbody>
@@ -2815,6 +2834,20 @@
    isCalculating.value = false;
  };
  // 处理税率远程搜索
  const handleTaxRateRemote = query => {
    if (query) {
      // 验证输入是否为数字且在0-100之间
      const num = parseFloat(query);
      if (!isNaN(num) && num > 0 && num < 100) {
        customTaxRate.value = query;
      } else {
        customTaxRate.value = "";
      }
    } else {
      customTaxRate.value = "";
    }
  };
  // 根据税率变化计算不含税总价
  const calculateFromTaxRate = () => {
    // 对私客户不需要税率计算