优化财务管理功能

This commit is contained in:
weipengfei 2023-07-24 16:01:38 +08:00
parent b42e74a2ac
commit 87e39b4d30
3 changed files with 52 additions and 27 deletions

View File

@ -95,7 +95,7 @@
<script> <script>
import { accountLogLists, accountLogListsMonth } from "@/api/pay.js" import { accountLogLists, accountLogListsMonth } from "@/api/pay.js"
import { Toast } from '@/libs/uniApi.js' import { Toast } from '@/libs/uniApi.js'
export default { export default {
data() { data() {
return { return {
@ -106,30 +106,29 @@ export default {
billListMonth: [], billListMonth: [],
loadConfig:{ loadConfig:{
page: 1, page: 1,
limit: 15, limit: 25,
loadingText: '努力加载中', loadingText: '努力加载中',
loadmoreText: '轻轻上拉', loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~', nomoreText: '没有更多账单了~~',
status: 'nomore' status: 'loadmore'
}, },
} }
}, },
onLoad() { onLoad() {
// console.log(this.userInfo); this.loadBill()
this.userInfo = this.$store.state.app.userInfo;
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#3175f9'
})
}, },
onShow() { onShow() {
this.loadBill() // console.log(this.userInfo);
this.userInfo = this.$store.state.app.userInfo;
}, },
computed:{ computed:{
eyeType(){ eyeType(){
return this.$store.state.config.eyeType; return this.$store.state.config.eyeType;
} }
}, },
onBackPress() {
this.loadBill()
},
methods: { methods: {
naviTo(url) { naviTo(url) {
url ? url ?
@ -140,17 +139,25 @@ export default {
updateEye(){ updateEye(){
this.$store.commit('SET_EYE_TYPE') this.$store.commit('SET_EYE_TYPE')
}, },
//
changeBillType(type){ changeBillType(type){
this.current = type; this.current = type;
if(type==1)this.loadBillMonth(); if(type==1)this.loadBillMonth();
}, },
async loadBill(){ async loadBill(){
if(this.loadConfig.status=="nomore")return;
this.loadConfig.status="loading"
let res = await accountLogLists({ let res = await accountLogLists({
type: 'um',// type: 'um', //
page_no: 1, page_no: this.loadConfig.page,
page_size: 10 page_size: this.loadConfig.page_size
}); });
console.log(res); this.loadConfig.status="loadmore"
if(res.data.lists.length<this.loadConfig.limit){
this.loadConfig.status="nomore"
}else {
this.loadConfig.page++;
}
this.billList = [...this.billList, ...res.data.lists]; this.billList = [...this.billList, ...res.data.lists];
}, },
async loadBillMonth(){ async loadBillMonth(){

View File

@ -24,7 +24,7 @@
<view class="item"> <view class="item">
<view class="text"> <view class="text">
支出总金额() 支出总金额()
<view class="price">0.00</view> <view class="price">{{disbursement}}</view>
</view> </view>
<view class="tips"> <view class="tips">
平台支出{{terraceIncome.count}}{{terraceIncome.num}} 平台支出{{terraceIncome.count}}{{terraceIncome.num}}
@ -74,19 +74,19 @@
}, },
loadConfig:{ loadConfig:{
page: 1, page: 1,
limit: 15, limit: 25,
loadingText: '努力加载中', loadingText: '努力加载中',
loadmoreText: '轻轻上拉', loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~', nomoreText: '没有更多账单了~~',
status: 'nomore' status: 'loadmore'
}, },
} }
}, },
onLoad() {}, onLoad() {
onShow() {
this.initDate() this.initDate()
this.loadBill() this.loadBill()
}, },
onShow() {},
computed:{ computed:{
nowYMD(){ nowYMD(){
let m = this.nowDate.m<10?'0'+this.nowDate.m:this.nowDate.m; let m = this.nowDate.m<10?'0'+this.nowDate.m:this.nowDate.m;
@ -144,13 +144,25 @@
}; };
} }
}, },
onReachBottom() {
this.loadBill()
},
methods: { methods: {
async loadBill() { async loadBill() {
if(this.loadConfig.status=="nomore")return;
this.loadConfig.status="loading"
let res = await accountLogLists({ let res = await accountLogLists({
type: 'um', // type: 'um', //
page_no: 1, page_no: this.loadConfig.page,
page_size: 10 page_size: this.loadConfig.page_size,
time: this.nowYMD
}); });
this.loadConfig.status="loadmore"
if(res.data.lists.length<this.loadConfig.limit){
this.loadConfig.status="nomore"
}else {
this.loadConfig.page++;
}
this.billList = [...this.billList, ...res.data.lists]; this.billList = [...this.billList, ...res.data.lists];
}, },
initDate(){ initDate(){
@ -161,11 +173,13 @@
}, },
// //
changeDate(e) { changeDate(e) {
console.log(e);
this.nowDate.y = e.year; this.nowDate.y = e.year;
this.nowDate.m = +e.month; this.nowDate.m = +e.month;
this.nowDate.d = e.date; this.nowDate.d = e.date;
this.loadConfig.page = 1;
this.loadConfig.status = 'loadmore';
this.billList = [];
this.loadBill();
}, },
// //
bindDateChangeMonth(e){ bindDateChangeMonth(e){

View File

@ -29,6 +29,7 @@
<script> <script>
import { recharge, payWay, payPrepay, wechatJsConfig, payStatus } from "@/api/pay.js" import { recharge, payWay, payPrepay, wechatJsConfig, payStatus } from "@/api/pay.js"
import { userInfo } from "@/api/oaUser.js"
import { debounce, throttle } from 'lodash' import { debounce, throttle } from 'lodash'
import { Toast } from '@/libs/uniApi.js' import { Toast } from '@/libs/uniApi.js'
export default { export default {
@ -122,8 +123,11 @@
from: data.from, from: data.from,
}).then((status)=>{ }).then((status)=>{
uni.showToast({ uni.showToast({
icon:status.data.pay_status?'success':'error', icon:status.data.pay_status?'success':'none',
title: status.data.pay_status?'支付成功!':'支付失败!' title: status.data.pay_status?'支付成功':'支付失败'
})
userInfo().then(user=>{
this.$store.commit('setUserInfo', user.data);
}) })
}) })
}, },