Kaynağa Gözat

fix: handle week busy status

wangyuan 2 yıl önce
ebeveyn
işleme
dafa84c3c3

+ 10 - 2
pages/appointment/appointment.js

@@ -7,6 +7,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    isBusyDay: true,
     hasAddress: false,
     accountNumber: 0,
     addressId: '',
@@ -181,6 +182,7 @@ Page({
           disabled: false,
           active: false,
           status: '',
+          busy: false
         })
       }
       this.setData({
@@ -196,16 +198,22 @@ Page({
     if (!disabled) {
       const cDate = e.currentTarget.dataset.date
       const index = e.currentTarget.dataset.index
-      console.log(cDate, 'cDate');
+      console.log(cDate, 'cDate', new Date(cDate).getDay(), index);
       const _year = cDate.split('-')[0]
       const _month = cDate.split('-')[1]
       const _weeklist = this.data.weekList
-      _weeklist[index].active = true
+      //_weeklist[index].active = true
       _weeklist.map((item, i) => {
         if (index == i ) {
           item.active = true
+          if (new Date(cDate).getDay() == 6 || new Date(cDate).getDay() == 0) {
+            item.busy = true
+          } else {
+            item.busy = false
+          }
         } else {
           item.active = false
+          item.busy = false
         }
       })
       this.setData({

+ 1 - 1
pages/appointment/appointment.wxml

@@ -61,7 +61,7 @@
             <view class="week-body-item backup-week-body-item {{item.disabled ? 'week-body-item-disabled' : ''}} {{item.date == '约满' ? 'week-body-item-full' : ''}}" wx:for="{{backupWeekList}}" wx:key="index">
               <view class="date">{{item.date}}</view>
             </view>
-            <view class="week-body-item {{item.disabled ? 'week-body-item-disabled' : ''}} {{item.active ? 'week-body-item-active' : ''}} {{item.date == '约满' ? 'week-body-item-full' : ''}}" wx:for="{{weekList}}" wx:key="index">
+            <view class="week-body-item {{item.disabled ? 'week-body-item-disabled' : ''}} {{item.active ? 'week-body-item-active' : ''}} {{item.date == '约满' ? 'week-body-item-full' : ''}} {{item.busy ? 'week-body-item-active-busy' : ''}}" wx:for="{{weekList}}" wx:key="index">
               <view class="date" data-date="{{item.dateStr}}" data-disabled="{{item.disabled}}" data-index="{{index}}" bindtap="handleSelectDate">{{item.date}}</view>
             </view>
           </view>

+ 4 - 1
pages/appointment/appointment.wxss

@@ -181,12 +181,15 @@
 }
 .week-body-item-active {
   color: #fff;
-  background-color: #45A6B5;
+  background-color: var(--maincolor);
   border-radius: 50%;
 }
 .week-body-item-full {
   color: #9A1D16;
 }
+.week-body-item-active-busy {
+  background-color: #9A1D16;
+}
 .date {
   width: 100%;
   height: 100%;