账户调整
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user