账单查询
This commit is contained in:
@@ -1,28 +1,45 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
sid: -1,
|
||||
showSetMoney: false,
|
||||
currentMoney: 0.00,
|
||||
currentMoneyText: "8754.09",
|
||||
currentMoneyText: 0,
|
||||
expendBalance: 0,
|
||||
incomeBalance: 0,
|
||||
priceError: false,
|
||||
visible : false,
|
||||
dateRangeText : '请选择日期区间',
|
||||
dateRange : [new Date().getTime()- 24 * 60 * 60 * 1000,new Date().getTime()],
|
||||
dateRangeText : null,
|
||||
dateRange : null,
|
||||
minDate: new Date().getTime() - 365 * 24 * 60 * 60 * 1000,
|
||||
maxDate: new Date().getTime(),
|
||||
incomeList : [
|
||||
{"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"}
|
||||
],
|
||||
payList : [
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"}
|
||||
]
|
||||
incomeList : [],
|
||||
payList : []
|
||||
},
|
||||
onLoad: function (options) {
|
||||
let sid = options.sid
|
||||
let currentMoneyText = options.balance
|
||||
this.setData({sid,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,
|
||||
}).then(res => {
|
||||
if (res.data){
|
||||
let incomeList = res.data.incomeList;
|
||||
let payList = res.data.incomeList;
|
||||
let expendBalance = res.data.expendBalance;
|
||||
let incomeBalance = res.data.incomeBalance;
|
||||
this.setData({
|
||||
incomeList,payList,expendBalance,incomeBalance
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCalendar() {
|
||||
this.setData({ visible: true });
|
||||
@@ -42,24 +59,25 @@ Page({
|
||||
showDialog() {
|
||||
this.setData({
|
||||
showSetMoney: true,
|
||||
currentMoney: this.data.currentMoneyText
|
||||
currentMoneyText: this.data.currentMoneyText
|
||||
})
|
||||
},
|
||||
onPriceInput(e) {
|
||||
this.setData({
|
||||
currentMoney: e.detail.value
|
||||
currentMoneyText: e.detail.value
|
||||
})
|
||||
},
|
||||
onConfirm () {
|
||||
const isNumber = /^\d+(\.\d+)?$/.test(this.data.currentMoney);
|
||||
const isNumber = /^\d+(\.\d+)?$/.test(this.data.currentMoneyText);
|
||||
if (!isNumber) {
|
||||
this.setData({
|
||||
priceError: true
|
||||
})
|
||||
return;
|
||||
}
|
||||
app.$api.editAccount({});
|
||||
this.setData({
|
||||
currentMoneyText: this.data.currentMoney,
|
||||
currentMoneyText: this.data.currentMoneyText,
|
||||
priceError: false
|
||||
})
|
||||
this.closeDialog()
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="space_box_no_padding font_big">
|
||||
<text class="t-color-expend">支出{{1203.00}}</text>
|
||||
<text class="t-color-income">收入{{1203.00}}</text>
|
||||
<text class="t-color-expend">支出{{expendMoney}}</text>
|
||||
<text class="t-color-income">收入{{incomeMoney}}</text>
|
||||
</view>
|
||||
<view class="padding_box">
|
||||
<t-divider content="{{dateRangeText}}" bind:tap="handleCalendar"/>
|
||||
@@ -53,5 +53,5 @@
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="closeDialog"
|
||||
>
|
||||
<t-input bindchange="onPriceInput" value="{{currentMoney}}" tips="{{priceError ? '请输入正确金额' : ''}}" slot="content" type="number" placeholder="0.00"/>
|
||||
<t-input bindchange="onPriceInput" value="{{currentMoneyText}}" tips="{{priceError ? '请输入正确金额' : ''}}" slot="content" type="number" placeholder="0.00"/>
|
||||
</t-dialog>
|
||||
|
||||
@@ -2,6 +2,9 @@ Page({
|
||||
data: {
|
||||
noMoney : "****",
|
||||
hiddenMoney: false,
|
||||
sumBalance: 0,
|
||||
cashBalance: 0,
|
||||
oweBalance: 0,
|
||||
cashAccountList : [
|
||||
{"name":"现金","money":"2000.00"},
|
||||
{"name":"银行卡","money":"30500.03"}
|
||||
@@ -17,6 +20,28 @@ Page({
|
||||
if (wx.canIUse('hideHomeButton')) {
|
||||
wx.hideHomeButton()
|
||||
}
|
||||
app.$api.getSettings().then(setting => {
|
||||
if (setting.data){
|
||||
let cashAccountList = setting.data.CASH_SETTING
|
||||
let sumBalance = 0;
|
||||
let cashBalance = 0;
|
||||
cashAccountList.forEach(item => {
|
||||
if (item.balance){
|
||||
cashBalance = cashBalance + item.balance
|
||||
sumBalance = sumBalance + item.balance
|
||||
}
|
||||
})
|
||||
let oweAccountList = setting.data.OWE_SETTING
|
||||
let oweBalance = 0;
|
||||
oweAccountList.forEach(item => {
|
||||
if (item.balance){
|
||||
oweBalance = oweBalance + item.balance
|
||||
sumBalance = sumBalance + item.balance
|
||||
}
|
||||
})
|
||||
this.setData({cashAccountList,oweAccountList,cashBalance,oweBalance,sumBalance})
|
||||
}
|
||||
})
|
||||
},
|
||||
changeHidden () {
|
||||
let isHidden = this.data.hiddenMoney;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<view class="look_content">
|
||||
<view class="pay_look">
|
||||
<view class="inline_box font_big">净资产<t-icon bind:tap="changeHidden" name="{{ hiddenMoney ? 'browse' : 'browse-off'}}"/></view>
|
||||
<text class="font_big">{{ hiddenMoney ? noMoney : 1200.00 }}</text>
|
||||
<text class="font_big">{{ hiddenMoney ? noMoney : sumBalance }}</text>
|
||||
</view>
|
||||
<view class="balance_look">
|
||||
<text>总资产: {{ hiddenMoney ? noMoney : 900.00 }}</text>
|
||||
<text>总资产: {{ hiddenMoney ? noMoney : cashBalance }}</text>
|
||||
<text> | </text>
|
||||
<text>总负债: {{ hiddenMoney ? noMoney : -300.00 }}</text>
|
||||
<text>总负债: {{ hiddenMoney ? noMoney : oweBalance }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -18,9 +18,9 @@
|
||||
<t-cell wx:for="{{cashAccountList}}" wx:key="index"
|
||||
title="{{item.name}}"
|
||||
align="top"
|
||||
image="/image/account/5.png"
|
||||
url="/pages/account/detail/index"
|
||||
note="{{hiddenMoney ? noMoney : item.money}}"
|
||||
image="{{item.icon}}"
|
||||
url="/pages/account/detail/index?sid={{item.id}}&balance={{item.balance}}"
|
||||
note="{{hiddenMoney ? noMoney : item.balance}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<view class="padding_box">
|
||||
@@ -30,9 +30,9 @@
|
||||
<t-cell wx:for="{{oweAccountList}}" wx:key="index"
|
||||
title="{{item.name}}"
|
||||
align="top"
|
||||
image="/image/account/10.png"
|
||||
url="/pages/account/detail/index"
|
||||
note="{{hiddenMoney ? noMoney : item.money}}"
|
||||
image="{{item.icon}}"
|
||||
url="/pages/account/detail/index?sid={{item.id}}&balance={{item.balance}}"
|
||||
note="{{hiddenMoney ? noMoney : item.balance}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<view class="placeholder"/>
|
||||
|
||||
Reference in New Issue
Block a user