How to implement WeChat Mini Programs Calendar plug-in
This article mainly introduces the WeChat Mini Programs calendar plug-in how to achieve the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this WeChat Mini Programs calendar plug-in how to achieve the article will have a harvest, let's take a look.
WeChat Mini Programs's calendar plug-in, mainly for the hotel to select the time period of the calendar, with the Gregorian calendar of the festival.
Main functions:
By selecting the check-in and departure time, record the corresponding time period, judge the selected start time and end time, and connect the corresponding time period by changing the back color.
SelectDataMarkLine: function () {let dateList = this.data.dateList; let {checkInDate, checkOutDate} = wx.getStorageSync ("ROOM_SOURCE_DATE"); let curreInid = checkInDate.substr (0,4) + "-" + (checkInDate.substr (5,2)
< 10 ? checkInDate.substr(6, 1) : checkInDate.substr(5, 2));//选择入住的id let curreOutid = checkOutDate.substr(0, 4) + "-" + (checkOutDate.substr(5, 2) < 10 ? checkOutDate.substr(6, 1) : checkOutDate.substr(5, 2));//选择离店的id let dayIn = checkInDate.substr(8, 2) >= 10? CheckInDate.substr (8,2): checkInDate.substr (9,1); / / choose the day of stay id let dayOut = checkOutDate.substr (8,2) > = 10? CheckOutDate.substr (8,2): checkOutDate.substr (9,1); / / choose the departure day id let monthIn = checkInDate.substr (5,2) > = 10? CheckInDate.substr (5,2): checkInDate.substr (6,1); / / monthly id let monthOut = checkOutDate.substr (5,2) > = 10? CheckOutDate.substr (5,2): checkOutDate.substr (6,1); / / choose the monthly id if (curreInid = = curreOutid) {/ / check-in and check-out is the current month for (let I = 0; I)
< dateList.length; i++) { if (dateList[i].id == curreInid) { let days = dateList[i].days; for (let k = 0; k < days.length; k++) { if (days[k].day >= dayIn & & days.day = dayIn) {days.class = days.class + 'bgitem';} if (days.day = = dayIn) {days.class = days.class +' active'; days [k] .inday = true } else {/ / check-in cross-month if (dateList [j] .month < monthOut) {/ / check-out month let days = dateList [j] .days; for (let k = 0; k < bgitem'; +) {days.class = days.class + 'bgitem';}} else if (dateList [j] .month = monthOut) {/ / the last month of departure let days = dateList.days For (let k = 0; k < days.length; kits +) {if (days [k] .day