会员钱包:接入钱包明细

pull/1/MERGE
YunaiV 2023-08-29 00:32:07 +08:00
parent 182cb8efdb
commit 31f8897d6e
5 changed files with 75 additions and 90 deletions

View File

@ -4,3 +4,8 @@ import request from "@/utils/request.js";
export function getPayWallet() { export function getPayWallet() {
return request.get("app-api/pay/wallet/get"); return request.get("app-api/pay/wallet/get");
} }
// 获得钱包流水分页
export function getWalletTransactionPage(data) {
return request.get("app-api/pay/wallet-transaction/page", data);
}

View File

@ -2,61 +2,47 @@
<view> <view>
<view class='bill-details'> <view class='bill-details'>
<view class='nav acea-row'> <view class='nav acea-row'>
<view class='item' :class='type==="all" ? "on":""' @click='changeType("all")'>全部</view> <view class='item' :class='type === undefined ? "on":""' @click='changeType(undefined)'>全部</view>
<view class='item' :class='type==="expenditure" ? "on":""' @click='changeType("expenditure")'>消费</view> <view class='item' :class='type === "1" ? "on":""' @click='changeType("1")'>收入</view>
<view class='item' :class='type==="income" ? "on":""' @click='changeType("income")'>充值</view> <view class='item' :class='type === "2" ? "on":""' @click='changeType("2")'>支出</view>
</view> </view>
<view class='sign-record'> <view class='sign-record'>
<view class='list pad30' v-for="(item,index) in userBillList" :key="index"> <view class='list' v-for="(item,index) in userBillList" :key="index">
<view class='item'> <view class='item'>
<view class='data'>{{item.date}}</view>
<view class='listn borRadius14'> <view class='listn borRadius14'>
<view class='itemn acea-row row-between-wrapper' v-for="(vo,indexn) in item.list" :key="indexn"> <view class='itemn acea-row row-between-wrapper'>
<view> <view>
<view class='name line1'>{{vo.title}}</view> <view class='name line1'>{{ item.title }}</view>
<view>{{vo.add_time}}</view> <view>{{ formatDate(item.createTime) }}</view>
</view> </view>
<view class='num' v-if="vo.pm">+{{vo.number}}</view> <view class='num' v-if="item.price > 0">+{{ fen2yuan(item.price) }}</view>
<view class='num font-color' v-else>-{{vo.number}}</view> <view class='num font-color' v-else>{{ fen2yuan(item.price) }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class='loadingicon acea-row row-center-wrapper' v-if="userBillList.length>0"> <view class='loadingicon acea-row row-center-wrapper' v-if="userBillList.length > 0">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}} <text class='loading iconfont icon-jiazai' :hidden='loading === false'></text>{{loadTitle}}
</view> </view>
<view v-if="userBillList.length == 0"> <view v-if="userBillList.length === 0">
<emptyPage title="暂无账单的记录哦~"></emptyPage> <emptyPage title="暂无账单的记录哦~"></emptyPage>
</view> </view>
</view> </view>
</view> </view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home> <home></home>
</view> </view>
</template> </template>
<script> <script>
import { import { toLogin } from '@/libs/login.js';
getBillList import { mapGetters } from "vuex";
} from '@/api/user.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import emptyPage from '@/components/emptyPage.vue'; import emptyPage from '@/components/emptyPage.vue';
import home from '@/components/home'; import home from '@/components/home';
export default { import * as WalletApi from '@/api/pay/wallet.js';
import dayjs from '@/plugin/dayjs/dayjs.min.js';
import * as Util from '@/utils/util.js';
export default {
components: { components: {
// #ifdef MP
authorize,
// #endif
emptyPage, emptyPage,
home home
}, },
@ -67,20 +53,18 @@
loadend: false, loadend: false,
page: 1, page: 1,
limit: 10, limit: 10,
type: 'all', type: undefined,
userBillList: [], userBillList: [],
isAuto: false, //
isShowAuth: false //
}; };
}, },
computed: mapGetters(['isLogin']), computed: mapGetters(['isLogin']),
onShow() { onShow() {
if (this.isLogin) { if (!this.isLogin) {
this.getUserBillList(); toLogin();
} else { return;
toLogin();
} }
}, this.getUserBillList();
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
@ -94,44 +78,32 @@
this.getUserBillList(); this.getUserBillList();
}, },
methods: { methods: {
/**
* 授权回调
*/
onLoadFun: function() {
this.getUserBillList();
},
//
authColse: function(e) {
this.isShowAuth = e
},
/** /**
* 获取账户明细 * 获取账户明细
*/ */
getUserBillList: function() { getUserBillList: function() {
let that = this; if (this.loadend || this.loading) {
if (that.loadend) return; return;
}
if (that.loading) return; this.loading = true;
that.loading = true; this.loadTitle = "";
that.loadTitle = ""; WalletApi.getWalletTransactionPage({
let data = { pageNo: this.page,
page: that.page, pageSize: this.limit,
limit: that.limit, type: this.type
type: that.type }).then(res => {
} const list = res.data.list ? res.data.list : [];
getBillList(data).then(function(res) { const loadend = res.data.list < res.data.limit;
let list = res.data.list?res.data.list:[], this.userBillList = this.$util.SplitArray(list, this.userBillList);
loadend = res.data.list < res.data.limit; this.$set(this, 'userBillList', this.userBillList);
that.userBillList = that.$util.SplitArray(list, that.userBillList); this.loadend = loadend;
that.$set(that, 'userBillList', that.userBillList); this.loading = false;
that.loadend = loadend; this.loadTitle = loadend ? "哼😕~我也是有底线的~" : "加载更多";
that.loading = false; this.page = this.page + 1;
that.loadTitle = loadend ? "哼😕~我也是有底线的~" : "加载更多"; }).catch(err => {
that.page = that.page + 1; this.loading = false;
}, function(res) { this.loadTitle = '加载更多';
that.loading = false; });
that.loadTitle = '加载更多';
});
}, },
/** /**
* 切换导航 * 切换导航
@ -143,13 +115,19 @@
this.$set(this, 'userBillList', []); this.$set(this, 'userBillList', []);
this.getUserBillList(); this.getUserBillList();
}, },
fen2yuan(price) {
return Util.fen2yuan(price)
},
formatDate: function(date) {
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
}
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.sign-record{ .sign-record{
} }
.bill-details .nav { .bill-details .nav {
background-color: #fff; background-color: #fff;

View File

@ -37,23 +37,23 @@
</view> </view>
</view> </view>
<view class='nav acea-row row-middle'> <view class='nav acea-row row-middle'>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=all'> <navigator class='item' hover-class='none' url='/pages/users/user_bill/index'>
<view class='pictrue'> <view class='pictrue'>
<image src='../../../static/images/record1.png'></image> <image src='../../../static/images/record1.png'></image>
</view> </view>
<view>账单记录</view> <view>账单记录</view>
</navigator> </navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=expenditure'> <navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2'>
<view class='pictrue'> <view class='pictrue'>
<image src='../../../static/images/record2.png'></image> <image src='../../../static/images/record2.png'></image>
</view> </view>
<view>消费记录</view> <view>支出记录</view>
</navigator> </navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=income' v-if="userInfo.rechargeSwitch"> <navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=1'>
<view class='pictrue'> <view class='pictrue'>
<image src='../../../static/images/record3.png'></image> <image src='../../../static/images/record3.png'></image>
</view> </view>
<view>充值记录</view> <view>收入记录</view>
</navigator> </navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_integral/index'> <navigator class='item' hover-class='none' url='/pages/users/user_integral/index'>
<view class='pictrue'> <view class='pictrue'>
@ -83,7 +83,7 @@
</navigator> </navigator>
</view> </view>
</view> </view>
<recommend :hostProduct="hostProduct" v-if="hostProduct.length"></recommend> <recommend :hostProduct="hostProduct" v-if="hostProduct.length" />
</view> </view>
<home></home> <home></home>
</view> </view>

View File

@ -101,7 +101,7 @@
computed: mapGetters(['isLogin', 'systemPlatform','userInfo']), computed: mapGetters(['isLogin', 'systemPlatform','userInfo']),
watch:{ watch:{
isLogin:{ isLogin:{
handler:function(newV,oldV){ handler: function(newV, oldV) {
if(newV){ if(newV){
this.getRecharge(); this.getRecharge();
} }
@ -113,6 +113,12 @@
// #ifdef H5 // #ifdef H5
this.from = this.$wechat.isWeixin() ? "public" : "weixinh5"; this.from = this.$wechat.isWeixin() ? "public" : "weixinh5";
// #endif // #endif
if (true) {
alert('充值功能暂未实现!预期 10 月份');
return;
}
if (this.isLogin) { if (this.isLogin) {
this.getRecharge(); this.getRecharge();
} else { } else {
@ -282,7 +288,7 @@
}) })
}); });
// #endif // #endif
// #ifdef H5 // #ifdef H5
rechargeWechat({ rechargeWechat({
price: money, price: money,
from: that.from, from: that.from,
@ -523,4 +529,4 @@
font-size: 24rpx; font-size: 24rpx;
color: #333; color: #333;
} }
</style> </style>

View File

@ -1,9 +1,8 @@
<template> <template>
<view> <view>
<view class='sign-record'> <view class='sign-record'>
<view class='list pad30' v-for="(item,index) in signList" :key="index"> <view class='list' v-for="(item,index) in signList" :key="index">
<view class='item'> <view class='item'>
<view class='data'>{{ formatMonth(item.createTime) }}</view>
<view class='listn borRadius14'> <view class='listn borRadius14'>
<view class='itemn acea-row row-between-wrapper'> <view class='itemn acea-row row-between-wrapper'>
<view> <view>
@ -88,9 +87,6 @@
formatDate: function(date) { formatDate: function(date) {
return dayjs(date).format("YYYY-MM-DD"); return dayjs(date).format("YYYY-MM-DD");
}, },
formatMonth: function(date) {
return dayjs(date).format("YYYY-MM");
}
} }
} }
</script> </script>