创作者微信小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
4.7 KiB

<template>
<view class="container">
<uni-list
border-full
v-for="(item,index) in withdrawList" :key="index"
>
<uni-list-item
showArrow
clickable
:title="'订单号:'+item.orderId"
:note="item.createTime+'&'+item.channel+'&'+item.status"
:rightText="'¥'+item.amt"
@click="targetToDetail(item.orderId)">
<template v-slot:body>
<view class="box">
<view class="uni-list-item__content-title">{{
item.createTime
}}</view>
<view class="box-bot">
<view>
{{ setChannel(item.channel) }}
</view>
<view :class="'primary-color'">
{{ setStatus(item.status)}}
</view>
</view>
</view>
</template>
</uni-list-item>
</uni-list>
<!-- 显示加载中或者全部加载完成 -->
<view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</view>
</template>
<script>
import {
getWithdrawList
} from '@/api/userInfo.js'
export default {
data() {
return {
withdrawList: [],
pageSize: 10,
pageNum: 1,
userInfo: {},
flag: false,
loadStatus:'noMore', //加载样式:more - 加载前样式,loading - 加载中样式,noMore - 没有数据样式
isLoadMore:false, //是否加载中
}
},
created() {
const userInfo = uni.getStorageSync('userInfo')
if (!userInfo) {
uni.showModal({
content: '艺术家账户过期,请重新登录!',
showCancel: false,
success() {
//没有缓存则跳转登录页面
uni.reLaunch({
url: '/pages/login/login'
});
}
});
} else {
this.userInfo = userInfo;
}
this.getWithdrawList();
},
// 下拉刷新
onPullDownRefresh() {
this.pageNum = 1
this.withdrawList = []
this.getWithdrawList()
uni.stopPullDownRefresh()
},
// 上划加载更多
onReachBottom() {//上拉触底函数
if(!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore=true
if (this.loadStatus === "more") {
this.pageNum += 1 //每次上拉请求新的一页
this.getWithdrawList();
}
}
},
methods: {
// 查询提现记录列表
async getWithdrawList() {
let that = this;
that.loadStatus = 'loading';
const res = await getWithdrawList({
pageSize: that.pageSize,
pageNum: that.pageNum,
creatorId: that.userInfo.id
})
if (res.data.code === 200) {
that.withdrawList.push(...res.data.rows)
if(res.data.rows.length < that.pageSize){ //判断接口返回数据量小于请求数据量,则表示此为最后一页
that.isLoadMore = true
that.loadStatus = 'noMore'
}else{
this.loadStatus = 'more';
that.isLoadMore = false
}
} else {
uni.showModal({
content: '提现记录列表数据加载失败!',
showCancel: false
});
that.isLoadMore = false
if(that.page > 1){
that.page -= 1
}
}
},
targetToDetail(orderId) {
if (orderId) {
uni.navigateTo({
url: 'withdrawDetail?orderId=' + orderId,
});
}
},
setChannel(data){
if (data == "0") {
return "微信";
} else if (data == "1") {
return "银行卡";
} else if (data == "2") {
return "支付宝";
}
},
setStatus(data){
if (data == "0") {
return "待审核";
} else if (data == "1") {
return "提现中";
} else if (data == "2") {
return "提现成功";
} else if(data == "3"){
return "提现失败";
}else if(data == "4"){
return "审核拒绝";
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
width: 670rpx;
margin: 20rpx auto;
::v-deep .uni-list {
background: $uni-bg-base-color !important;
margin-bottom: 20rpx;
border-radius: 24rpx;
overflow: hidden;
}
::v-deep .uni-list-item {
background: $uni-bg-base-color !important;
}
::v-deep .uni-list--border-top {
display: none !important;
}
::v-deep .uni-list--border-bottom {
display: none !important;
}
::v-deep .uni-list-item__content-title {
color: $uni-white !important;
}
::v-deep .uni-list-item__content-note {
color: $uni-secondary-color !important;
}
}
.box {
display: flex;
padding-right: 16rpx;
flex: 1;
color: $uni-secondary-color;
flex-direction: column;
justify-content: center;
overflow: hidden;
.primary-color {
color: $uni-primary;
}
}
.box-bot {
display: flex;
margin-top: 10rpx;
}
.box-bot view {
border-radius: 6rpx;
color: $uni-secondary-color;
border: 2rpx solid $uni-primary;
padding: 4rpx 10rpx;
margin-right: 10rpx;
font-size: 24rpx;
}
</style>