From 1482bda1fa556d80bf403dab63285c8603557a0e Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Sat, 7 Nov 2026 00:38:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=B5=AE=E5=B1=82?= =?UTF-8?q?=E5=8A=A8=E4=BD=9C=E9=A1=B9=E6=8C=89=E9=92=AE=E5=8C=96=E5=B9=B6?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/action-modal/index.js | 56 +++++++++ .../components/action-modal/index.json | 4 + .../components/action-modal/index.wxml | 12 ++ .../components/action-modal/index.wxss | 117 ++++++++++++++++++ .../pages/appointment-detail/index.js | 16 +-- .../pages/appointment-detail/index.json | 5 +- .../pages/appointment-detail/index.wxml | 1 + .../pages/appointment-form/index.js | 23 ++-- .../pages/appointment-form/index.json | 3 +- .../pages/appointment-form/index.wxml | 1 + JC-Salon-WeChat/pages/backfill-order/index.js | 8 +- .../pages/backfill-order/index.json | 2 +- .../pages/backfill-order/index.wxml | 1 + .../pages/employee-create/index.js | 12 +- .../pages/employee-create/index.json | 3 +- .../pages/employee-create/index.wxml | 5 +- .../pages/employee-create/index.wxss | 2 +- JC-Salon-WeChat/pages/planning/index.js | 28 ++--- JC-Salon-WeChat/pages/planning/index.json | 5 +- JC-Salon-WeChat/pages/planning/index.wxml | 3 +- JC-Salon-WeChat/pages/planning/index.wxss | 18 +-- JC-Salon-WeChat/pages/profile/index.js | 12 +- JC-Salon-WeChat/pages/profile/index.json | 5 +- JC-Salon-WeChat/pages/profile/index.wxml | 1 + .../pages/schedule-setting/index.js | 5 +- .../pages/schedule-setting/index.json | 5 +- .../pages/schedule-setting/index.wxml | 1 + JC-Salon-WeChat/pages/shop-settings/index.js | 6 +- .../pages/shop-settings/index.json | 5 +- .../pages/shop-settings/index.wxml | 1 + JC-Salon-WeChat/utils/action-modal.js | 34 +++++ 31 files changed, 322 insertions(+), 78 deletions(-) create mode 100644 JC-Salon-WeChat/components/action-modal/index.js create mode 100644 JC-Salon-WeChat/components/action-modal/index.json create mode 100644 JC-Salon-WeChat/components/action-modal/index.wxml create mode 100644 JC-Salon-WeChat/components/action-modal/index.wxss create mode 100644 JC-Salon-WeChat/utils/action-modal.js diff --git a/JC-Salon-WeChat/components/action-modal/index.js b/JC-Salon-WeChat/components/action-modal/index.js new file mode 100644 index 00000000..6f5d0b2f --- /dev/null +++ b/JC-Salon-WeChat/components/action-modal/index.js @@ -0,0 +1,56 @@ +Component({ + data: { + visible: false, + title: '', + content: '', + icon: '', + cancelText: '', + confirmText: '确定', + confirmType: 'primary', + layout: 'column', + editable: false, + placeholderText: '', + inputValue: '' + }, + + methods: { + open(options = {}) { + this._onClose = typeof options.onClose === 'function' ? options.onClose : null + this.setData({ + visible: true, + title: options.title || '', + content: options.content || '', + icon: options.icon || '', + cancelText: options.cancelText || '', + confirmText: options.confirmText || '确定', + confirmType: options.confirmType || 'primary', + layout: options.layout || (options.cancelText ? 'row' : 'column'), + editable: options.editable === true, + placeholderText: options.placeholderText || '', + inputValue: '' + }) + }, + + close(result) { + this.setData({ visible: false }) + const onClose = this._onClose + this._onClose = null + if (onClose) onClose(result) + }, + + onInput(event) { + this.setData({ inputValue: event.detail.value }) + }, + + onConfirm() { + this.close({ confirm: true, cancel: false, content: this.data.inputValue }) + }, + + onCancel() { + this.close({ confirm: false, cancel: true, content: this.data.inputValue }) + }, + + stopEvent() { + } + } +}) diff --git a/JC-Salon-WeChat/components/action-modal/index.json b/JC-Salon-WeChat/components/action-modal/index.json new file mode 100644 index 00000000..79f27309 --- /dev/null +++ b/JC-Salon-WeChat/components/action-modal/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "styleIsolation": "apply-shared" +} diff --git a/JC-Salon-WeChat/components/action-modal/index.wxml b/JC-Salon-WeChat/components/action-modal/index.wxml new file mode 100644 index 00000000..80452d9e --- /dev/null +++ b/JC-Salon-WeChat/components/action-modal/index.wxml @@ -0,0 +1,12 @@ + + + {{icon === 'warning' ? '!' : 'i'}} + {{title}} + {{content}} + + + + + + + diff --git a/JC-Salon-WeChat/components/action-modal/index.wxss b/JC-Salon-WeChat/components/action-modal/index.wxss new file mode 100644 index 00000000..7647ce29 --- /dev/null +++ b/JC-Salon-WeChat/components/action-modal/index.wxss @@ -0,0 +1,117 @@ +.action-modal-mask { + position: fixed; + z-index: 80; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + padding: 40rpx; + background: rgba(23, 33, 31, 0.45); +} + +.action-modal-card { + box-sizing: border-box; + display: flex; + width: 100%; + flex-direction: column; + align-items: center; + padding: 40rpx 32rpx 32rpx; + border-radius: 28rpx; + background: #ffffff; +} + +.action-modal-icon { + display: flex; + align-items: center; + justify-content: center; + width: 88rpx; + height: 88rpx; + margin-bottom: 20rpx; + border-radius: 50%; + background: #FFF1DC; + color: #8B5E24; + font-size: 44rpx; + font-weight: 800; + line-height: 1; +} + +.action-modal-title { + color: #17211f; + font-size: 32rpx; + font-weight: 800; + text-align: center; +} + +.action-modal-content { + margin-top: 16rpx; + color: #71807a; + font-size: 26rpx; + line-height: 1.6; + text-align: center; +} + +.action-modal-input { + box-sizing: border-box; + width: 100%; + height: 88rpx; + margin-top: 24rpx; + padding: 0 24rpx; + border: 1rpx solid #e7ece9; + border-radius: 16rpx; + background: #f7faf8; + color: #17211f; + font-size: 26rpx; +} + +.action-modal-actions { + display: flex; + width: 100%; + flex-direction: column; + gap: 20rpx; + margin-top: 32rpx; +} + +.action-modal-actions.row { + flex-direction: row; +} + +.action-modal-btn { + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + width: 100%; + height: 88rpx; + padding: 0; + border: 0; + border-radius: 20rpx; + font-size: 26rpx; + font-weight: 700; + line-height: 88rpx; +} + +.action-modal-btn::after { + border: 0; +} + +.action-modal-btn.secondary { + border: 1rpx solid #E7ECE9; + background: #F1F3F2; + color: #71807A; +} + +.action-modal-btn.primary { + background: #247B63; + color: #ffffff; +} + +.action-modal-btn.danger { + background: #B3261E; + color: #ffffff; +} + +.action-modal-actions.row .action-modal-btn { + width: auto; + min-width: 0; + flex: 1 1 0; +} diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.js b/JC-Salon-WeChat/pages/appointment-detail/index.js index 75286708..c803ed1e 100644 --- a/JC-Salon-WeChat/pages/appointment-detail/index.js +++ b/JC-Salon-WeChat/pages/appointment-detail/index.js @@ -2,6 +2,7 @@ const planningApi = require('../../api/planning') const customersApi = require('../../api/customers') const { markPlanningRefresh } = require('../../utils/planning-refresh') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') function displayValue(value, fallback) { if (value === null || value === undefined) return fallback @@ -127,21 +128,20 @@ Page({ this.updateStatus(2) }, - cancel() { + async cancel() { if (!this.data.showCancel || this.data.updating) return this._cancelReason = '' - wx.showModal({ + const result = await showActionModal(this, { title: '取消预约', editable: true, placeholderText: '可填写取消原因', - content: '', + cancelText: '取消', confirmText: '确认取消', - success: result => { - if (!result.confirm) return - this._cancelReason = result.content || '' - this.updateStatus(3) - } + confirmType: 'danger' }) + if (!result.confirm) return + this._cancelReason = result.content || '' + this.updateStatus(3) }, async dialCustomer() { diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.json b/JC-Salon-WeChat/pages/appointment-detail/index.json index 7712f917..865a7298 100644 --- a/JC-Salon-WeChat/pages/appointment-detail/index.json +++ b/JC-Salon-WeChat/pages/appointment-detail/index.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "预约详情" + "navigationBarTitleText": "预约详情", + "usingComponents": { + "action-modal": "/components/action-modal/index" + } } diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.wxml b/JC-Salon-WeChat/pages/appointment-detail/index.wxml index 055889d1..dd94bf71 100644 --- a/JC-Salon-WeChat/pages/appointment-detail/index.wxml +++ b/JC-Salon-WeChat/pages/appointment-detail/index.wxml @@ -85,4 +85,5 @@ + diff --git a/JC-Salon-WeChat/pages/appointment-form/index.js b/JC-Salon-WeChat/pages/appointment-form/index.js index 64577cff..d9954338 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.js +++ b/JC-Salon-WeChat/pages/appointment-form/index.js @@ -5,6 +5,7 @@ const dateUtil = require('../../utils/date') const { markPlanningRefresh } = require('../../utils/planning-refresh') const { uploadObjectFile } = require('../../utils/upload') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') const DRAFT_STORAGE_PREFIX = 'managerAppointmentDraft' const DRAFT_TTL_MS = 7 * 24 * 60 * 60 * 1000 @@ -39,15 +40,12 @@ function isShopBusinessExpired() { return Number(userInfo.type) === 2 && userInfo.shopBusinessExpired === true } -function showBusinessExpiryNotice() { - return new Promise(resolve => wx.showModal({ +function showBusinessExpiryNotice(page) { + return showActionModal(page, { title: '门店经营有效期已到期', content: '当前门店暂不能新增普通预约。历史订单、查询和补录不受影响,请联系平台管理员办理续期。', - showCancel: false, - confirmText: '知道了', - success: () => resolve(), - fail: () => resolve() - })) + confirmText: '知道了' + }).then(() => {}) } function buildDraftKey() { @@ -1136,14 +1134,13 @@ Page({ wx.showToast({ title: '图片上传中,请稍后再恢复默认值', icon: 'none' }) return } - const result = await new Promise(resolve => wx.showModal({ + const result = await showActionModal(this, { title: '恢复默认值', content: '将清除本表单内容和本机草稿,但不会删除已上传图片文件。保留日历带入的日期和美甲师,确定继续吗?', cancelText: '继续填写', confirmText: '恢复默认', - success: resolve, - fail: () => resolve({ confirm: false }) - })) + confirmType: 'danger' + }) if (!result.confirm) return this.cancelDraftSave() try { @@ -1979,7 +1976,7 @@ Page({ return } if (isShopBusinessExpired()) { - await showBusinessExpiryNotice() + await showBusinessExpiryNotice(this) return } let form = this.data.form @@ -2079,7 +2076,7 @@ Page({ wx.redirectTo({ url: `/pages/appointment-detail/index?id=${result.orderItemId}` }) } catch (error) { if ((error.message || '').includes('有效期') || (error.message || '').includes('到期')) { - await showBusinessExpiryNotice() + await showBusinessExpiryNotice(this) } else { showErrorToast(error, '提交失败') } diff --git a/JC-Salon-WeChat/pages/appointment-form/index.json b/JC-Salon-WeChat/pages/appointment-form/index.json index 28a971f8..b4e59ff8 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.json +++ b/JC-Salon-WeChat/pages/appointment-form/index.json @@ -2,6 +2,7 @@ "navigationBarTitleText": "新增预约", "usingComponents": { "entity-selector-sheet": "/components/entity-selector-sheet/index", - "product-selector-sheet": "/components/product-selector-sheet/index" + "product-selector-sheet": "/components/product-selector-sheet/index", + "action-modal": "/components/action-modal/index" } } diff --git a/JC-Salon-WeChat/pages/appointment-form/index.wxml b/JC-Salon-WeChat/pages/appointment-form/index.wxml index afedb8a1..574b029a 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.wxml +++ b/JC-Salon-WeChat/pages/appointment-form/index.wxml @@ -150,4 +150,5 @@ + diff --git a/JC-Salon-WeChat/pages/backfill-order/index.js b/JC-Salon-WeChat/pages/backfill-order/index.js index 43b7da69..a0432a64 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.js +++ b/JC-Salon-WeChat/pages/backfill-order/index.js @@ -5,6 +5,7 @@ const customersApi = require('../../api/customers') const dateUtil = require('../../utils/date') const { uploadObjectFile } = require('../../utils/upload') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') function normalizeProduct(product, artists) { const artistIds = String(product.bookableArtists || '').split(',').map(id => id.trim()).filter(Boolean) @@ -42,14 +43,13 @@ Page({ wx.showToast({ title: '图片上传中,请稍后再恢复默认值', icon: 'none' }) return } - const result = await new Promise(resolve => wx.showModal({ + const result = await showActionModal(this, { title: '恢复默认值', content: '将清除本次补录内容,但不会删除已上传图片文件。保留入口带入的日期和美甲师,确定继续吗?', cancelText: '继续填写', confirmText: '恢复默认', - success: resolve, - fail: () => resolve({ confirm: false }) - })) + confirmType: 'danger' + }) if (!result.confirm) return const defaults = this._entryDefaults || {} const artistId = defaults.artistId || '' diff --git a/JC-Salon-WeChat/pages/backfill-order/index.json b/JC-Salon-WeChat/pages/backfill-order/index.json index 1931c803..eb9de1fc 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.json +++ b/JC-Salon-WeChat/pages/backfill-order/index.json @@ -1,4 +1,4 @@ { "navigationBarTitleText": "补录历史订单", - "usingComponents": { "entity-selector-sheet": "/components/entity-selector-sheet/index", "product-selector-sheet": "/components/product-selector-sheet/index" } + "usingComponents": { "entity-selector-sheet": "/components/entity-selector-sheet/index", "product-selector-sheet": "/components/product-selector-sheet/index", "action-modal": "/components/action-modal/index" } } diff --git a/JC-Salon-WeChat/pages/backfill-order/index.wxml b/JC-Salon-WeChat/pages/backfill-order/index.wxml index 4cf35371..ecc391c7 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.wxml +++ b/JC-Salon-WeChat/pages/backfill-order/index.wxml @@ -97,4 +97,5 @@ + diff --git a/JC-Salon-WeChat/pages/employee-create/index.js b/JC-Salon-WeChat/pages/employee-create/index.js index ce826944..ff6edfba 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.js +++ b/JC-Salon-WeChat/pages/employee-create/index.js @@ -1,6 +1,7 @@ const employeesApi = require('../../api/employees') const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') const EMPLOYEE_COLORS = ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8'] const COLOR_WHEEL_RADIUS = 110 @@ -372,16 +373,15 @@ Page({ wx.showToast({ title: '已关联并通过审核', icon: 'success' }) } catch (error) { this.setData({ associatingApplication: false }) - wx.showModal({ + const result = await showActionModal(this, { title: '关联审核未完成', content: toUserMessage(error, '美甲师档案已创建,可重试关联申请。'), + icon: 'warning', confirmText: '重试', - cancelText: '稍后处理', - success: result => { - if (result.confirm) this.associateCreatedEmployee() - else this.setData({ onboardingVisible: true }) - } + cancelText: '稍后处理' }) + if (result.confirm) this.associateCreatedEmployee() + else this.setData({ onboardingVisible: true }) } }, diff --git a/JC-Salon-WeChat/pages/employee-create/index.json b/JC-Salon-WeChat/pages/employee-create/index.json index 5daad3d8..5cad5a1f 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.json +++ b/JC-Salon-WeChat/pages/employee-create/index.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "新增美甲师", "usingComponents": { - "entity-selector-sheet": "/components/entity-selector-sheet/index" + "entity-selector-sheet": "/components/entity-selector-sheet/index", + "action-modal": "/components/action-modal/index" } } diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxml b/JC-Salon-WeChat/pages/employee-create/index.wxml index 9351c6e4..f61bbe61 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxml +++ b/JC-Salon-WeChat/pages/employee-create/index.wxml @@ -55,12 +55,12 @@ 申请编号 {{applicationNo || applicationId}} - + 不立即设置时,将默认全年无休、全天排班(00:00-23:59);实际预约仍受门店营业时间限制,之后可在排班设置中调整。 - + @@ -87,4 +87,5 @@ + diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxss b/JC-Salon-WeChat/pages/employee-create/index.wxss index c98aa323..932cad3c 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxss +++ b/JC-Salon-WeChat/pages/employee-create/index.wxss @@ -301,6 +301,6 @@ .onboarding-desc { margin-top: 12rpx; color: #837b72; font-size: 23rpx; line-height: 1.7; text-align: center; } .onboarding-default-note { margin-top: 14rpx; padding: 14rpx 16rpx; border-radius: 12rpx; background: #eff7f2; color: #39705d; font-size: 21rpx; line-height: 1.55; text-align: left; } .onboarding-primary { width: 100%; margin-top: 30rpx; } -.onboarding-skip { margin-top: 12rpx; background: transparent; color: #7e776f; font-size: 23rpx; } +.onboarding-skip { margin-top: 20rpx; } .association-retry-box { width: 100%; margin-top: 20rpx; padding: 18rpx; box-sizing: border-box; border-radius: 12rpx; background: #fff5f3; color: #8f4d46; font-size: 22rpx; text-align: center; } .association-retry-box .onboarding-primary { margin-top: 18rpx; } diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js index 7555af70..ce16465c 100644 --- a/JC-Salon-WeChat/pages/planning/index.js +++ b/JC-Salon-WeChat/pages/planning/index.js @@ -7,6 +7,7 @@ const { normalizeAvatar } = require('../../utils/profile-card') const profileCache = require('../../utils/profile-cache') const employeesApi = require('../../api/employees') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') function canCreateAppointment() { const app = getApp() @@ -287,15 +288,11 @@ Page({ } if (!summary.noticeEnabled || Number(summary.pendingCount || 0) <= 0) return false app.globalData.reviewNoticeShown = true - const result = await new Promise(resolve => { - wx.showModal({ - title: '有美甲师申请待审核', - content: `当前有 ${summary.pendingCount} 条美甲师加入申请,请在小程序员工页面审核。是否立即处理?`, - cancelText: '稍后处理', - confirmText: '立即审核', - success: resolve, - fail: () => resolve({ confirm: false }) - }) + const result = await showActionModal(this, { + title: '有美甲师申请待审核', + content: `当前有 ${summary.pendingCount} 条美甲师加入申请,请在小程序员工页面审核。是否立即处理?`, + cancelText: '稍后处理', + confirmText: '立即审核' }) if (!result.confirm) return false app.globalData.openEmployeeReview = true @@ -934,21 +931,18 @@ Page({ wx.navigateTo({ url: `/pages/artist-transfer/index?id=${event.currentTarget.dataset.id}` }) }, - quickCancel(event) { + async quickCancel(event) { const appointment = (this._calendarData && this._calendarData.appointments || []).find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id)) if (!appointment) return - wx.showModal({ + const result = await showActionModal(this, { title: '取消预约', editable: true, placeholderText: '可填写取消原因', - content: '', + cancelText: '取消', confirmText: '确认取消', - success: result => { - if (result.confirm) { - this.updateAppointmentStatus(appointment.orderId, 3, result.content || '') - } - } + confirmType: 'danger' }) + if (result.confirm) this.updateAppointmentStatus(appointment.orderId, 3, result.content || '') }, async updateAppointmentStatus(orderId, status, cancelReason) { diff --git a/JC-Salon-WeChat/pages/planning/index.json b/JC-Salon-WeChat/pages/planning/index.json index 13a0b2a4..a39bf076 100644 --- a/JC-Salon-WeChat/pages/planning/index.json +++ b/JC-Salon-WeChat/pages/planning/index.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "日程" + "navigationBarTitleText": "日程", + "usingComponents": { + "action-modal": "/components/action-modal/index" + } } diff --git a/JC-Salon-WeChat/pages/planning/index.wxml b/JC-Salon-WeChat/pages/planning/index.wxml index 3ea116a6..0d5b8222 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxml +++ b/JC-Salon-WeChat/pages/planning/index.wxml @@ -48,7 +48,7 @@ {{profileSaving ? '上传中' : '点击更换'}} - + @@ -226,4 +226,5 @@ + diff --git a/JC-Salon-WeChat/pages/planning/index.wxss b/JC-Salon-WeChat/pages/planning/index.wxss index d02fba0e..2e206db7 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxss +++ b/JC-Salon-WeChat/pages/planning/index.wxss @@ -2,7 +2,7 @@ padding-top: 18rpx; } -.phone-banner { display:flex; align-items:center; margin-bottom:18rpx; padding:16rpx 18rpx; border-radius:14rpx; background:#fff2d8; color:#815f2b; overflow:hidden; }.phone-banner-track { display:flex; flex:1; width:0; gap:50rpx; white-space:nowrap; animation:phoneBannerScroll 10s linear infinite; font-size:22rpx; }.phone-banner-close { position:relative; z-index:2; margin-left:18rpx; padding:6rpx; background:#fff2d8; font-size:32rpx; }.profile-prompt-mask { position:fixed; z-index:30; inset:0; display:flex; align-items:center; justify-content:center; padding:40rpx; background:rgba(25,41,33,.55); }.profile-prompt { box-sizing:border-box; display:flex; width:100%; flex-direction:column; align-items:center; padding:36rpx; border-radius:24rpx; background:#fff; }.profile-prompt-title { color:#17211f; font-size:32rpx; font-weight:800; }.profile-prompt-desc { margin-top:10rpx; color:#71807a; font-size:22rpx; text-align:center; }.wechat-nickname { box-sizing:border-box; width:100%; height:80rpx; margin-top:24rpx; padding:0 22rpx; border:1rpx solid #dce8df; border-radius:13rpx; background:#f7faf8; }.profile-save { width:100%; height:80rpx; margin-top:22rpx; border-radius:14rpx; background:#247b63; color:#fff; line-height:80rpx; }.profile-skip { margin-top:12rpx; background:transparent; color:#7e8e85; font-size:23rpx; } +.phone-banner { display:flex; align-items:center; margin-bottom:18rpx; padding:16rpx 18rpx; border-radius:14rpx; background:#fff2d8; color:#815f2b; overflow:hidden; }.phone-banner-track { display:flex; flex:1; width:0; gap:50rpx; white-space:nowrap; animation:phoneBannerScroll 10s linear infinite; font-size:22rpx; }.phone-banner-close { position:relative; z-index:2; margin-left:18rpx; padding:6rpx; background:#fff2d8; font-size:32rpx; }.profile-prompt-mask { position:fixed; z-index:30; inset:0; display:flex; align-items:center; justify-content:center; padding:40rpx; background:rgba(25,41,33,.55); }.profile-prompt { box-sizing:border-box; display:flex; width:100%; flex-direction:column; align-items:center; padding:36rpx; border-radius:24rpx; background:#fff; }.profile-prompt-title { color:#17211f; font-size:32rpx; font-weight:800; }.profile-prompt-desc { margin-top:10rpx; color:#71807a; font-size:22rpx; text-align:center; }.wechat-nickname { box-sizing:border-box; width:100%; height:80rpx; margin-top:24rpx; padding:0 22rpx; border:1rpx solid #dce8df; border-radius:13rpx; background:#f7faf8; }.profile-save { margin-top:22rpx; }.profile-skip { margin-top:20rpx; } .wechat-avatar { position: relative; @@ -40,16 +40,18 @@ .wechat-avatar-hint { position: absolute; - right: 0; bottom: 0; - left: 0; - height: 38rpx; - background: rgba(22, 27, 25, 0.68); + left: 50%; + height: 44rpx; + padding: 0 24rpx; + border-radius: 22rpx; + background: rgba(0, 0, 0, 0.55); color: #fff; - font-size: 19rpx; + font-size: 22rpx; font-weight: 600; - line-height: 38rpx; - text-align: center; + line-height: 44rpx; + white-space: nowrap; + transform: translateX(-50%); } @keyframes phoneBannerScroll { from { transform:translateX(0); } to { transform:translateX(-48%); } } diff --git a/JC-Salon-WeChat/pages/profile/index.js b/JC-Salon-WeChat/pages/profile/index.js index 0caa33ae..aa5f9d3b 100644 --- a/JC-Salon-WeChat/pages/profile/index.js +++ b/JC-Salon-WeChat/pages/profile/index.js @@ -5,6 +5,7 @@ const { buildProfileCard } = require('../../utils/profile-card') const profileCache = require('../../utils/profile-cache') const authApi = require('../../api/auth') const { showErrorToast } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') function resolveRoleText(type) { const role = Number(type) @@ -118,13 +119,14 @@ Page({ }, async logout() { - const confirmed = await new Promise(resolve => wx.showModal({ + const result = await showActionModal(this, { title: '退出登录', content: '退出后将关闭自动登录,并清除本机提醒设置。', - success: result => resolve(result.confirm), - fail: () => resolve(false) - })) - if (!confirmed) return + cancelText: '取消', + confirmText: '确定', + confirmType: 'danger' + }) + if (!result.confirm) return try { await authApi.logout() } catch (error) {} getApp().logoutDevice() wx.reLaunch({ url: '/pages/login/index' }) diff --git a/JC-Salon-WeChat/pages/profile/index.json b/JC-Salon-WeChat/pages/profile/index.json index 4ec55be3..3f8ddbd7 100644 --- a/JC-Salon-WeChat/pages/profile/index.json +++ b/JC-Salon-WeChat/pages/profile/index.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "我的" + "navigationBarTitleText": "我的", + "usingComponents": { + "action-modal": "/components/action-modal/index" + } } diff --git a/JC-Salon-WeChat/pages/profile/index.wxml b/JC-Salon-WeChat/pages/profile/index.wxml index 61fd49f4..60f73d4a 100644 --- a/JC-Salon-WeChat/pages/profile/index.wxml +++ b/JC-Salon-WeChat/pages/profile/index.wxml @@ -60,4 +60,5 @@ + diff --git a/JC-Salon-WeChat/pages/schedule-setting/index.js b/JC-Salon-WeChat/pages/schedule-setting/index.js index dd22a53b..5f264cc7 100644 --- a/JC-Salon-WeChat/pages/schedule-setting/index.js +++ b/JC-Salon-WeChat/pages/schedule-setting/index.js @@ -2,6 +2,7 @@ const employeesApi = require('../../api/employees') const dateUtil = require('../../utils/date') const { markPlanningRefresh } = require('../../utils/planning-refresh') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') const PRESETS = [ { value: 'DOUBLE_REST', label: '双休', workDays: [1, 2, 3, 4, 5], startTime: '09:00', endTime: '17:00' }, @@ -254,7 +255,7 @@ Page({ } } catch (error) { const message = toUserMessage(error, '保存失败') - wx.showModal({ title: '排班保存失败', content: message, showCancel: false, confirmText: '知道了' }) + await showActionModal(this, { title: '排班保存失败', content: message, confirmText: '知道了' }) } finally { this.setData({ saving: false }) } @@ -285,7 +286,7 @@ Page({ await this.loadRule() } catch (error) { const message = toUserMessage(error, '例外保存失败') - wx.showModal({ title: '特殊日期保存失败', content: message, showCancel: false, confirmText: '知道了' }) + await showActionModal(this, { title: '特殊日期保存失败', content: message, confirmText: '知道了' }) } finally { this.setData({ saving: false }) } diff --git a/JC-Salon-WeChat/pages/schedule-setting/index.json b/JC-Salon-WeChat/pages/schedule-setting/index.json index 10df7645..325f3d97 100644 --- a/JC-Salon-WeChat/pages/schedule-setting/index.json +++ b/JC-Salon-WeChat/pages/schedule-setting/index.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "排班设置" + "navigationBarTitleText": "排班设置", + "usingComponents": { + "action-modal": "/components/action-modal/index" + } } diff --git a/JC-Salon-WeChat/pages/schedule-setting/index.wxml b/JC-Salon-WeChat/pages/schedule-setting/index.wxml index 33ade346..3337fc41 100644 --- a/JC-Salon-WeChat/pages/schedule-setting/index.wxml +++ b/JC-Salon-WeChat/pages/schedule-setting/index.wxml @@ -69,4 +69,5 @@ + diff --git a/JC-Salon-WeChat/pages/shop-settings/index.js b/JC-Salon-WeChat/pages/shop-settings/index.js index 9af58551..c742ce48 100644 --- a/JC-Salon-WeChat/pages/shop-settings/index.js +++ b/JC-Salon-WeChat/pages/shop-settings/index.js @@ -2,6 +2,7 @@ const { BRAND_CONFIG } = require('../../utils/config') const profileCache = require('../../utils/profile-cache') const shopApi = require('../../api/shop') const { showErrorToast, toUserMessage } = require('../../utils/toast') +const { showActionModal } = require('../../utils/action-modal') function resolveNameStatus(value) { const status = String(value || '').toUpperCase() @@ -164,11 +165,10 @@ Page({ } }, - explainDefaultDuration() { - wx.showModal({ + async explainDefaultDuration() { + await showActionModal(this, { title: '默认时长', content: '用于新建预约表单的初始值和未设置款式时的后备时长。已选款式的时长或你在预约中修改的时长优先。', - showCancel: false, confirmText: '知道了' }) }, diff --git a/JC-Salon-WeChat/pages/shop-settings/index.json b/JC-Salon-WeChat/pages/shop-settings/index.json index cdd38dd7..5e9d906b 100644 --- a/JC-Salon-WeChat/pages/shop-settings/index.json +++ b/JC-Salon-WeChat/pages/shop-settings/index.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "店铺设置" + "navigationBarTitleText": "店铺设置", + "usingComponents": { + "action-modal": "/components/action-modal/index" + } } diff --git a/JC-Salon-WeChat/pages/shop-settings/index.wxml b/JC-Salon-WeChat/pages/shop-settings/index.wxml index d856627c..08638e5b 100644 --- a/JC-Salon-WeChat/pages/shop-settings/index.wxml +++ b/JC-Salon-WeChat/pages/shop-settings/index.wxml @@ -19,4 +19,5 @@ 正在加载店铺设置… + diff --git a/JC-Salon-WeChat/utils/action-modal.js b/JC-Salon-WeChat/utils/action-modal.js new file mode 100644 index 00000000..dc8ea084 --- /dev/null +++ b/JC-Salon-WeChat/utils/action-modal.js @@ -0,0 +1,34 @@ +function showActionModal(page, options = {}) { + const modal = page && typeof page.selectComponent === 'function' ? page.selectComponent('#actionModal') : null + if (modal && typeof modal.open === 'function') { + return new Promise(resolve => { + modal.open({ + title: options.title, + content: options.content, + icon: options.icon, + cancelText: options.cancelText, + confirmText: options.confirmText, + confirmType: options.confirmType, + layout: options.layout, + editable: options.editable, + placeholderText: options.placeholderText, + onClose: resolve + }) + }) + } + return new Promise(resolve => { + wx.showModal({ + title: options.title, + content: options.content || '', + cancelText: options.cancelText, + confirmText: options.confirmText, + showCancel: !!options.cancelText, + editable: options.editable === true, + placeholderText: options.placeholderText, + success: resolve, + fail: () => resolve({ confirm: false, cancel: true, content: '' }) + }) + }) +} + +module.exports = { showActionModal }