fix:供应商账单测试

This commit is contained in:
GaoHao
2025-04-08 11:18:37 +08:00
parent 164dd52afa
commit a2361b39c4
16 changed files with 396 additions and 148 deletions

View File

@@ -12,28 +12,30 @@
<el-col :span="16">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button type="primary" @click="getTableData" plain>批量付款</el-button>
<el-text tag="b" size="large" style="margin-left: 15px;">供应商供应商名称</el-text>
<el-button type="primary" @click="handlePayment('all')" plain>批量付款</el-button>
<el-text tag="b" size="large" style="margin-left: 15px;">供应商{{ state.supplierName }}</el-text>
</el-col>
</el-row>
</el-card>
</div>
<div class="head-container">
<el-card shadow="never">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table @selection-change="handleSelectionChange" v-loading="state.tableData.loading"
:data="state.tableData.list">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="耗材信息">
<template v-slot="scope">
<div>{{ scope.row.shopName }}{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.shopName }}</div>
<div>联系电话{{ scope.row.phone }}</div>
<div>{{ scope.row.conName }}</div>
<div>单价{{ scope.row.purchasePrice }}</div>
<div>入库数量{{ scope.row.inOutNumber }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="账单金额" width="120" />
<el-table-column prop="status" label="已付款金额" width="120" />
<el-table-column prop="status" label="未付款金额" width="120" />
<el-table-column prop="status" label="创建时间" width="120" />
<el-table-column prop="createdAt" label="备注" />
<el-table-column prop="amountPayable" label="账单金额" width="120" />
<el-table-column prop="actualPaymentAmount" label="已付款金额" width="120" />
<el-table-column prop="unPaidAmount" label="未付款金额" width="120" />
<el-table-column prop="createTime" label="创建时间" width="120" />
<el-table-column prop="remark" label="备注" />
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button type="primary" size="small" link @click="handlePayment(scope.row)">
@@ -58,9 +60,9 @@
</template>
<script setup>
import ShopApi from "@/api/account/shop";
import { ElMessageBox } from "element-plus";
import AuthAPI from "@/api/supplier/index";
import payment from "./components/payment.vue";
import { ElMessage } from "element-plus";
const route = useRoute();
const router = useRouter();
@@ -68,6 +70,7 @@ const router = useRouter();
const state = reactive({
query: {
name: "",
vendorId: null,
},
tableData: {
list: [],
@@ -76,23 +79,28 @@ const state = reactive({
loading: false,
total: 0,
},
supplierName: '',
flowIdList: [],
allAmount: 0
});
onMounted(() => {
console.log(route.query);
if (route.query.id) {
if (route.query.vendorId) {
state.query.vendorId = route.query.vendorId
}
if (route.query.supplierName) {
state.supplierName = route.query.supplierName
}
getTableData();
});
// 获取商家列表
// 获取账单记录列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await AuthAPI.getRecordList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
key: state.query.name,
vendorId: state.query.vendorId,
});
state.tableData.loading = false;
state.tableData.list = res.records;
@@ -103,11 +111,28 @@ async function getTableData() {
}
const refPayment = ref();
function handlePayment(item) {
refPayment.value.open(item);
if (item != 'all') {
state.flowIdList = [item.id]
} else {
if( state.flowIdList.length <= 0 ){
ElMessage({ type: "error", message: "请选择付款耗材" });
return;
}
}
refPayment.value.open({ flowIdList: state.flowIdList, supplierName: state.supplierName,allAmount:state.allAmount });
}
function handleSelectionChange(e) {
state.flowIdList = []
state.allAmount = 0
e.map(item => {
state.flowIdList.push(item.id)
state.allAmount += item.unPaidAmount
})
}
// 付款记录
function handleRecord(id) {
router.push({ name: "financePaymentRecord", query: { id: id } });
router.push({ name: "financePaymentRecord", query: { id: id, supplierName: state.supplierName } });
}

View File

@@ -2,17 +2,18 @@
<!-- 修改和增加 -->
<el-dialog title="付款" v-model="show" width="400px" @close="reset">
<el-form :inline="false" ref="refform" label-width="90" :model="form" :rules="rules" class="demo-form-inline">
<el-form-item label="供应商" prop="conName">
<el-input v-model="form.conName" placeholder="请输入供应商名称"></el-input>
<el-form-item label="供应商">
<el-input v-model="supplierName" placeholder="请输入供应商名称" readonly></el-input>
</el-form-item>
<el-form-item label="付款金额 " prop="price">
<el-input-number v-model="form.price" placeholder="请输入付款金额" style="width: 100%;"></el-input-number>
<el-form-item label="付款金额 " prop="amount">
<el-input-number v-model="form.amount" :readonly="form.flowIdList.length > 1" placeholder="请输入付款金额"
style="width: 100%;"></el-input-number>
</el-form-item>
<el-form-item label="付款方式" prop="conName">
<el-input v-model="form.conName" placeholder="请输入付款方式"></el-input>
<el-form-item label="付款方式" prop="type">
<el-input v-model="form.type" placeholder="请输入付款方式"></el-input>
</el-form-item>
<el-form-item label="备注" prop="defaultUnit">
<el-input v-model="form.defaultUnit" placeholder="请输入备注"></el-input>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-form-item style="display: flex; justify-content: flex-end">
<el-button @click="close"> </el-button>
@@ -24,33 +25,35 @@
<script setup>
import consApi from "@/api/product/cons";
import AuthAPI from "@/api/supplier/index";
import { ElMessage } from "element-plus";
const emits = defineEmits(["refresh"]);
const rules = {
conName: [{ required: true, message: "请输入耗材名称", trigger: "blur" }],
price: [{ required: true, message: "请输入耗材价格", trigger: "blur" }],
conWarning: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
conUnit: [{ required: true, message: "请输入付款方式", trigger: "blur" }],
amount: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
type: [{ required: true, message: "请输入付款方式", trigger: "blur" }],
};
const basicForm = {
conName: "",
consGroupId: "",
conUnit: "",
price: undefined,
conWarning: undefined,
flowIdList: [],
amount: undefined,
type: '',
remark: '',
};
const form = reactive({
...basicForm,
});
const supplierName = ref('');
const show = ref(false);
function open(item) {
Object.assign(form, item);
form.flowIdList = item.flowIdList
supplierName.value = item.supplierName
if (item.flowIdList.length > 1 && item.allAmount) {
form.amount = item.allAmount
}
// Object.assign(form, item);
show.value = true;
}
@@ -61,8 +64,8 @@ const refform = ref();
async function submitForm() {
refform.value.validate(async (valid) => {
if (valid) {
const res = await consApi.add(form);
ElMessage({ type: "success", message: "付款成功" });
const res = await AuthAPI.billPay(form);
ElMessage({ type: "success", message: "付款成功" });
emits("refresh");
close();
}
@@ -72,7 +75,7 @@ async function submitForm() {
function reset() {
console.log("reset");
Object.assign(form, basicForm);
console.log(form);
close();
}
defineExpose({
open,

View File

@@ -21,16 +21,16 @@
<el-row :gutter="24">
<el-col :span="8" style="display: flex;flex-direction: column; justify-content: center;align-items: center;">
<div>账单总金额全部/本月</div>
<div>2000/1000</div>
<div>{{ state.summaryData.amountPayable }} / {{ state.summaryData.mouthAmountPayable }}</div>
</el-col>
<el-col :span="8" style="display: flex;flex-direction: column; justify-content: center;align-items: center;">
<div>已付款总金额全部/本月</div>
<div>2000/1000</div>
<div>{{ state.summaryData.actualPaymentAmount }} / {{ state.summaryData.mouthActualPaymentAmount }}</div>
</el-col>
<el-col :span="8" style="display: flex;flex-direction: column; justify-content: center;align-items: center;">
<div>未付款总金额全部/本月</div>
<div>2000/1000</div>
<div>{{ state.summaryData.unPaidAmount }} / {{ state.summaryData.mouthUnPaidAmount }}</div>
</el-col>
</el-row>
</el-card>
@@ -38,15 +38,14 @@
<div class="head-container">
<el-card shadow="never">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="status" label="供应商" width="220" />
<el-table-column prop="status" label="账单金额" width="160" />
<el-table-column prop="status" label="付款金额" width="160" />
<el-table-column prop="status" label="未付款金额" width="160" />
<el-table-column prop="createdAt" label="备注" />
<el-table-column prop="name" label="供应商" width="220" />
<el-table-column prop="amountPayable" label="账单金额" width="200" />
<el-table-column prop="actualPaymentAmount" label="已付款金额" width="200" />
<el-table-column prop="unPaidAmount" label="付款金额" width="200" />
<el-table-column prop="remark" label="备注" />
<el-table-column label="操作" width="120">
<template v-slot="scope">
<el-button type="primary" size="small" link @click="handleTo(scope.row.id)">
<el-button type="primary" size="small" link @click="handleTo(scope.row)">
账单记录
</el-button>
</template>
@@ -64,13 +63,14 @@
</template>
<script setup>
import ShopApi from "@/api/account/shop";
import AuthAPI from "@/api/supplier/index";
const router = useRouter();
const state = reactive({
query: {
name: "",
},
summaryData: {},
tableData: {
list: [],
page: 1,
@@ -80,18 +80,27 @@ const state = reactive({
},
});
onMounted(() => {
getSummary();
getTableData();
});
// 获取商家列表
async function getSummary() {
try {
const res = await AuthAPI.getSummary();
state.summaryData = res;
} catch (error) {
console.log(error);
}
}
// 获取账单列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await AuthAPI.getPage({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
key: state.query.name,
});
state.tableData.loading = false;
state.tableData.list = res.records;
@@ -100,9 +109,9 @@ async function getTableData() {
console.log(error);
}
}
function handleTo(id) {
function handleTo(row) {
// router.push({ path: "/finance/supplierBill/billingRecord", query: { id: e.id } });
router.push({ name: "financeBillingRecord", query: { id: id } });
router.push({ name: "financeBillingRecord", query: { vendorId: row.vendorId, supplierName: row.name } });
}
// 重置查询

View File

@@ -4,7 +4,7 @@
<el-card shadow="never">
<el-alert title="当前列表仅作为数据记录,不产生任何实际交易。" type="warning" show-icon :closable="false"
style="margin-bottom: 15px;" />
<el-text tag="b" size="large" style="margin-left: 15px;">供应商供应商名称</el-text>
<el-text tag="b" size="large" style="margin-left: 15px;">供应商{{ state.supplierName }}</el-text>
</el-card>
</div>
<div class="head-container">
@@ -13,20 +13,20 @@
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="耗材信息">
<template v-slot="scope">
<div>{{ scope.row.shopName }}{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.shopName }}</div>
<div>联系电话{{ scope.row.phone }}</div>
<div>{{ scope.row.conName }}</div>
<div>单价{{ scope.row.purchasePrice }}</div>
<div>入库数量{{ scope.row.inOutNumber }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="付款金额" width="120" />
<el-table-column prop="status" label="付款方式" width="120" />
<el-table-column prop="createdAt" label="备注" />
<el-table-column prop="status" label="创建时间" />
<el-table-column prop="amount" label="付款金额" width="120" />
<el-table-column prop="type" label="付款方式" width="120" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="createTime" label="创建时间" />
<el-table-column label="操作人" width="200">
<template v-slot="scope">
<div>员工名称{{ scope.row.shopName }}</div>
<div>员工编号{{ scope.row.shopName }}</div>
<div>员工账号{{ scope.row.phone }}</div>
<div>员工名称{{ scope.row.nickname }}</div>
<div>员工编号{{ scope.row.code }}</div>
<div>员工账号{{ scope.row.account }}</div>
</template>
</el-table-column>
</el-table>
@@ -43,12 +43,15 @@
<script setup>
import ShopApi from "@/api/account/shop";
import AuthAPI from "@/api/supplier/index";
import { ElMessageBox } from "element-plus";
const route = useRoute();
const state = reactive({
query: {
name: "",
flowId: null,
},
tableData: {
list: [],
@@ -57,23 +60,26 @@ const state = reactive({
loading: false,
total: 0,
},
supplierName: '',
});
onMounted(() => {
console.log(route.query);
if (route.query.id) {
state.query.flowId = route.query.id
}
if (route.query.supplierName) {
state.supplierName = route.query.supplierName
}
getTableData();
});
// 获取商家列表
// 获取账单付款列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await AuthAPI.getPayRecordList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
flowId: state.query.flowId,
});
state.tableData.loading = false;
state.tableData.list = res.records;