feat(finance): 优化付款单新增功能及界面交互
- 移除预付单类型切换时的冗余处理逻辑 - 修复付款状态字典引用错误,统一使用 dict.type.payment_status - 预付订单列表增加选择控制,限制只能选中一个订单 - 表格组件添加 ref 引用以便手动清除选中状态 - 新增预计付款时间必填校验规则 - 提交数据结构调整,明确区分应付单与预付单字段 - 增加含税总价大于0的前置校验 - 日志提示优化,增强用户操作引导信息 - 接口调用分离,针对不同付款类型调用对应后端接口 - 回执单组件默认值调整,避免空对象异常dev_1.0.0
parent
a4a93ee484
commit
49cd27c221
|
|
@ -51,7 +51,7 @@ export function returnPayment(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增付款单
|
// 新增付款单
|
||||||
export function addPayment(data) {
|
export function addPaymentFromPayable(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/finance/payable/mergeAndInitiatePayment',
|
url: '/finance/payable/mergeAndInitiatePayment',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|
@ -59,6 +59,14 @@ export function addPayment(data) {
|
||||||
needLoading: true
|
needLoading: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function addPayment(data) {
|
||||||
|
return request({
|
||||||
|
url: '/finance/payment/add',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
needLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 申请付款
|
// 申请付款
|
||||||
export function applyPaymentApi(data) {
|
export function applyPaymentApi(data) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="是否预付" prop="paymentBillType">
|
<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="PRE_PAYMENT">是</el-radio>
|
||||||
<el-radio label="FROM_PAYABLE">否</el-radio>
|
<el-radio label="FROM_PAYABLE">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
|
@ -54,6 +54,7 @@
|
||||||
<div v-if="form.paymentBillType === 'FROM_PAYABLE'" class="table-container">
|
<div v-if="form.paymentBillType === 'FROM_PAYABLE'" class="table-container">
|
||||||
<h4>应付单列表</h4>
|
<h4>应付单列表</h4>
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="payableTable"
|
||||||
:data="payableList"
|
:data="payableList"
|
||||||
border
|
border
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
|
|
@ -71,7 +72,7 @@
|
||||||
<el-table-column label="出入库单号" align="center" prop="inventoryCode" width="150"/>
|
<el-table-column label="出入库单号" align="center" prop="inventoryCode" width="150"/>
|
||||||
<el-table-column label="付款状态" align="center" prop="paymentStatus" width="120">
|
<el-table-column label="付款状态" align="center" prop="paymentStatus" width="120">
|
||||||
<template slot-scope="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="含税总价" align="center" prop="totalPriceWithTax" width="120"/>
|
<el-table-column label="含税总价" align="center" prop="totalPriceWithTax" width="120"/>
|
||||||
|
|
@ -105,12 +106,15 @@
|
||||||
<div v-if="form.paymentBillType === 'PRE_PAYMENT'" class="table-container">
|
<div v-if="form.paymentBillType === 'PRE_PAYMENT'" class="table-container">
|
||||||
<h4>订单列表</h4>
|
<h4>订单列表</h4>
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="orderTable"
|
||||||
:data="orderList"
|
:data="orderList"
|
||||||
border
|
border
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
|
@select="handleSelect"
|
||||||
|
@select-all="handleSelectAll"
|
||||||
max-height="400"
|
max-height="400"
|
||||||
row-key="orderNo"
|
row-key="id"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
|
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
|
||||||
<el-table-column prop="projectCode" label="项目编号"></el-table-column>
|
<el-table-column prop="projectCode" label="项目编号"></el-table-column>
|
||||||
|
|
@ -138,11 +142,11 @@
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<div v-if="form.paymentBillType === 'FROM_PAYABLE'" style="float: left; line-height: 36px;">
|
<!-- <div v-if="form.paymentBillType === 'FROM_PAYABLE'" style="float: left; line-height: 36px;">-->
|
||||||
<span style="margin-right: 20px;">计划付款总金额: <el-tag type="success">{{
|
<!-- <span style="margin-right: 20px;">计划付款总金额: <el-tag type="success">{{-->
|
||||||
totalPlannedAmount.toFixed(2)
|
<!-- totalPlannedAmount.toFixed(2)-->
|
||||||
}}</el-tag></span>
|
<!-- }}</el-tag></span>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -202,6 +206,7 @@ export default {
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
vendorCode: [{required: true, message: "制造商名称不能为空", trigger: "change"}],
|
vendorCode: [{required: true, message: "制造商名称不能为空", trigger: "change"}],
|
||||||
|
estimatedPaymentTime: [{required: true, message: "预计付款时间不能为空", trigger: "change"}],
|
||||||
paymentBillType: [{required: true, message: "请选择是否预付", trigger: "change"}],
|
paymentBillType: [{required: true, message: "请选择是否预付", trigger: "change"}],
|
||||||
totalPriceWithTax: [{required: false, message: "预付金额不能为空", trigger: "blur"}]
|
totalPriceWithTax: [{required: false, message: "预付金额不能为空", trigger: "blur"}]
|
||||||
},
|
},
|
||||||
|
|
@ -263,11 +268,6 @@ export default {
|
||||||
this.selectedRows = [];
|
this.selectedRows = [];
|
||||||
this.loadTableData();
|
this.loadTableData();
|
||||||
},
|
},
|
||||||
handleTypeChange() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.selectedRows = []; // Clear selection when switching type
|
|
||||||
this.loadTableData();
|
|
||||||
},
|
|
||||||
loadTableData() {
|
loadTableData() {
|
||||||
if (!this.form.vendorCode) return;
|
if (!this.form.vendorCode) return;
|
||||||
|
|
||||||
|
|
@ -277,7 +277,6 @@ export default {
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
vendorCode: this.form.vendorCode,
|
vendorCode: this.form.vendorCode,
|
||||||
orderStatus:'2',
|
|
||||||
pageNum: this.queryParams.pageNum,
|
pageNum: this.queryParams.pageNum,
|
||||||
pageSize: this.queryParams.pageSize
|
pageSize: this.queryParams.pageSize
|
||||||
};
|
};
|
||||||
|
|
@ -305,11 +304,35 @@ export default {
|
||||||
this.total = res.total;
|
this.total = res.total;
|
||||||
});
|
});
|
||||||
} else if (this.form.paymentBillType === 'PRE_PAYMENT') {
|
} else if (this.form.paymentBillType === 'PRE_PAYMENT') {
|
||||||
|
query.orderStatus = '2';
|
||||||
listOrders(query).then(res => {
|
listOrders(query).then(res => {
|
||||||
this.orderList = res.rows || [];
|
this.orderList = res.rows || [];
|
||||||
this.total = res.total;
|
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) {
|
handleSelectionChange(selection) {
|
||||||
this.selectedRows = selection;
|
this.selectedRows = selection;
|
||||||
|
|
@ -396,10 +419,26 @@ export default {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Prepayment logic
|
// 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 = {
|
const submitData = {
|
||||||
...this.form,
|
paymentBillType: 'PRE_PAYMENT',
|
||||||
details: this.selectedRows
|
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);
|
this.$emit("submit", submitData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ export default {
|
||||||
},
|
},
|
||||||
paymentData: {
|
paymentData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => null,
|
default: () => {},
|
||||||
},
|
},
|
||||||
dicts: {
|
dicts: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 { addDateRange } from "@/utils/ruoyi";
|
||||||
import DetailDrawer from "./components/DetailDrawer.vue";
|
import DetailDrawer from "./components/DetailDrawer.vue";
|
||||||
import AddForm from "./components/AddForm.vue";
|
import AddForm from "./components/AddForm.vue";
|
||||||
|
|
@ -306,7 +306,7 @@ export default {
|
||||||
addOpen: false,
|
addOpen: false,
|
||||||
// 回执单弹窗
|
// 回执单弹窗
|
||||||
receiptOpen: false,
|
receiptOpen: false,
|
||||||
currentRow: null,
|
currentRow: {},
|
||||||
// 付款申请弹窗
|
// 付款申请弹窗
|
||||||
applyPaymentOpen: false,
|
applyPaymentOpen: false,
|
||||||
applyPaymentForm: {},
|
applyPaymentForm: {},
|
||||||
|
|
@ -373,14 +373,26 @@ export default {
|
||||||
},
|
},
|
||||||
/** 新增提交 */
|
/** 新增提交 */
|
||||||
handleAddSubmit(form) {
|
handleAddSubmit(form) {
|
||||||
addPayment(form).then(response => {
|
if (form.paymentBillType==='FROM_PAYABLE'){
|
||||||
this.$modal.msgSuccess("新增成功");
|
addPaymentFromPayable(form).then(response => {
|
||||||
this.addOpen = false;
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.getList();
|
this.addOpen = false;
|
||||||
}).catch(error => {
|
this.getList();
|
||||||
console.error("新增付款单失败", error);
|
}).catch(error => {
|
||||||
this.$modal.msgError("新增失败");
|
console.error("新增付款单失败", error);
|
||||||
});
|
this.$modal.msgError("新增失败");
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
addPayment(form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.addOpen = false;
|
||||||
|
this.getList();
|
||||||
|
}).catch(error => {
|
||||||
|
console.error("新增付款单失败", error);
|
||||||
|
this.$modal.msgError("新增失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 详情按钮操作 */
|
/** 详情按钮操作 */
|
||||||
handleDetail(row) {
|
handleDetail(row) {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public class OmsPaymentBillController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存采购付款单
|
* 新增预付单
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("finance:payment:add")
|
@RequiresPermissions("finance:payment:add")
|
||||||
@Log(title = "采购付款单", businessType = BusinessType.INSERT)
|
@Log(title = "采购付款单", businessType = BusinessType.INSERT)
|
||||||
|
|
@ -91,6 +91,7 @@ public class OmsPaymentBillController extends BaseController
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@RequestBody OmsPaymentBill omsPaymentBill)
|
public AjaxResult addSave(@RequestBody OmsPaymentBill omsPaymentBill)
|
||||||
{
|
{
|
||||||
|
omsPaymentBill.setPreResidueAmount(omsPaymentBill.getTotalPriceWithTax());
|
||||||
return toAjax(omsPaymentBillService.insertOmsPaymentBill(omsPaymentBill));
|
return toAjax(omsPaymentBillService.insertOmsPaymentBill(omsPaymentBill));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue