修改之前封装方法出错导致出现的bug

master
学习很差啦 2022-09-30 16:29:16 +08:00
parent 4851487ecd
commit d101cd1b6a
3 changed files with 34 additions and 40 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="wap"> <view class="wap">
<u-navbar back-text="" title="预存款列表"> <u-navbar title="预存款列表">
</u-navbar> </u-navbar>
<view class="wrapper-show-money"> <view class="wrapper-show-money">
<view class="money-view"> <view class="money-view">
@ -28,7 +28,7 @@
</view> </view>
<u-empty v-if="datas.length==0" mode="history" text="暂无记录" /> <u-empty v-if="datas.length==0" mode="history" text="暂无记录" />
<u-loadmore v-else bg-color='#f8f8f8' :status="status" />
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
@ -45,7 +45,7 @@ export default {
data() { data() {
return { return {
walletNum: 0, walletNum: 0,
status: "loadmore",
current: 0, current: 0,
swiperCurrent: 0, swiperCurrent: 0,
userInfo: "", // userInfo: "", //
@ -82,27 +82,23 @@ export default {
/**分页获取预存款充值记录 */ /**分页获取预存款充值记录 */
getRecharge() { getRecharge() {
this.status = "loading";
getUserRecharge(this.params).then((res) => { getUserRecharge(this.params).then((res) => {
if (res.data.success) { if (res.data.success) {
if (res.data.result.records.length != 0) { if (res.data.result.records.length != 0) {
this.status = "loadmore";
this.datas.push(...res.data.result.records); this.datas.push(...res.data.result.records);
} else {
this.status = "nomore";
} }
} }
}); });
}, },
getWallet() { getWallet() {
this.status = "loading";
getWalletLog(this.params).then((res) => { getWalletLog(this.params).then((res) => {
if (res.data.success) { if (res.data.success) {
if (res.data.result.records.length != 0) { if (res.data.result.records.length != 0) {
this.datas.push(...res.data.result.records); this.datas.push(...res.data.result.records);
} else {
this.status = "nomore";
} }
} }
}); });

View File

@ -331,7 +331,7 @@ export default {
this.initData(0); this.initData(0);
} }
} }
this.loadData(this.status); // this.loadData(this.status);
}, },
onLoad(options) { onLoad(options) {

View File

@ -1,6 +1,6 @@
import Foundation from "./Foundation.js"; import Foundation from "./Foundation.js";
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";
import { getUserInfo } from '@/api/members'; import { getUserInfo } from "@/api/members";
import Vue from "vue"; import Vue from "vue";
/** /**
* 金钱单位置换 2999 --> 2,999.00 * 金钱单位置换 2999 --> 2,999.00
@ -107,29 +107,27 @@ export function isLogin(val) {
} }
} }
export function tipsToLogin() { export function tipsToLogin() {
if(!isLogin('auth')){ if (!isLogin("auth")) {
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "当前用户未登录是否登录?", content: "当前用户未登录是否登录?",
confirmText: "确定", confirmText: "确定",
cancelText: "取消", cancelText: "取消",
confirmColor: Vue.prototype.$mainColor, confirmColor: Vue.prototype.$mainColor,
success: res => { success: (res) => {
if (res.confirm) { if (res.confirm) {
navigateToLogin() navigateToLogin();
} else if (res.cancel) { } else if (res.cancel) {
uni.navigateBack() uni.navigateBack();
} }
}, },
}) });
return return false;
} }
return true;
} }
/** /**
* 获取用户信息并重新添加到缓存里面 * 获取用户信息并重新添加到缓存里面
*/ */
@ -137,7 +135,7 @@ export async function userInfo(){
let res = await getUserInfo(); let res = await getUserInfo();
if (res.data.success) { if (res.data.success) {
storage.setUserInfo(res.data.result); storage.setUserInfo(res.data.result);
return res.data.result return res.data.result;
} }
} }