electricity_bill_calc_wx/pages/invoiceDetailContent/index.js

38 lines
772 B
JavaScript

// pages/invoiceDetailContent/index.js
import { getInvoiceInfoDetail } from "../../service/invoice";
Page({
/**
* 页面的初始数据
*/
data: {
detail: {},
id: "",
header: [
{ key: 'time', title: '月份' },
{ title: '电表地址',renderBody: (item) => item.meter.address },
{ key: 'money', title: '金额' },
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options;
this.getDetail(id)
},
async getDetail(id) {
const { code, message, data } = await getInvoiceInfoDetail(id);
this.setData({
detail: data,
id
})
},
jumpToInvoiceDetail() {
wx.redirectTo({
url: '/pages/invoiceDetail/index?id=' + this.data.id,
})
},
})