ERP:初始化 receipt 收款单的逻辑 100%

This commit is contained in:
YunaiV 2024-02-16 08:13:25 +08:00
parent e07e19106c
commit c18b24e611
7 changed files with 1308 additions and 6 deletions

View File

@ -0,0 +1,61 @@
import request from '@/config/axios'
// ERP 收款单 VO
export interface FinanceReceiptVO {
id: number // 收款单编号
no: string // 收款单号
customerId: number // 客户编号
receiptTime: Date // 收款时间
totalPrice: number // 合计金额,单位:元
status: number // 状态
remark: string // 备注
}
// ERP 收款单 API
export const FinanceReceiptApi = {
// 查询收款单分页
getFinanceReceiptPage: async (params: any) => {
return await request.get({ url: `/erp/finance-receipt/page`, params })
},
// 查询收款单详情
getFinanceReceipt: async (id: number) => {
return await request.get({ url: `/erp/finance-receipt/get?id=` + id })
},
// 新增收款单
createFinanceReceipt: async (data: FinanceReceiptVO) => {
return await request.post({ url: `/erp/finance-receipt/create`, data })
},
// 修改收款单
updateFinanceReceipt: async (data: FinanceReceiptVO) => {
return await request.put({ url: `/erp/finance-receipt/update`, data })
},
// 更新收款单的状态
updateFinanceReceiptStatus: async (id: number, status: number) => {
return await request.put({
url: `/erp/finance-receipt/update-status`,
params: {
id,
status
}
})
},
// 删除收款单
deleteFinanceReceipt: async (ids: number[]) => {
return await request.delete({
url: `/erp/finance-receipt/delete`,
params: {
ids: ids.join(',')
}
})
},
// 导出收款单 Excel
exportFinanceReceipt: async (params: any) => {
return await request.download({ url: `/erp/finance-receipt/export-excel`, params })
}
}

View File

@ -0,0 +1,278 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1080">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
:disabled="disabled"
>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="收款单号" prop="no">
<el-input disabled v-model="formData.no" placeholder="保存时自动生成" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="收款时间" prop="receiptTime">
<el-date-picker
v-model="formData.receiptTime"
type="date"
value-format="x"
placeholder="选择收款时间"
class="!w-1/1"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="客户" prop="customerId">
<el-select
v-model="formData.customerId"
clearable
filterable
placeholder="请选择客户"
class="!w-1/1"
>
<el-option
v-for="item in customerList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="财务人员" prop="financeUserId">
<el-select
v-model="formData.financeUserId"
clearable
filterable
placeholder="请选择财务人员"
class="!w-1/1"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="formData.remark"
:rows="1"
placeholder="请输入备注"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="附件" prop="fileUrl">
<UploadFile :is-show-tip="false" v-model="formData.fileUrl" :limit="1" />
</el-form-item>
</el-col>
</el-row>
<!-- 子表的表单 -->
<ContentWrap>
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
<el-tab-pane label="采购入库、退货单" name="item">
<FinanceReceiptItemForm
ref="itemFormRef"
:customer-id="formData.customerId"
:items="formData.items"
:disabled="disabled"
/>
</el-tab-pane>
</el-tabs>
</ContentWrap>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="收款账户" prop="accountId">
<el-select
v-model="formData.accountId"
clearable
filterable
placeholder="请选择结算账户"
class="!w-1/1"
>
<el-option
v-for="item in accountList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="合计收款" prop="totalPrice">
<el-input disabled v-model="formData.totalPrice" :formatter="erpPriceInputFormatter" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="优惠金额" prop="discountPrice">
<el-input-number
v-model="formData.discountPrice"
controls-position="right"
:precision="2"
placeholder="请输入优惠金额"
class="!w-1/1"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实际收款">
<el-input
disabled
v-model="formData.receiptPrice"
:formatter="erpPriceInputFormatter"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!disabled">
</el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { FinanceReceiptApi, FinanceReceiptVO } from '@/api/erp/finance/receipt'
import FinanceReceiptItemForm from './components/FinanceReceiptItemForm.vue'
import { erpPriceInputFormatter } from '@/utils'
import * as UserApi from '@/api/system/user'
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
/** ERP 收款单表单 */
defineOptions({ name: 'FinanceReceiptForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update - detail -
const formData = ref({
id: undefined,
customerId: undefined,
accountId: undefined,
financeUserId: undefined,
receiptTime: undefined,
remark: undefined,
fileUrl: '',
totalPrice: 0,
discountPrice: 0,
receiptPrice: 0,
items: [],
no: undefined //
})
const formRules = reactive({
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
receiptTime: [{ required: true, message: '订单时间不能为空', trigger: 'blur' }]
})
const disabled = computed(() => formType.value === 'detail')
const formRef = ref() // Ref
const customerList = ref<CustomerVO[]>([]) //
const accountList = ref<AccountVO[]>([]) //
const userList = ref<UserApi.UserVO[]>([]) //
/** 子表的表单 */
const subTabsName = ref('item')
const itemFormRef = ref()
/** 计算 discountPrice、totalPrice 价格 */
watch(
() => formData.value,
(val) => {
if (!val) {
return
}
const totalPrice = val.items.reduce((prev, curr) => prev + curr.receiptPrice, 0)
formData.value.totalPrice = totalPrice
formData.value.receiptPrice = totalPrice - val.discountPrice
},
{ deep: true }
)
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await FinanceReceiptApi.getFinanceReceipt(id)
} finally {
formLoading.value = false
}
}
//
customerList.value = await CustomerApi.getCustomerSimpleList()
//
userList.value = await UserApi.getSimpleUserList()
//
accountList.value = await AccountApi.getAccountSimpleList()
const defaultAccount = accountList.value.find((item) => item.defaultStatus)
if (defaultAccount) {
formData.value.accountId = defaultAccount.id
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
await itemFormRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as FinanceReceiptVO
if (formType.value === 'create') {
await FinanceReceiptApi.createFinanceReceipt(data)
message.success(t('common.createSuccess'))
} else {
await FinanceReceiptApi.updateFinanceReceipt(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
customerId: undefined,
accountId: undefined,
financeUserId: undefined,
receiptTime: undefined,
remark: undefined,
fileUrl: undefined,
totalPrice: 0,
discountPrice: 0,
receiptPrice: 0,
items: [],
no: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,176 @@
<template>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
v-loading="formLoading"
label-width="0px"
:inline-message="true"
:disabled="disabled"
>
<el-table :data="formData" show-summary :summary-method="getSummaries" class="-mt-10px">
<el-table-column label="序号" type="index" align="center" width="60" />
<el-table-column label="销售单据编号" min-width="200">
<template #default="{ row }">
<el-form-item class="mb-0px!">
<el-input disabled v-model="row.bizNo" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="应付金额" prop="totalPrice" fixed="right" min-width="100">
<template #default="{ row }">
<el-form-item class="mb-0px!">
<el-input disabled v-model="row.totalPrice" :formatter="erpPriceInputFormatter" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="已付金额" prop="receiptedPrice" fixed="right" min-width="100">
<template #default="{ row }">
<el-form-item class="mb-0px!">
<el-input disabled v-model="row.receiptedPrice" :formatter="erpPriceInputFormatter" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="本次收款" prop="receiptPrice" fixed="right" min-width="115">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.receiptPrice`" class="mb-0px!">
<el-input-number
v-model="row.receiptPrice"
controls-position="right"
:precision="2"
class="!w-100%"
/>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="备注" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.remark`" class="mb-0px!">
<el-input v-model="row.remark" placeholder="请输入备注" />
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="60">
<template #default="{ $index }">
<el-button @click="handleDelete($index)" link></el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<el-row justify="center" class="mt-3" v-if="!disabled">
<el-button @click="handleOpenSaleOut" round>+ 添加销售出库单</el-button>
<el-button @click="handleOpenSaleReturn" round>+ 添加销售退货单</el-button>
</el-row>
<!-- 可收款的销售出库单列表 -->
<SaleOutReceiptEnableList ref="saleOutReceiptEnableListRef" @success="handleAddSaleOut" />
<!-- 可收款的销售出库单列表 -->
<SaleReturnRefundEnableList ref="saleReturnRefundEnableListRef" @success="handleAddSaleReturn" />
</template>
<script setup lang="ts">
import { ProductVO } from '@/api/erp/product/product'
import { erpPriceInputFormatter, getSumValue } from '@/utils'
import SaleOutReceiptEnableList from '@/views/erp/sale/out/components/SaleOutReceiptEnableList.vue'
import SaleReturnRefundEnableList from '@/views/erp/sale/return/components/SaleReturnRefundEnableList.vue'
import { SaleOutVO } from '@/api/erp/sale/out'
import { ErpBizType } from '@/utils/constants'
import { SaleReturnVO } from '@/api/erp/sale/return'
const props = defineProps<{
items: undefined
customerId: undefined
disabled: false
}>()
const message = useMessage()
const formLoading = ref(false) //
const formData = ref([])
const formRules = reactive({
receiptPrice: [{ required: true, message: '本次收款不能为空', trigger: 'blur' }]
})
const formRef = ref([]) // Ref
const productList = ref<ProductVO[]>([]) //
/** 初始化设置出库项 */
watch(
() => props.items,
async (val) => {
formData.value = val
},
{ immediate: true }
)
/** 合计 */
const getSummaries = (param: SummaryMethodProps) => {
const { columns, data } = param
const sums: string[] = []
columns.forEach((column, index: number) => {
if (index === 0) {
sums[index] = '合计'
return
}
if (['totalPrice', 'receiptedPrice', 'receiptPrice'].includes(column.property)) {
const sum = getSumValue(data.map((item) => Number(item[column.property])))
sums[index] = erpPriceInputFormatter(sum)
} else {
sums[index] = ''
}
})
return sums
}
/** 新增【销售出库】按钮操作 */
const saleOutReceiptEnableListRef = ref()
const handleOpenSaleOut = () => {
if (!props.customerId) {
message.error('请选择客户')
return
}
saleOutReceiptEnableListRef.value.open(props.customerId)
}
const handleAddSaleOut = (rows: SaleOutVO[]) => {
rows.forEach((row) => {
formData.value.push({
bizId: row.id,
bizType: ErpBizType.SALE_OUT,
bizNo: row.no,
totalPrice: row.totalPrice,
receiptedPrice: row.receiptPrice,
receiptPrice: row.totalPrice - row.receiptPrice
})
})
}
/** 新增【销售退货】按钮操作 */
const saleReturnRefundEnableListRef = ref()
const handleOpenSaleReturn = () => {
if (!props.customerId) {
message.error('请选择客户')
return
}
saleReturnRefundEnableListRef.value.open(props.customerId)
}
const handleAddSaleReturn = (rows: SaleReturnVO[]) => {
rows.forEach((row) => {
formData.value.push({
bizId: row.id,
bizType: ErpBizType.SALE_RETURN,
bizNo: row.no,
totalPrice: -row.totalPrice,
receiptedPrice: -row.refundPrice,
receiptPrice: -row.totalPrice + row.refundPrice
})
})
}
/** 删除按钮操作 */
const handleDelete = (index: number) => {
formData.value.splice(index, 1)
}
/** 表单校验 */
const validate = () => {
return formRef.value.validate()
}
defineExpose({ validate })
</script>

View File

@ -0,0 +1,389 @@
<template>
<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-240px"
/>
</el-form-item>
<el-form-item label="收款时间" prop="receiptTime">
<el-date-picker
v-model="queryParams.receiptTime"
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-220px"
/>
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="queryParams.supplierId"
clearable
filterable
placeholder="请选择供供应商"
class="!w-240px"
>
<el-option
v-for="item in supplierList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="创建人" prop="creator">
<el-select
v-model="queryParams.creator"
clearable
filterable
placeholder="请选择创建人"
class="!w-240px"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="财务人员" prop="financeUserId">
<el-select
v-model="queryParams.financeUserId"
clearable
filterable
placeholder="请选择财务人员"
class="!w-240px"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="收款账户" prop="accountId">
<el-select
v-model="queryParams.accountId"
clearable
filterable
placeholder="请选择收款账户"
class="!w-240px"
>
<el-option
v-for="item in accountList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.ERP_AUDIT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="queryParams.remark"
placeholder="请输入备注"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="采购单号" prop="bizNo">
<el-input
v-model="queryParams.bizNo"
placeholder="请输入采购单号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</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-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['erp:finance-receipt:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['erp:finance-receipt:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
<el-button
type="danger"
plain
@click="handleDelete(selectionList.map((item) => item.id))"
v-hasPermi="['erp:finance-receipt:delete']"
:disabled="selectionList.length === 0"
>
<Icon icon="ep:delete" class="mr-5px" /> 删除
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="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="receiptTime"
:formatter="dateFormatter2"
width="120px"
/>
<el-table-column label="创建人" align="center" prop="creatorName" />
<el-table-column label="财务人员" align="center" prop="financeUserName" />
<el-table-column label="收款账户" align="center" prop="accountName" />
<el-table-column
label="合计收款"
align="center"
prop="totalPrice"
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column
label="优惠金额"
align="center"
prop="discountPrice"
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column
label="实际收款"
align="center"
prop="receiptPrice"
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column label="状态" align="center" fixed="right" width="90" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ERP_AUDIT_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="220">
<template #default="scope">
<el-button
link
@click="openForm('detail', scope.row.id)"
v-hasPermi="['erp:finance-receipt:query']"
>
详情
</el-button>
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['erp:finance-receipt:update']"
:disabled="scope.row.status === 20"
>
编辑
</el-button>
<el-button
link
type="primary"
@click="handleUpdateStatus(scope.row.id, 20)"
v-hasPermi="['erp:finance-receipt:update-status']"
v-if="scope.row.status === 10"
>
审批
</el-button>
<el-button
link
type="danger"
@click="handleUpdateStatus(scope.row.id, 10)"
v-hasPermi="['erp:finance-receipt:update-status']"
v-else
>
反审批
</el-button>
<el-button
link
type="danger"
@click="handleDelete([scope.row.id])"
v-hasPermi="['erp:finance-receipt:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<FinanceReceiptForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download'
import { FinanceReceiptApi, FinanceReceiptVO } from '@/api/erp/finance/receipt'
import FinanceReceiptForm from './FinanceReceiptForm.vue'
import { UserVO } from '@/api/system/user'
import * as UserApi from '@/api/system/user'
import { erpPriceTableColumnFormatter } from '@/utils'
import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
/** ERP 收款单列表 */
defineOptions({ name: 'ErpPurchaseOrder' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<FinanceReceiptVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
no: undefined,
receiptTime: [],
supplierId: undefined,
creator: undefined,
financeUserId: undefined,
accountId: undefined,
status: undefined,
remark: undefined,
bizNo: undefined
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
const supplierList = ref<SupplierVO[]>([]) //
const userList = ref<UserVO[]>([]) //
const accountList = ref<AccountVO[]>([]) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await FinanceReceiptApi.getFinanceReceiptPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (ids: number[]) => {
try {
//
await message.delConfirm()
//
await FinanceReceiptApi.deleteFinanceReceipt(ids)
message.success(t('common.delSuccess'))
//
await getList()
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id))
} catch {}
}
/** 审批/反审批操作 */
const handleUpdateStatus = async (id: number, status: number) => {
try {
//
await message.confirm(`确定${status === 20 ? '审批' : '反审批'}该收款单吗?`)
//
await FinanceReceiptApi.updateFinanceReceiptStatus(id, status)
message.success(`${status === 20 ? '审批' : '反审批'}成功`)
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await FinanceReceiptApi.exportFinanceReceipt(queryParams)
download.excel(data, '收款单.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 选中操作 */
const selectionList = ref<FinanceReceiptVO[]>([])
const handleSelectionChange = (rows: FinanceReceiptVO[]) => {
selectionList.value = rows
}
/** 初始化 **/
onMounted(async () => {
await getList()
//
supplierList.value = await SupplierApi.getSupplierSimpleList()
userList.value = await UserApi.getSimpleUserList()
accountList.value = await AccountApi.getAccountSimpleList()
})
// TODO
// TODO
</script>

View File

@ -43,7 +43,7 @@
</el-form-item> </el-form-item>
<el-form-item label="退货时间" prop="orderTime"> <el-form-item label="退货时间" prop="orderTime">
<el-date-picker <el-date-picker
v-model="queryParams.inTime" v-model="queryParams.returnTime"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
type="daterange" type="daterange"
start-placeholder="开始日期" start-placeholder="开始日期"
@ -122,7 +122,7 @@ import { dateFormatter2 } from '@/utils/formatTime'
import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils' import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils'
import { ProductApi, ProductVO } from '@/api/erp/product/product' import { ProductApi, ProductVO } from '@/api/erp/product/product'
import { PurchaseReturnApi, PurchaseReturnVO } from '@/api/erp/purchase/return' import { PurchaseReturnApi, PurchaseReturnVO } from '@/api/erp/purchase/return'
import { PurchaseInVO } from '@/api/erp/purchase/in' import { SaleReturnVO } from '@/api/erp/sale/return'
defineOptions({ name: 'PurchaseInPaymentEnableList' }) defineOptions({ name: 'PurchaseInPaymentEnableList' })
@ -135,7 +135,7 @@ const queryParams = reactive({
pageSize: 10, pageSize: 10,
no: undefined, no: undefined,
productId: undefined, productId: undefined,
inTime: [], returnTime: [],
refundEnable: true, refundEnable: true,
supplierId: undefined supplierId: undefined
}) })
@ -143,8 +143,8 @@ const queryFormRef = ref() // 搜索的表单
const productList = ref<ProductVO[]>([]) // const productList = ref<ProductVO[]>([]) //
/** 选中操作 */ /** 选中操作 */
const selectionList = ref<PurchaseInVO[]>([]) const selectionList = ref<SaleReturnVO[]>([])
const handleSelectionChange = (rows: PurchaseInVO[]) => { const handleSelectionChange = (rows: SaleReturnVO[]) => {
selectionList.value = rows selectionList.value = rows
} }
@ -162,7 +162,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交选择 */ /** 提交选择 */
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'success', value: PurchaseInVO[]): void (e: 'success', value: SaleReturnVO[]): void
}>() }>()
const submitForm = () => { const submitForm = () => {
try { try {

View File

@ -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.outTime"
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="customerName" />
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
<el-table-column
label="出库时间"
align="center"
prop="outTime"
: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="receiptPrice"
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column label="未收金额" align="center">
<template #default="scope">
<span v-if="scope.row.receiptPrice === scope.row.totalPrice">0</span>
<el-tag type="danger" v-else>
{{ erpPriceInputFormatter(scope.row.totalPrice - scope.row.receiptPrice) }}
</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 { SaleOutApi, SaleOutVO } from '@/api/erp/sale/out'
defineOptions({ name: 'SaleOutReceiptEnableList' })
const list = ref<SaleOutVO[]>([]) //
const total = ref(0) //
const loading = ref(false) //
const dialogVisible = ref(false) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
no: undefined,
productId: undefined,
outTime: [],
receiptEnable: true,
customerId: undefined
})
const queryFormRef = ref() //
const productList = ref<ProductVO[]>([]) //
/** 选中操作 */
const selectionList = ref<SaleOutVO[]>([])
const handleSelectionChange = (rows: SaleOutVO[]) => {
selectionList.value = rows
}
/** 打开弹窗 */
const open = async (customerId: number) => {
dialogVisible.value = true
await nextTick() // queryFormRef
//
queryParams.customerId = customerId
await resetQuery()
//
productList.value = await ProductApi.getProductSimpleList()
}
defineExpose({ open }) // open
/** 提交选择 */
const emits = defineEmits<{
(e: 'success', value: SaleOutVO[]): void
}>()
const submitForm = () => {
try {
emits('success', selectionList.value)
} finally {
//
dialogVisible.value = false
}
}
/** 加载列表 */
const getList = async () => {
loading.value = true
try {
const data = await SaleOutApi.getSaleOutPage(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>

View File

@ -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.returnTime"
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="customerName" />
<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 { SaleReturnApi, SaleReturnVO } from '@/api/erp/sale/return'
defineOptions({ name: 'SaleReturnPaymentEnableList' })
const list = ref<SaleReturnVO[]>([]) //
const total = ref(0) //
const loading = ref(false) //
const dialogVisible = ref(false) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
no: undefined,
productId: undefined,
returnTime: [],
refundEnable: true,
customerId: undefined
})
const queryFormRef = ref() //
const productList = ref<ProductVO[]>([]) //
/** 选中操作 */
const selectionList = ref<SaleReturnVO[]>([])
const handleSelectionChange = (rows: SaleReturnVO[]) => {
selectionList.value = rows
}
/** 打开弹窗 */
const open = async (customerId: number) => {
dialogVisible.value = true
await nextTick() // queryFormRef
//
queryParams.customerId = customerId
await resetQuery()
//
productList.value = await ProductApi.getProductSimpleList()
}
defineExpose({ open }) // open
/** 提交选择 */
const emits = defineEmits<{
(e: 'success', value: SaleReturnVO[]): void
}>()
const submitForm = () => {
try {
emits('success', selectionList.value)
} finally {
//
dialogVisible.value = false
}
}
/** 加载列表 */
const getList = async () => {
loading.value = true
try {
const data = await SaleReturnApi.getSaleReturnPage(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>