Compare commits

..

No commits in common. "49cd27c22169b02d23946891f21cf6a47c6a1ffb" and "c940880a9daa1831acf64978595d6046d8297520" have entirely different histories.

7 changed files with 50 additions and 121 deletions

View File

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

View File

@ -33,9 +33,9 @@
<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"> <el-radio-group v-model="form.paymentBillType" @change="handleTypeChange">
<el-radio label="PRE_PAYMENT"></el-radio> <el-radio label="PRE_PAYMENT"></el-radio>
<el-radio label="FROM_PAYABLE"></el-radio> <el-radio label="NORMAL"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -51,10 +51,9 @@
<!-- Tables --> <!-- Tables -->
<div v-if="form.vendorCode"> <div v-if="form.vendorCode">
<div v-if="form.paymentBillType === 'FROM_PAYABLE'" class="table-container"> <div v-if="form.paymentBillType === 'NORMAL'" 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%"
@ -72,7 +71,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="dict.type.payment_status" :value="scope.row.paymentStatus"/> <dict-tag :options="dicts.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"/>
@ -104,27 +103,20 @@
</div> </div>
<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="id" row-key="orderNo"
> >
<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="orderNo" label="订单编号"></el-table-column>
<el-table-column prop="projectName" label="项目名称"></el-table-column> <el-table-column prop="orderTime" label="订单日期" width="180"></el-table-column>
<el-table-column prop="createTime" label="下单时间"></el-table-column> <el-table-column prop="orderAmount" label="订单金额"></el-table-column>
<el-table-column label="订单状态" prop="orderStatus"> <el-table-column prop="remark" label="备注"></el-table-column>
<template slot-scope="scope">
<dict-tag :options="dict.type.order_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
@ -142,11 +134,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 === 'NORMAL'" 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>
@ -171,7 +163,7 @@
<script> <script>
import {listAllVendor} from "@/api/base/vendor"; import {listAllVendor} from "@/api/base/vendor";
import {listPayableBills, listOrders} from "@/api/finance/payment"; import {listPayableBills, listPurchaseOrders} from "@/api/finance/payment";
import PaymentPlanSelector from "../../payable/components/PaymentPlan"; import PaymentPlanSelector from "../../payable/components/PaymentPlan";
export default { export default {
@ -181,9 +173,12 @@ export default {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false
},
dicts: {
type: Object,
default: () => ({})
} }
}, },
dicts:['order_status','payment_status'],
data() { data() {
return { return {
internalVisible: this.visible, internalVisible: this.visible,
@ -197,7 +192,7 @@ export default {
pageSize: 10 pageSize: 10
}, },
form: { form: {
paymentBillType: 'FROM_PAYABLE', // Default to Normal (Not Prepayment) paymentBillType: 'NORMAL', // Default to Normal (Not Prepayment)
vendorCode: null, vendorCode: null,
vendorName: null, vendorName: null,
remark: null, remark: null,
@ -206,7 +201,6 @@ 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"}]
}, },
@ -219,7 +213,7 @@ export default {
}, },
computed: { computed: {
totalPlannedAmount() { totalPlannedAmount() {
if (this.form.paymentBillType === 'FROM_PAYABLE') { if (this.form.paymentBillType === 'NORMAL') {
// Calculate based on selected rows and their plans/defaults // Calculate based on selected rows and their plans/defaults
return this.selectedRows.reduce((sum, row) => { return this.selectedRows.reduce((sum, row) => {
return sum + this.calculateOrderCurrentPaymentAmount(row); return sum + this.calculateOrderCurrentPaymentAmount(row);
@ -268,6 +262,11 @@ 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;
@ -281,7 +280,7 @@ export default {
pageSize: this.queryParams.pageSize pageSize: this.queryParams.pageSize
}; };
if (this.form.paymentBillType === 'FROM_PAYABLE') { if (this.form.paymentBillType === 'NORMAL') {
listPayableBills(query).then(res => { listPayableBills(query).then(res => {
this.payableList = (res.rows || []).map(item => { this.payableList = (res.rows || []).map(item => {
const paymentPlans = item.paymentPlans ? [...item.paymentPlans] : []; const paymentPlans = item.paymentPlans ? [...item.paymentPlans] : [];
@ -304,35 +303,11 @@ 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'; listPurchaseOrders(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;
@ -382,7 +357,7 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.paymentBillType === 'FROM_PAYABLE') { if (this.form.paymentBillType === 'NORMAL') {
if (this.selectedRows.length === 0) { if (this.selectedRows.length === 0) {
this.$message.warning("请选择至少一条应付单"); this.$message.warning("请选择至少一条应付单");
return; return;
@ -419,26 +394,10 @@ 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 = {
paymentBillType: 'PRE_PAYMENT', ...this.form,
orderCode: order.orderCode, details: this.selectedRows
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);
} }
} }
@ -449,7 +408,7 @@ export default {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
} }
this.form = { this.form = {
paymentBillType: 'FROM_PAYABLE', paymentBillType: 'NORMAL',
vendorCode: null, vendorCode: null,
vendorName: null, vendorName: null,
remark: null, remark: null,

View File

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

View File

@ -256,7 +256,7 @@
</template> </template>
<script> <script>
import { listPayment, getPayment, returnPayment, addPaymentFromPayable, applyPaymentApi, applyRefund,addPayment } from "@/api/finance/payment"; import { listPayment, getPayment, returnPayment, addPayment, applyPaymentApi, applyRefund } 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: {}, currentRow: null,
// //
applyPaymentOpen: false, applyPaymentOpen: false,
applyPaymentForm: {}, applyPaymentForm: {},
@ -373,16 +373,6 @@ export default {
}, },
/** 新增提交 */ /** 新增提交 */
handleAddSubmit(form) { 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 => { addPayment(form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.addOpen = false; this.addOpen = false;
@ -391,8 +381,6 @@ export default {
console.error("新增付款单失败", error); console.error("新增付款单失败", error);
this.$modal.msgError("新增失败"); this.$modal.msgError("新增失败");
}); });
}
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {

View File

@ -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,7 +91,6 @@ 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));
} }

View File

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

View File

@ -102,11 +102,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="notifierAddress != null and notifierAddress != ''">and t1.notifier_address = #{notifierAddress} <if test="notifierAddress != null and notifierAddress != ''">and t1.notifier_address = #{notifierAddress}
</if> </if>
<if test="duty != null and duty != ''">and t1.duty = #{duty}</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="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="dutyEmail != null and dutyEmail != ''">and t1.duty_email = #{dutyEmail}</if>
<if test="dutyPhone != null and dutyPhone != ''">and t1.duty_phone = #{dutyPhone}</if> <if test="dutyPhone != null and dutyPhone != ''">and t1.duty_phone = #{dutyPhone}</if>