ERP:初始化销售退货逻辑 100%

This commit is contained in:
YunaiV 2024-02-12 06:52:24 +08:00
parent 3860aaef6f
commit eae2ea0a82
4 changed files with 230 additions and 17 deletions

View File

@ -0,0 +1,212 @@
<!-- 可退货的订单列表 -->
<template>
<Dialog
title="选择销售订单(仅展示可退货)"
v-model="dialogVisible"
:appendToBody="true"
:scroll="true"
width="1080"
>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="订单单号" prop="no">
<el-input
v-model="queryParams.no"
placeholder="请输入订单单号"
clearable
@keyup.enter="handleQuery"
class="!w-160px"
/>
</el-form-item>
<el-form-item label="产品" prop="productId">
<el-select
v-model="queryParams.productId"
clearable
filterable
placeholder="请选择产品"
class="!w-160px"
>
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="订单时间" prop="orderTime">
<el-date-picker
v-model="queryParams.orderTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-160px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<ContentWrap>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" width="65">
<template #default="scope">
<el-radio
:label="scope.row.id"
v-model="currentRowValue"
@change="handleCurrentChange(scope.row)"
>
&nbsp;
</el-radio>
</template>
</el-table-column>
<el-table-column min-width="180" label="订单单号" align="center" prop="no" />
<el-table-column label="客户" align="center" prop="customerName" />
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
<el-table-column
label="订单时间"
align="center"
prop="orderTime"
:formatter="dateFormatter2"
width="120px"
/>
<el-table-column label="创建人" align="center" prop="creatorName" />
<el-table-column
label="总数量"
align="center"
prop="totalCount"
:formatter="erpCountTableColumnFormatter"
/>
<el-table-column
label="出库数量"
align="center"
prop="outCount"
:formatter="erpCountTableColumnFormatter"
/>
<el-table-column
label="退货数量"
align="center"
prop="returnCount"
:formatter="erpCountTableColumnFormatter"
/>
<el-table-column
label="金额合计"
align="center"
prop="totalProductPrice"
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column
label="含税金额"
align="center"
prop="totalPrice"
:formatter="erpPriceTableColumnFormatter"
/>
</el-table>
<!-- 分页 -->
<Pagination
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
<template #footer>
<el-button :disabled="!currentRow" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import { ElTable } from 'element-plus'
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
import { dateFormatter2 } from '@/utils/formatTime'
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
import { ProductApi, ProductVO } from '@/api/erp/product/product'
defineOptions({ name: 'SaleOrderReturnEnableList' })
const list = ref<SaleOrderVO[]>([]) //
const total = ref(0) //
const loading = ref(false) //
const dialogVisible = ref(false) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
no: undefined,
productId: undefined,
orderTime: [],
returnEnable: true
})
const queryFormRef = ref() //
const productList = ref<ProductVO[]>([]) //
/** 选中行 */
const currentRowValue = ref(undefined) // value
const currentRow = ref(undefined) //
const handleCurrentChange = (row) => {
currentRow.value = row
}
/** 打开弹窗 */
const open = async () => {
dialogVisible.value = true
await nextTick() // queryFormRef
// 退
await resetQuery()
//
productList.value = await ProductApi.getProductSimpleList()
}
defineExpose({ open }) // open
/** 提交选择 */
const emits = defineEmits<{
(e: 'success', value: SaleOrderVO): void
}>()
const submitForm = () => {
try {
emits('success', currentRow.value)
} finally {
//
dialogVisible.value = false
}
}
/** 加载列表 */
const getList = async () => {
loading.value = true
try {
const data = await SaleOrderApi.getSaleOrderPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
currentRowValue.value = undefined
currentRow.value = undefined
getList()
}
</script>

View File

@ -42,6 +42,7 @@
v-model="formData.customerId"
clearable
filterable
disabled
placeholder="请选择客户"
class="!w-1/1"
>

View File

@ -15,7 +15,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="退货时间" prop="outTime">
<el-form-item label="退货时间" prop="returnTime">
<el-date-picker
v-model="formData.returnTime"
type="date"
@ -42,6 +42,7 @@
v-model="formData.customerId"
clearable
filterable
disabled
placeholder="请选择客户"
class="!w-1/1"
>
@ -176,7 +177,7 @@
</Dialog>
<!-- 可退货的订单列表 -->
<!-- <SaleOrderReturnEnableList ref="saleOrderReturnEnableListRef" @success="handleSaleOrderChange" />-->
<SaleOrderReturnEnableList ref="saleOrderReturnEnableListRef" @success="handleSaleOrderChange" />
</template>
<script setup lang="ts">
import { SaleReturnApi, SaleReturnVO } from '@/api/erp/sale/return'
@ -184,7 +185,7 @@ import SaleReturnItemForm from './components/SaleReturnItemForm.vue'
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
// import SaleOrderReturnEnableList from '@/views/erp/sale/order/components/SaleOrderReturnEnableList.vue'
import SaleOrderReturnEnableList from '@/views/erp/sale/order/components/SaleOrderReturnEnableList.vue'
import { SaleOrderVO } from '@/api/erp/sale/order'
import * as UserApi from '@/api/system/user'
@ -299,8 +300,7 @@ const handleSaleOrderChange = (order: SaleOrderVO) => {
formData.value.fileUrl = order.fileUrl
// 退
order.items.forEach((item) => {
item.totalCount = item.count
item.count = item.totalCount - item.returnCount
item.count = item.outCount - item.returnCount
item.orderItemId = item.id
item.id = undefined
})

View File

@ -62,18 +62,6 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="原数量"
fixed="right"
min-width="80"
v-if="formData[0]?.totalCount != null"
>
<template #default="{ row }">
<el-form-item class="mb-0px!">
<el-input disabled v-model="row.totalCount" :formatter="erpCountInputFormatter" />
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="已出库"
fixed="right"
@ -86,6 +74,18 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="已退货"
fixed="right"
min-width="80"
v-if="formData[0]?.returnCount != null"
>
<template #default="{ row }">
<el-form-item class="mb-0px!">
<el-input disabled v-model="row.returnCount" :formatter="erpCountInputFormatter" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="数量" prop="count" fixed="right" min-width="140">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.count`" :rules="formRules.count" class="mb-0px!">