ERP:完成 payment 付款单的逻辑 100%

This commit is contained in:
YunaiV
2024-02-14 17:13:55 +08:00
parent 8a70b3fbba
commit e951ed1bd1
3 changed files with 234 additions and 6 deletions

View File

@@ -37,7 +37,6 @@
<el-input-number
v-model="row.paymentPrice"
controls-position="right"
:min="0"
:precision="2"
class="!w-100%"
/>
@@ -60,20 +59,28 @@
</el-form>
<el-row justify="center" class="mt-3" v-if="!disabled">
<el-button @click="handleOpenPurchaseIn" round>+ 添加采购入库单</el-button>
<el-button @click="handleAdd" round>+ 添加采购退货单</el-button>
<el-button @click="handleOpenPurchaseReturn" round>+ 添加采购退货单</el-button>
</el-row>
<!-- 可付款的采购入库单列表 -->
<PurchaseInPaymentEnableList
ref="purchaseInPaymentEnableListRef"
@success="handleAddPurchaseIn"
/>
<!-- 可付款的采购入库单列表 -->
<PurchaseReturnRefundEnableList
ref="purchaseReturnRefundEnableListRef"
@success="handleAddPurchaseReturn"
/>
</template>
<script setup lang="ts">
import { ProductVO } from '@/api/erp/product/product'
import { erpPriceInputFormatter, getSumValue } from '@/utils'
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 { ErpBizType } from '@/utils/constants'
import { PurchaseReturnVO } from '@/api/erp/purchase/return'
const props = defineProps<{
items: undefined
@@ -115,7 +122,6 @@ const getSummaries = (param: SummaryMethodProps) => {
sums[index] = ''
}
})
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) => {
formData.value.splice(index, 1)

View File

@@ -334,7 +334,7 @@ const handleDelete = async (ids: number[]) => {
// 删除的二次确认
await message.delConfirm()
// 发起删除
await FinancePaymentApi.deletePurchaseOrder(ids)
await FinancePaymentApi.deleteFinancePayment(ids)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
@@ -348,7 +348,7 @@ const handleUpdateStatus = async (id: number, status: number) => {
// 审批的二次确认
await message.confirm(`确定${status === 20 ? '审批' : '反审批'}该付款单吗?`)
// 发起审批
await FinancePaymentApi.updatePurchaseOrderStatus(id, status)
await FinancePaymentApi.updateFinancePaymentStatus(id, status)
message.success(`${status === 20 ? '审批' : '反审批'}成功`)
// 刷新列表
await getList()
@@ -362,7 +362,7 @@ const handleExport = async () => {
await message.exportConfirm()
// 发起导出
exportLoading.value = true
const data = await FinancePaymentApi.exportPurchaseOrder(queryParams)
const data = await FinancePaymentApi.exportFinancePayment(queryParams)
download.excel(data, '付款单.xls')
} catch {
} finally {