25 lines
570 B
JavaScript
25 lines
570 B
JavaScript
const { get } = require("../../utils/api");
|
|
const { showError } = require("../../utils/page-helpers");
|
|
|
|
Page({
|
|
data: { item: null, loading: false },
|
|
|
|
onLoad(options) {
|
|
wx.setNavigationBarTitle({ title: "排期详情" });
|
|
this.load(options.id);
|
|
},
|
|
|
|
async load(id) {
|
|
if (!id) return;
|
|
this.setData({ loading: true });
|
|
try {
|
|
const item = await get(`/api/schedule/${id}`);
|
|
this.setData({ item });
|
|
} catch (error) {
|
|
showError(error, "加载排期失败");
|
|
} finally {
|
|
this.setData({ loading: false });
|
|
}
|
|
}
|
|
});
|