From 4209ee732c809b4b15b349c9fce80834e4e6afbb Mon Sep 17 00:00:00 2001
From: xiaowang <2161656029@qq.com>
Date: Fri, 4 Sep 2026 15:50:55 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=88=91?=
=?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=BA=97=E9=93=BA?=
=?UTF-8?q?=E4=BB=8A=E6=97=A5=E6=A6=82=E8=A7=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
JC-Salon-WeChat/pages/profile/index.js | 65 ++++++++++++++++++
JC-Salon-WeChat/pages/profile/index.wxml | 35 ++++++++++
JC-Salon-WeChat/pages/profile/index.wxss | 86 ++++++++++++++++++++++++
3 files changed, 186 insertions(+)
diff --git a/JC-Salon-WeChat/pages/profile/index.js b/JC-Salon-WeChat/pages/profile/index.js
index bb0799ab..0f48b262 100644
--- a/JC-Salon-WeChat/pages/profile/index.js
+++ b/JC-Salon-WeChat/pages/profile/index.js
@@ -2,6 +2,10 @@ const { BRAND_CONFIG } = require('../../utils/config')
const userApi = require('../../api/user')
const auth = require('../../utils/auth')
const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
+const planningApi = require('../../api/planning')
+const employeesApi = require('../../api/employees')
+const shopApi = require('../../api/shop')
+const dateUtil = require('../../utils/date')
function resolveRoleText(type) {
const role = Number(type)
@@ -27,6 +31,17 @@ Page({
wechatId: '',
signature: ''
},
+ overviewLoading: false,
+ overview: {
+ date: '',
+ todayAppointments: 0,
+ pendingAppointments: 0,
+ upcomingAppointments: 0,
+ availableEmployees: 0,
+ scheduleExceptions: 0,
+ shopOpen: true,
+ shopStatus: '营业中'
+ },
menus: [
{ title: '个人信息', action: 'editProfile' },
{ title: '店铺设置', url: '/pages/shop-settings/index' },
@@ -39,6 +54,56 @@ Page({
onShow() {
this.refreshFromSession()
this.loadProfile()
+ this.loadOverview()
+ },
+
+ async loadOverview() {
+ const today = dateUtil.formatDate(new Date())
+ this.setData({ overviewLoading: true })
+ try {
+ const [calendar, shop] = await Promise.all([
+ planningApi.calendar({ startDate: today, endDate: today }),
+ shopApi.settings()
+ ])
+ const appointments = Array.isArray(calendar.appointments) ? calendar.appointments : []
+ const now = Date.now()
+ const upcomingAppointments = appointments.filter(item => {
+ const appointmentTime = new Date(String(item.appointmentTime || item.startTime || '').replace(/-/g, '/')).getTime()
+ return Number.isFinite(appointmentTime) && appointmentTime >= now
+ }).length
+ const artists = Array.isArray(calendar.artists) ? calendar.artists : []
+ const scheduleRules = await Promise.all(artists.map(artist => employeesApi.scheduleRule({ artistId: artist.id })))
+ const scheduleExceptions = scheduleRules.reduce((total, setting) => {
+ const exceptions = Array.isArray(setting && setting.exceptions) ? setting.exceptions : []
+ return total + exceptions.filter(item => item.workDate === today).length
+ }, 0)
+ const shopOpen = Number(shop && shop.status) !== 0
+ this.setData({
+ overview: {
+ date: `${today.slice(5, 7)}月${today.slice(8, 10)}日`,
+ todayAppointments: appointments.length,
+ pendingAppointments: appointments.filter(item => Number(item.status) === 0).length,
+ upcomingAppointments,
+ availableEmployees: artists.filter(item => Number(item.status) !== 0).length,
+ scheduleExceptions,
+ shopOpen,
+ shopStatus: shopOpen ? '营业中' : '已暂停'
+ }
+ })
+ } catch (error) {
+ wx.showToast({ title: error.message || '今日概览加载失败', icon: 'none' })
+ } finally {
+ this.setData({ overviewLoading: false })
+ }
+ },
+
+ goOverviewAction(event) {
+ const action = event.currentTarget.dataset.action
+ if (action === 'scheduleExceptions') {
+ wx.navigateTo({ url: '/pages/leave-management/index' })
+ return
+ }
+ wx.switchTab({ url: '/pages/planning/index' })
},
refreshFromSession() {
diff --git a/JC-Salon-WeChat/pages/profile/index.wxml b/JC-Salon-WeChat/pages/profile/index.wxml
index dca10981..37fda680 100644
--- a/JC-Salon-WeChat/pages/profile/index.wxml
+++ b/JC-Salon-WeChat/pages/profile/index.wxml
@@ -10,6 +10,41 @@
{{roleText}}
+
+
+ 店铺今日概览
+ {{overview.date}}
+
+ 正在加载今日数据...
+
+
+ {{overview.todayAppointments}}
+ 今日预约
+
+
+ {{overview.pendingAppointments}}
+ 待确认预约
+
+
+ {{overview.upcomingAppointments}}
+ 即将开始
+
+
+ {{overview.availableEmployees}}
+ 今日可预约员工
+
+
+ {{overview.scheduleExceptions}}
+ 请假/调班待处理
+
+
+
+ {{overview.shopStatus}}
+ 店铺当前状态
+
+
+
+