<template>
|
<view class="sales-account">
|
<!-- 使用通用页面头部组件 -->
|
<PageHeader title="付款登记" @back="goBack" />
|
|
<!-- 搜索和筛选区域 -->
|
<view class="search-section">
|
<view class="search-bar">
|
<view class="search-input">
|
<up-input
|
class="search-text"
|
placeholder="请输入供应商名称/合同号搜索"
|
v-model="searchForm.supplierNameOrContractNo"
|
@change="getList"
|
clearable
|
/>
|
</view>
|
<view class="filter-button" @click="getList">
|
<up-icon name="search" size="24" color="#999"></up-icon>
|
</view>
|
</view>
|
|
<!-- 筛选开关 -->
|
<view class="switch-row">
|
<text class="switch-label">不显示待付款为0</text>
|
<u-switch v-model="searchForm.status" @change="getList" active-color="#2979ff" inactive-color="#e5e5e5"/>
|
</view>
|
</view>
|
|
|
|
<!-- 列表区域 -->
|
<view class="ledger-list" v-if="tableData.length > 0">
|
<view v-for="(item, index) in tableData" :key="index">
|
<view class="ledger-item">
|
<view class="item-header">
|
<view class="item-left">
|
<view class="document-icon">
|
<up-icon name="file-text" size="16" color="#ffffff"></up-icon>
|
</view>
|
<text class="item-id">{{ item.purchaseContractNumber }}</text>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">销售合同号</text>
|
<text class="detail-value">{{ item.salesContractNo }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">供应商名称</text>
|
<text class="detail-value">{{ item.supplierName }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">发票号</text>
|
<text class="detail-value">{{ item.invoiceNumber }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">发票金额(元)</text>
|
<text class="detail-value">{{ item.invoiceAmount }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">已付款金额(元)</text>
|
<text class="detail-value">{{ item.paymentAmountTotal || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">待付款金额(元)</text>
|
<text class="detail-value highlight">{{ formatNumber(item.unPaymentAmountTotal) }}</text>
|
</view>
|
</view>
|
|
<!-- 操作按钮 -->
|
<view class="action-buttons">
|
<u-button
|
type="primary"
|
size="small"
|
class="action-btn"
|
:disabled="item.unPaymentAmountTotal == 0"
|
@click="openForm('add', item)"
|
>
|
新增付款
|
</u-button>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 无数据提示 -->
|
<view class="no-data" v-else>
|
<text>暂无付款数据</text>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref } from 'vue'
|
import useUserStore from '@/store/modules/user'
|
// 替换 toast 方法
|
const showToast = (message) => {
|
uni.showToast({
|
title: message,
|
icon: 'none'
|
})
|
}
|
import {onShow} from "@dcloudio/uni-app";
|
import {invoiceListPage} from "@/api/procurementManagement/procurementInvoiceLedger";
|
|
// 响应式数据
|
const tableData = ref([])
|
const tableLoading = ref(false)
|
|
// 查询参数设置为-1获取全部数据
|
const page = ref({
|
current: -1,
|
size: -1
|
})
|
|
// 搜索表单
|
const searchForm = ref({
|
supplierNameOrContractNo: '',
|
status: true,
|
customerName: '',
|
customerContractNo: '',
|
projectName: ''
|
})
|
|
// 格式化数字
|
const formatNumber = (value) => {
|
return parseFloat(value || 0).toFixed(2)
|
}
|
|
// 返回上一页
|
const goBack = () => {
|
uni.navigateBack()
|
}
|
|
// 获取列表数据
|
const getList = () => {
|
showLoadingToast('加载中...')
|
tableLoading.value = true
|
invoiceListPage({ ...searchForm.value, ...page.value }).then((res) => {
|
tableLoading.value = false
|
tableData.value = res.records || []
|
closeToast()
|
}).catch(() => {
|
tableLoading.value = false
|
closeToast()
|
})
|
}
|
|
// 显示加载提示
|
const showLoadingToast = (message) => {
|
uni.showLoading({
|
title: message,
|
mask: true
|
});
|
};
|
|
// 关闭提示
|
const closeToast = () => {
|
uni.hideLoading();
|
};
|
|
// 打开新增表单
|
const openForm = (type, item) => {
|
if (item.unPaymentAmountTotal == 0) {
|
showToast('无需再付款')
|
return
|
}
|
uni.setStorageSync('operationType', type);
|
uni.setStorageSync('invoiceLedgerEditRow', JSON.stringify(item))
|
uni.navigateTo({ url: '/pages/procurementManagement/paymentEntry/add' })
|
}
|
|
onShow(() => {
|
getList()
|
})
|
</script>
|
|
<style scoped lang="scss">
|
@import '@/styles/procurement-common.scss';
|
|
// 付款登记特有样式
|
.detail-value {
|
display: flex;
|
align-items: center;
|
justify-content: flex-end;
|
}
|
</style>
|