✨ ERP:完成 payment 付款单的逻辑 100%
This commit is contained in:
parent
8a70b3fbba
commit
e951ed1bd1
@ -37,7 +37,6 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="row.paymentPrice"
|
v-model="row.paymentPrice"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
:min="0"
|
|
||||||
:precision="2"
|
:precision="2"
|
||||||
class="!w-100%"
|
class="!w-100%"
|
||||||
/>
|
/>
|
||||||
@ -60,20 +59,28 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<el-row justify="center" class="mt-3" v-if="!disabled">
|
<el-row justify="center" class="mt-3" v-if="!disabled">
|
||||||
<el-button @click="handleOpenPurchaseIn" round>+ 添加采购入库单</el-button>
|
<el-button @click="handleOpenPurchaseIn" round>+ 添加采购入库单</el-button>
|
||||||
<el-button @click="handleAdd" round>+ 添加采购退货单</el-button>
|
<el-button @click="handleOpenPurchaseReturn" round>+ 添加采购退货单</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 可付款的【采购入库单】列表 -->
|
||||||
<PurchaseInPaymentEnableList
|
<PurchaseInPaymentEnableList
|
||||||
ref="purchaseInPaymentEnableListRef"
|
ref="purchaseInPaymentEnableListRef"
|
||||||
@success="handleAddPurchaseIn"
|
@success="handleAddPurchaseIn"
|
||||||
/>
|
/>
|
||||||
|
<!-- 可付款的【采购入库单】列表 -->
|
||||||
|
<PurchaseReturnRefundEnableList
|
||||||
|
ref="purchaseReturnRefundEnableListRef"
|
||||||
|
@success="handleAddPurchaseReturn"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ProductVO } from '@/api/erp/product/product'
|
import { ProductVO } from '@/api/erp/product/product'
|
||||||
import { erpPriceInputFormatter, getSumValue } from '@/utils'
|
import { erpPriceInputFormatter, getSumValue } from '@/utils'
|
||||||
import PurchaseInPaymentEnableList from '@/views/erp/purchase/in/components/PurchaseInPaymentEnableList.vue'
|
import PurchaseInPaymentEnableList from '@/views/erp/purchase/in/components/PurchaseInPaymentEnableList.vue'
|
||||||
|
import PurchaseReturnRefundEnableList from '@/views/erp/purchase/return/components/PurchaseReturnRefundEnableList.vue'
|
||||||
import { PurchaseInVO } from '@/api/erp/purchase/in'
|
import { PurchaseInVO } from '@/api/erp/purchase/in'
|
||||||
import { ErpBizType } from '@/utils/constants'
|
import { ErpBizType } from '@/utils/constants'
|
||||||
|
import { PurchaseReturnVO } from '@/api/erp/purchase/return'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
items: undefined
|
items: undefined
|
||||||
@ -115,7 +122,6 @@ const getSummaries = (param: SummaryMethodProps) => {
|
|||||||
sums[index] = ''
|
sums[index] = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return sums
|
return sums
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +147,28 @@ const handleAddPurchaseIn = (rows: PurchaseInVO[]) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 新增【采购退货】按钮操作 */
|
||||||
|
const purchaseReturnRefundEnableListRef = ref()
|
||||||
|
const handleOpenPurchaseReturn = () => {
|
||||||
|
if (!props.supplierId) {
|
||||||
|
message.error('请选择供应商')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
purchaseReturnRefundEnableListRef.value.open(props.supplierId)
|
||||||
|
}
|
||||||
|
const handleAddPurchaseReturn = (rows: PurchaseReturnVO[]) => {
|
||||||
|
rows.forEach((row) => {
|
||||||
|
formData.value.push({
|
||||||
|
bizId: row.id,
|
||||||
|
bizType: ErpBizType.PURCHASE_RETURN,
|
||||||
|
bizNo: row.no,
|
||||||
|
totalPrice: -row.totalPrice,
|
||||||
|
paidPrice: -row.refundPrice,
|
||||||
|
paymentPrice: -row.totalPrice + row.refundPrice
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = (index: number) => {
|
const handleDelete = (index: number) => {
|
||||||
formData.value.splice(index, 1)
|
formData.value.splice(index, 1)
|
||||||
|
@ -334,7 +334,7 @@ const handleDelete = async (ids: number[]) => {
|
|||||||
// 删除的二次确认
|
// 删除的二次确认
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
// 发起删除
|
// 发起删除
|
||||||
await FinancePaymentApi.deletePurchaseOrder(ids)
|
await FinancePaymentApi.deleteFinancePayment(ids)
|
||||||
message.success(t('common.delSuccess'))
|
message.success(t('common.delSuccess'))
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await getList()
|
await getList()
|
||||||
@ -348,7 +348,7 @@ const handleUpdateStatus = async (id: number, status: number) => {
|
|||||||
// 审批的二次确认
|
// 审批的二次确认
|
||||||
await message.confirm(`确定${status === 20 ? '审批' : '反审批'}该付款单吗?`)
|
await message.confirm(`确定${status === 20 ? '审批' : '反审批'}该付款单吗?`)
|
||||||
// 发起审批
|
// 发起审批
|
||||||
await FinancePaymentApi.updatePurchaseOrderStatus(id, status)
|
await FinancePaymentApi.updateFinancePaymentStatus(id, status)
|
||||||
message.success(`${status === 20 ? '审批' : '反审批'}成功`)
|
message.success(`${status === 20 ? '审批' : '反审批'}成功`)
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await getList()
|
await getList()
|
||||||
@ -362,7 +362,7 @@ const handleExport = async () => {
|
|||||||
await message.exportConfirm()
|
await message.exportConfirm()
|
||||||
// 发起导出
|
// 发起导出
|
||||||
exportLoading.value = true
|
exportLoading.value = true
|
||||||
const data = await FinancePaymentApi.exportPurchaseOrder(queryParams)
|
const data = await FinancePaymentApi.exportFinancePayment(queryParams)
|
||||||
download.excel(data, '付款单.xls')
|
download.excel(data, '付款单.xls')
|
||||||
} catch {
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -0,0 +1,200 @@
|
|||||||
|
<!-- 可退款的采购退货单列表 -->
|
||||||
|
<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.inTime"
|
||||||
|
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"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column width="30" label="选择" type="selection" />
|
||||||
|
<el-table-column min-width="180" label="退货单号" align="center" prop="no" />
|
||||||
|
<el-table-column label="供应商" align="center" prop="supplierName" />
|
||||||
|
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
|
||||||
|
<el-table-column
|
||||||
|
label="退货时间"
|
||||||
|
align="center"
|
||||||
|
prop="returnTime"
|
||||||
|
:formatter="dateFormatter2"
|
||||||
|
width="120px"
|
||||||
|
/>
|
||||||
|
<el-table-column label="创建人" align="center" prop="creatorName" />
|
||||||
|
<el-table-column
|
||||||
|
label="应退金额"
|
||||||
|
align="center"
|
||||||
|
prop="totalPrice"
|
||||||
|
:formatter="erpPriceTableColumnFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="已退金额"
|
||||||
|
align="center"
|
||||||
|
prop="refundPrice"
|
||||||
|
:formatter="erpPriceTableColumnFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column label="未退金额" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.refundPrice === scope.row.totalPrice">0</span>
|
||||||
|
<el-tag type="danger" v-else>
|
||||||
|
{{ erpPriceInputFormatter(scope.row.totalPrice - scope.row.refundPrice) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
<template #footer>
|
||||||
|
<el-button :disabled="!selectionList.length" 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 { dateFormatter2 } from '@/utils/formatTime'
|
||||||
|
import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils'
|
||||||
|
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
||||||
|
import { PurchaseReturnApi, PurchaseReturnVO } from '@/api/erp/purchase/return'
|
||||||
|
import { PurchaseInVO } from '@/api/erp/purchase/in'
|
||||||
|
|
||||||
|
defineOptions({ name: 'PurchaseInPaymentEnableList' })
|
||||||
|
|
||||||
|
const list = ref<PurchaseReturnVO[]>([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const loading = ref(false) // 列表的加载中
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
no: undefined,
|
||||||
|
productId: undefined,
|
||||||
|
inTime: [],
|
||||||
|
refundEnable: true,
|
||||||
|
supplierId: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const productList = ref<ProductVO[]>([]) // 产品列表
|
||||||
|
|
||||||
|
/** 选中操作 */
|
||||||
|
const selectionList = ref<PurchaseInVO[]>([])
|
||||||
|
const handleSelectionChange = (rows: PurchaseInVO[]) => {
|
||||||
|
selectionList.value = rows
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (supplierId: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
await nextTick() // 等待,避免 queryFormRef 为空
|
||||||
|
// 加载列表
|
||||||
|
queryParams.supplierId = supplierId
|
||||||
|
await resetQuery()
|
||||||
|
// 加载产品列表
|
||||||
|
productList.value = await ProductApi.getProductSimpleList()
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交选择 */
|
||||||
|
const emits = defineEmits<{
|
||||||
|
(e: 'success', value: PurchaseInVO[]): void
|
||||||
|
}>()
|
||||||
|
const submitForm = () => {
|
||||||
|
try {
|
||||||
|
emits('success', selectionList.value)
|
||||||
|
} finally {
|
||||||
|
// 关闭弹窗
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 加载列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await PurchaseReturnApi.getPurchaseReturnPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
selectionList.value = []
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user