yuan
4 天以前 4abdd48526e098acbb351addfaf5c86022e4009a
fix: 优化发货状态和类型的判断逻辑
已修改1个文件
57 ■■■■■ 文件已修改
src/views/salesManagement/salesLedger/index.vue 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue
@@ -2568,30 +2568,30 @@
   * @param row 行数据
   */
  const getShippingStatusText = row => {
    // 如果已发货(有发货日期或车牌号),显示"已发货"
    if (row.shippingDate || row.shippingCarNumber) {
      return "已发货";
    }
    // 获取发货状态字段
    // 以接口返回的 shippingStatus 为准(后端按「磅单净重合计 vs 订单数量」算出
    // 未发货 / 部分发货 / 已发货),不要再直接用「有没有发货日期」覆盖它,
    // 否则部分发货会被误显示成已发货。
    const status = row.shippingStatus;
    // 如果状态为空或未定义,默认为"待发货"
    if (status === null || status === undefined || status === "") {
      return "待发货";
    }
    // 状态是字符串
    const statusStr = String(status).trim();
    const statusStr = status === null || status === undefined ? "" : String(status).trim();
    const statusTextMap = {
      未发货: "待发货",
      待发货: "待发货",
      部分发货: "部分发货",
      待审核: "待审核",
      审核中: "审核中",
      审核拒绝: "审核拒绝",
      审核通过: "审核通过",
      已发货: "已发货",
    };
    return statusTextMap[statusStr] || "待发货";
    if (statusTextMap[statusStr]) {
      return statusTextMap[statusStr];
    }
    // 后端没给出状态时,退回按「有没有发货信息」判断
    if (row.shippingDate || row.shippingCarNumber) {
      return "已发货";
    }
    return "待发货";
  };
  /**
@@ -2599,30 +2599,27 @@
   * @param row 行数据
   */
  const getShippingStatusType = row => {
    // 如果已发货(有发货日期或车牌号),显示绿色
    if (row.shippingDate || row.shippingCarNumber) {
      return "success";
    }
    // 获取发货状态字段
    // 与 getShippingStatusText 保持同一口径,以 shippingStatus 为准
    const status = row.shippingStatus;
    // 如果状态为空或未定义,默认为灰色(待发货)
    if (status === null || status === undefined || status === "") {
      return "info";
    }
    // 状态是字符串
    const statusStr = String(status).trim();
    const statusStr = status === null || status === undefined ? "" : String(status).trim();
    const typeTextMap = {
      未发货: "info",
      待发货: "info",
      部分发货: "warning",
      待审核: "info",
      审核中: "warning",
      审核拒绝: "danger",
      审核通过: "success",
      已发货: "success",
    };
    return typeTextMap[statusStr] || "info";
    if (typeTextMap[statusStr]) {
      return typeTextMap[statusStr];
    }
    if (row.shippingDate || row.shippingCarNumber) {
      return "success";
    }
    return "info";
  };
  /**