diff --git a/FD-Core/src/main/java/com/xiaowang/fingertipdesigner/core/modules/user/service/impl/UserServiceImpl.java b/FD-Core/src/main/java/com/xiaowang/fingertipdesigner/core/modules/user/service/impl/UserServiceImpl.java index cb67bd85..6d4df621 100644 --- a/FD-Core/src/main/java/com/xiaowang/fingertipdesigner/core/modules/user/service/impl/UserServiceImpl.java +++ b/FD-Core/src/main/java/com/xiaowang/fingertipdesigner/core/modules/user/service/impl/UserServiceImpl.java @@ -1897,7 +1897,8 @@ public class UserServiceImpl extends ServiceImpl implements if (StringUtils.hasText(keyword)) { wrapper.and(w -> w.like(UserDO::getAccount, keyword) .or().like(UserDO::getNickname, keyword) - .or().like(UserDO::getPhone, keyword)); + .or().like(UserDO::getPhone, keyword) + .or().like(UserDO::getContactPhone, keyword)); } if (shopId != null && shopId > 0) { List userIds = userShopBindingSupport.listUserIdsByShopId(shopId, true); diff --git a/FD-Frontend/public/jiayu-designer-icon.png b/FD-Frontend/public/jiayu-designer-icon.png index e0a03c71..4e373e9a 100644 Binary files a/FD-Frontend/public/jiayu-designer-icon.png and b/FD-Frontend/public/jiayu-designer-icon.png differ diff --git a/FD-WeChat-Fronted/assets/images/app-icon.png b/FD-WeChat-Fronted/assets/images/app-icon.png index e0a03c71..4e373e9a 100644 Binary files a/FD-WeChat-Fronted/assets/images/app-icon.png and b/FD-WeChat-Fronted/assets/images/app-icon.png differ diff --git a/FM-Wechat-Fronted/assets/images/app-icon.png b/FM-Wechat-Fronted/assets/images/app-icon.png index 82896054..9e0f61e7 100644 Binary files a/FM-Wechat-Fronted/assets/images/app-icon.png and b/FM-Wechat-Fronted/assets/images/app-icon.png differ diff --git a/FM-Wechat-Fronted/pages/appointment-form/index.js b/FM-Wechat-Fronted/pages/appointment-form/index.js index f05e6099..869de60d 100644 --- a/FM-Wechat-Fronted/pages/appointment-form/index.js +++ b/FM-Wechat-Fronted/pages/appointment-form/index.js @@ -1,5 +1,6 @@ const planningApi = require('../../api/planning') const productsApi = require('../../api/products') +const customersApi = require('../../api/customers') const dateUtil = require('../../utils/date') function buildClientRequestId(prefix) { @@ -65,9 +66,22 @@ function isScheduleCoveringTime(schedule, form, startMinute, endMinute) { return scheduleStartMinute <= startMinute && scheduleEndMinute >= endMinute } +function normalizeCustomer(customer) { + const name = customer.nickname || customer.name || customer.account || '' + const phone = customer.contactPhone || customer.phone || '' + return { + id: customer.id, + name, + phone, + displayName: name || phone || '客户', + displayPhone: phone || '未填写手机号' + } +} + Page({ data: { form: { + customerUserId: '', customerName: '', phone: '', appointmentDate: dateUtil.formatDate(new Date()), @@ -79,6 +93,10 @@ Page({ artistId: '', remark: '' }, + customerOptions: [], + customerDropdownVisible: false, + customerLoading: false, + customerError: '', products: [], filteredProducts: [], artists: [], @@ -107,6 +125,7 @@ Page({ return } this.loadOptions() + this.searchCustomers() }, async loadOptions() { @@ -148,11 +167,81 @@ Page({ }, onInput(event) { + const field = event.currentTarget.dataset.field + const patch = { + [`form.${field}`]: event.detail.value + } + if (field === 'customerName' || field === 'phone') { + patch['form.customerUserId'] = '' + patch.customerDropdownVisible = true + } + this.setData(patch) + if (field === 'customerName' || field === 'phone') { + this.scheduleCustomerSearch(field) + } + }, + + onCustomerFocus(event) { + const field = event.currentTarget.dataset.field + this.setData({ customerDropdownVisible: true }) + this.searchCustomers(field) + }, + + scheduleCustomerSearch(field) { + clearTimeout(this._customerTimer) + this._customerTimer = setTimeout(() => this.searchCustomers(field), 250) + }, + + async searchCustomers(preferredField) { + if (!this.data.canCreateAppointment) { + return + } + const form = this.data.form + const sourceValue = preferredField === 'phone' ? form.phone : form.customerName || form.phone + const keyword = String(sourceValue || '').trim() + this.setData({ customerLoading: true }) + try { + const data = await customersApi.list({ keyword, page: 1, size: 20 }) + const list = data.list || data || [] + this.setData({ + customerOptions: list.map(normalizeCustomer), + customerError: '' + }) + } catch (error) { + this.setData({ + customerOptions: [], + customerError: error.message || '客户列表加载失败' + }) + } finally { + this.setData({ customerLoading: false }) + } + }, + + selectCustomer(event) { + const customer = this.data.customerOptions.find(item => String(item.id) === String(event.currentTarget.dataset.id)) + if (!customer) { + return + } this.setData({ - [`form.${event.currentTarget.dataset.field}`]: event.detail.value + 'form.customerUserId': customer.id, + 'form.customerName': customer.name, + 'form.phone': customer.phone, + customerDropdownVisible: false }) }, + hideCustomerDropdown() { + setTimeout(() => { + this.setData({ customerDropdownVisible: false }) + }, 180) + }, + + onUnload() { + if (this._customerTimer) { + clearTimeout(this._customerTimer) + } + }, + async onDateChange(event) { this.setData({ 'form.appointmentDate': event.detail.value }) await this.loadArtists() @@ -303,6 +392,7 @@ Page({ try { const payload = { ...form, + customerUserId: form.customerUserId ? String(form.customerUserId) : undefined, artistId: String(form.artistId), durationMinutes: Number(form.durationMinutes || 0) || undefined, clientRequestId: buildClientRequestId('manager-appointment') diff --git a/FM-Wechat-Fronted/pages/appointment-form/index.wxml b/FM-Wechat-Fronted/pages/appointment-form/index.wxml index 39c514ae..7cea1d3f 100644 --- a/FM-Wechat-Fronted/pages/appointment-form/index.wxml +++ b/FM-Wechat-Fronted/pages/appointment-form/index.wxml @@ -1,12 +1,28 @@ - - 客户姓名 - - - - 手机号 - + + + 客户姓名 + + + + 手机号 + + + + 正在搜索客户... + {{customerError}},可继续手动输入 + + + + {{item.displayName}} + {{item.displayPhone}} + + 选择 + + 暂无匹配客户,可继续手动输入 + + 预约日期 diff --git a/FM-Wechat-Fronted/pages/appointment-form/index.wxss b/FM-Wechat-Fronted/pages/appointment-form/index.wxss index be4121de..ac28a509 100644 --- a/FM-Wechat-Fronted/pages/appointment-form/index.wxss +++ b/FM-Wechat-Fronted/pages/appointment-form/index.wxss @@ -3,6 +3,77 @@ font-size: 24rpx; } +.customer-select { + position: relative; +} + +.customer-dropdown { + position: absolute; + top: 214rpx; + right: 0; + left: 180rpx; + z-index: 30; + max-height: 360rpx; + overflow-y: auto; + border: 1rpx solid #e5ded4; + border-radius: 18rpx; + background: #fffdf8; + box-shadow: 0 18rpx 40rpx rgba(58, 48, 34, 0.14); +} + +.customer-option { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; + min-height: 76rpx; + padding: 0 20rpx; + border-bottom: 1rpx solid #f0e9df; +} + +.customer-option:last-child { + border-bottom: 0; +} + +.customer-copy { + display: flex; + min-width: 0; + flex: 1; + flex-direction: column; + gap: 6rpx; +} + +.customer-name { + min-width: 0; + overflow: hidden; + color: #2a2521; + font-size: 26rpx; + font-weight: 800; + text-overflow: ellipsis; + white-space: nowrap; +} + +.customer-phone { + color: #8c8177; + font-size: 24rpx; +} + +.customer-select-tag { + flex: 0 0 auto; + padding: 4rpx 12rpx; + border-radius: 999rpx; + background: #e5eee9; + color: #55786d; + font-size: 22rpx; + font-weight: 800; +} + +.muted-option { + justify-content: center; + color: #9a9288; + font-size: 24rpx; +} + .product-value { display: flex; align-items: center; diff --git a/FM-Wechat-Fronted/pages/login/index.js b/FM-Wechat-Fronted/pages/login/index.js index 558532d6..94cb1e31 100644 --- a/FM-Wechat-Fronted/pages/login/index.js +++ b/FM-Wechat-Fronted/pages/login/index.js @@ -91,6 +91,10 @@ Page({ countdown: 0, countdownTimer: null, agreementAccepted: false, + agreementLoading: false, + agreementError: '', + agreementModalVisible: false, + selectedAgreement: null, rememberMe: false, agreements: [], appName: BRAND_CONFIG.appName, @@ -102,15 +106,15 @@ Page({ onLoad() { const preference = getLoginPreference() - if (!preference.rememberMe) { - return + if (preference.rememberMe) { + this.setData({ + loginMode: preference.loginMode === 'password' ? 'password' : 'phone', + rememberMe: true, + 'form.account': preference.account || '', + 'form.phone': preference.phone || '' + }) } - this.setData({ - loginMode: preference.loginMode === 'password' ? 'password' : 'phone', - rememberMe: true, - 'form.account': preference.account || '', - 'form.phone': preference.phone || '' - }) + this.loadAgreements() }, onInput(event) { @@ -151,13 +155,23 @@ Page({ async loadAgreements() { if (this.data.agreements.length) { - return + return this.data.agreements } + if (this.data.agreementLoading) { + return this.data.agreements + } + this.setData({ agreementLoading: true, agreementError: '' }) try { const agreements = await authApi.getCurrentAgreements() - this.setData({ agreements: Array.isArray(agreements) ? agreements : [] }) + const normalizedAgreements = Array.isArray(agreements) ? agreements : [] + this.setData({ agreements: normalizedAgreements }) + return normalizedAgreements } catch (error) { - wx.showToast({ title: error.message || '协议加载失败', icon: 'none' }) + const agreementError = error.message || '协议内容加载失败,请稍后重试' + this.setData({ agreementError }) + return [] + } finally { + this.setData({ agreementLoading: false }) } }, @@ -167,6 +181,30 @@ Page({ }) }, + async openAgreement(event) { + const type = event.currentTarget.dataset.type + const agreements = await this.loadAgreements() + const selectedAgreement = agreements.find(item => item.agreementType === type) + if (!selectedAgreement) { + wx.showToast({ title: this.data.agreementError || '协议内容暂不可用', icon: 'none' }) + return + } + this.setData({ + selectedAgreement, + agreementModalVisible: true + }) + }, + + closeAgreementModal() { + this.setData({ + agreementModalVisible: false, + selectedAgreement: null + }) + }, + + stopTap() { + }, + toggleRememberMe() { const rememberMe = !this.data.rememberMe this.setData({ rememberMe }) @@ -210,7 +248,7 @@ Page({ } const versions = this.buildAgreementPayload().agreementVersions if (!versions.USER_TERMS || !versions.PRIVACY_POLICY) { - wx.showToast({ title: '协议版本加载中,请稍后再试', icon: 'none' }) + wx.showToast({ title: this.data.agreementError || '协议版本加载中,请稍后再试', icon: 'none' }) return false } return true @@ -252,6 +290,7 @@ Page({ account: form.account, password: form.password, rememberMe: !!this.data.rememberMe, + ...this.buildAgreementPayload(), ...(shopId ? { shopId } : {}) } }, @@ -369,6 +408,9 @@ Page({ }, async submit() { + if (this.data.loading) { + return + } const form = this.data.form if (this.data.loginMode === 'password' && (!form.account || !form.password)) { wx.showToast({ title: '请填写账号和密码', icon: 'none' }) @@ -378,10 +420,8 @@ Page({ wx.showToast({ title: '请输入正确手机号和验证码', icon: 'none' }) return } - if (this.data.loginMode === 'phone') { - await this.loadAgreements() - } - if (this.data.loginMode === 'phone' && !this.ensureAgreementAccepted()) { + await this.loadAgreements() + if (!this.ensureAgreementAccepted()) { return } this.setData({ loading: true }) diff --git a/FM-Wechat-Fronted/pages/login/index.wxml b/FM-Wechat-Fronted/pages/login/index.wxml index d87965af..314023b0 100644 --- a/FM-Wechat-Fronted/pages/login/index.wxml +++ b/FM-Wechat-Fronted/pages/login/index.wxml @@ -32,15 +32,21 @@ - + {{agreementAccepted ? '✓' : ''}} - 我已阅读并同意用户协议和隐私政策 + + 我已阅读并同意 + 《用户协议》 + 和 + 《隐私政策》 + + {{agreementError}},点此重试 {{rememberMe ? '✓' : ''}} - 记住我 + 记住我,保持登录更久 - + @@ -73,4 +79,15 @@ 正在进入店铺... + + + + {{selectedAgreement.title || '协议详情'}} + 版本:{{selectedAgreement.version || '-'}} + + {{selectedAgreement.content || '暂无协议内容'}} + + + + diff --git a/FM-Wechat-Fronted/pages/login/index.wxss b/FM-Wechat-Fronted/pages/login/index.wxss index d4228d9d..250506cb 100644 --- a/FM-Wechat-Fronted/pages/login/index.wxss +++ b/FM-Wechat-Fronted/pages/login/index.wxss @@ -2,14 +2,14 @@ display: flex; flex-direction: column; justify-content: flex-start; - padding-top: 40rpx; + padding-top: 12rpx; } .brand { display: flex; flex-direction: column; align-items: center; - margin-bottom: 34rpx; + margin-bottom: 24rpx; } .logo { @@ -125,10 +125,26 @@ line-height: 1.45; } +.agreement-link { + color: #55786d; + font-weight: 800; +} + +.agreement-error { + margin-top: 16rpx; + color: #c36a6a; + font-size: 23rpx; + line-height: 1.5; +} + .login-btn { margin-top: 28rpx; } +.login-btn.disabled { + opacity: 0.56; +} + .auth-links { display: flex; justify-content: space-between; @@ -240,3 +256,52 @@ font-weight: 700; text-align: center; } + +.agreement-mask { + position: fixed; + inset: 0; + z-index: 90; + display: flex; + align-items: center; + justify-content: center; + padding: 28rpx; + background: rgba(36, 33, 29, 0.42); +} + +.agreement-modal { + width: 100%; + max-height: 82vh; + padding: 30rpx 28rpx; + border-radius: 24rpx; + background: #fffdf8; + box-shadow: 0 24rpx 64rpx rgba(58, 48, 34, 0.18); +} + +.agreement-modal-title { + color: #24211d; + font-size: 32rpx; + font-weight: 900; + line-height: 1.35; +} + +.agreement-modal-meta { + margin-top: 10rpx; + color: #928a80; + font-size: 22rpx; +} + +.agreement-modal-body { + height: 640rpx; + max-height: 56vh; + margin-top: 22rpx; + padding: 20rpx; + border-radius: 18rpx; + background: #f3eee7; + color: #2f2a25; + font-size: 24rpx; + line-height: 1.85; +} + +.agreement-modal-close { + margin-top: 22rpx; +} diff --git a/FM-Wechat-Fronted/project.config.json b/FM-Wechat-Fronted/project.config.json index d391fcc3..af61b852 100644 --- a/FM-Wechat-Fronted/project.config.json +++ b/FM-Wechat-Fronted/project.config.json @@ -34,7 +34,7 @@ } }, "condition": {}, - "projectname": "指尖管理师", + "projectname": "甲屿店务", "simulatorType": "wechat", "simulatorPluginLibVersion": {}, "editorSetting": {},