This commit is contained in:
2025-11-14 11:39:33 +08:00
parent 6e5d892992
commit 1ba633ba45
7143 changed files with 922330 additions and 0 deletions

232
pages/bill/bill.vue Normal file
View File

@@ -0,0 +1,232 @@
<template>
<view class="bill-list-page">
<!-- 自定义导航栏 -->
<customNavbar
title="我的账单"
></customNavbar>
<!-- Tab 按钮 -->
<view class="tab-bar">
<view
class="tab-item"
:class="{ active: currentTab === 'out' }"
@click="switchTab('out')"
>
</view>
<view
class="tab-item"
:class="{ active: currentTab === 'in' }"
@click="switchTab('in')"
>
</view>
</view>
<!-- 账单列表 -->
<scroll-view
scroll-y
class="scroll-content"
:scroll-top="0"
:refresher-enabled="true"
:refresher-triggered="isRefreshing"
@refresherrefresh="refresh"
@scrolltolower="loadMore"
>
<view v-if="bills.length > 0">
<view
class="bill-item"
v-for="item in bills"
:key="item.id"
@click="goDetail(item)"
>
<!-- 左侧信息 -->
<view class="bill-left">
<text class="bill-name">{{ item.feeName }}</text>
<text class="bill-date" v-if="item.payTime">支付时间{{ item.payTime }}</text>
<text
class="bill-status"
v-if="currentTab === 'out'"
>{{ item.status }}</text>
</view>
<!-- 右侧金额 + 箭头 -->
<view class="bill-right">
<text class="amount">{{ formatMoney(item.amount) }}</text>
<u-icon name="arrow-right" size="28" color="#ccc" />
</view>
</view>
</view>
<view v-else class="empty">
<u-empty mode="list" text="暂无账单" />
</view>
<u-loadmore :status="loadStatus" />
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
currentTab: 'out', // in 收 / out 支
bills: [],
isRefreshing: false,
loadStatus: 'more', // u-loadmore 状态
};
},
onLoad(options) {
// 可以从 options 获取用户ID或合同ID
this.loadBills();
},
methods: {
switchTab(tab) {
this.currentTab = tab;
this.loadBills();
},
loadBills() {
// 模拟数据加载
if (this.currentTab === 'in') {
this.bills = [
{
id: 'b101',
feeName: '第一期2024.12.01-2024.12.31',
payTime: '2024-12-05',
amount: 3000,
status: '已收',
},
{
id: 'b102',
feeName: '第二期2025.01.01-2025.01.31',
payTime: '',
amount: 3000,
status: '未收',
},
];
} else {
this.bills = [
{
id: 'b201',
feeName: '第一期租金2024.12.01-2024.12.31',
payTime: '2024-12-05',
amount: 3000,
status: '已支付',
},
{
id: 'b202',
feeName: '第二期租金2025.01.01-2025.01.31',
payTime: '',
amount: 3000,
status: '待支付',
},
];
}
},
refresh() {
this.isRefreshing = true;
setTimeout(() => {
this.loadBills();
this.isRefreshing = false;
}, 1000);
},
loadMore() {
// 可以调用接口分页加载更多数据
this.loadStatus = 'noMore';
},
formatMoney(val) {
if (!val && val !== 0) return '—';
return '¥' + Number(val).toFixed(2);
},
goDetail(item) {
uni.navigateTo({
url: `/pages/bill/billDetail?id=${item.id}`,
});
},
},
};
</script>
<style lang="scss" scoped>
.bill-list-page {
background: #f7f8fa;
min-height: 100vh;
padding-top: 175rpx; /* 给导航栏留空间 */
}
.tab-bar {
display: flex;
background: #fff;
margin: 0 20rpx;
border-radius: 12rpx;
overflow: hidden;
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
.tab-item {
flex: 1;
text-align: center;
padding: 20rpx 0;
font-size: 28rpx;
color: #666;
&.active {
color: #fff;
background: #007aff;
}
}
}
.scroll-content {
margin-top: 20rpx;
padding-bottom: 20rpx;
}
.bill-item {
display: flex;
justify-content: space-between;
background: #fff;
margin: 0 20rpx 20rpx 20rpx;
border-radius: 12rpx;
padding: 20rpx;
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
}
.bill-left {
display: flex;
flex-direction: column;
.bill-name {
font-size: 28rpx;
color: #333;
font-weight: bold;
}
.bill-date,
.bill-status {
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
}
}
.bill-right {
display: flex;
align-items: center;
.amount {
font-size: 28rpx;
color: #333;
margin-right: 10rpx;
}
}
.empty {
margin-top: 200rpx;
text-align: center;
}
</style>

133
pages/bill/billDetail.vue Normal file
View File

@@ -0,0 +1,133 @@
<template>
<view class="bill-detail-page">
<!-- 顶部自定义导航栏 -->
<custom-navbar title="账单详情" />
<scroll-view scroll-y class="scroll-content">
<!-- 基本信息 -->
<view class="section">
<view class="section-title">账单信息</view>
<view class="info-item">
<text class="label">费用名称</text>
<text class="value">{{ bill.feeName }}</text>
</view>
<view class="info-item">
<text class="label">支付时间</text>
<text class="value">{{ bill.payTime || '未支付' }}</text>
</view>
<view class="info-item">
<text class="label">支付状态</text>
<text class="value">{{ bill.status }}</text>
</view>
<view class="info-item">
<text class="label">金额</text>
<text class="value">{{ formatMoney(bill.amount) }}</text>
</view>
<view class="info-item" v-if="bill.contractId">
<text class="label">关联合同</text>
<text class="value" @click="goContractDetail(bill.contractId)" style="color:#007aff;">点击查看</text>
</view>
<view class="info-item" v-if="bill.payMethod">
<text class="label">支付方式</text>
<text class="value">{{ bill.payMethod }}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
bill: {},
};
},
onLoad(options) {
const { id } = options; // 列表页传过来的账单ID
this.loadBillDetail(id);
},
methods: {
loadBillDetail(id) {
// 模拟请求接口
this.bill = {
id,
feeName: '第一期租金2024.12.01-2024.12.31',
payTime: '2024-12-05',
status: '已支付',
amount: 3000,
contractId: 'c123',
payMethod: '线上支付',
};
},
formatMoney(val) {
if (!val && val !== 0) return '—';
return '¥' + Number(val).toFixed(2);
},
goDetail(contractId) {
uni.navigateTo({
url: `/pages/contract/contractDetail?id=${contractId}`,
});
},
},
};
</script>
<style lang="scss" scoped>
.bill-detail-page {
background: #f7f8fa;
min-height: 100vh;
padding-top: 175rpx; // 自定义导航栏高度
}
.scroll-content {
padding: 20rpx;
}
.section {
background: #fff;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 20rpx;
.section-title {
font-size: 28rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #333;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 16rpx 0;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.label {
font-size: 26rpx;
color: #666;
}
.value {
font-size: 26rpx;
color: #333;
margin-right: 16rpx; /* 增加右侧安全间距 */
max-width: 70%; /* 防止过长文字挤到箭头或屏幕边缘 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>

202
pages/bill/payHistory.vue Normal file
View File

@@ -0,0 +1,202 @@
<template>
<view class="pay-history-page">
<customNavbar title="缴费记录" />
<!-- 顶部tab切换 -->
<view class="tab-bar">
<view
v-for="(tab, index) in tabs"
:key="index"
:class="['tab-item', activeTab === tab.value ? 'active' : '']"
@click="activeTab = tab.value"
>
{{ tab.label }}
</view>
</view>
<!-- 收支记录列表 -->
<scroll-view scroll-y class="scroll-content">
<view v-if="filteredRecords.length > 0" class="record-list">
<view
v-for="(item, index) in filteredRecords"
:key="index"
class="record-item"
@click="goDetail(item)"
>
<!-- 左侧信息 -->
<view class="left">
<view class="title">{{ item.feeName }}</view>
<view class="sub">{{ item.timeLabel }}{{ item.time || '—' }}</view>
</view>
<!-- 右侧金额 + 图标 -->
<view class="right">
<view
class="amount"
:class="item.type === 'income' ? 'income' : 'expense'"
>
{{ item.type === 'income' ? '+' : '-' }}{{ item.amount.toFixed(2) }}
</view>
<u-icon name="arrow-right" size="32" color="#ccc"></u-icon>
</view>
</view>
</view>
<view v-else class="empty">
<u-empty mode="list" text="暂无记录" />
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
activeTab: 'income', // 默认显示“收”
tabs: [
{ label: '收', value: 'income' },
{ label: '支', value: 'expense' },
],
records: [
{
id: 1,
type: 'income', // 收
feeName: '第一期租金2024.01.01 - 2024.03.31',
time: '2024-01-05',
timeLabel: '收款时间',
amount: 8500,
},
{
id: 2,
type: 'expense', // 支
feeName: '押金缴纳',
time: '2024-01-03',
timeLabel: '支付时间',
amount: 5000,
},
{
id: 3,
type: 'expense',
feeName: '第二期租金2024.04.01 - 2024.06.30',
time: '',
timeLabel: '支付时间',
amount: 8500,
},
],
};
},
computed: {
filteredRecords() {
return this.records.filter((r) => r.type === this.activeTab);
},
},
methods: {
statusText(status) {
const map = {
paid: '已支付 / 已收款',
unpaid: '待支付',
pending: '处理中',
};
return map[status] || '未知状态';
},
goDetail(item) {
uni.navigateTo({
url: `/pages/bill/detail?id=${item.id}`,
});
},
},
};
</script>
<style lang="scss" scoped>
.pay-history-page {
background: #f8f8f8;
min-height: 100vh;
padding-top: 175rpx;
.tab-bar {
display: flex;
background: #fff;
margin: 0 20rpx;
border-radius: 12rpx;
overflow: hidden;
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
.tab-item {
flex: 1;
text-align: center;
padding: 24rpx 0;
font-size: 28rpx;
color: #666;
font-weight: 500;
transition: all 0.2s;
&.active {
color: #007aff;
font-weight: 700;
background: #eaf3ff;
}
}
}
.record-list {
padding: 20rpx;
.record-item {
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
border-radius: 16rpx;
margin-bottom: 20rpx;
padding: 20rpx;
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.03);
.left {
flex: 1;
.title {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
}
.sub {
font-size: 24rpx;
color: #888;
margin-bottom: 6rpx;
}
.status {
font-size: 24rpx;
&.paid {
color: #4caf50;
}
&.unpaid {
color: #f56c6c;
}
}
}
.right {
display: flex;
align-items: center;
.amount {
font-size: 30rpx;
font-weight: bold;
margin-right: 10rpx;
&.income {
color: #4caf50;
}
&.expense {
color: #f56c6c;
}
}
}
}
}
.empty {
margin-top: 100rpx;
}
}
</style>