Compare commits

..

2 Commits

Author SHA1 Message Date
chenhao 49cd27c221 feat(finance): 优化付款单新增功能及界面交互
- 移除预付单类型切换时的冗余处理逻辑
- 修复付款状态字典引用错误,统一使用 dict.type.payment_status
- 预付订单列表增加选择控制,限制只能选中一个订单
- 表格组件添加 ref 引用以便手动清除选中状态
- 新增预计付款时间必填校验规则
- 提交数据结构调整,明确区分应付单与预付单字段
- 增加含税总价大于0的前置校验
- 日志提示优化,增强用户操作引导信息
- 接口调用分离,针对不同付款类型调用对应后端接口
- 回执单组件默认值调整,避免空对象异常
2025-12-15 14:59:27 +08:00
chenhao a4a93ee484 feat(finance): 更新付款单表单逻辑与数据源
- 修改付款单类型选项,将 NORMAL 替换为 FROM_PAYABLE
- 调整应付单列表显示条件,适配新的付款单类型
- 更新订单列表标题及字段展示内容
- 修改默认付款单类型为 FROM_PAYABLE
- 优化订单列表接口调用方式,使用 POST 请求并设置 Content-Type
- 增加供应商编码查询条件,支持通过项目产品信息过滤订单
- 调整提交校验逻辑,确保选择应付单时进行有效性检查
2025-12-15 11:03:16 +08:00
7 changed files with 121 additions and 50 deletions

View File

@ -51,7 +51,7 @@ export function returnPayment(id) {
}
// 新增付款单
export function addPayment(data) {
export function addPaymentFromPayable(data) {
return request({
url: '/finance/payable/mergeAndInitiatePayment',
method: 'post',
@ -59,6 +59,14 @@ export function addPayment(data) {
needLoading: true
})
}
export function addPayment(data) {
return request({
url: '/finance/payment/add',
method: 'post',
data: data,
needLoading: true
})
}
// 申请付款
export function applyPaymentApi(data) {
@ -87,11 +95,14 @@ export function listPayableBills(query) {
}
// 查询采购订单列表 (用于新增付款单-预付)
export function listPurchaseOrders(query) {
export function listOrders(query) {
return request({
url: '/finance/payment/purchaseOrders',
method: 'get',
params: query
url: '/project/order/list',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: query
})
}

View File

@ -33,9 +33,9 @@
<el-row>
<el-col :span="24">
<el-form-item label="是否预付" prop="paymentBillType">
<el-radio-group v-model="form.paymentBillType" @change="handleTypeChange">
<el-radio-group v-model="form.paymentBillType">
<el-radio label="PRE_PAYMENT"></el-radio>
<el-radio label="NORMAL"></el-radio>
<el-radio label="FROM_PAYABLE"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -51,9 +51,10 @@
<!-- Tables -->
<div v-if="form.vendorCode">
<div v-if="form.paymentBillType === 'NORMAL'" class="table-container">
<div v-if="form.paymentBillType === 'FROM_PAYABLE'" class="table-container">
<h4>应付单列表</h4>
<el-table
ref="payableTable"
:data="payableList"
border
style="width: 100%"
@ -71,7 +72,7 @@
<el-table-column label="出入库单号" align="center" prop="inventoryCode" width="150"/>
<el-table-column label="付款状态" align="center" prop="paymentStatus" width="120">
<template slot-scope="scope">
<dict-tag :options="dicts.payment_status" :value="scope.row.paymentStatus"/>
<dict-tag :options="dict.type.payment_status" :value="scope.row.paymentStatus"/>
</template>
</el-table-column>
<el-table-column label="含税总价" align="center" prop="totalPriceWithTax" width="120"/>
@ -103,20 +104,27 @@
</div>
<div v-if="form.paymentBillType === 'PRE_PAYMENT'" class="table-container">
<h4>采购订单列表</h4>
<h4>订单列表</h4>
<el-table
ref="orderTable"
:data="orderList"
border
style="width: 100%"
@selection-change="handleSelectionChange"
@select="handleSelect"
@select-all="handleSelectAll"
max-height="400"
row-key="orderNo"
row-key="id"
>
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<el-table-column prop="orderNo" label="订单编号"></el-table-column>
<el-table-column prop="orderTime" label="订单日期" width="180"></el-table-column>
<el-table-column prop="orderAmount" label="订单金额"></el-table-column>
<el-table-column prop="remark" label="备注"></el-table-column>
<el-table-column prop="projectCode" label="项目编号"></el-table-column>
<el-table-column prop="projectName" label="项目名称"></el-table-column>
<el-table-column prop="createTime" label="下单时间"></el-table-column>
<el-table-column label="订单状态" prop="orderStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.order_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
</el-table>
</div>
@ -134,11 +142,11 @@
</el-form>
<div slot="footer" class="dialog-footer">
<div v-if="form.paymentBillType === 'NORMAL'" style="float: left; line-height: 36px;">
<span style="margin-right: 20px;">计划付款总金额: <el-tag type="success">{{
totalPlannedAmount.toFixed(2)
}}</el-tag></span>
</div>
<!-- <div v-if="form.paymentBillType === 'FROM_PAYABLE'" style="float: left; line-height: 36px;">-->
<!-- <span style="margin-right: 20px;">计划付款总金额: <el-tag type="success">{{-->
<!-- totalPlannedAmount.toFixed(2)-->
<!-- }}</el-tag></span>-->
<!-- </div>-->
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="handleSubmit"> </el-button>
</div>
@ -163,7 +171,7 @@
<script>
import {listAllVendor} from "@/api/base/vendor";
import {listPayableBills, listPurchaseOrders} from "@/api/finance/payment";
import {listPayableBills, listOrders} from "@/api/finance/payment";
import PaymentPlanSelector from "../../payable/components/PaymentPlan";
export default {
@ -173,12 +181,9 @@ export default {
visible: {
type: Boolean,
default: false
},
dicts: {
type: Object,
default: () => ({})
}
},
dicts:['order_status','payment_status'],
data() {
return {
internalVisible: this.visible,
@ -192,7 +197,7 @@ export default {
pageSize: 10
},
form: {
paymentBillType: 'NORMAL', // Default to Normal (Not Prepayment)
paymentBillType: 'FROM_PAYABLE', // Default to Normal (Not Prepayment)
vendorCode: null,
vendorName: null,
remark: null,
@ -201,6 +206,7 @@ export default {
},
rules: {
vendorCode: [{required: true, message: "制造商名称不能为空", trigger: "change"}],
estimatedPaymentTime: [{required: true, message: "预计付款时间不能为空", trigger: "change"}],
paymentBillType: [{required: true, message: "请选择是否预付", trigger: "change"}],
totalPriceWithTax: [{required: false, message: "预付金额不能为空", trigger: "blur"}]
},
@ -213,7 +219,7 @@ export default {
},
computed: {
totalPlannedAmount() {
if (this.form.paymentBillType === 'NORMAL') {
if (this.form.paymentBillType === 'FROM_PAYABLE') {
// Calculate based on selected rows and their plans/defaults
return this.selectedRows.reduce((sum, row) => {
return sum + this.calculateOrderCurrentPaymentAmount(row);
@ -262,11 +268,6 @@ export default {
this.selectedRows = [];
this.loadTableData();
},
handleTypeChange() {
this.queryParams.pageNum = 1;
this.selectedRows = []; // Clear selection when switching type
this.loadTableData();
},
loadTableData() {
if (!this.form.vendorCode) return;
@ -280,7 +281,7 @@ export default {
pageSize: this.queryParams.pageSize
};
if (this.form.paymentBillType === 'NORMAL') {
if (this.form.paymentBillType === 'FROM_PAYABLE') {
listPayableBills(query).then(res => {
this.payableList = (res.rows || []).map(item => {
const paymentPlans = item.paymentPlans ? [...item.paymentPlans] : [];
@ -303,11 +304,35 @@ export default {
this.total = res.total;
});
} else if (this.form.paymentBillType === 'PRE_PAYMENT') {
listPurchaseOrders(query).then(res => {
query.orderStatus = '2';
listOrders(query).then(res => {
this.orderList = res.rows || [];
this.total = res.total;
});
}
this.$nextTick(() => {
if (this.$refs.payableTable) {
this.$refs.payableTable.clearSelection()
}
if (this.$refs.orderTable) {
this.$refs.orderTable.clearSelection()
}
})
},
handleSelect(selection, row) {
if (this.form.paymentBillType === 'PRE_PAYMENT') {
this.$refs.orderTable.clearSelection();
const isSelected = selection.some(item => item.orderCode === row.orderCode);
if (isSelected) {
this.$refs.orderTable.toggleRowSelection(row, true);
}
}
},
handleSelectAll(selection) {
if (this.form.paymentBillType === 'PRE_PAYMENT') {
this.$refs.orderTable.clearSelection();
this.$modal.msgWarning("预付单只能选择一个订单");
}
},
handleSelectionChange(selection) {
this.selectedRows = selection;
@ -357,7 +382,7 @@ export default {
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
if (this.form.paymentBillType === 'NORMAL') {
if (this.form.paymentBillType === 'FROM_PAYABLE') {
if (this.selectedRows.length === 0) {
this.$message.warning("请选择至少一条应付单");
return;
@ -394,10 +419,26 @@ export default {
} else {
// Prepayment logic
console.log(this.selectedRows)
if (this.selectedRows.length > 1) {
this.$modal.msgWarning("只能选择一笔订单");
return;
}
if ((this.form.totalPriceWithTax ||0) <= 0) {
this.$message.warning("含税总价需要大于0");
return;
}
let order = this.selectedRows[0] ?? {};
const submitData = {
...this.form,
details: this.selectedRows
paymentBillType: 'PRE_PAYMENT',
orderCode: order.orderCode,
vendorCode: this.form.vendorCode,
projectCode:order.projectCode,
projectName:order.projectName,
paymentTime: this.form.estimatedPaymentTime,
totalPriceWithTax:this.form.totalPriceWithTax
};
console.log(submitData)
this.$emit("submit", submitData);
}
}
@ -408,7 +449,7 @@ export default {
this.$refs.form.resetFields();
}
this.form = {
paymentBillType: 'NORMAL',
paymentBillType: 'FROM_PAYABLE',
vendorCode: null,
vendorName: null,
remark: null,

View File

@ -174,7 +174,7 @@ export default {
},
paymentData: {
type: Object,
default: () => null,
default: () => {},
},
dicts: {
type: Object,

View File

@ -256,7 +256,7 @@
</template>
<script>
import { listPayment, getPayment, returnPayment, addPayment, applyPaymentApi, applyRefund } from "@/api/finance/payment";
import { listPayment, getPayment, returnPayment, addPaymentFromPayable, applyPaymentApi, applyRefund,addPayment } from "@/api/finance/payment";
import { addDateRange } from "@/utils/ruoyi";
import DetailDrawer from "./components/DetailDrawer.vue";
import AddForm from "./components/AddForm.vue";
@ -306,7 +306,7 @@ export default {
addOpen: false,
//
receiptOpen: false,
currentRow: null,
currentRow: {},
//
applyPaymentOpen: false,
applyPaymentForm: {},
@ -373,6 +373,16 @@ export default {
},
/** 新增提交 */
handleAddSubmit(form) {
if (form.paymentBillType==='FROM_PAYABLE'){
addPaymentFromPayable(form).then(response => {
this.$modal.msgSuccess("新增成功");
this.addOpen = false;
this.getList();
}).catch(error => {
console.error("新增付款单失败", error);
this.$modal.msgError("新增失败");
});
}else{
addPayment(form).then(response => {
this.$modal.msgSuccess("新增成功");
this.addOpen = false;
@ -381,6 +391,8 @@ export default {
console.error("新增付款单失败", error);
this.$modal.msgError("新增失败");
});
}
},
/** 详情按钮操作 */
handleDetail(row) {

View File

@ -83,7 +83,7 @@ public class OmsPaymentBillController extends BaseController
}
/**
*
*
*/
@RequiresPermissions("finance:payment:add")
@Log(title = "采购付款单", businessType = BusinessType.INSERT)
@ -91,6 +91,7 @@ public class OmsPaymentBillController extends BaseController
@ResponseBody
public AjaxResult addSave(@RequestBody OmsPaymentBill omsPaymentBill)
{
omsPaymentBill.setPreResidueAmount(omsPaymentBill.getTotalPriceWithTax());
return toAjax(omsPaymentBillService.insertOmsPaymentBill(omsPaymentBill));
}

View File

@ -88,6 +88,7 @@ public class ProjectOrderInfo extends BaseEntity {
@Excel(name = "代表处")
private String agentName;
private String agentCode;
private String vendorCode;
/**
*
*/

View File

@ -102,6 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="notifierAddress != null and notifierAddress != ''">and t1.notifier_address = #{notifierAddress}
</if>
<if test="duty != null and duty != ''">and t1.duty = #{duty}</if>
<if test="vendorCode != null and vendorCode != ''">and t1.project_id in (
select ppi.project_id from product_info pi
left join project_product_info ppi on ppi.product_bom_code=pi.product_code
where pi.vendor_code=#{vendorCode}
) </if>
<if test="dutyName != null and dutyName != ''">and t5.user_name like concat('%', #{dutyName}, '%')</if>
<if test="dutyEmail != null and dutyEmail != ''">and t1.duty_email = #{dutyEmail}</if>
<if test="dutyPhone != null and dutyPhone != ''">and t1.duty_phone = #{dutyPhone}</if>