市北党建引领小程序初始化
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.3 KiB

2 years ago
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("../../api/index");
Page({
data: {
loadMoreVisible: false,
loadMoreType: "none",
currentTab: "tab1",
timePickerVisible: false,
bookList: [],
bookedList: [],
currentMatterId: "",
currentMatterName: ""
},
onLoad: function (options) {
if (options.tab) {
this.setData({
currentTab: options.tab
});
}
if (this.data.currentTab === "tab1") {
this.getallmatters();
}
else if (this.data.currentTab === "tab2") {
this.appointmentrecordmini();
}
},
onReachBottom: function () {
this.setData({
loadMoreVisible: true
});
},
onChnageTab: function (e) {
var tab = e.currentTarget.dataset.tab;
this.setData({
currentTab: tab
});
if (this.data.currentTab === "tab1") {
this.getallmatters();
}
else if (this.data.currentTab === "tab2") {
this.appointmentrecordmini();
}
},
showTimePicker: function (e) {
var _a = e.currentTarget.dataset, id = _a.id, name = _a.name;
this.setData({
timePickerVisible: true,
currentMatterId: id,
currentMatterName: name
});
},
timePickerClose: function () {
this.setData({
timePickerVisible: false
});
},
bookCb: function () {
this.setData({
timePickerVisible: false,
currentMatterId: "",
currentMatterName: ""
});
this.getallmatters();
},
getallmatters: function () {
var _this_1 = this;
var params = {
gridId: wx.getStorageSync("gridId")
};
index_1.getallmatters(params).then(function (res) {
console.log("获取可预约列表", res);
_this_1.setData({
bookList: res.data
});
}).catch(function (err) {
console.error("获取可预约列表", err);
});
},
appointmentrecordmini: function () {
var _this_1 = this;
var params = {
gridId: wx.getStorageSync("gridId")
};
index_1.appointmentrecordmini(params).then(function (res) {
console.log("获取已预约列表", res);
_this_1.setData({
bookedList: res.data
});
}).catch(function (err) {
console.error("获取已预约列表", err);
});
},
cancelappointment: function (e) {
var _this = this;
wx.showModal({
showCancel: true,
title: "确认取消预约?",
success: function (res) {
if (res.confirm) {
var id = e.currentTarget.dataset.id;
var params = {
recordId: id
};
index_1.cancelappointment(params).then(function () {
wx.showToast({
icon: "none",
title: "取消成功"
});
_this.appointmentrecordmini();
});
}
}
});
}
});