37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
const { customerRequest, customerTokenKey } = require("../../utils/request");
|
|
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
|
|
|
Page({
|
|
data: { record: {}, presentation: {} },
|
|
onLoad(options) {
|
|
loadWorkspaceWithFallback()
|
|
.then((workspace) =>
|
|
this.setData({ presentation: workspace.brand?.visualPresentation?.success || {} }),
|
|
)
|
|
.catch(() => {});
|
|
const record = wx.getStorageSync("latestInquirySubmission") || {};
|
|
if (record.id === options.id) this.setData({ record });
|
|
if (options.id && wx.getStorageSync(customerTokenKey())) {
|
|
customerRequest("/customer/inquiry-submissions/" + encodeURIComponent(options.id))
|
|
.then((submission) =>
|
|
this.setData({
|
|
record: {
|
|
...record,
|
|
id: submission.id,
|
|
status: submission.status === "new" ? "待处理" : submission.status,
|
|
createdAt: submission.createdAt,
|
|
offeringName: submission.offering?.name || record.offeringName || "品牌合作",
|
|
},
|
|
}),
|
|
)
|
|
.catch(() => {});
|
|
}
|
|
},
|
|
viewRecords() {
|
|
wx.redirectTo({ url: "/pages/records/index" });
|
|
},
|
|
home() {
|
|
wx.navigateTo({ url: "/pages/index/index" });
|
|
},
|
|
});
|