账户调整

This commit is contained in:
2023-02-08 20:57:17 +08:00
parent 668a387554
commit eb071d6546
5 changed files with 25 additions and 26 deletions

View File

@@ -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({

View File

@@ -53,5 +53,5 @@
bind:confirm="onConfirm"
bind:cancel="closeDialog"
>
<t-input bindchange="onPriceInput" value="{{currentMoneyText}}" tips="{{priceError ? '请输入正确金额' : ''}}" slot="content" type="number" placeholder="0.00"/>
<t-input bindchange="onPriceInput" value="{{currentMoney}}" tips="{{priceError ? '请输入正确金额' : ''}}" slot="content" type="number" placeholder="0.00"/>
</t-dialog>

View File

@@ -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) {

View File

@@ -13,7 +13,7 @@
<t-cell wx:for="{{incomeList}}" wx:key="index"
title="{{item.name}}"
align="top"
image="/image/bill/11.png"
image="{{item.icon}}"
note="{{item.money}}"
url="../edit/index?isAccount=0&isIncome=1&isAdd=0&id={{item.id}}"
/>

View File

@@ -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'){