From b6a007d417bf5eea80ec807d3f1201e220e5f651 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 13 五月 2026 10:24:33 +0800
Subject: [PATCH] 销售和采购退货
---
src/views/salesManagement/returnOrder/components/formDia.vue | 22 +
src/views/salesManagement/returnOrder/components/detailDia.vue | 12
src/api/procurementManagement/purchase_return_order.js | 9
src/views/procurementManagement/purchaseReturnOrder/New.vue | 81 ++++--
src/views/procurementManagement/purchaseReturnOrder/index.vue | 478 +++++++++++++++++++++++++--------------
src/views/procurementManagement/purchaseReturnOrder/ProductList.vue | 84 ++++--
src/views/salesManagement/returnOrder/index.vue | 24 +-
7 files changed, 446 insertions(+), 264 deletions(-)
diff --git a/src/api/procurementManagement/purchase_return_order.js b/src/api/procurementManagement/purchase_return_order.js
index aeb380d..2705dde 100644
--- a/src/api/procurementManagement/purchase_return_order.js
+++ b/src/api/procurementManagement/purchase_return_order.js
@@ -19,6 +19,15 @@
});
}
+// 鏍规嵁閲囪喘鍙拌处 ID 鏌ヨ鍙��浜у搧绛変俊鎭�
+export function getPurchaseReturnOrderByPurchaseLedgerId(query) {
+ return request({
+ url: "/purchaseReturnOrders/getByPurchaseLedgerId",
+ method: "get",
+ params: query,
+ });
+}
+
// 鏌ョ湅璇︽儏
// purchaseReturnOrders/selectById/xxx
export function getPurchaseReturnOrderDetail(id) {
diff --git a/src/views/procurementManagement/purchaseReturnOrder/New.vue b/src/views/procurementManagement/purchaseReturnOrder/New.vue
index dffdeea..09e09d5 100644
--- a/src/views/procurementManagement/purchaseReturnOrder/New.vue
+++ b/src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -227,10 +227,11 @@
<span class="title-text">浜у搧鍒楄〃</span>
</div>
<el-button type="primary" size="small" style="margin-bottom: 20px" @click="isShowProductsModal = true" :disabled="!formState.purchaseLedgerId">娣诲姞浜у搧</el-button>
- <el-table :data="formState.purchaseReturnOrderProductsDtos"
+ <div class="product-table-scroll">
+ <el-table class="product-table-inner"
+ :data="formState.purchaseReturnOrderProductsDtos"
border
max-height="400"
- :scroll-y="true"
show-summary
:summary-method="summarizeChildrenTable">
<el-table-column align="center"
@@ -240,6 +241,12 @@
label="搴忓彿"
type="index"
width="60" />
+ <el-table-column label="鍏ュ簱鍗曞彿"
+ prop="inboundBatches"
+ width="150" />
+ <el-table-column label="鎵规鍙�"
+ prop="batchNo"
+ width="150" />
<el-table-column label="浜у搧澶х被"
prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿"
@@ -248,10 +255,13 @@
prop="unit"
width="70" />
<el-table-column label="鏁伴噺"
- prop="quantity"
+ prop="stockInNum"
width="100" />
<el-table-column label="鍙��璐ф暟閲�"
- prop="availableQuality"
+ prop="unQuantity"
+ width="130" />
+ <el-table-column label="宸查��璐ф暟閲�"
+ prop="totalReturnNum"
width="130" />
<el-table-column label="閫�璐ф暟閲�"
prop="returnQuantity"
@@ -268,27 +278,27 @@
placeholder="璇疯緭鍏ラ��璐ф暟閲�" />
</template>
</el-table-column>
- <el-table-column label="搴撳瓨棰勮鏁伴噺"
+ <!-- <el-table-column label="搴撳瓨棰勮鏁伴噺"
prop="warnNum"
width="120"
show-overflow-tooltip />
<el-table-column label="绋庣巼(%)"
prop="taxRate"
- width="80" />
+ width="80" /> -->
<el-table-column label="鍚◣鍗曚环(鍏�)"
prop="taxInclusiveUnitPrice"
:formatter="formattedNumber"
- width="150" />
+ width="120" />
<el-table-column label="閫�璐ф�讳环(鍏�)"
prop="taxInclusiveTotalPrice"
- width="180">
+ width="120">
<template #default="scope">
{{ formatAmount(getReturnTotal(scope.row)) || '--' }}
</template>
</el-table-column>
<el-table-column label="鏄惁璐ㄦ"
prop="isChecked"
- width="150">
+ width="100">
<template #default="scope">
<el-tag :type="scope.row.isChecked ? 'success' : 'info'">
{{ scope.row.isChecked ? '鏄�' : '鍚�' }}
@@ -311,6 +321,7 @@
</template>
</el-table-column>
</el-table>
+ </div>
</div>
<div class="section-title">
@@ -408,9 +419,6 @@
import {getOptions, purchaseList} from "@/api/procurementManagement/procurementLedger.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
const ProductList = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/ProductList.vue"));
- import {
- productList,
- } from "@/api/procurementManagement/procurementLedger.js";
const props = defineProps({
visible: {
type: Boolean,
@@ -553,7 +561,7 @@
}
const getReturnQtyMax = (row) => {
- const max = Number(row?.availableQuality)
+ const max = Number(row?.unQuantity)
if (Number.isNaN(max) || max < 0) {
return 0
}
@@ -568,17 +576,17 @@
return proxy.summarizeTable(
param,
[
- "quantity",
- "availableQuality",
+ "stockInNum",
+ "unQuantity",
"returnQuantity",
"taxInclusiveUnitPrice",
"taxInclusiveTotalPrice",
"taxExclusiveTotalPrice",
],
{
- quantity: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ stockInNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
returnQuantity: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- availableQuality: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ unQuantity: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
}
);
};
@@ -660,20 +668,10 @@
}
}
-// 澶勭悊鏀瑰彉閲囪喘鍙拌处鏁版嵁
-const handleChangePurchaseLedgerId = async () => {
+// 澶勭悊鏀瑰彉閲囪喘鍙拌处鏁版嵁锛堜笉璇锋眰鎺ュ彛鍥炴樉浜у搧锛屼骇鍝佷粎鍦ㄣ�屾坊鍔犱骇鍝併�嶅脊绐楀嬀閫夊悗鍐欏叆锛�
+const handleChangePurchaseLedgerId = () => {
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,
- returnQuantity: undefined,
- taxInclusiveTotalPrice: 0,
- salesLedgerProductId: item.id,
- }))
+ formState.value.purchaseReturnOrderProductsDtos = []
syncTotalAmount()
}
@@ -691,7 +689,7 @@
...item,
returnQuantity: undefined,
taxInclusiveTotalPrice: 0,
- salesLedgerProductId: item.id,
+ salesLedgerProductId: item.salesLedgerProductId ?? item.id,
}));
formState.value.purchaseReturnOrderProductsDtos.push(...newProducts);
syncTotalAmount()
@@ -717,7 +715,7 @@
// 閫愯鏍¢獙閫�璐ф暟閲忥細浠绘剰涓�琛屾湭濉�/闈炴硶/瓒呴檺閮戒笉鍏佽鎻愪氦
const invalidRowIndex = productList.findIndex((item) => {
const qty = Number(item.returnQuantity)
- const maxQty = Number(item.availableQuality)
+ const maxQty = Number(item.unQuantity)
if (item.returnQuantity === null || item.returnQuantity === undefined || item.returnQuantity === "") {
return true
@@ -738,7 +736,15 @@
proxy.$refs["formRef"].validate(valid => {
if (valid) {
- createPurchaseReturnOrder(formState.value).then(res => {
+ console.log(productList)
+ const submitPayload = {
+ ...formState.value,
+ purchaseReturnOrderProductsDtos: productList.map((row) => ({
+ ...row,
+ stockInRecordId: row.id,
+ })),
+ }
+ createPurchaseReturnOrder(submitPayload).then(res => {
// 鍏抽棴妯℃�佹
isShow.value = false;
// 鍛婄煡鐖剁粍浠跺凡瀹屾垚
@@ -785,4 +791,13 @@
border-radius: 50%;
margin-right: 8px;
}
+
+.product-table-scroll {
+ width: 100%;
+ overflow-x: auto;
+}
+
+.product-table-inner {
+ min-width: 1280px;
+}
</style>
\ No newline at end of file
diff --git a/src/views/procurementManagement/purchaseReturnOrder/ProductList.vue b/src/views/procurementManagement/purchaseReturnOrder/ProductList.vue
index 3eeb167..24d64c6 100644
--- a/src/views/procurementManagement/purchaseReturnOrder/ProductList.vue
+++ b/src/views/procurementManagement/purchaseReturnOrder/ProductList.vue
@@ -6,9 +6,10 @@
width="1200"
@close="closeModal"
>
- <div class="table_list">
+ <div class="table_list" v-loading="tableLoading">
<el-table :data="tableData"
border
+ row-key="id"
@selection-change="handleChangeSelection">
<el-table-column align="center"
type="selection"
@@ -17,6 +18,12 @@
label="搴忓彿"
type="index"
width="60" />
+ <el-table-column label="鍏ュ簱鍗曞彿"
+ prop="inboundBatches"
+ width="150" />
+ <el-table-column label="鎵规鍙�"
+ prop="batchNo"
+ width="150" />
<el-table-column label="浜у搧澶х被"
prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿"
@@ -25,27 +32,33 @@
prop="unit"
width="70" />
<el-table-column label="鏁伴噺"
- prop="quantity"
+ prop="stockInNum"
width="70" />
- <el-table-column label="搴撳瓨棰勮鏁伴噺"
+ <el-table-column label="鍙��璐ф暟閲�"
+ prop="unQuantity"
+ width="130" />
+ <el-table-column label="宸查��璐ф暟閲�"
+ prop="totalReturnNum"
+ width="130" />
+ <!-- <el-table-column label="搴撳瓨棰勮鏁伴噺"
prop="warnNum"
width="120"
show-overflow-tooltip />
<el-table-column label="绋庣巼(%)"
prop="taxRate"
- width="80" />
+ width="80" /> -->
<el-table-column label="鍚◣鍗曚环(鍏�)"
prop="taxInclusiveUnitPrice"
:formatter="formattedNumber"
width="150" />
- <el-table-column label="鍚◣鎬讳环(鍏�)"
+ <!-- <el-table-column label="鍚◣鎬讳环(鍏�)"
prop="taxInclusiveTotalPrice"
:formatter="formattedNumber"
width="150" />
<el-table-column label="涓嶅惈绋庢�讳环(鍏�)"
prop="taxExclusiveTotalPrice"
:formatter="formattedNumber"
- width="150" />
+ width="150" /> -->
<el-table-column label="鏄惁璐ㄦ"
prop="isChecked"
width="150">
@@ -56,8 +69,6 @@
</template>
</el-table-column>
</el-table>
- <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
- :page="page.current" :limit="page.size" @pagination="paginationChange" />
</div>
<template #footer>
@@ -71,8 +82,8 @@
</template>
<script setup>
-import {computed, reactive, ref, onMounted} from "vue";
-import {productList} from "@/api/procurementManagement/procurementLedger.js";
+import {computed, ref, onMounted} from "vue";
+import {getPurchaseReturnOrderByPurchaseLedgerId} from "@/api/procurementManagement/purchase_return_order.js";
import {ElMessage} from "element-plus";
const props = defineProps({
@@ -82,7 +93,7 @@
},
purchaseLedgerId: {
- type: Number,
+ type: [Number, String],
required: true,
}
});
@@ -101,32 +112,51 @@
const tableData = ref([])
const selectedRows = ref([])
const tableLoading = ref(false)
-const page = reactive({
- current: 1,
- size: 100,
-})
-const total = ref(0)
const formattedNumber = (row, column, cellValue) => {
return parseFloat(cellValue).toFixed(2);
};
-
-const paginationChange = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList()
-}
const handleChangeSelection = (val) => {
selectedRows.value = val;
}
+/** 涓� New.vue 涓噰璐彴璐﹀彉鏇存椂瑙f瀽 getByPurchaseLedgerId 鐨勮鍒欎竴鑷� */
+const parseProductRowsFromLedgerResponse = (res) => {
+ const payload = res?.data
+ let list = []
+ if (Array.isArray(payload)) {
+ list = payload
+ } else if (payload && typeof payload === 'object') {
+ const nested =
+ payload.purchaseReturnOrderProductsDtos ||
+ payload.purchaseReturnOrderProductsDetailVoList
+ list = Array.isArray(nested) ? nested : []
+ if (list.length && list[0]?.salesLedgerProduct) {
+ list = list.map((item) => ({ ...item, ...item.salesLedgerProduct }))
+ }
+ }
+ return list
+}
+
const fetchData = () => {
- tableLoading.value = true;
- productList({salesLedgerId: props.purchaseLedgerId, type: 2}).then((res) => {
- tableData.value = res.data;
- }).finally(() => {
- tableLoading.value = false;
+ if (props.purchaseLedgerId === undefined || props.purchaseLedgerId === null || props.purchaseLedgerId === '') {
+ tableData.value = []
+ return
+ }
+ tableLoading.value = true
+ getPurchaseReturnOrderByPurchaseLedgerId({
+ purchaseLedgerId: props.purchaseLedgerId,
})
+ .then((res) => {
+ const list = parseProductRowsFromLedgerResponse(res)
+ tableData.value = list
+ })
+ .catch(() => {
+ tableData.value = []
+ })
+ .finally(() => {
+ tableLoading.value = false
+ })
}
const handleSubmit = () => {
diff --git a/src/views/procurementManagement/purchaseReturnOrder/index.vue b/src/views/procurementManagement/purchaseReturnOrder/index.vue
index 942b4dc..3986f03 100644
--- a/src/views/procurementManagement/purchaseReturnOrder/index.vue
+++ b/src/views/procurementManagement/purchaseReturnOrder/index.vue
@@ -1,24 +1,26 @@
<template>
<div class="app-container">
<div class="search_form">
- <el-form :model="searchForm"
- :inline="true">
+ <el-form :model="searchForm" :inline="true">
<el-form-item label="閫�鏂欏崟鍙凤細">
- <el-input v-model="searchForm.no"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- @change="handleQuery" />
+ <el-input
+ v-model="searchForm.no"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ @change="handleQuery"
+ />
</el-form-item>
<el-form-item>
- <el-button type="primary"
- @click="handleQuery"> 鎼滅储 </el-button>
+ <el-button type="primary" @click="handleQuery"> 鎼滅储 </el-button>
</el-form-item>
</el-form>
<div>
- <el-button type="primary" @click="isShowNewModal = true">鏂板</el-button>
+ <el-button type="primary" @click="isShowNewModal = true"
+ >鏂板</el-button
+ >
</div>
</div>
@@ -35,14 +37,25 @@
@pagination="paginationChange"
>
<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>
+ <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>
- <new v-if="isShowNewModal"
- v-model:visible="isShowNewModal"
- @completed="handleQuery" />
+ <new
+ v-if="isShowNewModal"
+ v-model:visible="isShowNewModal"
+ @completed="handleQuery"
+ />
<el-dialog
v-model="detailVisible"
@@ -52,21 +65,51 @@
>
<div v-loading="detailLoading">
<el-descriptions :column="3" border>
- <el-descriptions-item label="閫�鏂欏崟鍙�">{{ detailData.no || '--' }}</el-descriptions-item>
- <el-descriptions-item label="閫�璐ф柟寮�">{{ getReturnTypeLabel(detailData.returnType) }}</el-descriptions-item>
- <el-descriptions-item label="渚涘簲鍟嗗悕绉�">{{ detailData.supplierName || '--' }}</el-descriptions-item>
- <el-descriptions-item label="椤圭洰闃舵">{{ getProjectPhaseLabel(detailData.projectPhase) }}</el-descriptions-item>
- <el-descriptions-item label="鍏宠仈鍗曞彿">{{ detailData.purchaseContractNumber || '--' }}</el-descriptions-item>
- <el-descriptions-item label="鍒朵綔鏃ユ湡">{{ detailData.preparedAt || '--' }}</el-descriptions-item>
- <el-descriptions-item label="鍒跺崟浜�">{{ detailData.preparedUserName || '--' }}</el-descriptions-item>
- <el-descriptions-item label="閫�鏂欎汉">{{ detailData.returnUserName || '--' }}</el-descriptions-item>
- <el-descriptions-item label="鏁村崟鎶樻墸棰�">{{ formatAmount(detailData.totalDiscountAmount) }}</el-descriptions-item>
- <el-descriptions-item label="鏁村崟鎶樻墸鐜�">{{ detailData.totalDiscountRate ?? '--' }}</el-descriptions-item>
- <el-descriptions-item label="鎴愪氦閲戦">{{ formatAmount(detailData.totalAmount) }}</el-descriptions-item>
- <el-descriptions-item label="鍒涘缓浜�">{{ detailData.createUserName || '--' }}</el-descriptions-item>
- <el-descriptions-item label="鍒涘缓鏃堕棿">{{ detailData.createTime || '--' }}</el-descriptions-item>
- <el-descriptions-item label="鏈�杩戞洿鏂版椂闂�">{{ detailData.updateTime || '--' }}</el-descriptions-item>
- <el-descriptions-item label="澶囨敞" :span="3">{{ detailData.remark || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="閫�鏂欏崟鍙�">{{
+ detailData.no || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="閫�璐ф柟寮�">{{
+ getReturnTypeLabel(detailData.returnType)
+ }}</el-descriptions-item>
+ <el-descriptions-item label="渚涘簲鍟嗗悕绉�">{{
+ detailData.supplierName || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰闃舵">{{
+ getProjectPhaseLabel(detailData.projectPhase)
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鍏宠仈鐨勯噰璐鍗曞彿">{{
+ detailData.purchaseContractNumber || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鍒朵綔鏃ユ湡">{{
+ detailData.preparedAt || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鍒跺崟浜�">{{
+ detailData.preparedUserName || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="閫�鏂欎汉">{{
+ detailData.returnUserName || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鏁村崟鎶樻墸棰�">{{
+ formatAmount(detailData.totalDiscountAmount)
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鏁村崟鎶樻墸鐜�">{{
+ detailData.totalDiscountRate ?? "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鎴愪氦閲戦">{{
+ formatAmount(detailData.totalAmount)
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鍒涘缓浜�">{{
+ detailData.createUserName || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鍒涘缓鏃堕棿">{{
+ detailData.createTime || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鏈�杩戞洿鏂版椂闂�">{{
+ detailData.updateTime || "--"
+ }}</el-descriptions-item>
+ <el-descriptions-item label="澶囨敞" :span="3">{{
+ detailData.remark || "--"
+ }}</el-descriptions-item>
</el-descriptions>
<el-divider content-position="left">浜у搧鍒楄〃</el-divider>
@@ -77,27 +120,72 @@
max-height="420"
style="width: 100%"
>
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="浜у搧澶х被" prop="productCategory" min-width="120" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" min-width="140" show-overflow-tooltip />
+ <el-table-column
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
+ />
+ <el-table-column label="鍏ュ簱鍗曞彿" prop="inboundBatches" width="150" />
+ <el-table-column label="鎵规鍙�" prop="batchNo" width="150" />
+ <el-table-column
+ label="浜у搧澶х被"
+ prop="productCategory"
+ min-width="120"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ min-width="140"
+ show-overflow-tooltip
+ />
<el-table-column label="鍗曚綅" prop="unit" width="80" />
- <el-table-column label="鏁伴噺" prop="quantity" width="80" />
- <el-table-column label="閫�璐ф暟閲�" prop="returnQuantity" width="100" />
- <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="120" />
- <el-table-column label="绋庣巼(%)" prop="taxRate" width="90" />
- <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" width="130">
- <template #default="scope">{{ formatAmount(scope.row.taxInclusiveUnitPrice) }}</template>
+ <el-table-column label="鏁伴噺" prop="stockInNum" width="80" />
+ <el-table-column label="鍙��璐ф暟閲�"
+ prop="unQuantity"
+ width="100" />
+ <el-table-column label="宸查��璐ф暟閲�"
+ prop="totalReturnNum"
+ width="100" />
+ <!-- <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="120" /> -->
+ <!-- <el-table-column label="绋庣巼(%)" prop="taxRate" width="90" /> -->
+ <el-table-column
+ label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ width="130"
+ >
+ <template #default="scope">{{
+ formatAmount(scope.row.taxInclusiveUnitPrice)
+ }}</template>
</el-table-column>
- <el-table-column label="閫�璐ф�讳环(鍏�)" prop="taxInclusiveTotalPrice" width="130">
- <template #default="scope">{{ formatAmount(scope.row.taxInclusiveTotalPrice) }}</template>
+ <!-- <el-table-column
+ label="閫�璐ф�讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ width="130"
+ >
+ <template #default="scope">{{
+ formatAmount(scope.row.taxInclusiveTotalPrice)
+ }}</template>
</el-table-column>
- <el-table-column label="涓嶉��璐ф�讳环(鍏�)" prop="taxExclusiveTotalPrice" width="140">
- <template #default="scope">{{ formatAmount(scope.row.taxExclusiveTotalPrice) }}</template>
- </el-table-column>
- <el-table-column label="鏄惁璐ㄦ" prop="isChecked" width="100" align="center">
+ <el-table-column
+ label="涓嶉��璐ф�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ width="140"
+ >
+ <template #default="scope">{{
+ formatAmount(scope.row.taxExclusiveTotalPrice)
+ }}</template>
+ </el-table-column> -->
+ <el-table-column
+ label="鏄惁璐ㄦ"
+ prop="isChecked"
+ width="100"
+ align="center"
+ >
<template #default="scope">
<el-tag :type="scope.row.isChecked ? 'success' : 'info'">
- {{ scope.row.isChecked ? '鏄�' : '鍚�' }}
+ {{ scope.row.isChecked ? "鏄�" : "鍚�" }}
</el-tag>
</template>
</el-table-column>
@@ -111,238 +199,272 @@
</template>
<script setup>
-import PIMTable from '@/components/PIMTable/PIMTable.vue'
-import { ref, reactive, toRefs, onMounted, defineAsyncComponent, getCurrentInstance } from 'vue'
-const { proxy } = getCurrentInstance()
-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([])
-const tableLoading = ref(false)
+import PIMTable from "@/components/PIMTable/PIMTable.vue";
+import {
+ ref,
+ reactive,
+ toRefs,
+ onMounted,
+ defineAsyncComponent,
+ getCurrentInstance,
+} from "vue";
+const { proxy } = getCurrentInstance();
+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([]);
+const tableLoading = ref(false);
const page = reactive({
current: 1,
size: 100,
total: 0,
-})
-const detailVisible = ref(false)
-const detailLoading = ref(false)
-const detailData = ref({})
-const detailProducts = ref([])
+});
+const detailVisible = ref(false);
+const detailLoading = ref(false);
+const detailData = ref({});
+const detailProducts = ref([]);
// 鏄惁鏄剧ず鏂板寮规
-const isShowNewModal = ref(false)
+const isShowNewModal = ref(false);
const returnTypeOptions = [
- { label: '閫�璐ч��娆�', value: 0 },
- { label: '鎷掓敹', value: 1 },
-]
+ { label: "閫�璐ч��娆�", value: 0 },
+ { label: "鎷掓敹", value: 1 },
+];
const projectPhaseOptions = [
- { label: '绔嬮」', value: 0 },
- { label: '璁捐', value: 1 },
- { label: '閲囪喘', value: 2 },
- { label: '鐢熶骇', value: 3 },
- { label: '鍑鸿揣', value: 4 },
-]
+ { label: "绔嬮」", value: 0 },
+ { label: "璁捐", value: 1 },
+ { label: "閲囪喘", value: 2 },
+ { label: "鐢熶骇", value: 3 },
+ { label: "鍑鸿揣", value: 4 },
+];
const tableColumn = ref([
{
- label: '閫�鏂欏崟鍙�',
- prop: 'no',
+ label: "閫�鏂欏崟鍙�",
+ prop: "no",
},
{
- label: '閫�璐ф柟寮�',
- prop: 'returnType',
- formatData: (val) => returnTypeOptions.find(item => item.value === val)?.label || '--',
+ label: "閫�璐ф柟寮�",
+ prop: "returnType",
+ formatData: (val) =>
+ returnTypeOptions.find((item) => item.value === val)?.label || "--",
},
{
- label: '渚涘簲鍟嗗悕绉�',
- prop: 'supplierName',
+ label: "渚涘簲鍟嗗悕绉�",
+ prop: "supplierName",
width: 180,
},
{
- label: '椤圭洰闃舵',
- prop: 'projectPhase',
+ label: "椤圭洰闃舵",
+ prop: "projectPhase",
width: 100,
- formatData: (val) => projectPhaseOptions.find(item => String(item.value) === String(val))?.label || '--',
+ formatData: (val) =>
+ projectPhaseOptions.find((item) => String(item.value) === String(val))
+ ?.label || "--",
},
{
- label: '鍏宠仈鍗曞彿',
- prop: 'purchaseContractNumber',
+ label: "鍏宠仈鐨勯噰璐鍗曞彿",
+ prop: "purchaseContractNumber",
width: 160,
},
{
- label: '鍒朵綔鏃ユ湡',
- prop: 'preparedAt',
+ label: "鍒朵綔鏃ユ湡",
+ prop: "preparedAt",
width: 130,
},
{
- label: '鍒跺崟浜�',
- prop: 'preparedUserName',
+ label: "鍒跺崟浜�",
+ prop: "preparedUserName",
width: 110,
},
{
- label: '閫�鏂欎汉',
- prop: 'returnUserName',
+ label: "閫�鏂欎汉",
+ prop: "returnUserName",
width: 110,
},
{
- label: '鏁村崟鎶樻墸棰�',
- prop: 'totalDiscountAmount',
+ label: "鏁村崟鎶樻墸棰�",
+ prop: "totalDiscountAmount",
width: 120,
},
{
- label: '鏁村崟鎶樻墸鐜�',
- prop: 'totalDiscountRate',
+ label: "鏁村崟鎶樻墸鐜�",
+ prop: "totalDiscountRate",
width: 120,
},
{
- label: '鎴愪氦閲戦',
- prop: 'totalAmount',
+ label: "鎴愪氦閲戦",
+ prop: "totalAmount",
width: 120,
},
{
- label: '鍒涘缓浜�',
- prop: 'createUserName',
+ label: "鍒涘缓浜�",
+ prop: "createUserName",
width: 110,
},
{
- label: '鍒涘缓鏃堕棿',
- prop: 'createTime',
+ label: "鍒涘缓鏃堕棿",
+ prop: "createTime",
width: 170,
},
{
- label: '鏈�杩戞洿鏂版椂闂�',
- prop: 'updateTime',
+ label: "鏈�杩戞洿鏂版椂闂�",
+ prop: "updateTime",
width: 170,
},
{
- label: '澶囨敞',
- prop: 'remark',
+ label: "澶囨敞",
+ prop: "remark",
width: 180,
},
{
dataType: "action",
width: 120,
- label: "鎿嶄綔",
- align: "center",
- fixed: "right",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
operation: [
{
- name: "璇︽儏",
- type: "text",
- clickFun: row => {handleDetail(row);},
- },
+ name: "璇︽儏",
+ type: "text",
+ clickFun: (row) => {
+ handleDetail(row);
+ },
+ },
{
name: "鍒犻櫎",
- clickFun: row => {handleDelete(row)},
+ clickFun: (row) => {
+ handleDelete(row);
+ },
},
- ],
+ ],
},
-
-])
+]);
const data = reactive({
searchForm: {
- no: '',
- }
-})
-const { searchForm } = toRefs(data)
+ no: "",
+ },
+});
+const { searchForm } = toRefs(data);
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
- page.current = 1
- getList()
-}
+ page.current = 1;
+ 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?.('鍒犻櫎澶辫触')
+ 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?.('宸插彇娑堝垹闄�')
-
- })
-}
+ .catch(() => {
+ // 鍙栨秷鍒犻櫎
+ proxy?.$modal?.msgInfo?.("宸插彇娑堝垹闄�");
+ });
+};
// 鏌ョ湅璇︽儏
const handleDetail = (row) => {
if (!row?.id) {
- proxy?.$modal?.msgWarning?.('鏈幏鍙栧埌鍗曟嵁ID')
- return
+ proxy?.$modal?.msgWarning?.("鏈幏鍙栧埌鍗曟嵁ID");
+ return;
}
- detailVisible.value = true
- detailLoading.value = true
- getPurchaseReturnOrderDetail(row.id).then(res => {
- const payload = res?.data || {}
- detailData.value = payload
- // 鎷兼帴杩炰釜瀵硅薄鎴愪竴涓璞★紝鏂逛究灞曠ず item 鍜� item.salesLedgerProduct 閲岀殑瀛楁
+ detailVisible.value = true;
+ detailLoading.value = true;
+ getPurchaseReturnOrderDetail(row.id)
+ .then((res) => {
+ const payload = res?.data || {};
+ detailData.value = payload;
+ // 鎷兼帴杩炰釜瀵硅薄鎴愪竴涓璞★紝鏂逛究灞曠ず item 鍜� item.salesLedgerProduct 閲岀殑瀛楁
-
- detailProducts.value =
- payload.purchaseReturnOrderProductsDetailVoList.map(item => ({ ...item, ...item.salesLedgerProduct })) ||
- []
- }).catch(() => {
- proxy?.$modal?.msgError?.('鑾峰彇璇︽儏澶辫触')
- }).finally(() => {
- detailLoading.value = false
- })
-}
-
+ detailProducts.value =
+ payload.purchaseReturnOrderProductsDetailVoList.map((item) => ({
+ ...item,
+ ...item.salesLedgerProduct,
+ })) || [];
+ })
+ .catch(() => {
+ proxy?.$modal?.msgError?.("鑾峰彇璇︽儏澶辫触");
+ })
+ .finally(() => {
+ detailLoading.value = false;
+ });
+};
const paginationChange = (obj) => {
page.current = obj.page;
page.size = obj.limit;
- getList()
-}
+ getList();
+};
const getList = () => {
- tableLoading.value = true
- findPurchaseReturnOrderListPage({ ...searchForm.value, ...page }).then(res => {
- tableLoading.value = false
- tableData.value = res.data.records
- page.total = res.data.total
- }).catch(() => {
- tableLoading.value = false
- })
-}
+ tableLoading.value = true;
+ findPurchaseReturnOrderListPage({ ...searchForm.value, ...page })
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+};
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
// 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.id);
-}
+ selectedRows.value = selection.filter((item) => item.id);
+};
const getReturnTypeLabel = (value) => {
- return returnTypeOptions.find(item => String(item.value) === String(value))?.label || '--'
-}
+ return (
+ returnTypeOptions.find((item) => String(item.value) === String(value))
+ ?.label || "--"
+ );
+};
const getProjectPhaseLabel = (value) => {
- return projectPhaseOptions.find(item => String(item.value) === String(value))?.label || '--'
-}
+ return (
+ projectPhaseOptions.find((item) => String(item.value) === String(value))
+ ?.label || "--"
+ );
+};
const formatAmount = (value) => {
- if (value === null || value === undefined || value === '') {
- return '--'
+ if (value === null || value === undefined || value === "") {
+ return "--";
}
- const num = Number(value)
+ const num = Number(value);
if (Number.isNaN(num)) {
- return value
+ return value;
}
- return num.toFixed(2)
-}
+ return num.toFixed(2);
+};
onMounted(() => {
- getList()
-})
+ getList();
+});
</script>
<style scoped>
.table_list {
- margin-top: unset;
+ margin-top: unset;
}
</style>
diff --git a/src/views/salesManagement/returnOrder/components/detailDia.vue b/src/views/salesManagement/returnOrder/components/detailDia.vue
index 9ff4e89..4a40181 100644
--- a/src/views/salesManagement/returnOrder/components/detailDia.vue
+++ b/src/views/salesManagement/returnOrder/components/detailDia.vue
@@ -10,8 +10,8 @@
<el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detail.customerName }}</el-descriptions-item>
<el-descriptions-item label="閿�鍞崟鍙�">{{ detail.salesContractNo }}</el-descriptions-item>
<el-descriptions-item label="涓氬姟鍛�">{{ detail.salesman }}</el-descriptions-item>
- <el-descriptions-item label="鍏宠仈鍑哄簱鍗曞彿">{{ detail.shippingNo }}</el-descriptions-item>
- <el-descriptions-item label="椤圭洰鍚嶇О">{{ detail.projectName }}</el-descriptions-item>
+ <el-descriptions-item label="鍏宠仈鍙戣揣鍗曞彿">{{ detail.shippingNo }}</el-descriptions-item>
+ <!-- <el-descriptions-item label="椤圭洰鍚嶇О">{{ detail.projectName }}</el-descriptions-item> -->
<el-descriptions-item label="鍒跺崟浜�">{{ detail.maker }}</el-descriptions-item>
<el-descriptions-item label="鍒跺崟鏃堕棿">{{ detail.makeTime }}</el-descriptions-item>
<el-descriptions-item label="閫�璐у師鍥�">{{ detail.returnReason }}</el-descriptions-item>
@@ -42,10 +42,12 @@
const availableProducts = ref([]);
const tableColumn = [
- {align: "center", label: "浜у搧澶х被", prop: "productCategory"},
- {align: "center", label: "瑙勬牸鍨嬪彿", prop: "specificationModel"},
+ {align: "center", label: "鍑哄簱鍗曞彿", prop: "outboundBatches"},
+ {align: "center", label: "鎵规鍙�", prop: "batchNo"},
+ {align: "center", label: "浜у搧澶х被", prop: "productName"},
+ {align: "center", label: "瑙勬牸鍨嬪彿", prop: "model"},
{align: "center", label: "鍗曚綅", prop: "unit", width: 80},
- {align: "center", label: "鎬绘暟閲�", prop: "quantity", width: 120},
+ {align: "center", label: "鎬绘暟閲�", prop: "stockOutNum", width: 120},
{align: "center", label: "宸查��璐ф暟閲�", prop: "totalReturnNum", width: 120},
{align: "center", label: "鏈��璐ф暟閲�", prop: "unQuantity", width: 120},
{align: "center", label: "閫�璐ф暟閲�", prop: "returnQuantity", width: 120},
diff --git a/src/views/salesManagement/returnOrder/components/formDia.vue b/src/views/salesManagement/returnOrder/components/formDia.vue
index 95d403a..742b79d 100644
--- a/src/views/salesManagement/returnOrder/components/formDia.vue
+++ b/src/views/salesManagement/returnOrder/components/formDia.vue
@@ -145,10 +145,12 @@
row-key="id"
>
<el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" prop="outboundBatches" label="鍑哄簱鍗曞彿" />
+ <el-table-column align="center" prop="batchNo" label="鎵规鍙�" />
<el-table-column align="center" prop="productCategory" label="浜у搧澶х被" />
<el-table-column align="center" prop="specificationModel" label="瑙勬牸鍨嬪彿" />
<el-table-column align="center" prop="unit" label="鍗曚綅" />
- <el-table-column align="center" prop="quantity" label="鎬绘暟閲�" />
+ <el-table-column align="center" prop="stockOutNum" label="鎬绘暟閲�" />
<el-table-column align="center" prop="unQuantity" label="鏈��璐ф暟閲�" />
<el-table-column align="center" label="宸查��璐ф暟閲�">
<template #default="{ row }">{{ calcAlreadyReturned(row) }}</template>
@@ -208,17 +210,19 @@
const { form, rules } = toRefs(data);
const calcAlreadyReturned = (row) => {
- const total = Number(row?.quantity ?? row?.totalQuantity ?? row?.totalReturnNum ?? 0);
+ const total = Number(row?.stockOutNum ?? row?.totalQuantity ?? row?.totalReturnNum ?? 0);
const un = Number(row?.unQuantity ?? 0);
if (!Number.isFinite(total) || !Number.isFinite(un)) return 0;
return Math.max(total - un, 0);
};
const tableColumn = ref([
+ {align: "center", label: "鍑哄簱鍗曞彿", prop: "outboundBatches" },
+ {align: "center", label: "鎵规鍙�", prop: "batchNo" },
{align: "center", label: "浜у搧澶х被", prop: "productCategory" },
{align: "center", label: "瑙勬牸鍨嬪彿", prop: "specificationModel" },
{align: "center", label: "鍗曚綅", prop: "unit", width: 80 },
- {align: "center", label: "鎬绘暟閲�", prop: "quantity", width: 120 },
+ {align: "center", label: "鎬绘暟閲�", prop: "stockOutNum", width: 120 },
{align: "center", label: "宸查��璐ф暟閲�", prop: "totalReturnNum", width: 120 },
{align: "center", label: "鏈��璐ф暟閲�", prop: "unQuantity", width: 120 },
{align: "center", label: "閫�璐ф暟閲�", prop: "returnQuantity", dataType: "slot", slot: "returnQuantity", width: 120 },
@@ -320,7 +324,7 @@
proxy.$refs["formRef"].validate(valid => {
if (!valid) return;
const returnSaleProducts = (tableData.value || []).map(el => ({
- returnSaleLedgerProductId: el.returnSaleLedgerProductId ?? el.id,
+ stockOutRecordId: el.returnSaleLedgerProductId ?? el.id,
productModelId: el.productModelId,
unit: el.unit,
num: Number(el.num ?? el.returnQuantity ?? 0),
@@ -419,8 +423,8 @@
// If backend returns project info, set it
if (res.data.projectId) form.value.projectId = res.data.projectId;
- // Store available products for selection
- availableProducts.value = res.data.productDtoData || [];
+ availableProducts.value =
+ res.data.shippingProductVoList || [];
if (clearTable) tableData.value = [];
}
};
@@ -457,9 +461,9 @@
};
const calculateRowAmount = (row) => {
- const quantity = Number(row.returnQuantity || 0);
+ const stockOutNum = Number(row.returnQuantity || 0);
const price = Number(row.price || 0);
- row.amount = (quantity * price).toFixed(2);
+ row.amount = (stockOutNum * price).toFixed(2);
};
const calculateTotalRefund = () => {
@@ -514,7 +518,7 @@
productName: product.productName,
specificationModel: product.specificationModel,
unit: product.unit,
- quantity: product.quantity,
+ stockOutNum: product.stockOutNum,
totalReturnNum: product.totalReturnNum,
unQuantity: product.unQuantity
});
diff --git a/src/views/salesManagement/returnOrder/index.vue b/src/views/salesManagement/returnOrder/index.vue
index d41d4bf..0a8257b 100644
--- a/src/views/salesManagement/returnOrder/index.vue
+++ b/src/views/salesManagement/returnOrder/index.vue
@@ -11,8 +11,8 @@
<el-form-item label="閿�鍞崟鍙�">
<el-input v-model="searchForm.salesContractNo" placeholder="閿�鍞崟鍙�" clearable />
</el-form-item>
- <el-form-item label="鍏宠仈鍑哄簱鍗曞彿">
- <el-input v-model="searchForm.shippingNo" placeholder="鍏宠仈鍑哄簱鍗曞彿" clearable />
+ <el-form-item label="鍏宠仈鍙戣揣鍗曞彿">
+ <el-input v-model="searchForm.shippingNo" placeholder="鍏宠仈鍙戣揣鍗曞彿" clearable />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">鎼滅储</el-button>
@@ -112,22 +112,22 @@
]);
const defaultColumns = [
- { label: "閫�璐у崟鍙�", prop: "returnNo", width: 160 },
- { label: "鍗曟嵁鐘舵��", prop: "status", width: 90, dataType: "slot", slot: "status" },
- { label: "鍒跺崟鏃堕棿", prop: "makeTime", width: 170 },
- { label: "瀹㈡埛鍚嶇О", prop: "customerName", width: 220 },
- { label: "閿�鍞崟鍙�", prop: "salesContractNo", width: 160 },
- { label: "涓氬姟鍛�", prop: "salesman", width: 120 },
- { label: "鍏宠仈鍑哄簱鍗曞彿", prop: "shippingNo", width: 170 },
- { label: "椤圭洰鍚嶇О", prop: "projectName", width: 180 },
- { label: "鍒跺崟浜�", prop: "maker", width: 120 },
+ { label: "閫�璐у崟鍙�", prop: "returnNo", minWidth: 160 },
+ { label: "鍗曟嵁鐘舵��", prop: "status", minWidth: 90, dataType: "slot", slot: "status" },
+ { label: "鍒跺崟鏃堕棿", prop: "makeTime", minWidth: 170 },
+ { label: "瀹㈡埛鍚嶇О", prop: "customerName", minWidth: 220 },
+ { label: "閿�鍞崟鍙�", prop: "salesContractNo", minWidth: 160 },
+ { label: "涓氬姟鍛�", prop: "salesman", minWidth: 120 },
+ { label: "鍏宠仈鍙戣揣鍗曞彿", prop: "shippingNo", minWidth: 170 },
+ { label: "椤圭洰鍚嶇О", prop: "projectName", minWidth: 180 },
+ { label: "鍒跺崟浜�", prop: "maker", minWidth: 120 },
{
label: "鎿嶄綔",
prop: "operation",
dataType: "action",
align: "center",
fixed: "right",
- width: 240,
+ minWidth: 240,
operation: [
{ name: "缂栬緫", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => openForm("edit", row) },
{ name: "閫�娆惧鐞�", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => handleRowHandle(row) },
--
Gitblit v1.9.3