buhuazhen
6 天以前 168c23ac6a1c021407f905323525c8d411857e57
src/views/salesManagement/salesLedger/index.vue
@@ -10,10 +10,6 @@
          <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search"
            @change="handleQuery" />
        </el-form-item>
        <el-form-item label="项目名称:">
          <el-input v-model="searchForm.projectName" placeholder="请输入" clearable prefix-icon="Search"
            @change="handleQuery" />
        </el-form-item>
        <el-form-item label="录入日期:">
          <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
            placeholder="请选择" clearable @change="changeDaterange" />
@@ -64,28 +60,12 @@
                           </el-tag>
                        </template>
                     </el-table-column>
                     <el-table-column label="快递公司" prop="expressCompany" show-overflow-tooltip />
                     <el-table-column label="快递单号" prop="expressNumber" show-overflow-tooltip />
              <el-table-column label="发货车牌" minWidth="100px" align="center">
                <template #default="scope">
                  <div>
                    <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag>
                    <el-tag v-else type="info">-</el-tag>
                  </div>
                </template>
              </el-table-column>
                     <el-table-column label="发货日期"
                                              minWidth="100px"
                                              align="center">
                <template #default="scope">
                  <div>
                    <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
                              <el-tag v-else
                                          type="info">-</el-tag>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="数量" prop="quantity" />
              <el-table-column label="数量" prop ="quantity" />
               <el-table-column label="已发货数量" prop="partSendAmount" >
                  <template #default="scope">
                              {{ scope.row.partSendAmount || 0 }}
                        </template>
                  </el-table-column>
              <el-table-column label="税率(%)" prop="taxRate" />
              <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
              <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
@@ -101,6 +81,13 @@
                    @click="openDeliveryForm(scope.row)">
                    发货
                  </el-button>
                  <el-button
                    link
                    type="primary"
                    size="small"
                    @click="openDeliveryDetail(scope.row)">
                    详情
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
@@ -110,17 +97,17 @@
        <el-table-column label="销售合同号" prop="salesContractNo" width="180" show-overflow-tooltip />
        <el-table-column label="客户名称" prop="customerName" width="300" show-overflow-tooltip />
        <el-table-column label="业务员" prop="salesman" width="100" show-overflow-tooltip />
        <el-table-column label="项目名称" prop="projectName" width="180" show-overflow-tooltip />
        <el-table-column label="付款方式" prop="paymentMethod" show-overflow-tooltip />
        <el-table-column label="合同金额(元)" prop="contractAmount" width="220" show-overflow-tooltip
          :formatter="formattedNumber" />
        <el-table-column label="录入人" prop="entryPersonName" width="100" show-overflow-tooltip />
        <el-table-column label="录入日期" prop="entryDate" width="120" show-overflow-tooltip />
        <el-table-column label="签订日期" prop="executionDate" width="120" show-overflow-tooltip />
        <el-table-column label="交付日期" prop="deliveryDate" width="120" show-overflow-tooltip />
        <el-table-column label="备注" prop="remarks" width="200" show-overflow-tooltip />
        <el-table-column fixed="right" label="操作" min-width="100" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">编辑</el-button>
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit">编辑</el-button>
<!--            <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详情</el-button>-->
            <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button>
<!--            <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button>-->
@@ -168,25 +155,19 @@
              </el-select>
            </el-form-item>
          </el-col>
               <el-col :span="12">
               <!-- <el-col :span="12">
                  <el-form-item label="项目名称:" prop="projectName">
                     <el-input v-model="form.projectName" placeholder="请输入" clearable :disabled="operationType === 'view'" />
                  </el-form-item>
               </el-col>
        </el-row>
        <el-row :gutter="30">
               </el-col> -->
               <el-col :span="12">
                  <el-form-item label="签订日期:" prop="executionDate">
                     <el-date-picker style="width: 100%" v-model="form.executionDate" value-format="YYYY-MM-DD"
                                             format="YYYY-MM-DD" type="date" placeholder="请选择" clearable :disabled="operationType === 'view'" />
                  </el-form-item>
               </el-col>
               <el-col :span="12">
                  <el-form-item label="付款方式">
                     <el-input v-model="form.paymentMethod" placeholder="请输入" clearable :disabled="operationType === 'view'" />
                  </el-form-item>
               </el-col>
            </el-row>
        </el-row>
            <el-row :gutter="30">
               <el-col :span="12">
                  <el-form-item label="录入人:" prop="entryPerson">
@@ -207,14 +188,14 @@
            </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="交货日期:" prop="entryDate">
            <el-form-item label="交货日期:" prop="deliveryDate">
              <el-date-picker style="width: 100%" v-model="form.deliveryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
                              type="date" placeholder="请选择" clearable />
            </el-form-item>
          </el-col>
        </el-row>
            <el-row>
               <el-form-item label="产品信息:" prop="entryDate">
               <el-form-item label="产品信息:">
                  <el-button v-if="operationType !== 'view'" type="primary" @click="openProductForm('add')">添加</el-button>
                  <el-button v-if="operationType !== 'view'" plain type="danger" @click="deleteProduct" >删除</el-button>
               </el-form-item>
@@ -242,14 +223,14 @@
            </el-table>
            <el-row :gutter="30">
               <el-col :span="24">
                  <el-form-item label="备注·:" prop="remark">
                     <el-input v-model="form.remark" placeholder="请输入" clearable type="textarea" :rows="2" :disabled="operationType === 'view'" />
                  <el-form-item label="备注:" prop="remarks">
                     <el-input v-model="form.remarks" placeholder="请输入" clearable type="textarea" :rows="2" :disabled="operationType === 'view'" />
                  </el-form-item>
               </el-col>
            </el-row>
            <el-row :gutter="30">
               <el-col :span="24">
                  <el-form-item label="附件材料:" prop="remark">
                  <el-form-item label="附件材料:" prop="salesLedgerFiles">
                     <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
                                     :headers="upload.headers" :before-upload="handleBeforeUpload" :on-error="handleUploadError"
                                     :on-success="handleUploadSuccess" :on-remove="handleRemove">
@@ -318,6 +299,15 @@
            </el-table-column>
         </el-table>
         
         <pagination
            v-show="quotationPage.total > 0"
            :total="quotationPage.total"
            layout="total, sizes, prev, pager, next, jumper"
            :page="quotationPage.current"
            :limit="quotationPage.size"
            @pagination="quotationPaginationChange"
         />
         <template #footer>
            <el-button @click="quotationDialogVisible = false">关闭</el-button>
         </template>
@@ -376,7 +366,7 @@
                  </el-form-item>
               </el-col>
               <el-col :span="12">
                  <el-form-item label="数量:" prop="quantity">
                  <el-form-item label="数量" prop="quantity">
                     <el-input-number  :step="0.1" :min="0" v-model="productForm.quantity" placeholder="请输入" clearable
                                                :precision="2"
                                                @change="calculateFromQuantity" style="width: 100%" />
@@ -471,7 +461,6 @@
               <div v-for="(item, index) in printData" :key="index" class="print-page">
                  <div class="delivery-note">
                     <div class="header">
                        <div class="company-name">鼎诚瑞实业有限责任公司</div>
                        <div class="document-title">零售发货单</div>
                     </div>
                     
@@ -480,10 +469,6 @@
                           <div>
                              <span class="label">发货日期:</span>
                              <span class="value">{{ formatDate(item.createTime) }}</span>
                           </div>
                           <div>
                              <span class="label">发货车牌号:</span>
                              <span class="value">{{ item.shippingCarNumber }}</span>
                           </div>
                        </div>
                        <div class="info-row">
@@ -574,19 +559,52 @@
      >
         <el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef">
            <el-row :gutter="30">
               <el-col :span="24">
               <!-- <el-col :span="12">
                  <el-form-item label="发货类型:" prop="type">
                     <el-select
                        v-model="deliveryForm.type"
                        placeholder="请选择发货类型"
                        disabled
                        style="width: 100%"
                     >
                        <el-option label="货车" value="货车" />
                        <el-option label="快递" value="快递" />
                     </el-select>
                  </el-form-item>
               </el-col> -->
      <el-col :span="12">
                  <el-form-item label="待发货数量:" prop="remainAmount">
                     <el-input v-model="deliveryForm.remainAmount" disabled placeholder="请输入待发货数量"></el-input>
                  </el-form-item>
               </el-col>
      <el-col :span="12">
                  <el-form-item label="发货模式:" prop="deliveryMode">
                     <el-select
                        v-model="deliveryForm.deliveryMode"
                        placeholder="请选择发货模式"
            style="width: 100%"
            @change="onDeliveryModeChange"
                     >
                     <el-option label="全部" value="全部" />
                     <el-option label="部分" value="部分" />
                     </el-select>
                  </el-form-item>
               </el-col>
      <el-col :span="12">
        <el-form-item label="发货数量:" prop="partSendAmount">
          <el-input-number
            v-model="deliveryForm.partSendAmount"
            :min="1"
            :max="deliveryForm.remainAmount"
            :precision="0"
            :step="1"
            :disabled="deliveryForm.deliveryMode === '全部'"
            style="width: 100%"
            placeholder="请输入本次发货数量"
          />
        </el-form-item>
      </el-col>
            </el-row>
        <!-- 审批人选择(仿协同审批里的审批人节点选择) -->
        <el-row>
@@ -640,6 +658,48 @@
            </div>
         </template>
      </el-dialog>
      <!-- 发货详情弹框 -->
      <el-dialog
         v-model="deliveryDetailVisible"
         title="发货详情"
         width="80%"
         :close-on-click-modal="false"
         @close="closeDeliveryDetail"
      >
         <el-table
            :data="deliveryDetailTableData"
            border
            stripe
            v-loading="deliveryDetailLoading"
            height="520px"
         >
            <el-table-column align="center" label="序号" type="index" width="60" />
            <el-table-column prop="salesContractNo" label="销售订单" width="180" show-overflow-tooltip />
            <el-table-column prop="shippingNo" label="发货订单号" width="180" show-overflow-tooltip />
            <el-table-column prop="customerName" label="客户名称" min-width="200" show-overflow-tooltip />
            <el-table-column prop="status" label="发货状态" min-width="200" show-overflow-tooltip />
            <el-table-column prop="productName" label="产品名称" min-width="160" show-overflow-tooltip />
            <el-table-column prop="specificationModel" label="规格型号" min-width="160" show-overflow-tooltip />
            <el-table-column prop="type" label="发货类型" width="100" show-overflow-tooltip />
            <el-table-column prop="expressCompany" label="快递公司" width="140" show-overflow-tooltip />
            <el-table-column prop="expressNumber" label="快递单号" width="160" show-overflow-tooltip />
            <el-table-column prop="partSendAmount" label="本次发货数量" width="120" align="center" />
         </el-table>
         <pagination
            v-show="deliveryDetailPage.total > 0"
            :total="deliveryDetailPage.total"
            layout="total, sizes, prev, pager, next, jumper"
            :page="deliveryDetailPage.current"
            :limit="deliveryDetailPage.size"
            @pagination="deliveryDetailPaginationChange"
         />
         <template #footer>
            <div class="dialog-footer">
               <el-button @click="closeDeliveryDetail">关闭</el-button>
            </div>
         </template>
      </el-dialog>
   </div>
</template>
@@ -647,7 +707,7 @@
import { getToken } from "@/utils/auth";
import pagination from "@/components/PIMTable/Pagination.vue";
import {onMounted, ref, getCurrentInstance} from "vue";
import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
import { addShippingInfo, deliveryLedgerListPage } from "@/api/salesManagement/deliveryLedger.js";
import { ElMessageBox, ElMessage } from "element-plus";
import { UploadFilled, Download } from "@element-plus/icons-vue";
import useUserStore from "@/store/modules/user";
@@ -749,7 +809,6 @@
      taxInclusiveUnitPrice: [
         { required: true, message: "请输入", trigger: "blur" },
      ],
      taxRate: [{ required: true, message: "请选择", trigger: "change" }],
      taxInclusiveTotalPrice: [
         { required: true, message: "请输入", trigger: "blur" },
      ],
@@ -780,22 +839,122 @@
   quotationNo: "",
   customer: "",
});
// 报价单弹框分页
const quotationPage = reactive({
   current: 1,
   size: 10,
   total: 0,
});
const selectedQuotation = ref(null);
// 发货相关
const deliveryFormVisible = ref(false);
const deliveryDetailVisible = ref(false);
const deliveryDetailLoading = ref(false);
const deliveryDetailTableData = ref([]);
const deliveryDetailSalesLedgerId = ref(null);
const deliveryDetailPage = reactive({
   current: 1,
   size: 10,
   total: 0,
});
const currentDeliveryRow = ref(null);
const deliveryFormData = reactive({
  deliveryForm: {
    type: "货车", // 货车, 快递
    type: "快递", // 货车, 快递
    remainAmount: 0,
    deliveryMode: "全部", // 全部 | 部分
    partSendAmount: 0,
  },
  deliveryRules: {
    type: [
      { required: true, message: "请选择发货类型", trigger: "change" }
    ],
    remainAmount: [
      {
        validator: (rule, value, callback) => {
          const remain = Number(value) || 0;
          if (remain <= 0) {
            return callback(new Error("待发货数量需要大于0"));
          }
          return callback();
        },
        trigger: "change",
      }
    ],
    deliveryMode: [
      { required: true, message: "请选择发货模式", trigger: "change" }
    ],
    partSendAmount: [
      {
        validator: (rule, value, callback) => {
          if (deliveryFormData.deliveryForm.deliveryMode !== "部分") {
            return callback();
          }
          const max = Number(deliveryFormData.deliveryForm.remainAmount) || 0;
          const v = Number(value);
          if (!v || v <= 0) {
            return callback(new Error("请输入发货数量"));
          }
          if (v > max) {
            return callback(new Error(`发货数量不能超过待发货数量(${max})`));
          }
          return callback();
        },
        trigger: "change",
      }
    ]
  },
});
const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
const onDeliveryModeChange = (val) => {
  const remain = Number(deliveryForm.value.remainAmount) || 0;
  if (val === "全部") {
    deliveryForm.value.partSendAmount = remain;
  } else {
    let v = Number(deliveryForm.value.partSendAmount) || 0;
    if (v <= 0 || v > remain) {
      deliveryForm.value.partSendAmount = remain > 0 ? Math.min(1, remain) : 0;
    }
  }
};
const getDeliveryDetailList = () => {
   if (!deliveryDetailSalesLedgerId.value) return;
   deliveryDetailLoading.value = true;
   return deliveryLedgerListPage({
      salesLedgerProductId: deliveryDetailSalesLedgerId.value,
      current: deliveryDetailPage.current,
      size: deliveryDetailPage.size,
   }).then((res) => {
      deliveryDetailTableData.value = res?.data?.records || [];
      deliveryDetailPage.total = res?.data?.total || 0;
   }).finally(() => {
      deliveryDetailLoading.value = false;
   });
};
const deliveryDetailPaginationChange = (obj) => {
   deliveryDetailPage.current = obj.page;
   deliveryDetailPage.size = obj.limit;
   getDeliveryDetailList();
};
const openDeliveryDetail = (row) => {
   deliveryDetailSalesLedgerId.value = row?.id ?? null;
   deliveryDetailPage.current = 1;
   deliveryDetailVisible.value = true;
   getDeliveryDetailList();
};
const closeDeliveryDetail = () => {
   deliveryDetailVisible.value = false;
   deliveryDetailTableData.value = [];
   deliveryDetailSalesLedgerId.value = null;
   deliveryDetailPage.current = 1;
   deliveryDetailPage.total = 0;
};
// 发货审批人节点(仿协同审批 infoFormDia.vue)
const approverNodes = ref([{ id: 1, userId: null }]);
@@ -1004,8 +1163,10 @@
// 添加表行类名方法
const tableRowClassName = ({ row }) => {
  const diff = row.deliveryDaysDiff;
  if (!row.deliveryDate) return '';
  if (row.isFh) return '';
  const diff = row.deliveryDaysDiff;
  if (diff === 15) {
    return 'yellow';
  } else if (diff === 10) {
@@ -1072,6 +1233,8 @@
const openQuotationDialog = async () => {
   if (operationType.value === "view") return;
   quotationDialogVisible.value = true;
   // 打开弹窗时重置分页到第一页
   quotationPage.current = 1;
   // 先确保客户列表已加载,便于后续回填 customerId
   if (!customerOption.value || customerOption.value.length === 0) {
      try {
@@ -1088,14 +1251,15 @@
   quotationLoading.value = true;
   try {
      const params = {
         // 兼容后端分页字段:这里沿用报价页面已有可用的字段命名
         currentPage: 1,
         pageSize: 100,
         // 后端分页字段:current / size
         current: quotationPage.current,
         size: quotationPage.size,
         ...quotationSearchForm,
         status: "通过",
      };
      const res = await getQuotationList(params);
      quotationList.value = res?.data?.records || [];
      quotationPage.total = res?.data?.total || 0;
   } finally {
      quotationLoading.value = false;
   }
@@ -1104,7 +1268,15 @@
const resetQuotationSearch = async () => {
   quotationSearchForm.quotationNo = "";
   quotationSearchForm.customer = "";
   quotationPage.current = 1;
   await fetchQuotationList();
};
// 报价单弹框分页切换
const quotationPaginationChange = (obj) => {
   quotationPage.current = obj.page;
   quotationPage.size = obj.limit;
   fetchQuotationList();
};
// 选中报价单后回填到台账表单
@@ -1267,10 +1439,15 @@
const submitProduct = () => {
   proxy.$refs["productFormRef"].validate((valid) => {
      if (valid) {
         // 如果里面的数据没有taxRate 那就默认带上一个taxRate 为空
         if (!Object.prototype.hasOwnProperty.call(productForm.value, 'taxRate') || productForm.value.taxRate === null || productForm.value.taxRate === undefined) {
            productForm.value.taxRate = 0;
         }
         if (operationType.value === "edit") {
            submitProductEdit();
         } else {
            if(productOperationType.value === "add"){
               productData.value.push({ ...productForm.value });
            }else{
               productData.value[productIndex.value] = { ...productForm.value }
@@ -1641,7 +1818,6 @@
      <div class="print-page">
        <div class="delivery-note">
          <div class="header">
            <div class="company-name">鼎诚瑞实业有限责任公司</div>
            <div class="document-title">零售发货单</div>
          </div>
          
@@ -1845,13 +2021,15 @@
   // 计算含税单价 = 含税总价 / 数量
   productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
   
   // 如果有税率,计算不含税总价
   // 有税率则计算不含税总价,否则不含税总价 = 含税总价
   if (productForm.value.taxRate) {
      productForm.value.taxExclusiveTotalPrice =
         proxy.calculateTaxExclusiveTotalPrice(
            totalPrice,
            productForm.value.taxRate
         );
   } else {
      productForm.value.taxExclusiveTotalPrice = totalPrice.toFixed(2);
   }
   
   isCalculating.value = false;
@@ -1859,39 +2037,34 @@
// 根据不含税总价计算含税单价和数量
const calculateFromExclusiveTotalPrice = () => {
   if (!productForm.value.taxRate) {
      proxy.$modal.msgWarning("请先选择税率");
      return;
   }
   if (isCalculating.value) return;
   
   const exclusiveTotalPrice = parseFloat(productForm.value.taxExclusiveTotalPrice);
   const quantity = parseFloat(productForm.value.quantity);
   const taxRate = parseFloat(productForm.value.taxRate);
   
   if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
   if (!exclusiveTotalPrice || !quantity || quantity <= 0) {
      return;
   }
   
   isCalculating.value = true;
   
   // 先计算含税总价 = 不含税总价 / (1 - 税率/100)
   const taxRateDecimal = taxRate / 100;
   const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
   productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
   // 计算含税单价 = 含税总价 / 数量
   productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
   if (productForm.value.taxRate) {
      // 有税率:含税总价 = 不含税总价 / (1 - 税率/100)
      const taxRateDecimal = parseFloat(productForm.value.taxRate) / 100;
      const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
      productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
      productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
   } else {
      // 无税率:含税总价 = 不含税总价
      productForm.value.taxInclusiveTotalPrice = exclusiveTotalPrice.toFixed(2);
      productForm.value.taxInclusiveUnitPrice = (exclusiveTotalPrice / quantity).toFixed(2);
   }
   
   isCalculating.value = false;
};
// 根据数量变化计算总价
const calculateFromQuantity = () => {
   if (!productForm.value.taxRate) {
      proxy.$modal.msgWarning("请先选择税率");
      return;
   }
   if (isCalculating.value) return;
   
   const quantity = parseFloat(productForm.value.quantity);
@@ -1906,13 +2079,15 @@
   // 计算含税总价
   productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
   
   // 如果有税率,计算不含税总价
   // 有税率则计算不含税总价,否则不含税总价 = 含税总价
   if (productForm.value.taxRate) {
      productForm.value.taxExclusiveTotalPrice =
         proxy.calculateTaxExclusiveTotalPrice(
            productForm.value.taxInclusiveTotalPrice,
            productForm.value.taxRate
         );
   } else {
      productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice;
   }
   
   isCalculating.value = false;
@@ -1920,10 +2095,6 @@
// 根据含税单价变化计算总价
const calculateFromUnitPrice = () => {
   if (!productForm.value.taxRate) {
      proxy.$modal.msgWarning("请先选择税率");
      return;
   }
   if (isCalculating.value) return;
   
   const quantity = parseFloat(productForm.value.quantity);
@@ -1938,13 +2109,15 @@
   // 计算含税总价
   productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
   
   // 如果有税率,计算不含税总价
   // 有税率则计算不含税总价,否则不含税总价 = 含税总价
   if (productForm.value.taxRate) {
      productForm.value.taxExclusiveTotalPrice =
         proxy.calculateTaxExclusiveTotalPrice(
            productForm.value.taxInclusiveTotalPrice,
            productForm.value.taxRate
         );
   } else {
      productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice;
   }
   
   isCalculating.value = false;
@@ -1952,27 +2125,27 @@
// 根据税率变化计算不含税总价
const calculateFromTaxRate = () => {
   if (!productForm.value.taxRate) {
      proxy.$modal.msgWarning("请先选择税率");
      return;
   }
   if (isCalculating.value) return;
   
   const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
   const taxRate = parseFloat(productForm.value.taxRate);
   
   if (!inclusiveTotalPrice || !taxRate) {
   if (!inclusiveTotalPrice) {
      return;
   }
   
   isCalculating.value = true;
   
   // 计算不含税总价
   productForm.value.taxExclusiveTotalPrice =
      proxy.calculateTaxExclusiveTotalPrice(
         inclusiveTotalPrice,
         taxRate
      );
   if (productForm.value.taxRate) {
      // 有税率:重新计算不含税总价
      productForm.value.taxExclusiveTotalPrice =
         proxy.calculateTaxExclusiveTotalPrice(
            inclusiveTotalPrice,
            parseFloat(productForm.value.taxRate)
         );
   } else {
      // 无税率:不含税总价 = 含税总价
      productForm.value.taxExclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
   }
   
   isCalculating.value = false;
};
@@ -1981,30 +2154,18 @@
 * @param row 行数据
 */
const getShippingStatusText = (row) => {
   // 如果已发货(有发货日期或车牌号),显示"已发货"
   if (row.shippingDate || row.shippingCarNumber) {
      return '已发货';
   }
   // 获取发货状态字段
   const status = row.shippingStatus;
   // 如果状态为空或未定义,默认为"待发货"
   if (status === null || status === undefined || status === '') {
   const total = Number(row?.quantity || 0);
   const shipped = Number(row?.partSendAmount || 0);
   if (shipped <= 0) {
      return '待发货';
   }
   // 状态是字符串
   const statusStr = String(status).trim();
   const statusTextMap = {
      '待发货': '待发货',
      '待审核': '待审核',
      '审核中': '审核中',
      '审核拒绝': '审核拒绝',
      '审核通过': '审核通过',
      '已发货': '已发货'
   };
   return statusTextMap[statusStr] || '待发货';
   if (shipped < total) {
      return '发货中';
   }
   if (shipped >= total && total > 0) {
      return '已发货';
   }
   return '待发货';
};
/**
@@ -2012,30 +2173,24 @@
 * @param row 行数据
 */
const getShippingStatusType = (row) => {
   // 如果已发货(有发货日期或车牌号),显示绿色
   if (row.shippingDate || row.shippingCarNumber) {
      return 'success';
   }
   // 获取发货状态字段
   const status = row.shippingStatus;
   // 如果状态为空或未定义,默认为灰色(待发货)
   if (status === null || status === undefined || status === '') {
   const total = Number(row?.quantity || 0);
   const shipped = Number(row?.partSendAmount || 0);
   if (shipped <= 0) {
      return 'info';
   }
   // 状态是字符串
   const statusStr = String(status).trim();
   const typeTextMap = {
      '待发货': 'info',
      '待审核': 'info',
      '审核中': 'warning',
      '审核拒绝': 'danger',
      '审核通过': 'success',
      '已发货': 'success'
   };
   return typeTextMap[statusStr] || 'info';
   if (shipped < total) {
      return 'warning';
   }
   if (shipped >= total && total > 0) {
      return 'success';
   }
   return 'info';
};
const getRemainAmount = (row) => {
   const total = Number(row?.quantity || 0);
   const shipped = Number(row?.partSendAmount || 0);
   return Math.max(0, total - shipped);
};
/**
@@ -2048,18 +2203,13 @@
   if (row.approveStatus !== 1) {
      return false;
   }
   // 获取发货状态
   const shippingStatus = row.shippingStatus;
   // 如果已发货(有发货日期或车牌号),不能再次发货
   if (row.shippingDate || row.shippingCarNumber) {
   if (getRemainAmount(row) <= 0) {
      return false;
   }
   // 发货状态必须是"待发货"或"审核拒绝"
   const statusStr = shippingStatus ? String(shippingStatus).trim() : '';
   return statusStr === '待发货' || statusStr === '审核拒绝';
   return true;
};
/**
@@ -2077,6 +2227,7 @@
   });
}
// 打开发货弹框
const openDeliveryForm = (row) => {
   // 检查是否可以发货
@@ -2084,10 +2235,15 @@
      proxy.$modal.msgWarning("只有在产品状态是充足,发货状态是待发货或审核拒绝的时候才可以发货");
      return;
   }
   currentDeliveryRow.value = row;
  const total = Number(row.quantity || 0);
  const shipped = Number(row.partSendAmount || 0);
  const remain = Math.max(0, total - shipped);
  deliveryForm.value = {
    type: "货车",
    type: "快递",
    remainAmount: remain,
    deliveryMode: "全部",
    partSendAmount: remain,
  };
  // 重置审批人节点(默认一个空节点)
  approverNodes.value = [{ id: 1, userId: null }];
@@ -2106,6 +2262,24 @@
        return;
      }
      const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
      const remain = Number(deliveryForm.value.remainAmount) || 0;
      if (remain <= 0) {
        proxy.$modal.msgWarning("待发货数量为0,无法发货");
        return;
      }
      const isAllSend = deliveryForm.value.deliveryMode === "全部" ? 1 : 0;
      let quantityToSend = remain;
      if (isAllSend === 0) {
        quantityToSend = Number(deliveryForm.value.partSendAmount) || 0;
        if (quantityToSend <= 0) {
          proxy.$modal.msgWarning("请输入发货数量");
          return;
        }
        if (quantityToSend > remain) {
          proxy.$modal.msgWarning(`发货数量不能超过待发货数量(${remain})`);
          return;
        }
      }
      // 保存当前展开的行ID,以便发货后重新加载子表格数据
      const currentExpandedKeys = [...expandedRowKeys.value];
      const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
@@ -2113,6 +2287,8 @@
        salesLedgerId: salesLedgerId,
        salesLedgerProductId: currentDeliveryRow.value.id,
        type: deliveryForm.value.type,
        isAllSend,
        partSendAmount: quantityToSend,
            approveUserIds,
      })
        .then(() => {