src/views/salesManagement/deliveryLedger/index.vue
@@ -29,6 +29,8 @@
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column label="销售订单" prop="salesContractNo" show-overflow-tooltip />
        <el-table-column label="发货订单号" prop="shippingNo" show-overflow-tooltip />
        <el-table-column label="产品名称" prop="productCategory" show-overflow-tooltip />
        <el-table-column label="图纸编号" prop="specificationModel" show-overflow-tooltip />
        <el-table-column label="客户名称" prop="customerName" show-overflow-tooltip />
        <el-table-column label="发货进度" align="center" width="150">
          <template #default="scope">
@@ -39,7 +41,7 @@
            />
          </template>
        </el-table-column>
        <el-table-column label="审核状态" prop="status" align="center" width="120">
        <el-table-column label="状态" prop="status" align="center" width="120">
          <template #default="scope">
            <el-tag :type="getApprovalStatusType(scope.row.status)">
              {{ getApprovalStatusText(scope.row.status) }}
@@ -52,7 +54,7 @@
              link 
              type="primary"  
              size="small" 
              :disabled="(scope.row.waitShippingTotal || 0) <= 0"
              :disabled="(scope.row.waitShippingTotal || 0) <= 0 || isRevoked(scope.row.status)"
              @click="openForm('edit', scope.row)">分批发货</el-button>
            <el-button
              link
@@ -106,6 +108,14 @@
                  <span class="label">发货订单号</span>
                  <span class="value">{{ currentShippingOrder.shippingNo || '--' }}</span>
                </div>
                <div class="info-item">
                  <span class="label">产品名称</span>
                  <span class="value">{{ currentShippingOrder.productCategory || '--' }}</span>
                </div>
                <div class="info-item">
                  <span class="label">图纸编号</span>
                  <span class="value">{{ currentShippingOrder.specificationModel || '--' }}</span>
                </div>
                <el-divider />
                <div class="quantity-summary">
                  <div class="summary-item">
@@ -115,6 +125,10 @@
                  <div class="summary-item">
                    <div class="summary-label">已发货数量</div>
                    <div class="summary-value shipped">{{ currentShippingOrder.shippingSuccessTotal || 0 }}</div>
                  </div>
                  <div class="summary-item">
                    <div class="summary-label">已退货数量</div>
                    <div class="summary-value returned">{{ currentShippingOrder.returnTotal || 0 }}</div>
                  </div>
                  <div class="summary-item">
                    <div class="summary-label">待发货数量</div>
@@ -169,6 +183,10 @@
                        <span class="info-label">发货数量</span>
                        <span class="info-value quantity">{{ record.shippingNum }}</span>
                      </div>
                      <div class="info-row">
                        <span class="info-label">退货数量</span>
                        <span class="info-value returned">{{ record.returnTotal || 0 }}</span>
                      </div>
                      <div class="info-row" v-if="record.type === '货车'">
                        <span class="info-label">车牌号</span>
                        <span class="info-value">{{ record.shippingCarNumber || '--' }}</span>
@@ -194,6 +212,18 @@
                            preview-teleported
                          />
                        </div>
                      </div>
                                 <div class="info-row">
                                    <span class="info-label">库位</span>
                                    <span class="info-value">{{ record.stockLocation || '--' }}</span>
                                 </div>
                      <div class="record-actions" v-if="canRevokeShipping(record)">
                        <el-button
                          type="danger"
                          size="small"
                          @click="handleRevokeShipping(record)">
                          撤销发货
                        </el-button>
                      </div>
                    </div>
                  </div>
@@ -244,11 +274,18 @@
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="库位" prop="stockLocation">
                     <el-input v-model="shippingForm.stockLocation" placeholder="请输入库位" clearable/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="发货日期" prop="shippingDate">
              <el-date-picker
                v-model="shippingForm.shippingDate"
                value-format="YYYY-MM-DD HH:mm:ss"
                type="datetime"
              <el-date-picker
                v-model="shippingForm.shippingDate"
                value-format="YYYY-MM-DD HH:mm:ss"
                type="datetime"
                placeholder="请选择"
                style="width: 100%"
              />
@@ -327,6 +364,7 @@
   addShippingInfoDetail,
   updateShippingInfoDetail,
   delShippingInfoDetail,
   getShippingInfoById,
} from "@/api/salesManagement/deliveryLedger.js";
import { delLedgerFile } from "@/api/salesManagement/salesLedger.js";
 
@@ -356,9 +394,11 @@
  shippingCarNumber: "",
  expressCompany: "",
  expressNumber: "",
   stockLocation: "",
});
const shippingRules = {
  shippingNum: [{ required: true, message: "请输入发货数量", trigger: "blur" }],
   stockLocation: [{ required: true, message: "请输入库位", trigger: "blur" }],
  type: [{ required: true, message: "请选择发货类型", trigger: "change" }],
  shippingDate: [{ required: true, message: "请选择发货日期", trigger: "change" }],
  shippingCarNumber: [
@@ -442,6 +482,11 @@
    return;
  }
  
  if (type === 'edit' && isRevoked(row.status)) {
    proxy.$modal.msgWarning("已撤销状态不能分批发货");
    return;
  }
  dialogMode.value = type === 'edit' ? 'edit' : 'view';
  currentShippingOrder.value = row;
  showAddForm.value = false;
@@ -452,6 +497,7 @@
    shippingCarNumber: "",
    expressCompany: "",
    expressNumber: "",
      stockLocation: "",
  };
  shippingFileList.value = [];
  
@@ -487,6 +533,7 @@
    shippingCarNumber: "",
    expressCompany: "",
    expressNumber: "",
      stockLocation: "",
  };
  shippingFileList.value = [];
};
@@ -501,6 +548,7 @@
    shippingCarNumber: "",
    expressCompany: "",
    expressNumber: "",
      stockLocation: "",
  };
  shippingFileList.value = [];
};
@@ -519,6 +567,30 @@
  return waitShipping > 0;
};
// 是否可以撤销发货
const canRevokeShipping = (record) => {
  const shippingNum = record.shippingNum || 0;
  const returnNum = record.returnNum || 0;
  return shippingNum > 0 && returnNum > 0 && shippingNum === returnNum;
};
// 撤销发货
const handleRevokeShipping = (record) => {
  ElMessageBox.confirm("此操作将撤销该发货记录,是否确认?", "撤销发货", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      updateShippingInfoDetail({ ...record, status: 3 }).then((res) => {
        proxy.$modal.msgSuccess("撤销成功");
        loadShippingRecords(currentShippingOrder.value.id);
        getList();
      });
    })
    .catch(() => {});
};
// 提交发货
const submitShipping = () => {
  proxy.$refs["shippingFormRef"].validate((valid) => {
@@ -529,10 +601,13 @@
      }
      const payload = {
        shippingInfoId: currentShippingOrder.value.id,
        salesLedgerId: currentShippingOrder.value.salesLedgerId,
        salesLedgerProductId: currentShippingOrder.value.salesLedgerProductId,
        shippingTotal: currentShippingOrder.value.shippingTotal,
        shippingNum: shippingForm.value.shippingNum,
        type: shippingForm.value.type,
        shippingDate: shippingForm.value.shippingDate,
            stockLocation: shippingForm.value.stockLocation,
        shippingCarNumber: shippingForm.value.type === "货车" ? shippingForm.value.shippingCarNumber : "",
        expressCompany: shippingForm.value.type === "快递" ? shippingForm.value.expressCompany : "",
        expressNumber: shippingForm.value.type === "快递" ? shippingForm.value.expressNumber : "",
@@ -541,6 +616,11 @@
      addShippingInfoDetail(payload).then((res) => {
        proxy.$modal.msgSuccess("发货成功");
        hideAddShippingForm();
        getShippingInfoById(currentShippingOrder.value.id).then((infoRes) => {
          if (infoRes.code === 200) {
            currentShippingOrder.value = infoRes.data;
          }
        });
        loadShippingRecords(currentShippingOrder.value.id);
        getList();
      });
@@ -739,6 +819,7 @@
    '审核中': '审核中',
    '审核拒绝': '审核拒绝',
    '审核通过': '审核通过',
    '已撤销': '已撤销',
    '0': '待审核',
    '1': '审核中',
    '2': '审核拒绝',
@@ -767,6 +848,7 @@
    '审核中': 'warning',
    '审核拒绝': 'danger',
    '审核通过': 'success',
    '已撤销': 'warning',
    '0': 'info',
    '1': 'warning',
    '2': 'danger',
@@ -797,6 +879,18 @@
  }
  const statusStr = String(status).trim();
  return statusStr === '审核中' || statusStr === '1';
};
// 检查状态是否为"已撤销"
const isRevoked = (status) => {
  if (status === null || status === undefined || status === '') {
    return false;
  }
  if (typeof status === 'number') {
    return status === 3;
  }
  const statusStr = String(status).trim();
  return statusStr === '已撤销' || statusStr === '3';
};
onMounted(() => {
@@ -879,6 +973,10 @@
            
            &.shipped {
              color: #67C23A;
            }
            &.returned {
              color: #F56C6C;
            }
            
            &.waiting {
@@ -992,9 +1090,21 @@
                  color: #409EFF;
                  font-size: 16px;
                }
                &.returned {
                  font-weight: bold;
                  color: #F56C6C;
                  font-size: 16px;
                }
              }
            }
            
            .record-actions {
              margin-top: 12px;
              padding-top: 12px;
              border-top: 1px solid #EBEEF5;
            }
            .record-images {
              display: flex;
              gap: 8px;