已修改6个文件
195 ■■■■ 文件已修改
src/api/procurementManagement/purchase_return_order.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PIMTable/PIMTable.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/feedbackRegistration/components/formDia.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/feedbackRegistration/index.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/New.vue 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/index.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/procurementManagement/purchase_return_order.js
@@ -26,4 +26,13 @@
        url: "/purchaseReturnOrders/selectById/" + id,
        method: "get",
    });
}
// 采购退货单删除
// POST purchaseReturnOrders/deleteById/xxx
export function deletePurchaseReturnOrder(id) {
    return request({
        url: "/purchaseReturnOrders/deleteById/" + id,
        method: "post",
    });
}
src/components/PIMTable/PIMTable.vue
@@ -367,11 +367,11 @@
    return format(val);
  } else return val;
};
const validTagTypes = ["primary", "success", "info", "warning", "danger"];
const formatType = (val, format) => {
  if (typeof format === "function") {
    return format(val);
  } else return "";
  const type = typeof format === "function" ? format(val) : undefined;
  return validTagTypes.includes(type) ? type : undefined;
};
const isOperationDisabled = (operation, row) => {
src/views/customerService/feedbackRegistration/components/formDia.vue
@@ -106,6 +106,11 @@
                :column="tableColumn"
                :tableData="tableData"
            >
              <template #approveStatus="{ row }">
                <el-tag :type="getApproveStatusType(row)" size="small">
                  {{ getApproveStatusText(row) }}
                </el-tag>
              </template>
              <template #shippingStatus="{ row }">
                <el-tag :type="getShippingStatusType(row)" size="small">
                  {{ getShippingStatusText(row) }}
@@ -219,9 +224,8 @@
    prop: "approveStatus",
    width: 100,
    align: "center",
    dataType: "tag",
    formatData: (v) => (v === 1 ? "充足" : "不足"),
    formatType: (v) => (v === 1 ? "success" : "danger"),
    dataType: "slot",
    slot: "approveStatus",
  },
  {
    label: "发货状态",
@@ -304,9 +308,15 @@
})
const customerNameChange = (val) => {
  form.value.salesContractNo = "";
  form.value.salesLedgerId = null;
  tableData.value = [];
  associatedSalesOrderNumberOptions.value = [];
  const opt = customerNameOptions.value.find(item => item.value === val);
  if (opt) {
    form.value.customerId = opt.id;
  } else {
    form.value.customerId = null;
  }
  getSalesLedger({
    customerName: form.value.customerName
@@ -322,6 +332,22 @@
  })
}
const getApproveStatusText = (row) => {
  if (!row) return '不足'
  if (row.approveStatus === 1 && (!row.shippingDate || !row.shippingCarNumber)) {
    return '充足'
  }
  if (row.approveStatus === 0 && (row.shippingDate || row.shippingCarNumber)) {
    return '已出库'
  }
  return '不足'
}
const getApproveStatusType = (row) => {
  const statusText = getApproveStatusText(row)
  return statusText === '不足' ? 'danger' : 'success'
}
const getShippingStatusText = (row) => {
  if (!row) return '待发货'
  if (row.shippingDate || row.shippingCarNumber) {
src/views/customerService/feedbackRegistration/index.vue
@@ -404,15 +404,19 @@
      });
};
const getStatsCountByStatus = (list, status) => {
  if (!Array.isArray(list)) return 0;
  return list.find((item) => item?.status === status)?.count || 0;
};
  // 获取统计数据并刷新顶部卡片
  const getSalesLedgerDetails = () => {
    getSalesLedgerDetail({}).then((res) => {
      if (res.code === 200) {
        statsList.value[0].count = res.data.filter((item) => item.status === 3)[0].count;
        statsList.value[1].count = res.data.filter((item) => item.status === 2)[0].count;
        statsList.value[2].count = res.data.filter((item) => item.status === 1)[0].count;
        // });
        const statsData = Array.isArray(res.data) ? res.data : [];
        statsList.value[0].count = getStatsCountByStatus(statsData, 3);
        statsList.value[1].count = getStatsCountByStatus(statsData, 2);
        statsList.value[2].count = getStatsCountByStatus(statsData, 1);
      }
    });
  }
src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -334,12 +334,17 @@
            label="整单折扣率:"
            prop="totalDiscountAmount"
        >
          <el-input-number v-model="formState.totalDiscountRate"
          <el-input v-model="formState.totalDiscountRate"
                           controls-position="right"
                           :step="0.01"
                           :precision="2"
                           style="width: 100%;"
                           placeholder="请输入整单折扣率"/>
                           @change="totalDiscount"
                           placeholder="请输入整单折扣率">
            <template #append>
                %
            </template>
          </el-input>
        </el-form-item>
        <el-form-item
@@ -412,7 +417,24 @@
  }
});
let { proxy } = getCurrentInstance()
const { payment_methods } = proxy.useDict("payment_methods");
const payment_methods  = [
    {
        "label": "现金",
        "value": "0",
    },
    {
        "label": "支票",
        "value": "1",
    },
    {
        "label": "银行转账",
        "value": "2",
    },
    {
        "label": "其他",
        "value": "3",
    },
]
const emit = defineEmits(['update:visible', 'completed']);
// 响应式数据(替代选项式的 data)
@@ -509,6 +531,26 @@
  row.taxInclusiveTotalPrice = getReturnTotal(row)
}
const getBaseAmount = () => {
  const rows = formState.value.purchaseReturnOrderProductsDtos || []
  return rows.reduce((sum, item) => {
    return sum + toNumber(item.taxInclusiveTotalPrice)
  }, 0)
}
// 同步折扣额
const totalDiscount = () => {
  const discountRate = toNumber(formState.value.totalDiscountRate)
  if (discountRate < 0 || discountRate > 100) {
    proxy.$modal.msgError("请输入0-100之间的折扣率")
    return
  }
  const baseAmount = getBaseAmount()
  // 折扣额 = 产品退货总价合计 * 折扣率
  formState.value.totalDiscountAmount = Number((baseAmount * (discountRate / 100)).toFixed(2))
  syncTotalAmount()
}
const getReturnQtyMax = (row) => {
  const max = Number(row?.availableQuality)
  if (Number.isNaN(max) || max < 0) {
@@ -541,14 +583,39 @@
};
const handleChangeTotalDiscountAmount= () => {
  const discountAmount = toNumber(formState.value.totalDiscountAmount)
  if (discountAmount < 0) {
    proxy.$modal.msgError("整单折扣额不能小于0")
    formState.value.totalDiscountAmount = 0
  }
  const baseAmount = getBaseAmount()
  const normalizedAmount = toNumber(formState.value.totalDiscountAmount)
  if (baseAmount <= 0) {
    formState.value.totalDiscountRate = 0
    syncTotalAmount()
    return
  }
  if (normalizedAmount > baseAmount) {
    proxy.$modal.msgError("整单折扣额不能大于产品退货总价合计")
    formState.value.totalDiscountAmount = Number(baseAmount.toFixed(2))
  }
  const discountRate = (toNumber(formState.value.totalDiscountAmount) / baseAmount) * 100
  formState.value.totalDiscountRate = Number(discountRate.toFixed(2))
  syncTotalAmount()
}
const resetFeeInfo = () => {
  formState.value.totalDiscountAmount = 0
  formState.value.totalDiscountRate = undefined
  formState.value.totalAmount = 0
  formState.value.incomeType = undefined
}
const syncTotalAmount = () => {
  const rows = formState.value.purchaseReturnOrderProductsDtos || []
  const baseAmount = rows.reduce((sum, item) => {
    return sum + toNumber(item.taxInclusiveTotalPrice)
  }, 0)
  const baseAmount = getBaseAmount()
  const discount = toNumber(formState.value.totalDiscountAmount)
  // 成交金额 = 产品退货总价合计 - 折扣额
  formState.value.totalAmount = Number((baseAmount - discount).toFixed(2))
@@ -594,6 +661,11 @@
// 处理改变采购台账数据
const handleChangePurchaseLedgerId = async () => {
  resetFeeInfo()
  if (!formState.value.purchaseLedgerId) {
    formState.value.purchaseReturnOrderProductsDtos = []
    return
  }
  const res = await productList({ salesLedgerId: formState.value.purchaseLedgerId, type: 2 });
  formState.value.purchaseReturnOrderProductsDtos = res.data.map(item => ({
    ...item,
src/views/procurementManagement/purchaseReturnOrder/index.vue
@@ -36,6 +36,7 @@
      >
        <template #operation="{ row }">
          <el-button link type="primary" size="small" style="color: #67C23A" @click="handleDetail(row)">详情</el-button>
          <el-button link size="small" @click="handleDelete(row)">删除</el-button>
        </template>
      </PIMTable>
    </div>
@@ -113,7 +114,7 @@
import PIMTable from '@/components/PIMTable/PIMTable.vue'
import { ref, reactive, toRefs, onMounted, defineAsyncComponent, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance()
import {findPurchaseReturnOrderListPage, getPurchaseReturnOrderDetail} from "@/api/procurementManagement/purchase_return_order.js";
import {findPurchaseReturnOrderListPage, getPurchaseReturnOrderDetail, deletePurchaseReturnOrder} from "@/api/procurementManagement/purchase_return_order.js";
const New = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/New.vue"));
const tableData = ref([])
const selectedRows = ref([])
@@ -218,13 +219,24 @@
    width: 180,
  },
  {
    fixed: 'right',
    label: '操作',
    dataType: 'slot',
    slot: 'operation',
    width: 100,
    align: 'center',
    dataType: "action",
    width: 120,
      label: "操作",
      align: "center",
      fixed: "right",
    operation: [
      {
                name: "详情",
                type: "text",
                clickFun: row => {handleDetail(row);},
            },
      {
        name: "删除",
        clickFun: row => {handleDelete(row)},
      },
  ],
  },
])
const data = reactive({
  searchForm: {
@@ -240,9 +252,27 @@
  getList()
}
// 删除操作
const handleDelete = (row) => {
  console.log('删除行数据:', row)
  proxy?.$modal?.confirm('确定要删除吗?删除将无法恢复').then(() => {
    // 这里调用删除接口,传入 row.id
    deletePurchaseReturnOrder(row.id).then(() => {
      proxy?.$modal?.msgSuccess?.("删除成功");
      getList()
    }).catch(() => {
      proxy?.$modal?.msgError?.('删除失败')
    })
  }).catch(() => {
    // 取消删除
    proxy?.$modal?.msgInfo?.('已取消删除')
  })
}
// 查看详情
const handleDetail = (row) => {
  if (!row?.id) {
    proxy?.$modal?.msgWarning('未获取到单据ID')
    proxy?.$modal?.msgWarning?.('未获取到单据ID')
    return
  }
  detailVisible.value = true
@@ -257,7 +287,7 @@
      payload.purchaseReturnOrderProductsDetailVoList.map(item => ({ ...item, ...item.salesLedgerProduct })) ||
      []
  }).catch(() => {
    proxy?.$modal?.msgError('获取详情失败')
    proxy?.$modal?.msgError?.('获取详情失败')
  }).finally(() => {
    detailLoading.value = false
  })