Files
quinn-accounts/pages/bill/index.js
2023-02-07 16:37:00 +08:00

60 lines
1.5 KiB
JavaScript

const app = getApp()
Page({
data: {
sid: null,
showDeleteConfirm: false,
name : null,
money : null,
balance : null,
date : null,
billType: null,
moneyName: null,
fromAccountName: null,
accountName: null,
},
onLoad: function (options) {
let sid = options.id
this.setData({sid})
},
onShow() {
app.$api.getBill(this.data.sid).then(res => {
if (res.data) {
let sid = res.data.id
let name = res.data.name
let money = res.data.money
let balance = res.data.balance
let date = res.data.date
let billType = res.data.billType
let moneyName = res.data.moneyName
let fromAccountName = res.data.fromAccountName
let accountName = res.data.accountName
this.setData({sid,name,money,balance,date,billType,moneyName,fromAccountName,accountName})
}
})
},
editBill() {
wx.navigateTo({
url: './edit/index?id=' + this.data.sid
})
},
deleteBill() {
this.setData({
showDeleteConfirm: true
})
},
onConfirm (e) {
app.$api.deleteBill(this.data.sid).then(res => {
if (res){
wx.navigateBack();
this.closeDialog()
}
})
},
closeDialog() {
this.setData({
showDeleteConfirm: false
})
}
});