From 3f9032e92fdd383bfefc87a0bec9b242e1223851 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 09 六月 2026 17:08:44 +0800
Subject: [PATCH] 改bug
---
app/pages/wallet/wallet.vue | 147 +++++++++++++++++++++++++++++++++++++-----------
1 files changed, 113 insertions(+), 34 deletions(-)
diff --git a/app/pages/wallet/wallet.vue b/app/pages/wallet/wallet.vue
index de6359a..f89d304 100644
--- a/app/pages/wallet/wallet.vue
+++ b/app/pages/wallet/wallet.vue
@@ -53,22 +53,20 @@
</view>
</view>
<view class="item-date-bottom">
- <text>鏀跺叆锛毬{(countDataList.totalIncome || 0).toFixed(2)}}</text>
- <text>鏀嚭锛毬{(countDataList.totalExpense || 0).toFixed(2)}}</text>
+ <text>鏀跺叆锛毬{((countDataList.totalIncome || 0) / 100).toFixed(2)}}</text>
+ <text>鏀嚭锛毬{((countDataList.totalExpense || 0) / 100).toFixed(2)}}</text>
</view>
</view>
<view class="item-list">
<view class="item-list-item" v-for="(item, index) in dataList" :key="index" @click="jumpDetail(item)">
<view class="image">
- <image v-if="item.type === 0" src="/static/image/ic_shouru@2x.png" mode="widthFix"></image>
- <image v-if="item.type === 1" src="/static/image/ic_tixian@2x.png" mode="widthFix"></image>
- <image v-if="item.type === 2" src="/static/image/ic_tuikuan@2x.png" mode="widthFix"></image>
+ <image :src="getTransactionIcon(item.type)" mode="widthFix"></image>
</view>
<view class="info">
<view class="info">
<view class="info-a">
<view class="info-a-label">
- {{item.type === 0 ? '瀹屾垚璁㈠崟' : item.type === 1 ? '鎻愮幇鏀嚭' : item.type === 2 ? '鎻愮幇閫�鍥�' : ''}}
+ {{ getTransactionLabel(item.type) }}
<template v-if="item.type === 1">
<text style="color: #FF0020;" v-if="item.withdrawStatus == 2">鏈�氳繃</text>
<text style="color: #004096" v-else-if="item.withdrawStatus == 1">宸查�氳繃</text>
@@ -76,7 +74,7 @@
</template>
</view>
<view class="info-a-price">
- <text>{{item.type==1?'-':'+'}}{{(item.num ||0).toFixed(2)}}</text>
+ <text>{{ isExpenseType(item) ? '-' : '+' }}{{(item.amountInfo ||0)}}</text>
<text></text>
</view>
</view>
@@ -109,10 +107,13 @@
<view class="sear-item">
<view class="sear-item-label">浜ゆ槗绫诲瀷</view>
<view class="sear-item-list">
- <view @click="checkType(0)" :class="tempType == 0?'sear-item-list-item active':'sear-item-list-item'">鍏ㄩ儴</view>
- <view @click="checkType(1)" :class="tempType == 1?'sear-item-list-item active':'sear-item-list-item'">璁㈠崟缁撶畻</view>
- <view @click="checkType(2)" :class="tempType == 2?'sear-item-list-item active':'sear-item-list-item'">鎻愮幇</view>
- <view @click="checkType(4)" :class="tempType == 4?'sear-item-list-item active':'sear-item-list-item'">鎻愮幇閫�鍥�</view>
+ <view @click="checkType('')" :class="tempType === '' ? 'sear-item-list-item active':'sear-item-list-item'">鍏ㄩ儴</view>
+ <view @click="checkType(0)" :class="tempType === 0 ?'sear-item-list-item active':'sear-item-list-item'">璁㈠崟缁撶畻</view>
+ <view @click="checkType(1)" :class="tempType === 1?'sear-item-list-item active':'sear-item-list-item'">鎻愮幇</view>
+ <view @click="checkType(2)" :class="tempType === 2?'sear-item-list-item active':'sear-item-list-item'">鎻愮幇閫�鍥�</view>
+ <view @click="checkType(3)" :class="tempType === 3?'sear-item-list-item active':'sear-item-list-item'">骞冲彴濂栧姳</view>
+ <view @click="checkType(4)" :class="tempType === 4?'sear-item-list-item active':'sear-item-list-item'">璐d换鎵f</view>
+ <view @click="checkType(5)" :class="tempType === 5?'sear-item-list-item active':'sear-item-list-item'">寮傚父杞繍</view>
<view style="width: 216rpx; height: 0;"></view>
</view>
</view>
@@ -165,13 +166,14 @@
data() {
return {
currentPage:1,
+ loading:false,
total:0,
active:0,
wordsWidth:250,
tempActive :0,
- type:0,
+ type:'',
words:'鍏ㄩ儴',
- tempType :0,
+ tempType :'',
dateType :0,
dataList:[],
startDate:null,
@@ -196,7 +198,7 @@
this.active=0
this.wordsWidth=250
this.words='鍏ㄩ儴'
- this.tempActive=0
+ this.tempActive=''
this.dateType=0
this.countData={}
this.tempStartDate=null
@@ -206,12 +208,28 @@
this.initDateStr()
// uni.$on('accountListReload', this.getFirstPageData())
},
+ onReachBottom() {
+ console.log('onReachBottom')
+ this.getShopPage()
+ },
methods:{
bindChange1 (e) {
this.tempStartDate = e.detail.value || null
+ if (this.tempStartDate && this.tempEndDate) {
+ if (new Date(this.tempStartDate + ' 00:00:00') > new Date(this.tempEndDate + ' 00:00:00')) {
+ this.tempStartDate = this.tempEndDate
+ uni.showToast({ title: '寮�濮嬫棩鏈熶笉鑳藉ぇ浜庣粨鏉熸棩鏈�', icon: 'none' })
+ }
+ }
},
bindChange2 (e) {
- this.tempEndDate= e.detail.value || null
+ this.tempEndDate = e.detail.value || null
+ if (this.tempStartDate && this.tempEndDate) {
+ if (new Date(this.tempStartDate + ' 00:00:00') > new Date(this.tempEndDate + ' 00:00:00')) {
+ this.tempEndDate = this.tempStartDate
+ uni.showToast({ title: '寮�濮嬫棩鏈熶笉鑳藉ぇ浜庣粨鏉熸棩鏈�', icon: 'none' })
+ }
+ }
},
formatter(type, value) {
if (type === 'year') {
@@ -223,6 +241,7 @@
return value
},
getShopPage() {
+ console.log(this.loading, this.hasNext)
if(this.loading || !this.hasNext){
return
}
@@ -231,27 +250,33 @@
this.hasNext = true
this.dataList=[]
}
- console.log('page')
+ console.log({
+ startTime: this.startDate || this.defaultStartDate,
+ endTime: this.endDate || this.defaultEndDate,
+ type: this.type,
+ optType: this.active === 1?1:(this.active === 2?-1:'')
+ })
this.$u.api.driverPage({
capacity: 10,
model: {
startTime: this.startDate || this.defaultStartDate,
endTime: this.endDate || this.defaultEndDate,
- type: this.active === 1?0:(this.active===2?1:''),
- objType: this.type === 1?16:( this.type === 2?17:( this.type === 3?25: (this.type === 4?1: ''))),
+ type: this.type,
+ optType: this.active === 1?1:(this.active === 2?-1:'')
},
page: this.currentPage
}).then(res => {
if (res.code == 200) {
- this.dataList.push(...res.data.records)
+ const records = res.data.records || []
+ this.dataList.push(...records)
this.total = res.data.total
- this.currentPage = this.currentPage+1
- if (this.dataList.length >= res.data.total) {
- this.hasNext = false
- } else {
- this.hasNext = true
- }
+ this.currentPage++
+ this.hasNext = this.dataList.length < res.data.total
}
+ }).catch(err => {
+ console.log(err)
+ }).finally(() => {
+ this.loading = false
})
},
getShopSummary() {
@@ -259,7 +284,7 @@
startTime: this.startDate || this.defaultStartDate,
endTime: this.endDate || this.defaultEndDate,
type: this.active === 1?0:(this.active===2?1:''),
- objType: this.type === 1?16:( this.type === 2?17:( this.type === 3?25: (this.type === 4?1: ''))),
+ objType: this.getSummaryObjType(this.type),
}).then(res=>{
if(res.code == 200){
this.countDataList = res.data
@@ -276,6 +301,12 @@
},
comfirmDate(flag){
if (flag) {
+ if (!this.tempStartDate || !this.tempEndDate) {
+ return uni.showToast({
+ title: '璇烽�夋嫨璧锋鏃ユ湡',
+ icon: 'none'
+ })
+ }
if(new Date(this.tempEndDate+" 00:00:00").getTime() < new Date(this.tempStartDate+" 00:00:00").getTime()){
return uni.showToast({
title:'鏃ユ湡鑼冨洿涓嶆纭�',
@@ -287,8 +318,8 @@
} else {
this.startDate = null
this.endDate = null
- this.tempStartDate = this.defaultStartDate
- this.tempEndDate = this.defaultEndDate
+ this.tempStartDate = null
+ this.tempEndDate = null
}
this.getFirstPageData()
this.getShopSummary()
@@ -305,11 +336,11 @@
this.type = this.tempType
this.show = false
this.wordsWidth = 250
- if(this.active === 0 && this.type === 0){
+ if(this.active === 0 && this.type === ''){
this.words = '鍏ㄩ儴'
}else {
let t1 = this.active === 1 ? '鏀跺叆 ':(this.active === 2 ? '鏀嚭 ' : '');
- let t2 = this.type === 1 ? '璁㈠崟缁撶畻' : (this.type === 2 ? '鎻愮幇': (this.type === 3 ? '璁㈠崟缁撶畻閫�鍥�' : (this.type === 4 ? '鎻愮幇閫�鍥�' : '')))
+ let t2 = this.getFilterTypeLabel(this.type)
if(t1 !='' && t2 !=''){
this.wordsWidth = 350
}
@@ -317,9 +348,9 @@
}
} else {
this.tempActive = 0
- this.tempType = 0
+ this.tempType = ''
this.active = 0
- this.type = 0
+ this.type = ''
this.words = '鍏ㄩ儴'
this.wordsWidth = 250
this.show = false
@@ -354,11 +385,59 @@
checkActive(index){
this.tempActive =index
},
+ getTransactionLabel(type) {
+ const typeMap = {
+ 0: '瀹屾垚璁㈠崟',
+ 1: '鎻愮幇鏀嚭',
+ 2: '鎻愮幇閫�鍥�',
+ 3: '骞冲彴濂栧姳',
+ 4: '璐d换鎵f',
+ 5: '寮傚父杞繍'
+ }
+ return typeMap[type] || ''
+ },
+ getFilterTypeLabel(type) {
+ const typeMap = {
+ 0: '璁㈠崟缁撶畻',
+ 1: '鎻愮幇',
+ 2: '鎻愮幇閫�鍥�',
+ 3: '骞冲彴濂栧姳',
+ 4: '璐d换鎵f',
+ 5: '寮傚父杞繍'
+ }
+ return typeMap[type] || ''
+ },
+ getTransactionIcon(type) {
+ const typeMap = {
+ 0: '/static/image/ic_shouru@2x.png',
+ 1: '/static/image/ic_tixian@2x.png',
+ 2: '/static/image/ic_tuikuan@2x.png',
+ 3: '/static/image/ic_shouru@2x.png',
+ 4: '/static/image/ic_tixian@2x.png',
+ 5: '/static/image/ic_tuikuan@2x.png'
+ }
+ return typeMap[type] || '/static/image/ic_shouru@2x.png'
+ },
+ getSummaryObjType(type) {
+ const typeMap = {
+ 1: 16,
+ 2: 17,
+ 3: 25,
+ 4: 1
+ }
+ return typeMap[type] || ''
+ },
+ isExpenseType(item) {
+ if (item && item.optType !== undefined && item.optType !== null && item.optType !== '') {
+ return Number(item.optType) === -1
+ }
+ return [1, 4].includes(Number(item.type))
+ },
checkType(index){
- this.tempType =index
+ this.tempType = index
},
getFirstPageData(){
- this.currentPage = 0
+ this.currentPage = 1
this.hasNext=true
this.loading=false
this.total=0
--
Gitblit v1.9.3