feat(transDetail): 修复交易明细没有分页的问题
This commit is contained in:
parent
7fba675e7f
commit
a53e2cab6f
|
|
@ -1,301 +1,397 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="contentList" v-for="item,index in tableList" :key="index">
|
<view class="contentList" v-for="(item, index) in tableList" :key="index">
|
||||||
<view class="linebox">
|
<view class="linebox">
|
||||||
<view class="line_title">{{'交易状态'}}</view>
|
<view class="line_title">{{ '交易状态' }}</view>
|
||||||
<view class="line_content thesuccess">{{'完成'}}</view>
|
<view class="line_content thesuccess">{{ '完成' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="linebox">
|
<view class="linebox">
|
||||||
<view class="line_title">{{'单据编号'}}</view>
|
<view class="line_title">{{ '单据编号' }}</view>
|
||||||
<view class="line_content">{{item.tradeCode}}</view>
|
<view class="line_content">{{ item.tradeCode }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="linebox">
|
<view class="linebox">
|
||||||
<view class="line_title">{{'账户类型'}}</view>
|
<view class="line_title">{{ '账户类型' }}</view>
|
||||||
<view class="line_content">{{item.pkAccountVal}}</view>
|
<view class="line_content">{{ item.pkAccountVal }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="linebox">
|
<view class="linebox">
|
||||||
<view class="line_title">{{'交易类型'}}</view>
|
<view class="line_title">{{ '交易类型' }}</view>
|
||||||
<view class="line_content">{{item.tradeTypeVal}}</view>
|
<view class="line_content">{{ item.tradeTypeVal }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="linebox">
|
<view class="linebox">
|
||||||
<view class="line_title">{{'交易额度'}}</view>
|
<view class="line_title">{{ '交易额度' }}</view>
|
||||||
<view class="line_content">{{item.tradeAmount}}</view>
|
<view class="line_content">{{ item.tradeAmount }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="linebox">
|
<view class="linebox">
|
||||||
<view class="line_title">{{'交易余额'}}</view>
|
<view class="line_title">{{ '交易余额' }}</view>
|
||||||
<view class="line_content">{{item.tradeBalance |numberToCurrency}}</view>
|
<view class="line_content">{{
|
||||||
</view>
|
item.tradeBalance | numberToCurrency
|
||||||
<view class="linebox">
|
}}</view>
|
||||||
<view class="line_title">{{'交易时间'}}</view>
|
</view>
|
||||||
<view class="line_content">{{item.creationTime}}</view>
|
<view class="linebox">
|
||||||
</view>
|
<view class="line_title">{{ '交易时间' }}</view>
|
||||||
<view class="linebox">
|
<view class="line_content">{{ item.creationTime }}</view>
|
||||||
<view class="line_title">{{'备注'}}</view>
|
</view>
|
||||||
<view class="line_content">{{item.remarks}}</view>
|
<view class="linebox">
|
||||||
</view>
|
<view class="line_title">{{ '备注' }}</view>
|
||||||
</view>
|
<view class="line_content">{{ item.remarks }}</view>
|
||||||
<u-popup :show="sxShow" mode="right" @close="sxShow = false" :closeOnClickOverlay="false">
|
</view>
|
||||||
<view class="rightPopup">
|
</view>
|
||||||
<view class="popup_top">
|
<u-popup
|
||||||
<view @click="getSearch">{{'筛选'}}</view>
|
:show="sxShow"
|
||||||
<view class="top_red" @click="sxShow = false">{{'返回'}}</view>
|
mode="right"
|
||||||
</view>
|
@close="sxShow = false"
|
||||||
<view class="typesBox">
|
:closeOnClickOverlay="false"
|
||||||
<view class="typeTitle">
|
>
|
||||||
{{'交易类型'}}
|
<view class="rightPopup">
|
||||||
</view>
|
<view class="popup_top">
|
||||||
<view class="choiceBox">
|
<view @click="getSearch">{{ '筛选' }}</view>
|
||||||
<view class="flex_btn" @click="clickTransType(item)" v-for="(item,index) in tradeTypeList"
|
<view class="top_red" @click="sxShow = false">{{ '返回' }}</view>
|
||||||
:key="index" :class="queryParams.tradeType==item.value?'selectbtn':''">
|
</view>
|
||||||
{{item.label}}
|
<view class="typesBox">
|
||||||
</view>
|
<view class="typeTitle">
|
||||||
|
{{ '交易类型' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="choiceBox">
|
||||||
<view class="typesBox">
|
<view
|
||||||
<view class="typeTitle">
|
class="flex_btn"
|
||||||
{{'账户类型'}}
|
@click="clickTransType(item)"
|
||||||
</view>
|
v-for="(item, index) in tradeTypeList"
|
||||||
<view class="choiceBox">
|
:key="index"
|
||||||
<view class="flex_btn"
|
:class="queryParams.tradeType == item.value ? 'selectbtn' : ''"
|
||||||
@click="clickAccountType(item)"
|
>
|
||||||
v-for="(item,index) in pkAccountList"
|
{{ item.label }}
|
||||||
:key="index"
|
</view>
|
||||||
:class="queryParams.pkAccount==item.pkId?'selectbtn':''">
|
</view>
|
||||||
{{item.accountName}}
|
</view>
|
||||||
</view>
|
<view class="typesBox">
|
||||||
|
<view class="typeTitle">
|
||||||
</view>
|
{{ '账户类型' }}
|
||||||
</view>
|
</view>
|
||||||
<view class="typesBox">
|
<view class="choiceBox">
|
||||||
<view class="typeTitle">
|
<view
|
||||||
{{'交易时间'}}
|
class="flex_btn"
|
||||||
</view>
|
@click="clickAccountType(item)"
|
||||||
<view class="choiceBox">
|
v-for="(item, index) in pkAccountList"
|
||||||
<view class="flex_btn" @click="openDate(0)">
|
:key="index"
|
||||||
{{queryParams.startDate?queryParams.startDate:'开始时间'}}
|
:class="queryParams.pkAccount == item.pkId ? 'selectbtn' : ''"
|
||||||
</view>
|
>
|
||||||
<view style="color: #666;">
|
{{ item.accountName }}
|
||||||
——
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex_btn" @click="openDate(1)">
|
</view>
|
||||||
{{queryParams.endDate?queryParams.endDate:'结束时间'}}
|
<view class="typesBox">
|
||||||
</view>
|
<view class="typeTitle">
|
||||||
</view>
|
{{ '交易时间' }}
|
||||||
</view>
|
</view>
|
||||||
<u-datetime-picker :closeOnClickOverlay="true" @close="dataShow = false" @cancel="dataShow = false"
|
<view class="choiceBox">
|
||||||
@confirm="getDate" :show="dataShow" v-model="value1" mode="date"></u-datetime-picker>
|
<view class="flex_btn" @click="openDate(0)">
|
||||||
<view class="popup_bottom">
|
{{ queryParams.startDate ? queryParams.startDate : '开始时间' }}
|
||||||
<view class="bottom_btn thebtn1" @click="clearAll">清空筛选条件</view>
|
</view>
|
||||||
<view class="bottom_btn thebtn2" @click="()=>{getSearch(),sxShow = false}">
|
<view style="color: #666"> —— </view>
|
||||||
确定
|
<view class="flex_btn" @click="openDate(1)">
|
||||||
</view>
|
{{ queryParams.endDate ? queryParams.endDate : '结束时间' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</u-popup>
|
<u-datetime-picker
|
||||||
</view>
|
:closeOnClickOverlay="true"
|
||||||
|
@close="dataShow = false"
|
||||||
|
@cancel="dataShow = false"
|
||||||
|
@confirm="getDate"
|
||||||
|
:show="dataShow"
|
||||||
|
v-model="value1"
|
||||||
|
mode="date"
|
||||||
|
></u-datetime-picker>
|
||||||
|
<view class="popup_bottom">
|
||||||
|
<view class="bottom_btn thebtn1" @click="clearAll">清空筛选条件</view>
|
||||||
|
<view
|
||||||
|
class="bottom_btn thebtn2"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
;(getSearch(), (sxShow = false))
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 加载提示 -->
|
||||||
|
<view
|
||||||
|
v-if="tableList.length > 0"
|
||||||
|
style="
|
||||||
|
padding: 30rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
font-size: 24rpx;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<view v-if="loading">加载中...</view>
|
||||||
|
<view v-else-if="!hasMore">没有更多数据了</view>
|
||||||
|
</view>
|
||||||
|
<!-- 空状态 -->
|
||||||
|
<view
|
||||||
|
v-if="tableList.length === 0 && !loading"
|
||||||
|
style="padding: 100rpx 0; text-align: center; color: #999"
|
||||||
|
>
|
||||||
|
暂无交易记录
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as bal from "@/config/balance.js"
|
import * as bal from '@/config/balance.js'
|
||||||
import {
|
import { formatMsToDate } from '@/util/index'
|
||||||
formatMsToDate
|
export default {
|
||||||
} from '@/util/index'
|
data() {
|
||||||
export default {
|
return {
|
||||||
data() {
|
sxShow: false,
|
||||||
return {
|
queryParams: {
|
||||||
sxShow: false,
|
pageNum: 1,
|
||||||
queryParams: {
|
pageSize: 50,
|
||||||
pageNum: 1,
|
tradeType: '', //交易类型
|
||||||
pageSize: 50,
|
pkAccount: '', //账户类型
|
||||||
tradeType: "", //交易类型
|
startDate: '',
|
||||||
pkAccount: "", //账户类型
|
endDate: '',
|
||||||
startDate: "",
|
},
|
||||||
endDate: ""
|
tradeTypeList: [], //交易类型
|
||||||
},
|
pkAccountList: [], //账户类型
|
||||||
tradeTypeList: [], //交易类型
|
tableList: [],
|
||||||
pkAccountList: [], //账户类型
|
timeIndex: 0,
|
||||||
tableList: [],
|
dataShow: false,
|
||||||
timeIndex: 0,
|
value1: '',
|
||||||
dataShow: false,
|
loading: false, // 加载状态
|
||||||
value1: ""
|
hasMore: true, // 是否还有更多数据
|
||||||
}
|
total: 0, // 总记录数
|
||||||
},
|
}
|
||||||
onLoad() {
|
},
|
||||||
this.getOthers()
|
onLoad() {
|
||||||
this.getSearch()
|
this.getOthers()
|
||||||
},
|
this.getSearch()
|
||||||
onNavigationBarButtonTap() {
|
},
|
||||||
this.sxShow = true
|
onNavigationBarButtonTap() {
|
||||||
},
|
this.sxShow = true
|
||||||
methods: {
|
},
|
||||||
getDate(e) {
|
// 触底加载
|
||||||
if (this.timeIndex == 1) {
|
onReachBottom() {
|
||||||
this.queryParams.endDate = formatMsToDate(e.value)
|
this.loadMore()
|
||||||
} else {
|
},
|
||||||
this.queryParams.startDate = formatMsToDate(e.value)
|
methods: {
|
||||||
}
|
getDate(e) {
|
||||||
this.dataShow = false
|
if (this.timeIndex == 1) {
|
||||||
},
|
this.queryParams.endDate = formatMsToDate(e.value)
|
||||||
openDate(index) {
|
} else {
|
||||||
this.timeIndex = index
|
this.queryParams.startDate = formatMsToDate(e.value)
|
||||||
this.dataShow = true
|
}
|
||||||
},
|
this.dataShow = false
|
||||||
|
},
|
||||||
|
openDate(index) {
|
||||||
|
this.timeIndex = index
|
||||||
|
this.dataShow = true
|
||||||
|
},
|
||||||
|
|
||||||
clickTransType(item) {
|
clickTransType(item) {
|
||||||
this.queryParams.tradeType = item.value
|
this.queryParams.tradeType = item.value
|
||||||
},
|
},
|
||||||
clickAccountType(item) {
|
clickAccountType(item) {
|
||||||
// this.queryParams.pkAccount = item.pkId
|
// this.queryParams.pkAccount = item.pkId
|
||||||
console.log(item, '....item')
|
console.log(item, '....item')
|
||||||
this.$set(this.queryParams, 'pkAccount', item.pkId)
|
this.$set(this.queryParams, 'pkAccount', item.pkId)
|
||||||
},
|
},
|
||||||
getOthers() {
|
getOthers() {
|
||||||
bal.getTradeTypeList().then((res) => {
|
bal.getTradeTypeList().then(res => {
|
||||||
this.tradeTypeList = res.data;
|
this.tradeTypeList = res.data
|
||||||
});
|
})
|
||||||
bal.getEnumsAccountList().then((res) => {
|
bal.getEnumsAccountList().then(res => {
|
||||||
this.pkAccountList = res.data;
|
this.pkAccountList = res.data
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getSearch() {
|
// isReset: 是否重置列表(首次加载或筛选时为true,加载更多时为false)
|
||||||
bal.getTransactionDetails(this.queryParams).then(res => {
|
getSearch(isReset = true) {
|
||||||
this.tableList = res.rows
|
if (this.loading) return
|
||||||
})
|
|
||||||
},
|
this.loading = true
|
||||||
clearAll() {
|
|
||||||
this.sxShow = false
|
// 如果是重置,清空列表并重置页码
|
||||||
Object.assign(this.queryParams, {
|
if (isReset) {
|
||||||
pageNum: 1,
|
this.queryParams.pageNum = 1
|
||||||
pageSize: 50,
|
this.tableList = []
|
||||||
tradeType: "", //交易类型
|
this.hasMore = true
|
||||||
pkAccount: "", //账户类型
|
}
|
||||||
startDate: "",
|
|
||||||
})
|
bal
|
||||||
this.getSearch()
|
.getTransactionDetails(this.queryParams)
|
||||||
},
|
.then(res => {
|
||||||
}
|
if (isReset) {
|
||||||
}
|
// 首次加载或筛选,直接赋值
|
||||||
|
this.tableList = res.rows || []
|
||||||
|
} else {
|
||||||
|
// 加载更多,追加数据
|
||||||
|
this.tableList = [...this.tableList, ...(res.rows || [])]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新总数
|
||||||
|
this.total = res.total || 0
|
||||||
|
|
||||||
|
// 判断是否还有更多数据
|
||||||
|
this.hasMore = this.tableList.length < this.total
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('获取交易详情失败:', err)
|
||||||
|
uni.showToast({
|
||||||
|
title: '加载失败',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 加载更多
|
||||||
|
loadMore() {
|
||||||
|
// 如果正在加载或没有更多数据,直接返回
|
||||||
|
if (this.loading || !this.hasMore) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页码+1
|
||||||
|
this.queryParams.pageNum++
|
||||||
|
|
||||||
|
// 加载数据,不重置列表
|
||||||
|
this.getSearch(false)
|
||||||
|
},
|
||||||
|
clearAll() {
|
||||||
|
this.sxShow = false
|
||||||
|
Object.assign(this.queryParams, {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 50,
|
||||||
|
tradeType: '', //交易类型
|
||||||
|
pkAccount: '', //账户类型
|
||||||
|
startDate: '',
|
||||||
|
})
|
||||||
|
this.getSearch()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
::v-deep .u-popup__content {
|
::v-deep .u-popup__content {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
background: #F2F2F2;
|
background: #f2f2f2;
|
||||||
|
|
||||||
.contentList {
|
.contentList {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-top: 8rpx;
|
margin-top: 8rpx;
|
||||||
padding: 10rpx 23rpx;
|
padding: 10rpx 23rpx;
|
||||||
|
|
||||||
.linebox {
|
.linebox {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
margin: 14rpx 0;
|
margin: 14rpx 0;
|
||||||
|
|
||||||
.line_title {
|
.line_title {
|
||||||
min-width: 150rpx;
|
min-width: 150rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line_content {
|
.line_content {
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thesuccess {
|
.thesuccess {
|
||||||
color: #45C242;
|
color: #45c242;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rightPopup {
|
.rightPopup {
|
||||||
width: 645rpx;
|
width: 645rpx;
|
||||||
|
|
||||||
.popup_top {
|
.popup_top {
|
||||||
padding: 25rpx;
|
padding: 25rpx;
|
||||||
background-color: rgba(176, 196, 222, .45);
|
background-color: rgba(176, 196, 222, 0.45);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-family: Source Han Sans CN;
|
font-family: Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
|
|
||||||
.top_red {
|
.top_red {
|
||||||
color: #005BAC;
|
color: #005bac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.popup_bottom {
|
.popup_bottom {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.bottom_btn {
|
.bottom_btn {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 36rpx 0;
|
padding: 36rpx 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thebtn1 {
|
.thebtn1 {
|
||||||
background-color: rgba(176, 196, 222, .45);
|
background-color: rgba(176, 196, 222, 0.45);
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thebtn2 {
|
.thebtn2 {
|
||||||
background-color: #005BAC;
|
background-color: #005bac;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.typesBox {
|
.typesBox {
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
|
|
||||||
.typeTitle {
|
.typeTitle {
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-family: Source Han Sans CN;
|
font-family: Source Han Sans CN;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.choiceBox {
|
.choiceBox {
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 17rpx;
|
margin-top: 17rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.flex_btn {
|
.flex_btn {
|
||||||
background-color: rgba(176, 196, 222, .45);
|
background-color: rgba(176, 196, 222, 0.45);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 14rpx 48rpx;
|
padding: 14rpx 48rpx;
|
||||||
border-radius: 26rpx;
|
border-radius: 26rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-family: Source Han Sans CN;
|
font-family: Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin: 17rpx 5rpx;
|
margin: 17rpx 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectbtn {
|
.selectbtn {
|
||||||
background-color: #005BAC;
|
background-color: #005bac;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue