修改小数点问题

This commit is contained in:
2023-02-28 21:31:25 +08:00
parent a0b72a542a
commit 1371987bed
4 changed files with 6 additions and 15 deletions

View File

@@ -68,8 +68,7 @@ page {
/* 占位置 */ /* 占位置 */
.empty-view { .empty-view {
margin-top: 200rpx; margin-top: 200rpx;
height: 1000rpx; margin-bottom: 800rpx;
margin-bottom: 1000rpx;
} }
.placeholder { .placeholder {
height: 168rpx; height: 168rpx;

View File

@@ -54,7 +54,7 @@
box-sizing: border-box; box-sizing: border-box;
width: inherit; width: inherit;
min-width: 0; min-width: 0;
height: 100%; height: 144rpx;
min-height: 20px; min-height: 20px;
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@@ -24,7 +24,6 @@ Page({
cashAccountList.forEach(item => { cashAccountList.forEach(item => {
if (item.balance){ if (item.balance){
cashBalance = cashBalance + item.balance cashBalance = cashBalance + item.balance
sumBalance = sumBalance + item.balance
} }
}) })
let oweAccountList = setting.data.OWE_SETTING let oweAccountList = setting.data.OWE_SETTING
@@ -32,9 +31,11 @@ Page({
oweAccountList.forEach(item => { oweAccountList.forEach(item => {
if (item.balance){ if (item.balance){
oweBalance = oweBalance + item.balance oweBalance = oweBalance + item.balance
sumBalance = sumBalance + item.balance
} }
}) })
cashBalance = Math.floor(cashBalance * 100) / 100
oweBalance = Math.floor(cashBalance * 100) / 100
sumBalance = Math.floor((cashBalance - oweBalance) * 100) / 100
this.setData({cashAccountList,oweAccountList,cashBalance,oweBalance,sumBalance}) this.setData({cashAccountList,oweAccountList,cashBalance,oweBalance,sumBalance})
} }
}) })

View File

@@ -13,6 +13,7 @@ function buildURL(url, needToken) {
}) })
wx.showToast({ wx.showToast({
title: '请先登录', title: '请先登录',
icon: 'none',
mask: true, mask: true,
duration: 2000 duration: 2000
}) })
@@ -51,10 +52,8 @@ export function fetchPost(url, params, needToken, multiple) {
console.log(res); console.log(res);
if (response.statusCode == 200) { if (response.statusCode == 200) {
if (res.err_code == 0) { if (res.err_code == 0) {
wx.hideLoading();
resolve(res); resolve(res);
} else { } else {
wx.hideLoading();
wx.showToast({ wx.showToast({
title: res.data.err_msg, title: res.data.err_msg,
icon: 'none', icon: 'none',
@@ -63,7 +62,6 @@ export function fetchPost(url, params, needToken, multiple) {
reject(res); reject(res);
} }
} else { } else {
wx.hideLoading();
wx.showToast({ wx.showToast({
title: '服务器异常', title: '服务器异常',
icon: 'none', icon: 'none',
@@ -74,7 +72,6 @@ export function fetchPost(url, params, needToken, multiple) {
}, },
fail: function(err) { fail: function(err) {
console.log(err); console.log(err);
wx.hideLoading();
wx.showToast({ wx.showToast({
title: '网络错误', title: '网络错误',
icon: 'none', icon: 'none',
@@ -98,10 +95,8 @@ export function fetchPost(url, params, needToken, multiple) {
success: function(res) { success: function(res) {
console.log("POST返回数据", url,res); console.log("POST返回数据", url,res);
if (res.data.err_code == 0) { if (res.data.err_code == 0) {
wx.hideLoading();
resolve(res.data); resolve(res.data);
} else { } else {
wx.hideLoading();
wx.showToast({ wx.showToast({
title: res.data.err_msg, title: res.data.err_msg,
icon: 'none', icon: 'none',
@@ -111,7 +106,6 @@ export function fetchPost(url, params, needToken, multiple) {
} }
}, },
fail: function(res) { fail: function(res) {
wx.hideLoading();
wx.showToast({ wx.showToast({
title: '网络错误', title: '网络错误',
icon: 'none', icon: 'none',
@@ -144,13 +138,11 @@ export function fetchGet(url, params, needToken) {
console.log("GET返回数据", url, res); console.log("GET返回数据", url, res);
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (res.data.err_code == 0) { if (res.data.err_code == 0) {
wx.hideLoading();
resolve(res.data); resolve(res.data);
} else { } else {
reject(res); reject(res);
} }
} else { } else {
wx.hideLoading();
reject(res) reject(res)
wx.showToast({ wx.showToast({
title: '服务器异常', title: '服务器异常',
@@ -160,7 +152,6 @@ export function fetchGet(url, params, needToken) {
} }
}, },
fail: function(res) { fail: function(res) {
wx.hideLoading();
reject(res) reject(res)
wx.showToast({ wx.showToast({
title: '网络错误', title: '网络错误',