src/views/salesManagement/deliveryLedger/index.vue
@@ -39,7 +39,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 +52,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
@@ -117,6 +117,10 @@
                    <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.returnedQuantity || 0 }}</div>
                  </div>
                  <div class="summary-item">
                    <div class="summary-label">待发货数量</div>
                    <div class="summary-value waiting">{{ currentShippingOrder.waitShippingTotal || 0 }}</div>
                  </div>
@@ -169,6 +173,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.returnNum || 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 +202,14 @@
                            preview-teleported
                          />
                        </div>
                      </div>
                      <div class="record-actions" v-if="canRevokeShipping(record)">
                        <el-button
                          type="danger"
                          size="small"
                          @click="handleRevokeShipping(record)">
                          撤销发货
                        </el-button>
                      </div>
                    </div>
                  </div>
@@ -442,6 +458,11 @@
    return;
  }
  
  if (type === 'edit' && isRevoked(row.status)) {
    proxy.$modal.msgWarning("已撤销状态不能分批发货");
    return;
  }
  dialogMode.value = type === 'edit' ? 'edit' : 'view';
  currentShippingOrder.value = row;
  showAddForm.value = false;
@@ -517,6 +538,30 @@
  if (!currentShippingOrder.value) return false;
  const waitShipping = currentShippingOrder.value.waitShippingTotal || 0;
  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(() => {});
};
// 提交发货
@@ -741,6 +786,7 @@
    '审核中': '审核中',
    '审核拒绝': '审核拒绝',
    '审核通过': '审核通过',
    '已撤销': '已撤销',
    '0': '待审核',
    '1': '审核中',
    '2': '审核拒绝',
@@ -769,6 +815,7 @@
    '审核中': 'warning',
    '审核拒绝': 'danger',
    '审核通过': 'success',
    '已撤销': 'warning',
    '0': 'info',
    '1': 'warning',
    '2': 'danger',
@@ -799,6 +846,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(() => {
@@ -881,6 +940,10 @@
            
            &.shipped {
              color: #67C23A;
            }
            &.returned {
              color: #F56C6C;
            }
            
            &.waiting {
@@ -994,9 +1057,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;