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.
142 lines
4.6 KiB
142 lines
4.6 KiB
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var index_1 = require("../../api/index");
|
|
function getCurrentDay() {
|
|
var date = new Date();
|
|
var year = date.getFullYear();
|
|
var month = (date.getMonth() + 1) > 9 ? date.getMonth() + 1 : "0" + (date.getMonth() + 1);
|
|
var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
|
|
return year + "-" + month + "-" + day;
|
|
}
|
|
var arr = [];
|
|
Component({
|
|
data: {
|
|
popupVisible: true,
|
|
datePickerVisible: false,
|
|
datePickerValue: arr,
|
|
datePickerOptions: [
|
|
{ label: "2022-03-01", value: "2022-03-01" },
|
|
{ label: "2022-03-02", value: "2022-03-02" },
|
|
{ label: "2022-03-03", value: "2022-03-03" },
|
|
{ label: "2022-03-04", value: "2022-03-04" },
|
|
],
|
|
currentTime: "",
|
|
hoursList: [],
|
|
selectHourList: []
|
|
},
|
|
properties: {
|
|
visible: {
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
matterId: {
|
|
type: String,
|
|
value: "",
|
|
observer: function (val) {
|
|
if (val) {
|
|
this.appointmenttime(getCurrentDay());
|
|
}
|
|
}
|
|
},
|
|
matterName: {
|
|
type: String,
|
|
value: ""
|
|
}
|
|
},
|
|
methods: {
|
|
onPopupClose: function () {
|
|
this.triggerEvent("onclose");
|
|
},
|
|
onCheckboxChange: function (e) {
|
|
this.setData({
|
|
selectHourList: e.detail.value
|
|
});
|
|
},
|
|
showDatePicker: function () {
|
|
this.setData({
|
|
datePickerVisible: true
|
|
});
|
|
},
|
|
datePickerConfirm: function (e) {
|
|
this.setData({
|
|
currentTime: e.detail.label,
|
|
datePickerValue: [e.detail.label]
|
|
});
|
|
this.appointmenttime(e.detail.label);
|
|
},
|
|
datePickerCancel: function () {
|
|
this.setData({
|
|
datePickerVisible: false
|
|
});
|
|
},
|
|
datePickerVisibleChange: function (e) {
|
|
this.setData({
|
|
datePickerVisible: e.detail.visible
|
|
});
|
|
},
|
|
bookTime: function () {
|
|
this.triggerEvent("bookCb");
|
|
},
|
|
appointmenttime: function (date) {
|
|
var _this = this;
|
|
var params = {
|
|
matterId: this.data.matterId,
|
|
date: date
|
|
};
|
|
index_1.appointmenttime(params).then(function (res) {
|
|
var _a = res.data, dateList = _a.dateList, timeDetail = _a.timeDetail;
|
|
var datePickerOptions = [];
|
|
dateList.forEach(function (item) {
|
|
datePickerOptions.push({ label: item, value: item });
|
|
});
|
|
var hoursList = [];
|
|
timeDetail.forEach(function (item) {
|
|
hoursList.push({
|
|
time: item.time,
|
|
id: item.timeId,
|
|
disabled: !item.isAppointment,
|
|
checked: false,
|
|
reason: !item.isAppointment && item.isMiss ? "已预约" : "已过期"
|
|
});
|
|
});
|
|
_this.setData({
|
|
currentTime: date,
|
|
datePickerValue: [date],
|
|
datePickerOptions: datePickerOptions,
|
|
hoursList: hoursList
|
|
});
|
|
console.log("获取可预约时间", res);
|
|
}).catch(function (err) {
|
|
console.error(err);
|
|
});
|
|
},
|
|
appointmentmini: function () {
|
|
var _this = this;
|
|
if (this.data.selectHourList.length === 0) {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: "请选择时间段"
|
|
});
|
|
return false;
|
|
}
|
|
var params = {
|
|
matterId: this.data.matterId,
|
|
appointmentDate: this.data.currentTime,
|
|
timeId: this.data.selectHourList.join(","),
|
|
remark: "",
|
|
orgId: wx.getStorageSync("gridId"),
|
|
orgType: "grid"
|
|
};
|
|
index_1.appointmentmini(params).then(function (res) {
|
|
console.log(res);
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: "预约成功"
|
|
});
|
|
_this.triggerEvent("bookCb");
|
|
}).catch(function (err) {
|
|
console.error(err);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|