✨ ERP:付款单 60%(接入)【可付款的采购入库单列表】
This commit is contained in:
parent
d7427bf49c
commit
8a70b3fbba
@ -418,3 +418,14 @@ export const TradeOrderStatusEnum = {
|
||||
name: '已取消'
|
||||
}
|
||||
}
|
||||
|
||||
// ========== ERP - 企业资源计划 ==========
|
||||
|
||||
export const ErpBizType = {
|
||||
PURCHASE_ORDER: 10,
|
||||
PURCHASE_IN: 11,
|
||||
PURCHASE_RETURN: 12,
|
||||
SALE_ORDER: 20,
|
||||
SALE_OUT: 21,
|
||||
SALE_RETURN: 22
|
||||
}
|
||||
|
@ -83,6 +83,7 @@
|
||||
<el-tab-pane label="采购入库、退货单" name="item">
|
||||
<FinancePaymentItemForm
|
||||
ref="itemFormRef"
|
||||
:supplier-id="formData.supplierId"
|
||||
:items="formData.items"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
@ -196,11 +197,9 @@ watch(
|
||||
if (!val) {
|
||||
return
|
||||
}
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
formData.value.discountPrice = discountPrice
|
||||
formData.value.totalPrice = totalPrice - discountPrice
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.paymentPrice, 0)
|
||||
formData.value.totalPrice = totalPrice
|
||||
formData.value.paymentPrice = totalPrice - val.discountPrice
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
@ -59,24 +59,29 @@
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3" v-if="!disabled">
|
||||
<el-button @click="handleAdd" round>+ 添加采购入库单</el-button>
|
||||
<el-button @click="handleOpenPurchaseIn" round>+ 添加采购入库单</el-button>
|
||||
<el-button @click="handleAdd" round>+ 添加采购退货单</el-button>
|
||||
</el-row>
|
||||
|
||||
<PurchaseInPaymentEnableList
|
||||
ref="purchaseInPaymentEnableListRef"
|
||||
@success="handleAddPurchaseIn"
|
||||
/>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
||||
import { StockApi } from '@/api/erp/stock/stock'
|
||||
import {
|
||||
erpCountInputFormatter,
|
||||
erpPriceInputFormatter,
|
||||
erpPriceMultiply,
|
||||
getSumValue
|
||||
} from '@/utils'
|
||||
import { ProductVO } from '@/api/erp/product/product'
|
||||
import { erpPriceInputFormatter, getSumValue } from '@/utils'
|
||||
import PurchaseInPaymentEnableList from '@/views/erp/purchase/in/components/PurchaseInPaymentEnableList.vue'
|
||||
import { PurchaseInVO } from '@/api/erp/purchase/in'
|
||||
import { ErpBizType } from '@/utils/constants'
|
||||
|
||||
const props = defineProps<{
|
||||
items: undefined
|
||||
supplierId: undefined
|
||||
disabled: false
|
||||
}>()
|
||||
const message = useMessage()
|
||||
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
const formRules = reactive({
|
||||
@ -114,17 +119,26 @@ const getSummaries = (param: SummaryMethodProps) => {
|
||||
return sums
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
const row = {
|
||||
id: undefined,
|
||||
totalPrice: undefined,
|
||||
paidPrice: undefined,
|
||||
paymentPrice: undefined,
|
||||
totalPrice: undefined,
|
||||
remark: undefined
|
||||
/** 新增【采购入库】按钮操作 */
|
||||
const purchaseInPaymentEnableListRef = ref()
|
||||
const handleOpenPurchaseIn = () => {
|
||||
if (!props.supplierId) {
|
||||
message.error('请选择供应商')
|
||||
return
|
||||
}
|
||||
formData.value.push(row)
|
||||
purchaseInPaymentEnableListRef.value.open(props.supplierId)
|
||||
}
|
||||
const handleAddPurchaseIn = (rows: PurchaseInVO[]) => {
|
||||
rows.forEach((row) => {
|
||||
formData.value.push({
|
||||
bizId: row.id,
|
||||
bizType: ErpBizType.PURCHASE_IN,
|
||||
bizNo: row.no,
|
||||
totalPrice: row.totalPrice,
|
||||
paidPrice: row.paymentPrice,
|
||||
paymentPrice: row.totalPrice - row.paymentPrice
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
|
@ -0,0 +1,199 @@
|
||||
<!-- 可付款的采购入库单列表 -->
|
||||
<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="inTime"
|
||||
: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="paymentPrice"
|
||||
:formatter="erpPriceTableColumnFormatter"
|
||||
/>
|
||||
<el-table-column label="未付金额" align="center">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.paymentPrice === scope.row.totalPrice">0</span>
|
||||
<el-tag type="danger" v-else>
|
||||
{{ erpPriceInputFormatter(scope.row.totalPrice - scope.row.paymentPrice) }}
|
||||
</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 { PurchaseInApi, PurchaseInVO } from '@/api/erp/purchase/in'
|
||||
|
||||
defineOptions({ name: 'PurchaseInPaymentEnableList' })
|
||||
|
||||
const list = ref<PurchaseInVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
no: undefined,
|
||||
productId: undefined,
|
||||
inTime: [],
|
||||
paymentEnable: 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 PurchaseInApi.getPurchaseInPage(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>
|
@ -73,7 +73,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="supplierName" />
|
||||
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
|
||||
<el-table-column
|
||||
label="订单时间"
|
||||
|
Loading…
Reference in New Issue
Block a user