shaogen1995 2 hónapja
szülő
commit
76c373194e

+ 45 - 16
展示端/src/pages/B3start/index.tsx

@@ -5,8 +5,8 @@ import dayjs from 'dayjs'
 import getWeekList, { TimeChageResType } from '@/utils/timeChange'
 import classNames from 'classnames'
 import history from '@/utils/history'
-import { B1_APIgetInfoByDay } from '@/store/action/all'
-import { B3TimeArrType } from './type'
+import { B1_APIgetInfoByDay, B3_APIgetList } from '@/store/action/all'
+import { B3ListApiType, B3TimeArrType } from './type'
 import { useParams } from 'react-router-dom'
 
 function B3start() {
@@ -53,26 +53,55 @@ function B3start() {
       // 取消晚上8点,按晚上12点来
       let xiaoShi8 = nowXiaoShi >= 20 ? 7 : 7
 
-      const arr = getWeekList(undefined, undefined, xiaoShi8)
+      const arr1 = getWeekList(undefined, undefined, xiaoShi8)
 
       let arrRes: TimeChageResType[] = []
 
-      arr.forEach((v, i) => {
-        if (!noTimeArr.includes(v.date)) {
-          // arrRes.push(v)
-          // 只有周六日可以约
-          const num = dayjs(v.timeStamp).day()
-          if ([6, 0].includes(num)) {
-            arrRes.push(v)
-          }
+      // 过滤掉 日期没有名额的-----------
+      const res2 = await B3_APIgetList()
+      if (res2.code === 0) {
+        const listAll: B3ListApiType[] = res2.data
+
+        const obj: { [key: string]: B3TimeArrType[] } = {
+          0: [],
+          1: [],
+          2: [],
+          3: [],
+          4: [],
+          5: [],
+          6: []
         }
-      })
 
-      if (arrRes && arrRes.length) setNowTime(arrRes[0].date)
+        listAll.forEach(v => {
+          obj[0].push({ id: v.id, time: v.time, pcs: v.sunday })
+          obj[1].push({ id: v.id, time: v.time, pcs: v.monday })
+          obj[2].push({ id: v.id, time: v.time, pcs: v.tuesday })
+          obj[3].push({ id: v.id, time: v.time, pcs: v.wednesday })
+          obj[4].push({ id: v.id, time: v.time, pcs: v.thursday })
+          obj[5].push({ id: v.id, time: v.time, pcs: v.friday })
+          obj[6].push({ id: v.id, time: v.time, pcs: v.saturday })
+        })
+
+        arr1.forEach((v, i) => {
+          if (!noTimeArr.includes(v.date)) {
+            const num = dayjs(v.timeStamp).day()
+            const acArr = obj[num]
+            if (acArr.some(c => c.pcs)) {
+              arrRes.push(v)
+            }
+
+            // 只有周六日可以约
+            // if ([6, 0].includes(num)) {
+            //   arrRes.push(v)
+            // }
+          }
+        })
+        if (arrRes && arrRes.length) setNowTime(arrRes[0].date)
 
-      // 设置顶部数组
-      setZhouArr(arrRes)
-      setLoding(true)
+        // 设置顶部数组
+        setZhouArr(arrRes)
+        setLoding(true)
+      }
     }
   }, [])
 

+ 1 - 1
平板二维码扫码/src/pages/A2look/index.tsx

@@ -49,7 +49,7 @@ function A2look({ sId, closeFu, type, upTable }: Props) {
         const nowDay = dayjs().format('MM_DD')
 
         // 不是当天的日期
-        if (orderDay !== nowDay) setIsNowDay(true)
+        if (orderDay !== nowDay && type === '核销') setIsNowDay(true)
       }
     },
     [closeFu, type, upTable]