From eb071d65466675cc0c4737949c8c68b5a647ec67 Mon Sep 17 00:00:00 2001
From: limqhz <540344226@qq.com>
Date: Wed, 8 Feb 2023 20:57:17 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E6=88=B7=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/account/detail/index.js | 24 ++++++++++++++----------
pages/account/detail/index.wxml | 2 +-
pages/account/index.js | 10 +++-------
pages/settings/income/index.wxml | 2 +-
utils/api.js | 13 ++++++-------
5 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/pages/account/detail/index.js b/pages/account/detail/index.js
index 3f821e8..4c3d627 100644
--- a/pages/account/detail/index.js
+++ b/pages/account/detail/index.js
@@ -3,6 +3,7 @@ Page({
data: {
sid: -1,
showSetMoney: false,
+ currentMoney: 0,
currentMoneyText: 0,
expendBalance: 0,
incomeBalance: 0,
@@ -17,18 +18,18 @@ Page({
},
onLoad: function (options) {
let sid = options.sid
+ let currentMoney = options.balance
let currentMoneyText = options.balance
- this.setData({sid,currentMoneyText})
+ this.setData({sid,currentMoney,currentMoneyText})
let dateRange = [new Date().getTime()- 24 * 60 * 60 * 1000,new Date().getTime()]
let dateRangeText = app.$utils.formatDate(new Date(dateRange[0])) + '至' +
(dateRange[1] ? app.$utils.formatDate(new Date(dateRange[1])) : app.$utils.formatDate(new Date()));
this.setData({dateRange,dateRangeText})
-
},
onShow() {
app.$api.listBillByAccount({
- id:this.data.sid,
- dateRangeText:this.data.dateRangeText,
+ sid:this.data.sid,
+ dateRange:this.data.dateRangeText,
}).then(res => {
if (res.data){
let incomeList = res.data.incomeList;
@@ -59,28 +60,31 @@ Page({
showDialog() {
this.setData({
showSetMoney: true,
- currentMoneyText: this.data.currentMoneyText
+ currentMoney: this.data.currentMoneyText
})
},
onPriceInput(e) {
this.setData({
- currentMoneyText: e.detail.value
+ currentMoney: e.detail.value
})
},
onConfirm () {
- const isNumber = /^\d+(\.\d+)?$/.test(this.data.currentMoneyText);
+ const isNumber = /^\d+(\.\d+)?$/.test(this.data.currentMoney);
if (!isNumber) {
this.setData({
priceError: true
})
return;
}
- app.$api.editAccount({});
this.setData({
- currentMoneyText: this.data.currentMoneyText,
+ currentMoneyText:this.data.currentMoney,
priceError: false
})
- this.closeDialog()
+ app.$api.editAccount({sid:this.data.sid,balance:this.data.currentMoney}).then(res => {
+ if (res){
+ this.closeDialog()
+ }
+ })
},
closeDialog() {
this.setData({
diff --git a/pages/account/detail/index.wxml b/pages/account/detail/index.wxml
index cec8526..1616971 100644
--- a/pages/account/detail/index.wxml
+++ b/pages/account/detail/index.wxml
@@ -53,5 +53,5 @@
bind:confirm="onConfirm"
bind:cancel="closeDialog"
>
-
+
diff --git a/pages/account/index.js b/pages/account/index.js
index fafb5d1..480533c 100644
--- a/pages/account/index.js
+++ b/pages/account/index.js
@@ -1,3 +1,4 @@
+const app = getApp();
Page({
data: {
noMoney : "****",
@@ -5,13 +6,8 @@ Page({
sumBalance: 0,
cashBalance: 0,
oweBalance: 0,
- cashAccountList : [
- {"name":"现金","money":"2000.00"},
- {"name":"银行卡","money":"30500.03"}
- ],
- oweAccountList : [
- {"name":"信用卡","money":"-200.00"},
- ]
+ cashAccountList : [],
+ oweAccountList : []
},
onLoad: function (options) {
diff --git a/pages/settings/income/index.wxml b/pages/settings/income/index.wxml
index 5fdcb5f..53ccb65 100644
--- a/pages/settings/income/index.wxml
+++ b/pages/settings/income/index.wxml
@@ -13,7 +13,7 @@
diff --git a/utils/api.js b/utils/api.js
index 400e98d..c9f2e75 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -1,22 +1,21 @@
import utils from './util'
//testURL
-const BASE_URL = 'http://127.0.0.1:8080/wx';
-const LOGIN_URL = 'https://api.weixin.qq.com/sns/jscode2session';
+// const BASE_URL = 'http://127.0.0.1:8080/wx';
+//devURL
+// const BASE_URL = 'https://lmqhznn.goho.co/wx';
//prodURL
-// const BASE_URL = 'https://www.qnforever.top/wx';
+const BASE_URL = 'https://www.qnforever.top/wx';
function buildURL(url, needToken) {
let userId = wx.getStorageSync('userId');
if (!userId && url != '/user/login') {
wx.redirectTo({
url: '../myself/index'
})
- wx.showLoading({
+ wx.showToast({
title: '请先登录',
mask: true,
+ duration: 2000
})
- setTimeout(function () {
- wx.hideLoading()
- }, 2000)
return;
}
if (url != '/user/login'){