diff --git a/JC-Salon-WeChat/app.wxss b/JC-Salon-WeChat/app.wxss index 8d2f1e55..7daa4987 100644 --- a/JC-Salon-WeChat/app.wxss +++ b/JC-Salon-WeChat/app.wxss @@ -48,7 +48,7 @@ button::after { .card { border: 1rpx solid var(--theme-border); - border-radius: 12px; + border-radius: 20rpx; background: var(--theme-card-bg); box-shadow: 0 10rpx 28rpx rgba(23, 33, 31, 0.06); } @@ -97,8 +97,8 @@ button::after { align-items: center; justify-content: center; width: 100%; - min-height: 76rpx; - border-radius: 12px; + min-height: 88rpx; + border-radius: 20rpx; font-size: 26rpx; font-weight: 700; } @@ -117,16 +117,30 @@ button::after { } .secondary-btn { - border: 1rpx solid var(--theme-border); - background: var(--theme-card-bg); - color: var(--text-primary); + border: 1rpx solid #E7ECE9; + background: #F1F3F2; + color: #71807A; } .danger-btn { - background: #d98d8d; + background: #B3261E; color: #fff; } +.btn-row { + display: flex; + gap: 20rpx; +} + +.btn-row .primary-btn, +.btn-row .secondary-btn, +.btn-row .danger-btn { + width: auto; + min-width: 0; + max-width: none; + flex: 1 1 0; +} + .text-btn { width: auto; min-width: 0; diff --git a/JC-Salon-WeChat/pages/employee-create/index.js b/JC-Salon-WeChat/pages/employee-create/index.js index 9de1ca76..ce826944 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.js +++ b/JC-Salon-WeChat/pages/employee-create/index.js @@ -3,6 +3,63 @@ const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload') const { showErrorToast, toUserMessage } = require('../../utils/toast') const EMPLOYEE_COLORS = ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8'] +const COLOR_WHEEL_RADIUS = 110 + +function clamp(value, min, max) { + return Math.min(max, Math.max(min, value)) +} + +function normalizeHex(value) { + const raw = String(value || '').trim().replace('#', '') + if (/^[0-9a-fA-F]{3}$/.test(raw)) { + return ('#' + raw.split('').map(char => char + char).join('')).toUpperCase() + } + if (/^[0-9a-fA-F]{6}$/.test(raw)) return ('#' + raw).toUpperCase() + return '' +} + +function rgbToHex(red, green, blue) { + return ('#' + [red, green, blue] + .map(value => Math.round(clamp(value, 0, 255)).toString(16).padStart(2, '0')) + .join('')).toUpperCase() +} + +function hsvToHex(hue, saturation) { + const normalizedHue = ((Number(hue) % 360) + 360) % 360 + const s = clamp(Number(saturation) || 0, 0, 1) + const chroma = s + const x = chroma * (1 - Math.abs(((normalizedHue / 60) % 2) - 1)) + const offset = 1 - chroma + let red = 0 + let green = 0 + let blue = 0 + if (normalizedHue < 60) { red = chroma; green = x } + else if (normalizedHue < 120) { red = x; green = chroma } + else if (normalizedHue < 180) { green = chroma; blue = x } + else if (normalizedHue < 240) { green = x; blue = chroma } + else if (normalizedHue < 300) { red = x; blue = chroma } + else { red = chroma; blue = x } + return rgbToHex((red + offset) * 255, (green + offset) * 255, (blue + offset) * 255) +} + +function hexToHsv(value) { + const hex = normalizeHex(value) || '#8FB89A' + const red = parseInt(hex.slice(1, 3), 16) / 255 + const green = parseInt(hex.slice(3, 5), 16) / 255 + const blue = parseInt(hex.slice(5, 7), 16) / 255 + const max = Math.max(red, green, blue) + const min = Math.min(red, green, blue) + const delta = max - min + let hue = 0 + if (delta === 0) hue = 0 + else if (max === red) hue = 60 * (((green - blue) / delta) % 6) + else if (max === green) hue = 60 * ((blue - red) / delta + 2) + else hue = 60 * ((red - green) / delta + 4) + return { + hue: ((hue % 360) + 360) % 360, + saturation: max === 0 ? 0 : delta / max + } +} Page({ data: { @@ -10,6 +67,11 @@ Page({ appointmentContext: { date: '', time: '', durationMinutes: '' }, applicationId: '', employeeColors: EMPLOYEE_COLORS, + colorSheetVisible: false, + colorDraft: '#8FB89A', + colorHexInput: '#8FB89A', + wheelDotX: COLOR_WHEEL_RADIUS, + wheelDotY: 0, onboardingVisible: false, createdEmployee: null, userPickerVisible: false, @@ -56,8 +118,80 @@ Page({ this.setData({ [`form.${field}`]: value }) }, - selectColor(event) { - this.setData({ 'form.color': event.currentTarget.dataset.color }) + openColorSheet() { + const color = normalizeHex(this.data.form.color) || '#8FB89A' + this.setData({ colorSheetVisible: true, colorDraft: color, colorHexInput: color }) + this.applyDraftColor(color) + if (typeof wx.nextTick === 'function') { + wx.nextTick(() => { + wx.createSelectorQuery().in(this).select('.color-wheel').boundingClientRect(rect => { + this._wheelRect = rect + }).exec() + }) + } + }, + + closeColorSheet() { + this.setData({ colorSheetVisible: false }) + }, + + stopColorSheetTap() {}, + + pickDraftColor(event) { + const color = normalizeHex(event.currentTarget.dataset.color) + if (color) this.applyDraftColor(color) + }, + + onColorHexInput(event) { + this.setData({ colorHexInput: event.detail.value }) + }, + + applyColorHex() { + const color = normalizeHex(this.data.colorHexInput) + if (!color) { + wx.showToast({ title: '请输入有效的十六进制色值', icon: 'none' }) + return + } + this.applyDraftColor(color) + }, + + applyDraftColor(color) { + const { hue, saturation } = hexToHsv(color) + const angle = (hue - 90) * Math.PI / 180 + const distance = saturation * COLOR_WHEEL_RADIUS + this.setData({ + colorDraft: color, + colorHexInput: color, + wheelDotX: Math.round(COLOR_WHEEL_RADIUS + Math.cos(angle) * distance), + wheelDotY: Math.round(COLOR_WHEEL_RADIUS + Math.sin(angle) * distance) + }) + }, + + applyWheelPoint(clientX, clientY) { + const rect = this._wheelRect + if (!rect || !rect.width) return + const centerX = rect.left + rect.width / 2 + const centerY = rect.top + rect.height / 2 + const radius = rect.width / 2 + const offsetX = clientX - centerX + const offsetY = clientY - centerY + const distance = Math.min(radius, Math.sqrt(offsetX * offsetX + offsetY * offsetY)) + const hue = ((Math.atan2(offsetY, offsetX) * 180 / Math.PI + 90) % 360 + 360) % 360 + this.applyDraftColor(hsvToHex(hue, radius ? distance / radius : 0)) + }, + + onWheelTap(event) { + const touch = event.touches && event.touches[0] + if (touch) this.applyWheelPoint(touch.clientX, touch.clientY) + }, + + onWheelTouch(event) { + const touch = event.touches && event.touches[0] + if (touch) this.applyWheelPoint(touch.clientX, touch.clientY) + }, + + saveColorSheet() { + this.setData({ 'form.color': this.data.colorDraft, colorSheetVisible: false }) }, async openUserPicker() { diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxml b/JC-Salon-WeChat/pages/employee-create/index.wxml index 45a3bf05..9351c6e4 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxml +++ b/JC-Salon-WeChat/pages/employee-create/index.wxml @@ -35,8 +35,10 @@ 日程中排班展示颜色 - - + + + {{form.color}} + 选择颜色› @@ -62,6 +64,27 @@ + + + + 选择颜色 + + 推荐色 + + + + 色轮 + + + + 自定义色值 + + + + + + + diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxss b/JC-Salon-WeChat/pages/employee-create/index.wxss index 79b10094..c98aa323 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxss +++ b/JC-Salon-WeChat/pages/employee-create/index.wxss @@ -95,23 +95,166 @@ width: 176rpx; } -.color-options { +.color-current { display: flex; - flex-wrap: wrap; - gap: 18rpx; - padding: 10rpx 0; + flex: 1; + min-width: 0; + align-items: center; + gap: 16rpx; } -.color-option { - width: 44rpx; - height: 44rpx; - border: 4rpx solid #fff; - border-radius: 50%; +.color-current-chip { + width: 56rpx; + height: 56rpx; + flex: none; + border-radius: 14rpx; box-shadow: 0 0 0 1rpx #d9e3dd; } -.color-option.selected { - box-shadow: 0 0 0 4rpx #287a62; +.color-current-value { + color: #71807a; + font-size: 24rpx; +} + +.color-select-btn { + display: flex; + flex: none; + align-items: center; + gap: 6rpx; + height: 56rpx; + margin-left: auto; + padding: 0 20rpx; + border: 1rpx solid #e7ece9; + border-radius: 999rpx; + background: #f1f3f2; + color: #71807a; + font-size: 23rpx; + font-weight: 700; +} + +.color-select-arrow { + font-size: 24rpx; + line-height: 1; +} + +.color-sheet-mask { + position: fixed; + z-index: 60; + inset: 0; + display: flex; + align-items: flex-end; + background: rgba(23, 33, 31, 0.45); +} + +.color-sheet { + box-sizing: border-box; + width: 100%; + padding: 12rpx 28rpx calc(28rpx + env(safe-area-inset-bottom)); + border-radius: 40rpx 40rpx 0 0; + background: #ffffff; +} + +.color-sheet-handle { + width: 72rpx; + height: 8rpx; + margin: 0 auto 18rpx; + border-radius: 999rpx; + background: #dfe5e2; +} + +.color-sheet-title { + display: block; + color: #17211f; + font-size: 30rpx; + font-weight: 800; + text-align: center; +} + +.color-preview { + height: 110rpx; + margin-top: 18rpx; + border-radius: 16rpx; + box-shadow: 0 0 0 1rpx #e7ece9 inset; +} + +.color-section-title { + display: block; + margin-top: 20rpx; + color: #71807a; + font-size: 22rpx; +} + +.color-grid { + display: grid; + grid-template-columns: repeat(8, 1fr); + gap: 14rpx; + margin-top: 12rpx; +} + +.color-grid-item { + height: 56rpx; + border-radius: 12rpx; + box-shadow: 0 0 0 1rpx #e7ece9; +} + +.color-grid-item.selected { + box-shadow: 0 0 0 4rpx #247b63; +} + +.color-wheel { + position: relative; + width: 220rpx; + height: 220rpx; + margin: 18rpx auto 0; + border-radius: 50%; + background: radial-gradient(circle, #ffffff 0%, rgba(255, 255, 255, 0) 72%), conic-gradient(#ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000); +} + +.color-wheel-dot { + position: absolute; + width: 26rpx; + height: 26rpx; + border: 3rpx solid #ffffff; + border-radius: 50%; + box-shadow: 0 0 0 1rpx rgba(0, 0, 0, 0.25); + transform: translate(-50%, -50%); +} + +.color-hex-row { + display: flex; + align-items: center; + gap: 16rpx; + margin-top: 12rpx; +} + +.color-hex-input { + flex: 1; + min-width: 0; + height: 80rpx; + padding: 0 24rpx; + border: 1rpx solid #e7ece9; + border-radius: 12rpx; + background: #f7faf8; + font-size: 26rpx; +} + +.color-apply-btn { + display: flex; + flex: none; + align-items: center; + height: 80rpx; + margin: 0; + padding: 0 28rpx; + border-radius: 12rpx; + background: #e5f4ed; + color: #247b63; + font-size: 24rpx; + font-weight: 700; + line-height: 80rpx; +} + +.color-save-btn { + margin-top: 24rpx; } .onboarding-mask { diff --git a/JC-Salon-WeChat/pages/register/index.wxml b/JC-Salon-WeChat/pages/register/index.wxml index 2ed0d0cb..857f34ca 100644 --- a/JC-Salon-WeChat/pages/register/index.wxml +++ b/JC-Salon-WeChat/pages/register/index.wxml @@ -3,7 +3,7 @@ 123 !申请入口已失效这次注册凭证已过期或已使用,请返回登录页重新点击微信快捷登录获取新凭证。 *选择工作身份无需手机号和密码,审核人会根据你的身份处理申请店店长创建并负责一家 Salon 门店{{role === 'manager' ? '✓' : '○'}}员店员加入已有门店协同工作{{role === 'staff' ? '✓' : '○'}} - 补充资料{{role === 'manager' ? '提交后由平台管理员审核' : '提交后由对应店长审核,昵称和头像为必填资料'}}*店铺名称店铺地址 选填地图选点为可选项,仅用于门店展示和预约导航,不会在后台静默获取位置。*选择店铺{{selectedShopName || '请选择要加入的店铺'}}›*昵称可从微信昵称中选择,也可以手动填写,最多20个字。*头像请选择头像,头像会先上传并完成资料登记,提交时只引用已上传的文件。审核通过前不会获得门店业务权限返回上一步 + 补充资料{{role === 'manager' ? '提交后由平台管理员审核' : '提交后由对应店长审核,昵称和头像为必填资料'}}*店铺名称店铺地址 选填地图选点为可选项,仅用于门店展示和预约导航,不会在后台静默获取位置。*选择店铺{{selectedShopName || '请选择要加入的店铺'}}›*昵称可从微信昵称中选择,也可以手动填写,最多20个字。*头像请选择头像,头像会先上传并完成资料登记,提交时只引用已上传的文件。审核通过前不会获得门店业务权限 {{registrationStatusText === '已驳回' ? '!' : registrationStatusText === '已通过' ? '✓' : '…'}}{{registrationStatusText === '已通过' ? '申请已通过' : registrationStatusText === '已驳回' ? '申请未通过' : '申请已提交'}}{{registrationStatusText === '已通过' ? '现在可以返回登录页,使用微信快捷登录。' : registrationStatusText === '已驳回' ? (registrationStatus.rejectReason || '返回登录并重新快捷登录后,可修改资料再次申请。') : (role === 'manager' ? '申请由平台管理员处理,通过后即可使用快捷登录。' : '申请由门店店长处理,通过后即可使用快捷登录。')}}当前状态:{{registrationStatusText}}申请门店{{registrationStatus.shopName || selectedShopName || form.shopName || '—'}}申请身份{{role === 'manager' ? '店长' : '店员'}}申请昵称{{form.applicantNickname || '—'}}申请编号{{registrationStatus.applicationNo}}提交时间{{applicationSubmittedAt || '刚刚'}}{{contentStatusText}}{{contentStatusReason}} OpenID 仅用于识别你的微信身份,不会在页面中展示。 diff --git a/JC-Salon-WeChat/pages/register/index.wxss b/JC-Salon-WeChat/pages/register/index.wxss index 26977b2c..4ada6484 100644 --- a/JC-Salon-WeChat/pages/register/index.wxss +++ b/JC-Salon-WeChat/pages/register/index.wxss @@ -34,6 +34,8 @@ .progress-step { display: flex; + width: 104rpx; + flex: none; flex-direction: column; align-items: center; color: #a3b0a7; @@ -54,7 +56,7 @@ font-weight: 700; } -.progress-step label { margin-top: 8rpx; } +.progress-step label { display: block; margin-top: 8rpx; text-align: center; } .progress-step.active { color: #247b63; } .progress-step.active text { background: #247b63; color: #fff; } @@ -165,26 +167,29 @@ font-weight: 500; } -.secondary-entry, -.back-entry { +.secondary-entry { margin-top: 24rpx; color: #5b806b; font-size: 24rpx; text-align: center; } +.back-entry { + margin-top: 20rpx; +} + .secondary-entry text { margin-left: 8rpx; font-size: 30rpx; } .password-panel { padding-bottom: 4rpx; } .primary-btn { - height: 84rpx; + height: 88rpx; margin-top: 30rpx; - border-radius: 14rpx; + border-radius: 20rpx; background: #247b63; color: #fff; font-size: 28rpx; font-weight: 700; - line-height: 84rpx; + line-height: 88rpx; } .role-list { margin-top: 28rpx; } @@ -225,8 +230,8 @@ .role-mark { color: #6f9780; font-size: 34rpx; } .notice { - margin-top: 18rpx; - padding: 18rpx; + margin: 26rpx 0 0; + padding: 20rpx 24rpx; border-radius: 12rpx; background: #e5f4ed; color: #718579; @@ -269,22 +274,50 @@ .registration-detail text:last-child { min-width: 0; color: #17211f; text-align: right; overflow-wrap: anywhere; } .safe-note { margin-top: 28rpx; color: #9aa9a0; font-size: 21rpx; line-height: 1.5; text-align: center; } .avatar-pick-field { margin-top: 26rpx; } -.avatar-pick { +.avatar-row { display: flex; align-items: center; - width: 100%; - height: 104rpx; - padding: 0 20rpx; - border: 1rpx solid #dfe9e1; - border-radius: 14rpx; - background: #f3f7f4; - color: #4d7660; - font-size: 25rpx; - text-align: left; + gap: 20rpx; +} +.avatar-pick-image { + width: 72rpx; + height: 72rpx; + flex: none; + border-radius: 50%; + background: #e5f4ed; +} +.avatar-outline-btn { + width: auto; + min-width: 0; + height: 72rpx; + margin: 0; + padding: 0 24rpx; + border: 1rpx solid #e7ece9; + border-radius: 16rpx; + background: #ffffff; + color: #17211f; + font-size: 23rpx; + font-weight: 600; + line-height: 72rpx; + white-space: nowrap; +} +.avatar-outline-btn::after { border: 0; } +.address-entry { display:flex; align-items:flex-start; gap:12rpx; } +.address-entry input { min-width:0; flex:1; height:84rpx; } +.map-pick-btn { + flex: none; + width: auto; + min-width: 0; + height: 84rpx; + margin: 0; + padding: 0 22rpx; + border: 1rpx solid #e7ece9; + border-radius: 12rpx; + background: #f1f3f2; + color: #71807a; + font-size: 22rpx; + font-weight: 600; + line-height: 84rpx; + white-space: nowrap; } -.avatar-pick::after { border: 0; } -.avatar-pick image { width: 72rpx; height: 72rpx; margin-right: 20rpx; border-radius: 50%; background: #e5f4ed; } -.address-entry { display:flex; align-items:center; gap:12rpx; } -.address-entry input { min-width:0; flex:1; } -.map-pick-btn { flex:none; width:132rpx; height:64rpx; margin:0; padding:0; border-radius:10rpx; background:#e5f4ed; color:#247b63; font-size:21rpx; line-height:64rpx; } .field-hint { display:block; margin-top:10rpx; color:#819087; font-size:20rpx; line-height:1.5; }