账单/租赁资产/水电缴费/待付页面样式修改完成
This commit is contained in:
@@ -5,21 +5,53 @@
|
|||||||
title="我的账单"
|
title="我的账单"
|
||||||
></customNavbar>
|
></customNavbar>
|
||||||
|
|
||||||
<!-- Tab 按钮 -->
|
<!-- 筛选栏 -->
|
||||||
<view class="tab-bar">
|
<view class="filter-bar">
|
||||||
<view
|
<!-- 年份筛选点击区域 -->
|
||||||
class="tab-item"
|
<view class="year-filter" @click="toggleYearPicker">
|
||||||
:class="{ active: currentTab === 'out' }"
|
<text class="year-text">{{ currentYear }}年</text>
|
||||||
@click="switchTab('out')"
|
<u-icon name="arrow-down" size="24" color="#666"></u-icon>
|
||||||
>
|
|
||||||
支
|
|
||||||
</view>
|
</view>
|
||||||
<view
|
|
||||||
class="tab-item"
|
<!-- 自定义年份选择器弹窗 -->
|
||||||
:class="{ active: currentTab === 'in' }"
|
<u-popup v-model="showYearPicker" mode="bottom" border-radius="20rpx" :closeable="true">
|
||||||
@click="switchTab('in')"
|
<view class="year-picker-popup">
|
||||||
>
|
<!-- 弹窗标题 -->
|
||||||
收
|
<view class="popup-header">
|
||||||
|
<text class="popup-title">选择年份</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 年份列表 -->
|
||||||
|
<view class="year-list">
|
||||||
|
<view
|
||||||
|
class="year-item"
|
||||||
|
v-for="year in years"
|
||||||
|
:key="year"
|
||||||
|
:class="{ active: currentYear === year }"
|
||||||
|
@click="selectYear(year)"
|
||||||
|
>
|
||||||
|
{{ year }}年
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
|
||||||
|
<!-- 支出/收入切换 -->
|
||||||
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -75,6 +107,10 @@ export default {
|
|||||||
bills: [],
|
bills: [],
|
||||||
isRefreshing: false,
|
isRefreshing: false,
|
||||||
loadStatus: 'more', // u-loadmore 状态
|
loadStatus: 'more', // u-loadmore 状态
|
||||||
|
// 年份筛选相关
|
||||||
|
currentYear: 2025,
|
||||||
|
years: [2025, 2024, 2023, 2022, 2021],
|
||||||
|
showYearPicker: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -86,6 +122,19 @@ export default {
|
|||||||
this.currentTab = tab;
|
this.currentTab = tab;
|
||||||
this.loadBills();
|
this.loadBills();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 切换年份选择器显示
|
||||||
|
toggleYearPicker() {
|
||||||
|
this.showYearPicker = !this.showYearPicker;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择年份
|
||||||
|
selectYear(year) {
|
||||||
|
this.currentYear = year;
|
||||||
|
this.showYearPicker = false;
|
||||||
|
// 重新加载账单数据
|
||||||
|
this.loadBills();
|
||||||
|
},
|
||||||
|
|
||||||
loadBills() {
|
loadBills() {
|
||||||
// 模拟数据加载
|
// 模拟数据加载
|
||||||
@@ -160,24 +209,90 @@ export default {
|
|||||||
padding-top: 120rpx; /* 给导航栏留空间 */
|
padding-top: 120rpx; /* 给导航栏留空间 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filter-bar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
background: #fff;
|
||||||
|
padding: 24rpx 30rpx;
|
||||||
|
margin: 20rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 年份筛选 */
|
||||||
|
.year-filter {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 支出/收入切换 */
|
||||||
.tab-bar {
|
.tab-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
background: #fff;
|
gap: 20rpx;
|
||||||
margin: 0 20rpx;
|
}
|
||||||
border-radius: 12rpx;
|
|
||||||
overflow: hidden;
|
|
||||||
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
|
|
||||||
|
|
||||||
.tab-item {
|
.tab-item {
|
||||||
flex: 1;
|
padding: 12rpx 32rpx;
|
||||||
text-align: center;
|
font-size: 28rpx;
|
||||||
padding: 20rpx 0;
|
border-radius: 24rpx;
|
||||||
font-size: 28rpx;
|
color: #333;
|
||||||
color: #666;
|
background-color: #f5f5f5;
|
||||||
&.active {
|
transition: all 0.2s ease;
|
||||||
color: #fff;
|
&.active {
|
||||||
background: #007aff;
|
color: #fff;
|
||||||
}
|
background: #ff3b30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义年份选择器样式 */
|
||||||
|
.year-picker-popup {
|
||||||
|
background: #fff;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-header {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-title {
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.year-list {
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.year-item {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #666;
|
||||||
|
text-align: center;
|
||||||
|
padding: 24rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
background: #f5f5f5;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #ff3b30;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #ff5252;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +316,7 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.bill-name {
|
.bill-name {
|
||||||
font-size: 30rpx;
|
font-size: 28rpx;
|
||||||
color: #2D2B2C;
|
color: #2D2B2C;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
@@ -219,7 +334,7 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.amount {
|
.amount {
|
||||||
font-size: 30rpx;
|
font-size: 28rpx;
|
||||||
color: #F34038;
|
color: #F34038;
|
||||||
margin-right: 10rpx;
|
margin-right: 10rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,25 +64,25 @@
|
|||||||
<view class="service-list">
|
<view class="service-list">
|
||||||
<view class="service-item" @click="clickNav('pages/bill/bill')">
|
<view class="service-item" @click="clickNav('pages/bill/bill')">
|
||||||
<view class="service-icon">
|
<view class="service-icon">
|
||||||
<image src="/static/icon/账单.png" mode="widthFix"></image>
|
<image src="/static/icon/账单.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-name">账单</view>
|
<view class="service-name">账单</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-item" @click="clickNav('pages/center/myLease')">
|
<view class="service-item" @click="clickNav('pages/center/myLease')">
|
||||||
<view class="service-icon">
|
<view class="service-icon">
|
||||||
<image src="/static/icon/租赁资产.png" mode="widthFix"></image>
|
<image src="/static/icon/租赁资产.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-name">租赁资产</view>
|
<view class="service-name">租赁资产</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-item" @click="clickNav('pages/wae/wae')">
|
<view class="service-item" @click="clickNav('pages/wae/wae')">
|
||||||
<view class="service-icon">
|
<view class="service-icon">
|
||||||
<image src="/static/icon/水电费.png" mode="widthFix"></image>
|
<image src="/static/icon/水电费.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-name">水电缴费</view>
|
<view class="service-name">水电缴费</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-item" @click="clickNav('pages/unpaid/unpaid')">
|
<view class="service-item" @click="clickNav('pages/unpaid/unpaid')">
|
||||||
<view class="service-icon">
|
<view class="service-icon">
|
||||||
<image src="/static/icon/待付款.png" mode="widthFix"></image>
|
<image src="/static/icon/待付款.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-name">待付</view>
|
<view class="service-name">待付</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
padding-top: 175rpx;
|
padding-top: 120rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-bar {
|
.filter-bar {
|
||||||
|
|||||||
@@ -1,335 +1,352 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="pending-bill-page">
|
<view class="pending-bill-page">
|
||||||
<!-- 自定义导航栏 -->
|
<!-- 自定义导航栏 -->
|
||||||
<custom-navbar title="我的待付" />
|
<custom-navbar title="我的待付" />
|
||||||
|
|
||||||
<scroll-view
|
<scroll-view scroll-y class="scroll-content" :refresher-enabled="true" :refresher-triggered="isRefreshing"
|
||||||
scroll-y
|
@refresherrefresh="refresh" @scrolltolower="loadMore">
|
||||||
class="scroll-content"
|
<view v-if="bills.length > 0">
|
||||||
:refresher-enabled="true"
|
<view class="bill-item" v-for="item in bills" :key="item.id">
|
||||||
:refresher-triggered="isRefreshing"
|
<!-- 左侧勾选 + 信息 -->
|
||||||
@refresherrefresh="refresh"
|
<view class="bill-left">
|
||||||
@scrolltolower="loadMore"
|
<u-checkbox v-model="item.checked" @change="toggleCheck(item)" size="32"
|
||||||
>
|
active-color="#EA414A" />
|
||||||
<view v-if="bills.length > 0">
|
<view class="bill-info">
|
||||||
<view
|
<text class="bill-name">{{ item.feeName }}</text>
|
||||||
class="bill-item"
|
<text class="bill-date">缴费截止:<text class="date">{{ item.dueDate }}</text></text>
|
||||||
v-for="item in bills"
|
</view>
|
||||||
:key="item.id"
|
</view>
|
||||||
>
|
|
||||||
<!-- 左侧勾选 + 信息 -->
|
|
||||||
<view class="bill-left">
|
|
||||||
<u-checkbox
|
|
||||||
v-model="item.checked"
|
|
||||||
@change="toggleCheck(item)"
|
|
||||||
size="32"
|
|
||||||
active-color="#007aff"
|
|
||||||
/>
|
|
||||||
<view class="bill-info">
|
|
||||||
<text class="bill-name">{{ item.feeName }}</text>
|
|
||||||
<text class="bill-date">缴费截止:{{ item.dueDate }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 右侧金额 + 支付按钮 -->
|
<!-- 右侧金额 + 支付按钮 -->
|
||||||
<view class="bill-right">
|
<view class="bill-right">
|
||||||
<text class="amount">{{ formatMoney(item.amount) }}</text>
|
<text class="amount">{{ formatMoney(item.amount) }}</text>
|
||||||
<button
|
<button class="pay-btn" @click="goPayTest([item])">去支付
|
||||||
class="pay-btn"
|
</button>
|
||||||
@click="goPayTest([item])"
|
</view>
|
||||||
>去支付
|
</view>
|
||||||
</button>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
<view v-else class="empty">
|
||||||
|
<u-empty mode="list" text="暂无待支付账单" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<u-loadmore :status="loadStatus" />
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<!-- 底部批量支付栏 -->
|
||||||
|
<view v-if="selectedBills.length > 0" class="batch-pay-bar">
|
||||||
|
<view class="batch-pay-bar-left"><text>已选 {{ selectedBills.length }} 项</text></view>
|
||||||
|
<view class="batch-pay-bar-center">
|
||||||
|
合计:<text class="sumAmount">{{ formatMoney(sumAmount) }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else class="empty">
|
|
||||||
<u-empty mode="list" text="暂无待支付账单" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<u-loadmore :status="loadStatus" />
|
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
<!-- 底部批量支付栏 -->
|
|
||||||
<view v-if="selectedBills.length > 0" class="batch-pay-bar">
|
|
||||||
<view class="batch-pay-bar-left"><text>已选 {{ selectedBills.length }} 项</text></view>
|
|
||||||
<view class="batch-pay-bar-right">
|
<view class="batch-pay-bar-right">
|
||||||
<text class="sumAmount">{{ formatMoney(sumAmount) }}</text>
|
<button class="bottomPayBtn" color="linear-gradient(90deg, #007aff, #00aaff)" type="primary"
|
||||||
<button class="bottomPayBtn" color="linear-gradient(90deg, #007aff, #00aaff)" type="primary" size="small" @click="goPayTest(selectedBills)">
|
size="small" @click="goPayTest(selectedBills)">
|
||||||
批量支付
|
批量支付
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
bills: [],
|
bills: [],
|
||||||
isRefreshing: false,
|
isRefreshing: false,
|
||||||
loadStatus: 'more',
|
loadStatus: 'more',
|
||||||
sumAmount: 0,
|
sumAmount: 0,
|
||||||
selectedBills: [], // 勾选的账单集合
|
selectedBills: [], // 勾选的账单集合
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.loadBills();
|
this.loadBills();
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow() {},
|
||||||
},
|
methods: {
|
||||||
methods: {
|
loadBills() {
|
||||||
loadBills() {
|
this.bills = [{
|
||||||
this.bills = [
|
id: 'p101',
|
||||||
{
|
feeName: '第一期租金(2024.12.01-2024.12.31)',
|
||||||
id: 'p101',
|
dueDate: '2024-12-15',
|
||||||
feeName: '第一期租金(2024.12.01-2024.12.31)',
|
amount: 300000,
|
||||||
dueDate: '2024-12-15',
|
checked: false,
|
||||||
amount: 300000,
|
},
|
||||||
checked: false,
|
{
|
||||||
},
|
id: 'p102',
|
||||||
{
|
feeName: '第二期物业费(2025.01.01-2025.01.31)',
|
||||||
id: 'p102',
|
dueDate: '2025-01-15',
|
||||||
feeName: '第二期物业费(2025.01.01-2025.01.31)',
|
amount: 500,
|
||||||
dueDate: '2025-01-15',
|
checked: false,
|
||||||
amount: 500,
|
},
|
||||||
checked: false,
|
];
|
||||||
},
|
this.updateSelected();
|
||||||
];
|
},
|
||||||
this.updateSelected();
|
refresh() {
|
||||||
},
|
this.isRefreshing = true;
|
||||||
refresh() {
|
setTimeout(() => {
|
||||||
this.isRefreshing = true;
|
this.loadBills();
|
||||||
setTimeout(() => {
|
this.isRefreshing = false;
|
||||||
this.loadBills();
|
}, 1000);
|
||||||
this.isRefreshing = false;
|
},
|
||||||
}, 1000);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadMore() {
|
loadMore() {
|
||||||
this.loadStatus = 'noMore';
|
this.loadStatus = 'noMore';
|
||||||
},
|
},
|
||||||
|
|
||||||
formatMoney(val) {
|
formatMoney(val) {
|
||||||
if (val === null || val === undefined || isNaN(val)) return '—';
|
if (val === null || val === undefined || isNaN(val)) return '—';
|
||||||
|
|
||||||
val = Number(val);
|
|
||||||
|
|
||||||
if (val >= 10000) {
|
|
||||||
return '¥' + (val / 10000).toFixed(2) + '万';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '¥' + val.toFixed(2);
|
|
||||||
},
|
|
||||||
toggleCheck(item) {
|
|
||||||
item.checked = !item.checked;
|
|
||||||
if(item.checked && !this.selectedBills.some(b => b.id === item.id)) {
|
|
||||||
this.selectedBills.push(item);
|
|
||||||
}else{
|
|
||||||
// 取消勾选时从已选数组移除
|
|
||||||
this.selectedBills = this.selectedBills.filter(b => b.id !== item.id);
|
|
||||||
}
|
|
||||||
let sumFee = 0;
|
|
||||||
this.selectedBills.forEach(b => sumFee += b.amount);
|
|
||||||
this.sumAmount = sumFee;
|
|
||||||
},
|
|
||||||
updateSelected() {
|
|
||||||
if (!Array.isArray(this.bills)) return;
|
|
||||||
this.selectedBills = this.bills.filter(b => b.checked);
|
|
||||||
},
|
|
||||||
goPayTest(billList) {
|
|
||||||
if (!billList || billList.length === 0) return;
|
|
||||||
|
|
||||||
// 模拟后台生成订单返回
|
val = Number(val);
|
||||||
const order = {
|
|
||||||
timeStamp: String(Date.now()), // 时间戳
|
|
||||||
nonceStr: Math.random().toString(36).substr(2, 15), // 随机字符串
|
|
||||||
package: 'prepay_id=TEST1234567890', // 模拟预支付ID
|
|
||||||
signType: 'MD5',
|
|
||||||
paySign: 'TEST_SIGN', // 模拟签名
|
|
||||||
};
|
|
||||||
|
|
||||||
// 调用微信支付接口(测试)
|
if (val >= 10000) {
|
||||||
uni.requestPayment({
|
return '¥' + (val / 10000).toFixed(2) + '万';
|
||||||
...order,
|
}
|
||||||
success: () => {
|
|
||||||
uni.showToast({ title: '支付成功(测试)', icon: 'success' });
|
|
||||||
// 清空勾选状态
|
|
||||||
billList.forEach(b => b.checked = false);
|
|
||||||
this.updateSelected();
|
|
||||||
// 刷新列表(可选)
|
|
||||||
this.loadBills();
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
uni.showToast({ title: '支付失败(测试)', icon: 'none' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async goPay(billList) {
|
|
||||||
if (!billList || billList.length === 0) return;
|
|
||||||
|
|
||||||
try {
|
return '¥' + val.toFixed(2);
|
||||||
// 1. 请求后台生成订单
|
},
|
||||||
const res = await uni.request({
|
toggleCheck(item) {
|
||||||
url: 'https://api.example.com/payments/create',
|
item.checked = !item.checked;
|
||||||
method: 'POST',
|
if (item.checked && !this.selectedBills.some(b => b.id === item.id)) {
|
||||||
data: {
|
this.selectedBills.push(item);
|
||||||
userId: this.userId,
|
} else {
|
||||||
bills: billList.map(b => b.id),
|
// 取消勾选时从已选数组移除
|
||||||
}
|
this.selectedBills = this.selectedBills.filter(b => b.id !== item.id);
|
||||||
});
|
}
|
||||||
|
let sumFee = 0;
|
||||||
|
this.selectedBills.forEach(b => sumFee += b.amount);
|
||||||
|
this.sumAmount = sumFee;
|
||||||
|
},
|
||||||
|
updateSelected() {
|
||||||
|
if (!Array.isArray(this.bills)) return;
|
||||||
|
this.selectedBills = this.bills.filter(b => b.checked);
|
||||||
|
},
|
||||||
|
goPayTest(billList) {
|
||||||
|
if (!billList || billList.length === 0) return;
|
||||||
|
|
||||||
if (res[1].data.code !== 0) {
|
// 模拟后台生成订单返回
|
||||||
uni.showToast({ title: res[1].data.msg, icon: 'none' });
|
const order = {
|
||||||
return;
|
timeStamp: String(Date.now()), // 时间戳
|
||||||
}
|
nonceStr: Math.random().toString(36).substr(2, 15), // 随机字符串
|
||||||
|
package: 'prepay_id=TEST1234567890', // 模拟预支付ID
|
||||||
|
signType: 'MD5',
|
||||||
|
paySign: 'TEST_SIGN', // 模拟签名
|
||||||
|
};
|
||||||
|
|
||||||
const order = res[1].data.data; // 后台返回的支付参数
|
// 调用微信支付接口(测试)
|
||||||
|
uni.requestPayment({
|
||||||
|
...order,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功(测试)',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
// 清空勾选状态
|
||||||
|
billList.forEach(b => b.checked = false);
|
||||||
|
this.updateSelected();
|
||||||
|
// 刷新列表(可选)
|
||||||
|
this.loadBills();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付失败(测试)',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async goPay(billList) {
|
||||||
|
if (!billList || billList.length === 0) return;
|
||||||
|
|
||||||
// 2. 调用微信支付
|
try {
|
||||||
uni.requestPayment({
|
// 1. 请求后台生成订单
|
||||||
timeStamp: order.timeStamp,
|
const res = await uni.request({
|
||||||
nonceStr: order.nonceStr,
|
url: 'https://api.example.com/payments/create',
|
||||||
package: order.package,
|
method: 'POST',
|
||||||
signType: order.signType,
|
data: {
|
||||||
paySign: order.paySign,
|
userId: this.userId,
|
||||||
success: () => {
|
bills: billList.map(b => b.id),
|
||||||
uni.showToast({ title: '支付成功', icon: 'success' });
|
}
|
||||||
// 更新勾选状态
|
});
|
||||||
billList.forEach(b => b.checked = false);
|
|
||||||
this.updateSelected();
|
|
||||||
// 刷新列表
|
|
||||||
this.loadBills();
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
uni.showToast({ title: '支付失败', icon: 'none' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
if (res[1].data.code !== 0) {
|
||||||
console.error('支付请求失败', error);
|
uni.showToast({
|
||||||
uni.showToast({ title: '支付请求失败', icon: 'none' });
|
title: res[1].data.msg,
|
||||||
}
|
icon: 'none'
|
||||||
},
|
});
|
||||||
}
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
const order = res[1].data.data; // 后台返回的支付参数
|
||||||
|
|
||||||
|
// 2. 调用微信支付
|
||||||
|
uni.requestPayment({
|
||||||
|
timeStamp: order.timeStamp,
|
||||||
|
nonceStr: order.nonceStr,
|
||||||
|
package: order.package,
|
||||||
|
signType: order.signType,
|
||||||
|
paySign: order.paySign,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
// 更新勾选状态
|
||||||
|
billList.forEach(b => b.checked = false);
|
||||||
|
this.updateSelected();
|
||||||
|
// 刷新列表
|
||||||
|
this.loadBills();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('支付请求失败', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付请求失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pending-bill-page {
|
.pending-bill-page {
|
||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-top: 175rpx; /* 自定义导航栏高度 */
|
padding-top: 120rpx;
|
||||||
}
|
/* 自定义导航栏高度 */
|
||||||
|
}
|
||||||
.scroll-content {
|
|
||||||
padding: 20rpx;
|
.scroll-content {
|
||||||
box-sizing: border-box;
|
padding: 20rpx;
|
||||||
}
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
.bill-item {
|
|
||||||
display: flex;
|
.bill-item {
|
||||||
justify-content: space-between;
|
display: flex;
|
||||||
background: #fff;
|
justify-content: space-between;
|
||||||
margin-bottom: 20rpx;
|
background: #fff;
|
||||||
border-radius: 12rpx;
|
margin-bottom: 20rpx;
|
||||||
padding: 20rpx;
|
border-radius: 12rpx;
|
||||||
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
|
padding: 20rpx;
|
||||||
}
|
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
.bill-left {
|
|
||||||
display: flex;
|
.bill-left {
|
||||||
align-items: center;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.bill-info {
|
|
||||||
display: flex;
|
.bill-info {
|
||||||
flex-direction: column;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.bill-name {
|
|
||||||
font-size: 28rpx;
|
.bill-name {
|
||||||
color: #333;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
color: #2D2B2C;
|
||||||
}
|
font-weight: 500;
|
||||||
|
}
|
||||||
.bill-date {
|
|
||||||
font-size: 24rpx;
|
.bill-date {
|
||||||
color: #666;
|
font-size: 26rpx;
|
||||||
margin-top: 6rpx;
|
color: #86868C;
|
||||||
}
|
margin-top: 6rpx;
|
||||||
}
|
|
||||||
}
|
.date{
|
||||||
|
font-size: 24rpx;
|
||||||
.bill-right {
|
color: #2D2B2C;
|
||||||
flex-direction: column;
|
}
|
||||||
align-items: flex-end;
|
}
|
||||||
width: 30%;
|
}
|
||||||
.amount {
|
}
|
||||||
text-align: center;
|
|
||||||
font-size: 28rpx;
|
.bill-right {
|
||||||
height: 28rpx;
|
flex-direction: column;
|
||||||
line-height: 28rpx;
|
align-items: flex-end;
|
||||||
color: #ff7f00;
|
width: 30%;
|
||||||
}
|
|
||||||
|
.amount {
|
||||||
.pay-btn {
|
text-align: center;
|
||||||
margin-top: 12rpx;
|
font-size: 30rpx;
|
||||||
padding: 0 40rpx;
|
height: 28rpx;
|
||||||
height: 60rpx;
|
line-height: 28rpx;
|
||||||
line-height: 60rpx;
|
color: #EF8849;
|
||||||
border-radius: 30rpx; // 圆角
|
}
|
||||||
font-size: 28rpx;
|
|
||||||
color: #fff;
|
.pay-btn {
|
||||||
background: linear-gradient(90deg, #007aff, #00aaff);
|
margin-top: 12rpx;
|
||||||
text-align: center;
|
padding: 0 40rpx;
|
||||||
}
|
height: 60rpx;
|
||||||
.btn-text{
|
line-height: 60rpx;
|
||||||
padding-top: 13rpx;
|
border-radius: 6rpx; // 圆角
|
||||||
}
|
font-size: 30rpx;
|
||||||
}
|
color: #fff;
|
||||||
|
background-color: #F34038;
|
||||||
.batch-pay-bar {
|
text-align: center;
|
||||||
position: fixed;
|
}
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
.btn-text {
|
||||||
right: 0;
|
padding-top: 13rpx;
|
||||||
height: 170rpx;
|
}
|
||||||
padding: 0 30rpx;
|
}
|
||||||
background-color: #fff;
|
|
||||||
display: flex;
|
.batch-pay-bar {
|
||||||
align-items: center;
|
position: fixed;
|
||||||
justify-content: space-between;
|
bottom: 0;
|
||||||
box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.08);
|
left: 0;
|
||||||
z-index: 999;
|
right: 0;
|
||||||
.batch-pay-bar-left{
|
height: 170rpx;
|
||||||
font-size: 28rpx;
|
padding: 0 30rpx;
|
||||||
color: #333;
|
background-color: #fff;
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.batch-pay-bar-right{
|
justify-content: space-between;
|
||||||
flex-direction: column;
|
box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.08);
|
||||||
align-items: flex-end;
|
z-index: 999;
|
||||||
.sumAmount{
|
|
||||||
font-size: 28rpx;
|
.batch-pay-bar-left {
|
||||||
color: #ff7f00;
|
font-size: 28rpx;
|
||||||
}
|
color: #86868C;
|
||||||
.bottomPayBtn {
|
}
|
||||||
margin-top: 12rpx;
|
|
||||||
height: 60rpx;
|
.batch-pay-bar-center {
|
||||||
line-height: 60rpx;
|
font-size: 28rpx;
|
||||||
padding: 0 40rpx;
|
color: #222222;
|
||||||
border-radius: 30rpx;
|
|
||||||
font-size: 28rpx;
|
.sumAmount {
|
||||||
font-weight: bold;
|
font-size: 28rpx;
|
||||||
text-align: center;
|
color: #ff7f00;
|
||||||
background: linear-gradient(90deg, #007aff, #00aaff);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.batch-pay-bar-right {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
.bottomPayBtn {
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
background: #F34038;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
margin-top: 200rpx;
|
margin-top: 200rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,336 +1,352 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="pending-bill-page">
|
<view class="pending-bill-page">
|
||||||
<!-- 自定义导航栏 -->
|
<!-- 自定义导航栏 -->
|
||||||
<custom-navbar title="水电缴费" />
|
<custom-navbar title="水电缴费" />
|
||||||
|
|
||||||
<scroll-view
|
<scroll-view scroll-y class="scroll-content" :refresher-enabled="true" :refresher-triggered="isRefreshing"
|
||||||
scroll-y
|
@refresherrefresh="refresh" @scrolltolower="loadMore">
|
||||||
class="scroll-content"
|
<view v-if="bills.length > 0">
|
||||||
:refresher-enabled="true"
|
<view class="bill-item" v-for="item in bills" :key="item.id">
|
||||||
:refresher-triggered="isRefreshing"
|
<!-- 左侧勾选 + 信息 -->
|
||||||
@refresherrefresh="refresh"
|
<view class="bill-left">
|
||||||
@scrolltolower="loadMore"
|
<u-checkbox v-model="item.checked" @change="toggleCheck(item)" size="32"
|
||||||
>
|
active-color="#EA414A" />
|
||||||
<view v-if="bills.length > 0">
|
<view class="bill-info">
|
||||||
<view
|
<text class="bill-name">{{ item.feeName }}</text>
|
||||||
class="bill-item"
|
<text class="bill-date">缴费截止:<text class="date">{{ item.dueDate }}</text></text>
|
||||||
v-for="item in bills"
|
</view>
|
||||||
:key="item.id"
|
</view>
|
||||||
>
|
|
||||||
<!-- 左侧勾选 + 信息 -->
|
|
||||||
<view class="bill-left">
|
|
||||||
<u-checkbox
|
|
||||||
v-model="item.checked"
|
|
||||||
@change="toggleCheck(item)"
|
|
||||||
size="32"
|
|
||||||
active-color="#007aff"
|
|
||||||
/>
|
|
||||||
<view class="bill-info">
|
|
||||||
<text class="bill-name">{{ item.feeName }}</text>
|
|
||||||
<text class="bill-date">缴费截止:{{ item.dueDate }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 右侧金额 + 支付按钮 -->
|
<!-- 右侧金额 + 支付按钮 -->
|
||||||
<view class="bill-right">
|
<view class="bill-right">
|
||||||
<text class="amount">{{ formatMoney(item.amount) }}</text>
|
<text class="amount">{{ formatMoney(item.amount) }}</text>
|
||||||
<button
|
<button class="pay-btn" @click="goPayTest([item])">去支付
|
||||||
class="pay-btn"
|
</button>
|
||||||
@click="goPayTest([item])"
|
</view>
|
||||||
>去支付
|
</view>
|
||||||
</button>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
<view v-else class="empty">
|
||||||
|
<u-empty mode="list" text="暂无水电费账单" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<u-loadmore :status="loadStatus" />
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<!-- 底部批量支付栏 -->
|
||||||
|
<view v-if="selectedBills.length > 0" class="batch-pay-bar">
|
||||||
|
<view class="batch-pay-bar-left"><text>已选 {{ selectedBills.length }} 项</text></view>
|
||||||
|
<view class="batch-pay-bar-center">
|
||||||
|
合计:<text class="sumAmount">{{ formatMoney(sumAmount) }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else class="empty">
|
|
||||||
<u-empty mode="list" text="暂无水电费账单" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<u-loadmore :status="loadStatus" />
|
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
<!-- 底部批量支付栏 -->
|
|
||||||
<view v-if="selectedBills.length > 0" class="batch-pay-bar">
|
|
||||||
<view class="batch-pay-bar-left"><text>已选 {{ selectedBills.length }} 项</text></view>
|
|
||||||
<view class="batch-pay-bar-right">
|
<view class="batch-pay-bar-right">
|
||||||
<text class="sumAmount">{{ formatMoney(sumAmount) }}</text>
|
<button class="bottomPayBtn" color="linear-gradient(90deg, #007aff, #00aaff)" type="primary"
|
||||||
<button class="bottomPayBtn" color="linear-gradient(90deg, #007aff, #00aaff)" type="primary" size="small" @click="goPayTest(selectedBills)">
|
size="small" @click="goPayTest(selectedBills)">
|
||||||
批量缴费
|
批量缴费
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
bills: [],
|
bills: [],
|
||||||
isRefreshing: false,
|
isRefreshing: false,
|
||||||
loadStatus: 'more',
|
loadStatus: 'more',
|
||||||
sumAmount: 0,
|
sumAmount: 0,
|
||||||
selectedBills: [], // 勾选的账单集合
|
selectedBills: [], // 勾选的账单集合
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.loadBills();
|
this.loadBills();
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow() {},
|
||||||
},
|
methods: {
|
||||||
methods: {
|
loadBills() {
|
||||||
loadBills() {
|
this.bills = [{
|
||||||
this.bills = [
|
id: 1,
|
||||||
{
|
feeName: '电费(2025.10)',
|
||||||
id: 1,
|
dueDate: '2025-11-20',
|
||||||
feeName: '电费(2025.10)',
|
amount: 120.5,
|
||||||
dueDate: '2025-11-20',
|
checked: false
|
||||||
amount: 120.5,
|
},
|
||||||
checked: false
|
{
|
||||||
},
|
id: 2,
|
||||||
{
|
feeName: '水费(2025.10)',
|
||||||
id: 2,
|
dueDate: '2025-11-22',
|
||||||
feeName: '水费(2025.10)',
|
amount: 60.2,
|
||||||
dueDate: '2025-11-22',
|
checked: false
|
||||||
amount: 60.2,
|
}
|
||||||
checked: false
|
];
|
||||||
}
|
this.updateSelected();
|
||||||
];
|
},
|
||||||
this.updateSelected();
|
refresh() {
|
||||||
},
|
this.isRefreshing = true;
|
||||||
refresh() {
|
setTimeout(() => {
|
||||||
this.isRefreshing = true;
|
this.loadBills();
|
||||||
setTimeout(() => {
|
this.isRefreshing = false;
|
||||||
this.loadBills();
|
}, 1000);
|
||||||
this.isRefreshing = false;
|
},
|
||||||
}, 1000);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadMore() {
|
loadMore() {
|
||||||
this.loadStatus = 'noMore';
|
this.loadStatus = 'noMore';
|
||||||
},
|
},
|
||||||
|
|
||||||
formatMoney(val) {
|
formatMoney(val) {
|
||||||
if (val === null || val === undefined || isNaN(val)) return '—';
|
if (val === null || val === undefined || isNaN(val)) return '—';
|
||||||
|
|
||||||
val = Number(val);
|
|
||||||
|
|
||||||
if (val >= 10000) {
|
|
||||||
return '¥' + (val / 10000).toFixed(2) + '万';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '¥' + val.toFixed(2);
|
|
||||||
},
|
|
||||||
toggleCheck(item) {
|
|
||||||
item.checked = !item.checked;
|
|
||||||
if(item.checked && !this.selectedBills.some(b => b.id === item.id)) {
|
|
||||||
this.selectedBills.push(item);
|
|
||||||
}else{
|
|
||||||
// 取消勾选时从已选数组移除
|
|
||||||
this.selectedBills = this.selectedBills.filter(b => b.id !== item.id);
|
|
||||||
}
|
|
||||||
let sumFee = 0;
|
|
||||||
this.selectedBills.forEach(b => sumFee += b.amount);
|
|
||||||
this.sumAmount = sumFee;
|
|
||||||
},
|
|
||||||
updateSelected() {
|
|
||||||
if (!Array.isArray(this.bills)) return;
|
|
||||||
this.selectedBills = this.bills.filter(b => b.checked);
|
|
||||||
},
|
|
||||||
goPayTest(billList) {
|
|
||||||
if (!billList || billList.length === 0) return;
|
|
||||||
|
|
||||||
// 模拟后台生成订单返回
|
val = Number(val);
|
||||||
const order = {
|
|
||||||
timeStamp: String(Date.now()), // 时间戳
|
|
||||||
nonceStr: Math.random().toString(36).substr(2, 15), // 随机字符串
|
|
||||||
package: 'prepay_id=TEST1234567890', // 模拟预支付ID
|
|
||||||
signType: 'MD5',
|
|
||||||
paySign: 'TEST_SIGN', // 模拟签名
|
|
||||||
};
|
|
||||||
|
|
||||||
// 调用微信支付接口(测试)
|
if (val >= 10000) {
|
||||||
uni.requestPayment({
|
return '¥' + (val / 10000).toFixed(2) + '万';
|
||||||
...order,
|
}
|
||||||
success: () => {
|
|
||||||
uni.showToast({ title: '支付成功(测试)', icon: 'success' });
|
|
||||||
// 清空勾选状态
|
|
||||||
billList.forEach(b => b.checked = false);
|
|
||||||
this.updateSelected();
|
|
||||||
// 刷新列表(可选)
|
|
||||||
this.loadBills();
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
uni.showToast({ title: '支付失败(测试)', icon: 'none' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async goPay(billList) {
|
|
||||||
if (!billList || billList.length === 0) return;
|
|
||||||
|
|
||||||
try {
|
return '¥' + val.toFixed(2);
|
||||||
// 1. 请求后台生成订单
|
},
|
||||||
const res = await uni.request({
|
toggleCheck(item) {
|
||||||
url: 'https://api.example.com/payments/create',
|
item.checked = !item.checked;
|
||||||
method: 'POST',
|
if (item.checked && !this.selectedBills.some(b => b.id === item.id)) {
|
||||||
data: {
|
this.selectedBills.push(item);
|
||||||
userId: this.userId,
|
} else {
|
||||||
bills: billList.map(b => b.id),
|
// 取消勾选时从已选数组移除
|
||||||
}
|
this.selectedBills = this.selectedBills.filter(b => b.id !== item.id);
|
||||||
});
|
}
|
||||||
|
let sumFee = 0;
|
||||||
|
this.selectedBills.forEach(b => sumFee += b.amount);
|
||||||
|
this.sumAmount = sumFee;
|
||||||
|
},
|
||||||
|
updateSelected() {
|
||||||
|
if (!Array.isArray(this.bills)) return;
|
||||||
|
this.selectedBills = this.bills.filter(b => b.checked);
|
||||||
|
},
|
||||||
|
goPayTest(billList) {
|
||||||
|
if (!billList || billList.length === 0) return;
|
||||||
|
|
||||||
if (res[1].data.code !== 0) {
|
// 模拟后台生成订单返回
|
||||||
uni.showToast({ title: res[1].data.msg, icon: 'none' });
|
const order = {
|
||||||
return;
|
timeStamp: String(Date.now()), // 时间戳
|
||||||
}
|
nonceStr: Math.random().toString(36).substr(2, 15), // 随机字符串
|
||||||
|
package: 'prepay_id=TEST1234567890', // 模拟预支付ID
|
||||||
|
signType: 'MD5',
|
||||||
|
paySign: 'TEST_SIGN', // 模拟签名
|
||||||
|
};
|
||||||
|
|
||||||
const order = res[1].data.data; // 后台返回的支付参数
|
// 调用微信支付接口(测试)
|
||||||
|
uni.requestPayment({
|
||||||
|
...order,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功(测试)',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
// 清空勾选状态
|
||||||
|
billList.forEach(b => b.checked = false);
|
||||||
|
this.updateSelected();
|
||||||
|
// 刷新列表(可选)
|
||||||
|
this.loadBills();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付失败(测试)',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async goPay(billList) {
|
||||||
|
if (!billList || billList.length === 0) return;
|
||||||
|
|
||||||
// 2. 调用微信支付
|
try {
|
||||||
uni.requestPayment({
|
// 1. 请求后台生成订单
|
||||||
timeStamp: order.timeStamp,
|
const res = await uni.request({
|
||||||
nonceStr: order.nonceStr,
|
url: 'https://api.example.com/payments/create',
|
||||||
package: order.package,
|
method: 'POST',
|
||||||
signType: order.signType,
|
data: {
|
||||||
paySign: order.paySign,
|
userId: this.userId,
|
||||||
success: () => {
|
bills: billList.map(b => b.id),
|
||||||
uni.showToast({ title: '支付成功', icon: 'success' });
|
}
|
||||||
// 更新勾选状态
|
});
|
||||||
billList.forEach(b => b.checked = false);
|
|
||||||
this.updateSelected();
|
|
||||||
// 刷新列表
|
|
||||||
this.loadBills();
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
uni.showToast({ title: '支付失败', icon: 'none' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
if (res[1].data.code !== 0) {
|
||||||
console.error('支付请求失败', error);
|
uni.showToast({
|
||||||
uni.showToast({ title: '支付请求失败', icon: 'none' });
|
title: res[1].data.msg,
|
||||||
}
|
icon: 'none'
|
||||||
},
|
});
|
||||||
}
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
const order = res[1].data.data; // 后台返回的支付参数
|
||||||
|
|
||||||
|
// 2. 调用微信支付
|
||||||
|
uni.requestPayment({
|
||||||
|
timeStamp: order.timeStamp,
|
||||||
|
nonceStr: order.nonceStr,
|
||||||
|
package: order.package,
|
||||||
|
signType: order.signType,
|
||||||
|
paySign: order.paySign,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
// 更新勾选状态
|
||||||
|
billList.forEach(b => b.checked = false);
|
||||||
|
this.updateSelected();
|
||||||
|
// 刷新列表
|
||||||
|
this.loadBills();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('支付请求失败', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付请求失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pending-bill-page {
|
.pending-bill-page {
|
||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-top: 175rpx; /* 自定义导航栏高度 */
|
padding-top: 120rpx;
|
||||||
}
|
/* 自定义导航栏高度 */
|
||||||
|
}
|
||||||
.scroll-content {
|
|
||||||
padding: 20rpx;
|
.scroll-content {
|
||||||
box-sizing: border-box;
|
padding: 20rpx;
|
||||||
}
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
.bill-item {
|
|
||||||
display: flex;
|
.bill-item {
|
||||||
justify-content: space-between;
|
display: flex;
|
||||||
background: #fff;
|
justify-content: space-between;
|
||||||
margin-bottom: 20rpx;
|
background: #fff;
|
||||||
border-radius: 12rpx;
|
margin-bottom: 20rpx;
|
||||||
padding: 20rpx;
|
border-radius: 12rpx;
|
||||||
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
|
padding: 20rpx;
|
||||||
}
|
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
.bill-left {
|
|
||||||
display: flex;
|
.bill-left {
|
||||||
align-items: center;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.bill-info {
|
|
||||||
display: flex;
|
.bill-info {
|
||||||
flex-direction: column;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.bill-name {
|
|
||||||
font-size: 28rpx;
|
.bill-name {
|
||||||
color: #333;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
color: #2D2B2C;
|
||||||
}
|
font-weight: 500;
|
||||||
|
}
|
||||||
.bill-date {
|
|
||||||
font-size: 24rpx;
|
.bill-date {
|
||||||
color: #666;
|
font-size: 24rpx;
|
||||||
margin-top: 6rpx;
|
color: #86868C;
|
||||||
}
|
margin-top: 6rpx;
|
||||||
}
|
|
||||||
}
|
.date{
|
||||||
|
font-size: 24rpx;
|
||||||
.bill-right {
|
color: #2D2B2C;
|
||||||
flex-direction: column;
|
}
|
||||||
align-items: flex-end;
|
}
|
||||||
width: 30%;
|
}
|
||||||
.amount {
|
}
|
||||||
text-align: center;
|
|
||||||
font-size: 28rpx;
|
.bill-right {
|
||||||
height: 28rpx;
|
flex-direction: column;
|
||||||
line-height: 28rpx;
|
align-items: flex-end;
|
||||||
font-size: 28rpx;
|
width: 30%;
|
||||||
color: #ff7f00;
|
|
||||||
}
|
.amount {
|
||||||
|
text-align: center;
|
||||||
.pay-btn {
|
height: 28rpx;
|
||||||
margin-top: 12rpx;
|
line-height: 28rpx;
|
||||||
padding: 0 40rpx;
|
font-size: 30rpx;
|
||||||
height: 60rpx;
|
color: #EF8849;
|
||||||
line-height: 60rpx;
|
}
|
||||||
border-radius: 30rpx; // 圆角
|
|
||||||
font-size: 28rpx;
|
.pay-btn {
|
||||||
color: #fff;
|
margin-top: 12rpx;
|
||||||
background: linear-gradient(90deg, #007aff, #00aaff);
|
padding: 0 40rpx;
|
||||||
text-align: center;
|
height: 60rpx;
|
||||||
}
|
line-height: 60rpx;
|
||||||
.btn-text{
|
border-radius: 6rpx; // 圆角
|
||||||
padding-top: 13rpx;
|
font-size: 30rpx;
|
||||||
}
|
color: #fff;
|
||||||
}
|
background-color: #F34038;
|
||||||
|
text-align: center;
|
||||||
.batch-pay-bar {
|
}
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
.btn-text {
|
||||||
left: 0;
|
padding-top: 13rpx;
|
||||||
right: 0;
|
}
|
||||||
height: 170rpx;
|
}
|
||||||
padding: 0 30rpx;
|
|
||||||
background-color: #fff;
|
.batch-pay-bar {
|
||||||
display: flex;
|
position: fixed;
|
||||||
align-items: center;
|
bottom: 0;
|
||||||
justify-content: space-between;
|
left: 0;
|
||||||
box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.08);
|
right: 0;
|
||||||
z-index: 999;
|
height: 170rpx;
|
||||||
.batch-pay-bar-left{
|
padding: 0 30rpx;
|
||||||
font-size: 28rpx;
|
background-color: #fff;
|
||||||
color: #333;
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
.batch-pay-bar-right{
|
box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.08);
|
||||||
flex-direction: column;
|
z-index: 999;
|
||||||
align-items: flex-end;
|
|
||||||
.sumAmount{
|
.batch-pay-bar-left {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #ff7f00;
|
color: #86868C;
|
||||||
}
|
}
|
||||||
.bottomPayBtn {
|
|
||||||
margin-top: 12rpx;
|
.batch-pay-bar-center {
|
||||||
height: 60rpx;
|
font-size: 28rpx;
|
||||||
line-height: 60rpx;
|
color: #222222;
|
||||||
padding: 0 40rpx;
|
|
||||||
border-radius: 30rpx;
|
.sumAmount {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: bold;
|
color: #ff7f00;
|
||||||
text-align: center;
|
}
|
||||||
background: linear-gradient(90deg, #007aff, #00aaff);
|
}
|
||||||
|
|
||||||
|
.batch-pay-bar-right {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
.bottomPayBtn {
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
background: #F34038;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
margin-top: 200rpx;
|
margin-top: 200rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user