统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,762 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const productsApi = require('../../api/products')
|
||||
const customersApi = require('../../api/customers')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
|
||||
const DRAFT_STORAGE_PREFIX = 'managerAppointmentDraft'
|
||||
const TIME_SLOT_MINUTES = 15
|
||||
|
||||
function buildClientRequestId(prefix) {
|
||||
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
|
||||
}
|
||||
|
||||
function getCalendarArtists(calendar) {
|
||||
return calendar && Array.isArray(calendar.artists) ? calendar.artists : []
|
||||
}
|
||||
|
||||
function findArtist(artists, artistId) {
|
||||
return artists.find(item => String(item.id) === String(artistId)) || {}
|
||||
}
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
return Number(userInfo.type) !== 3
|
||||
}
|
||||
|
||||
function buildDraftKey() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
return `${DRAFT_STORAGE_PREFIX}:${userInfo.id || 'guest'}:${userInfo.shopId || 'default'}`
|
||||
}
|
||||
|
||||
function hasPresetOptions(options) {
|
||||
return Boolean(options.customerName || options.phone || options.date || options.artistId)
|
||||
}
|
||||
|
||||
function readDraftForm() {
|
||||
try {
|
||||
const draft = wx.getStorageSync(buildDraftKey())
|
||||
return draft && draft.form ? draft.form : null
|
||||
} catch (error) {
|
||||
throw new Error(`读取预约草稿失败:${error.message || error}`)
|
||||
}
|
||||
}
|
||||
|
||||
function writeDraftForm(form) {
|
||||
try {
|
||||
wx.setStorageSync(buildDraftKey(), {
|
||||
form,
|
||||
savedAt: Date.now()
|
||||
})
|
||||
} catch (error) {
|
||||
throw new Error(`保存预约草稿失败:${error.message || error}`)
|
||||
}
|
||||
}
|
||||
|
||||
function removeDraftForm() {
|
||||
try {
|
||||
wx.removeStorageSync(buildDraftKey())
|
||||
} catch (error) {
|
||||
throw new Error(`清空预约草稿失败:${error.message || error}`)
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeDuration(value) {
|
||||
const duration = Number(value)
|
||||
return Number.isFinite(duration) && duration > 0 ? Math.floor(duration) : 0
|
||||
}
|
||||
|
||||
function buildTimeRangeLabel(startMinute, durationMinutes) {
|
||||
return `${dateUtil.timeFromMinutes(startMinute)}-${dateUtil.timeFromMinutes(startMinute + durationMinutes)}`
|
||||
}
|
||||
|
||||
function getTimePeriod(minute) {
|
||||
if (minute < 12 * 60) {
|
||||
return { key: 'morning', title: '上午' }
|
||||
}
|
||||
if (minute < 18 * 60) {
|
||||
return { key: 'afternoon', title: '下午' }
|
||||
}
|
||||
return { key: 'evening', title: '晚上' }
|
||||
}
|
||||
|
||||
function normalizeAppointmentDate(item) {
|
||||
return item.date || String(item.startTime || '').slice(0, 10)
|
||||
}
|
||||
|
||||
function extractTimeText(value) {
|
||||
const target = String(value || '')
|
||||
if (target.includes('T')) {
|
||||
return target.slice(11, 16)
|
||||
}
|
||||
if (target.includes(' ')) {
|
||||
return target.slice(11, 16)
|
||||
}
|
||||
return target.slice(0, 5)
|
||||
}
|
||||
|
||||
function resolveAppointmentStartMinute(item) {
|
||||
if (item.startMinute !== undefined && item.startMinute !== null) {
|
||||
return Number(item.startMinute)
|
||||
}
|
||||
return dateUtil.minutesOfDay(extractTimeText(item.startTime))
|
||||
}
|
||||
|
||||
function resolveAppointmentEndMinute(item, startMinute) {
|
||||
if (item.endMinute !== undefined && item.endMinute !== null) {
|
||||
return Number(item.endMinute)
|
||||
}
|
||||
if (item.endTime) {
|
||||
return dateUtil.minutesOfDay(extractTimeText(item.endTime))
|
||||
}
|
||||
return startMinute + Number(item.durationMinutes || 60)
|
||||
}
|
||||
|
||||
function isCancelledAppointment(item) {
|
||||
return item.status === 3 || item.statusText === '已取消'
|
||||
}
|
||||
|
||||
function buildBusyRanges(appointments, form) {
|
||||
return (appointments || [])
|
||||
.filter(item => String(item.artistId) === String(form.artistId))
|
||||
.filter(item => normalizeAppointmentDate(item) === form.appointmentDate)
|
||||
.filter(item => !isCancelledAppointment(item))
|
||||
.map(item => {
|
||||
const startMinute = resolveAppointmentStartMinute(item)
|
||||
return {
|
||||
startMinute,
|
||||
endMinute: resolveAppointmentEndMinute(item, startMinute)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hasBusyConflict(startMinute, endMinute, ranges) {
|
||||
return ranges.some(range => startMinute < range.endMinute && endMinute > range.startMinute)
|
||||
}
|
||||
|
||||
function buildAvailableTimeGroups(calendar, form, durationMinutes) {
|
||||
const schedules = (calendar.schedules || [])
|
||||
.filter(item => String(item.artistId) === String(form.artistId))
|
||||
.filter(item => item.date === form.appointmentDate)
|
||||
.filter(item => item.status === 1 && Number(item.capacity === undefined ? 1 : item.capacity) >= 1)
|
||||
const busyRanges = buildBusyRanges(calendar.appointments || [], form)
|
||||
const groupMap = {
|
||||
morning: { key: 'morning', title: '上午', times: [] },
|
||||
afternoon: { key: 'afternoon', title: '下午', times: [] },
|
||||
evening: { key: 'evening', title: '晚上', times: [] }
|
||||
}
|
||||
schedules.forEach(schedule => {
|
||||
const scheduleStart = dateUtil.minutesOfDay(extractTimeText(schedule.startTime))
|
||||
const scheduleEnd = dateUtil.minutesOfDay(extractTimeText(schedule.endTime))
|
||||
for (let minute = scheduleStart; minute + durationMinutes <= scheduleEnd; minute += TIME_SLOT_MINUTES) {
|
||||
const endMinute = minute + durationMinutes
|
||||
if (!hasBusyConflict(minute, endMinute, busyRanges)) {
|
||||
const period = getTimePeriod(minute)
|
||||
groupMap[period.key].times.push({
|
||||
value: dateUtil.timeFromMinutes(minute),
|
||||
rangeText: buildTimeRangeLabel(minute, durationMinutes)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return Object.keys(groupMap)
|
||||
.map(key => ({
|
||||
...groupMap[key],
|
||||
times: groupMap[key].times.filter((item, index, array) => array.findIndex(candidate => candidate.value === item.value) === index)
|
||||
}))
|
||||
.filter(group => group.times.length > 0)
|
||||
}
|
||||
|
||||
function flattenTimeGroups(groups) {
|
||||
return (groups || []).reduce((list, group) => list.concat(group.times || []), [])
|
||||
}
|
||||
|
||||
function parseProductTags(product) {
|
||||
if (Array.isArray(product.tagList) && product.tagList.length > 0) {
|
||||
return product.tagList
|
||||
}
|
||||
if (Array.isArray(product.tagInfos) && product.tagInfos.length > 0) {
|
||||
return product.tagInfos.map(item => item.tagName).filter(Boolean)
|
||||
}
|
||||
return String(product.tags || '')
|
||||
.split(/[;,,、]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function normalizeProduct(product, artists) {
|
||||
const imageUrls = Array.isArray(product.imageUrls) ? product.imageUrls : []
|
||||
const bookableArtists = String(product.bookableArtists || '')
|
||||
.split(',')
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
const artistNames = bookableArtists
|
||||
.map(id => findArtist(artists, id).name)
|
||||
.filter(Boolean)
|
||||
const durationText = product.approximateDuration || (product.serviceDurationMinutes ? `${product.serviceDurationMinutes}分钟` : '')
|
||||
return {
|
||||
...product,
|
||||
coverImage: imageUrls[0] || '',
|
||||
tagList: parseProductTags(product).slice(0, 4),
|
||||
artistText: artistNames.length > 0 ? artistNames.join('、') : '全部美甲师',
|
||||
priceText: product.price || product.price === 0 ? `¥${product.price}` : '价格待定',
|
||||
durationText
|
||||
}
|
||||
}
|
||||
|
||||
function isScheduleCoveringTime(schedule, form, startMinute, endMinute) {
|
||||
if (!schedule || String(schedule.artistId) !== String(form.artistId) || schedule.date !== form.appointmentDate) {
|
||||
return false
|
||||
}
|
||||
if (schedule.status !== 1 || Number(schedule.capacity === undefined ? 1 : schedule.capacity) < 1) {
|
||||
return false
|
||||
}
|
||||
const scheduleStartMinute = dateUtil.minutesOfDay(extractTimeText(schedule.startTime))
|
||||
const scheduleEndMinute = dateUtil.minutesOfDay(extractTimeText(schedule.endTime))
|
||||
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()),
|
||||
appointmentTime: '',
|
||||
productId: '',
|
||||
manualProductTitle: '',
|
||||
manualProductPrice: '',
|
||||
manualProductDescription: '',
|
||||
manualProductTags: '',
|
||||
manualProductTargetAudience: '',
|
||||
manualProductPrecautions: '',
|
||||
manualProductImageFileIds: '',
|
||||
manualProductImageUrl: '',
|
||||
durationMinutes: '',
|
||||
artistId: '',
|
||||
remark: ''
|
||||
},
|
||||
customerOptions: [],
|
||||
customerDropdownVisible: false,
|
||||
customerLoading: false,
|
||||
customerError: '',
|
||||
products: [],
|
||||
filteredProducts: [],
|
||||
artists: [],
|
||||
selectedProduct: {},
|
||||
selectedArtist: {},
|
||||
productModalVisible: false,
|
||||
productKeyword: '',
|
||||
productError: '',
|
||||
conflictTip: '',
|
||||
conflictLevel: 'free',
|
||||
canCreateAppointment: true,
|
||||
draftSavedAtText: '',
|
||||
manualImageUploading: false,
|
||||
timeSheetVisible: false,
|
||||
timeLoading: false,
|
||||
timeError: '',
|
||||
timeSelectTip: '请先选择美甲师并填写时长',
|
||||
availableTimeGroups: [],
|
||||
loading: false
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const creatable = canCreateAppointment()
|
||||
const draftForm = creatable && !hasPresetOptions(options) ? readDraftForm() : null
|
||||
const baseForm = draftForm || {}
|
||||
this.setData({
|
||||
canCreateAppointment: creatable,
|
||||
form: {
|
||||
...this.data.form,
|
||||
...baseForm,
|
||||
customerName: options.customerName ? decodeURIComponent(options.customerName) : (baseForm.customerName || ''),
|
||||
phone: options.phone ? decodeURIComponent(options.phone) : (baseForm.phone || ''),
|
||||
appointmentDate: options.date || baseForm.appointmentDate || dateUtil.formatDate(new Date()),
|
||||
artistId: options.artistId || baseForm.artistId || ''
|
||||
},
|
||||
draftSavedAtText: draftForm ? '已恢复本机草稿' : ''
|
||||
})
|
||||
if (!creatable) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.loadOptions()
|
||||
this.searchCustomers()
|
||||
},
|
||||
|
||||
async loadOptions() {
|
||||
try {
|
||||
const productsData = await productsApi.list({ page: 1, size: 100 })
|
||||
const products = productsData.list || productsData || []
|
||||
this.setData({ products, productError: '' })
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
products: [],
|
||||
filteredProducts: [],
|
||||
productError: error.message || '作品列表加载失败'
|
||||
})
|
||||
}
|
||||
await this.loadArtists()
|
||||
this.refreshProductCards()
|
||||
await this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async loadArtists() {
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: this.data.form.appointmentDate,
|
||||
endDate: this.data.form.appointmentDate
|
||||
})
|
||||
const artists = getCalendarArtists(calendar)
|
||||
const selectedArtist = this.data.form.artistId ? findArtist(artists, this.data.form.artistId) : {}
|
||||
this.setData({ artists, selectedArtist })
|
||||
this.refreshProductCards()
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
artists: [],
|
||||
selectedArtist: {},
|
||||
'form.artistId': '',
|
||||
conflictTip: error.message || '美甲师列表加载失败',
|
||||
conflictLevel: 'danger'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
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)
|
||||
}
|
||||
if (field === 'durationMinutes') {
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
}
|
||||
},
|
||||
|
||||
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.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,
|
||||
'form.appointmentTime': ''
|
||||
})
|
||||
await this.loadArtists()
|
||||
await this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
refreshProductCards() {
|
||||
const keyword = this.data.productKeyword.trim().toLowerCase()
|
||||
const products = this.data.products
|
||||
.map(product => normalizeProduct(product, this.data.artists))
|
||||
.filter(product => {
|
||||
if (!keyword) return true
|
||||
return [product.title, product.artistText, product.priceText, product.durationText, ...(product.tagList || [])]
|
||||
.some(value => String(value || '').toLowerCase().includes(keyword))
|
||||
})
|
||||
this.setData({ filteredProducts: products })
|
||||
},
|
||||
|
||||
openProductModal() {
|
||||
this.refreshProductCards()
|
||||
this.setData({ productModalVisible: true })
|
||||
},
|
||||
|
||||
closeProductModal() {
|
||||
this.setData({ productModalVisible: false })
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
onProductSearch(event) {
|
||||
this.setData({ productKeyword: event.detail.value })
|
||||
this.refreshProductCards()
|
||||
},
|
||||
|
||||
selectProduct(event) {
|
||||
const selectedProduct = this.data.filteredProducts.find(item => String(item.id) === String(event.currentTarget.dataset.id)) || {}
|
||||
this.setData({
|
||||
selectedProduct,
|
||||
'form.productId': selectedProduct.id,
|
||||
'form.manualProductTitle': '',
|
||||
'form.manualProductPrice': '',
|
||||
'form.manualProductDescription': '',
|
||||
'form.manualProductTags': '',
|
||||
'form.manualProductTargetAudience': '',
|
||||
'form.manualProductPrecautions': '',
|
||||
'form.manualProductImageFileIds': '',
|
||||
'form.manualProductImageUrl': '',
|
||||
'form.durationMinutes': String(parseInt(selectedProduct.approximateDuration, 10) || this.data.form.durationMinutes || '')
|
||||
})
|
||||
this.closeProductModal()
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
useManualProduct() {
|
||||
const title = String(this.data.form.manualProductTitle || '').trim()
|
||||
const price = Number(this.data.form.manualProductPrice)
|
||||
if (!title || Number.isNaN(price) || price < 0) {
|
||||
wx.showToast({ title: '请填写手动预约作品名称和价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
selectedProduct: {},
|
||||
'form.productId': '',
|
||||
'form.manualProductTitle': title,
|
||||
'form.manualProductPrice': String(price)
|
||||
})
|
||||
this.closeProductModal()
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async chooseManualProductImage() {
|
||||
if (this.data.manualImageUploading) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const filePath = await chooseImageFilePath()
|
||||
if (!filePath) {
|
||||
return
|
||||
}
|
||||
this.setData({ manualImageUploading: true })
|
||||
const uploadResult = await uploadObjectFile(filePath)
|
||||
const fileId = uploadResult.id || uploadResult.fileId
|
||||
const fileUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath
|
||||
if (!fileId) {
|
||||
throw new Error('作品图片上传成功但未返回文件ID')
|
||||
}
|
||||
this.setData({
|
||||
'form.manualProductImageFileIds': String(fileId),
|
||||
'form.manualProductImageUrl': fileUrl
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '图片上传失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ manualImageUploading: false })
|
||||
}
|
||||
},
|
||||
|
||||
removeManualProductImage() {
|
||||
this.setData({
|
||||
'form.manualProductImageFileIds': '',
|
||||
'form.manualProductImageUrl': ''
|
||||
})
|
||||
},
|
||||
|
||||
onArtistChange(event) {
|
||||
const selectedArtist = this.data.artists[Number(event.detail.value)] || {}
|
||||
this.setData({
|
||||
selectedArtist,
|
||||
'form.artistId': selectedArtist.id,
|
||||
'form.appointmentTime': ''
|
||||
})
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
canOpenTimeSheet() {
|
||||
const form = this.data.form
|
||||
return Boolean(form.appointmentDate && form.artistId && normalizeDuration(form.durationMinutes))
|
||||
},
|
||||
|
||||
async refreshAvailableTimes() {
|
||||
const form = this.data.form
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
const requestSeq = (this._availableTimeRequestSeq || 0) + 1
|
||||
this._availableTimeRequestSeq = requestSeq
|
||||
if (!form.appointmentDate || !form.artistId || !durationMinutes) {
|
||||
const patch = {
|
||||
availableTimeGroups: [],
|
||||
timeError: '',
|
||||
timeSelectTip: '请先选择美甲师并填写时长'
|
||||
}
|
||||
if (form.appointmentTime) {
|
||||
patch['form.appointmentTime'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
timeLoading: true,
|
||||
timeError: '',
|
||||
timeSelectTip: '正在计算可约时间...'
|
||||
})
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: form.appointmentDate,
|
||||
endDate: form.appointmentDate,
|
||||
artistId: form.artistId
|
||||
})
|
||||
if (requestSeq !== this._availableTimeRequestSeq) {
|
||||
return
|
||||
}
|
||||
const availableTimeGroups = buildAvailableTimeGroups(calendar, form, durationMinutes)
|
||||
const availableTimes = flattenTimeGroups(availableTimeGroups).map(item => item.value)
|
||||
const patch = {
|
||||
availableTimeGroups,
|
||||
timeSelectTip: availableTimes.length > 0 ? '请选择预约时间' : '当前美甲师当天暂无可约时间'
|
||||
}
|
||||
if (form.appointmentTime && !availableTimes.includes(form.appointmentTime)) {
|
||||
patch['form.appointmentTime'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
} catch (error) {
|
||||
if (requestSeq !== this._availableTimeRequestSeq) {
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
availableTimeGroups: [],
|
||||
timeError: error.message || '可约时间加载失败',
|
||||
timeSelectTip: '可约时间加载失败'
|
||||
})
|
||||
} finally {
|
||||
if (requestSeq === this._availableTimeRequestSeq) {
|
||||
this.setData({ timeLoading: false })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async openTimeSheet() {
|
||||
if (!this.canOpenTimeSheet()) {
|
||||
wx.showToast({ title: '请先选择美甲师并填写时长', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ timeSheetVisible: true })
|
||||
await this.refreshAvailableTimes()
|
||||
},
|
||||
|
||||
closeTimeSheet() {
|
||||
this.setData({ timeSheetVisible: false })
|
||||
},
|
||||
|
||||
selectAvailableTime(event) {
|
||||
const value = event.currentTarget.dataset.value
|
||||
this.setData({
|
||||
'form.appointmentTime': value,
|
||||
timeSheetVisible: false
|
||||
})
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async checkAvailability() {
|
||||
const form = this.data.form
|
||||
if (!form.appointmentDate || !form.appointmentTime || !form.artistId) {
|
||||
this.setData({ conflictTip: '', conflictLevel: 'free' })
|
||||
return { ok: true }
|
||||
}
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
if (!durationMinutes) {
|
||||
this.setData({ conflictTip: '', conflictLevel: 'free' })
|
||||
return { ok: true }
|
||||
}
|
||||
const startMinute = dateUtil.minutesOfDay(form.appointmentTime)
|
||||
const endMinute = startMinute + durationMinutes
|
||||
if (startMinute < dateUtil.minutesOfDay('10:00') || endMinute > dateUtil.minutesOfDay('22:00')) {
|
||||
const tip = '该时间超出营业时间 10:00-22:00'
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: form.appointmentDate,
|
||||
endDate: form.appointmentDate,
|
||||
artistId: form.artistId
|
||||
})
|
||||
const schedule = (calendar.schedules || []).find(item => isScheduleCoveringTime(item, form, startMinute, endMinute))
|
||||
if (!schedule) {
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} 当前时段无可预约排班`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
const conflicts = (calendar.appointments || []).filter(item => {
|
||||
if (String(item.artistId) !== String(form.artistId) || normalizeAppointmentDate(item) !== form.appointmentDate) return false
|
||||
if (isCancelledAppointment(item)) return false
|
||||
const itemStart = resolveAppointmentStartMinute(item)
|
||||
const itemEnd = resolveAppointmentEndMinute(item, itemStart)
|
||||
return startMinute < itemEnd && endMinute > itemStart
|
||||
})
|
||||
if (conflicts.length > 0) {
|
||||
const first = conflicts[0]
|
||||
const itemStart = resolveAppointmentStartMinute(first)
|
||||
const itemEnd = resolveAppointmentEndMinute(first, itemStart)
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} ${dateUtil.timeFromMinutes(itemStart)}-${dateUtil.timeFromMinutes(itemEnd)} 已有预约`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} ${form.appointmentTime}-${dateUtil.timeFromMinutes(endMinute)} 可预约`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'free' })
|
||||
return { ok: true, tip }
|
||||
} catch (error) {
|
||||
const tip = error.message || '排班校验失败,请稍后重试'
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const form = this.data.form
|
||||
const hasManualProduct = String(form.manualProductTitle || '').trim() && String(form.manualProductPrice || '').trim()
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
if (!form.customerName || !form.phone || (!form.productId && !hasManualProduct) || !form.artistId) {
|
||||
wx.showToast({ title: '请补全预约信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!durationMinutes) {
|
||||
wx.showToast({ title: '请填写预约时长', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const availability = await this.checkAvailability()
|
||||
if (!availability.ok) {
|
||||
wx.showToast({ title: availability.tip || '该时段已被预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const payload = {
|
||||
...form,
|
||||
customerUserId: form.customerUserId ? String(form.customerUserId) : undefined,
|
||||
artistId: String(form.artistId),
|
||||
durationMinutes,
|
||||
clientRequestId: buildClientRequestId('manager-appointment')
|
||||
}
|
||||
if (form.productId) {
|
||||
payload.productId = String(form.productId)
|
||||
payload.manualProductTitle = undefined
|
||||
payload.manualProductPrice = undefined
|
||||
} else {
|
||||
payload.productId = undefined
|
||||
payload.manualProductTitle = String(form.manualProductTitle || '').trim()
|
||||
payload.manualProductPrice = Number(form.manualProductPrice)
|
||||
payload.manualProductDescription = String(form.manualProductDescription || '').trim() || undefined
|
||||
payload.manualProductTags = String(form.manualProductTags || '').trim() || undefined
|
||||
payload.manualProductTargetAudience = String(form.manualProductTargetAudience || '').trim() || undefined
|
||||
payload.manualProductPrecautions = String(form.manualProductPrecautions || '').trim() || undefined
|
||||
payload.manualProductImageFileIds = String(form.manualProductImageFileIds || '').trim() || undefined
|
||||
}
|
||||
const result = await planningApi.createAppointment(payload)
|
||||
removeDraftForm()
|
||||
markPlanningRefresh()
|
||||
wx.redirectTo({ url: `/pages/appointment-detail/index?id=${result.orderItemId}` })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '提交失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
saveDraft() {
|
||||
try {
|
||||
writeDraftForm(this.data.form)
|
||||
this.setData({ draftSavedAtText: '草稿已保存到本机' })
|
||||
wx.showToast({ title: '草稿已保存', icon: 'success' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '草稿保存失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
clearDraft() {
|
||||
try {
|
||||
removeDraftForm()
|
||||
this.setData({ draftSavedAtText: '' })
|
||||
wx.showToast({ title: '草稿已清空', icon: 'success' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '草稿清空失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "新建预约"
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card form-card">
|
||||
<view class="customer-select">
|
||||
<view class="field">
|
||||
<text class="field-label required">客户姓名</text>
|
||||
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入手机号" />
|
||||
</view>
|
||||
<view wx:if="{{customerDropdownVisible}}" class="customer-dropdown">
|
||||
<view wx:if="{{customerLoading}}" class="customer-option muted-option">正在搜索客户...</view>
|
||||
<view wx:elif="{{customerError}}" class="customer-option muted-option">{{customerError}},可继续手动输入</view>
|
||||
<view wx:else>
|
||||
<view wx:for="{{customerOptions}}" wx:key="id" class="customer-option" data-id="{{item.id}}" bindtap="selectCustomer">
|
||||
<view class="customer-copy">
|
||||
<text class="customer-name">{{item.displayName}}</text>
|
||||
<text class="customer-phone">{{item.displayPhone}}</text>
|
||||
</view>
|
||||
<text class="customer-select-tag">选择</text>
|
||||
</view>
|
||||
<view wx:if="{{customerOptions.length === 0}}" class="customer-option muted-option">暂无匹配客户,可继续手动输入</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预约日期</text>
|
||||
<picker mode="date" value="{{form.appointmentDate}}" bindchange="onDateChange">
|
||||
<view class="field-value">{{form.appointmentDate}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预约作品</text>
|
||||
<view class="field-value product-value" bindtap="openProductModal">
|
||||
<text>{{selectedProduct.title || form.manualProductTitle || '请选择预约作品'}}</text>
|
||||
<text wx:if="{{form.manualProductTitle && !form.productId}}" class="manual-badge">手动</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预计时长</text>
|
||||
<input value="{{form.durationMinutes}}" data-field="durationMinutes" bindinput="onInput" type="number" placeholder="请输入预约时长" />
|
||||
<text class="unit">分钟</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">指定员工</text>
|
||||
<picker range="{{artists}}" range-key="name" bindchange="onArtistChange">
|
||||
<view class="field-value">{{selectedArtist.name || '请选择美甲师'}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预约时间</text>
|
||||
<view class="field-value time-value {{form.appointmentTime ? '' : 'placeholder'}}" bindtap="openTimeSheet">
|
||||
<view>
|
||||
<text>{{form.appointmentTime || timeSelectTip}}</text>
|
||||
<text wx:if="{{form.appointmentTime}}" class="time-range">{{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟</text>
|
||||
</view>
|
||||
<text class="time-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field textarea-field">
|
||||
<text class="field-label">备注</text>
|
||||
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="客户偏好、款式说明" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="capacity-tip card">
|
||||
<text class="tip-title">容量校验</text>
|
||||
<text class="tip-text">提交预约时会校验营业时间、美甲师休息和同时间段容量,冲突会直接拦截。</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{draftSavedAtText}}" class="draft-tip card">
|
||||
<text>{{draftSavedAtText}}</text>
|
||||
<button class="text-btn draft-clear" bindtap="clearDraft">清空</button>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{conflictTip}}" class="availability-tip card {{conflictLevel}}">
|
||||
<text class="tip-title">时段检查</text>
|
||||
<text class="tip-text">{{conflictTip}}</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{productModalVisible}}" class="modal-mask" bindtap="closeProductModal">
|
||||
<view class="product-modal" catchtap="stopTap">
|
||||
<view class="modal-head">
|
||||
<view>
|
||||
<text class="modal-title">选择预约作品</text>
|
||||
</view>
|
||||
<view class="modal-close" bindtap="closeProductModal">×</view>
|
||||
</view>
|
||||
<input class="product-search" value="{{productKeyword}}" bindinput="onProductSearch" placeholder="搜索作品、标签、美甲师" />
|
||||
<scroll-view class="product-list" scroll-y>
|
||||
<view wx:if="{{productError}}" class="product-empty">{{productError}}</view>
|
||||
<view wx:for="{{filteredProducts}}" wx:key="id" class="product-option {{form.productId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectProduct">
|
||||
<image wx:if="{{item.coverImage}}" class="product-cover" src="{{item.coverImage}}" mode="aspectFill"></image>
|
||||
<view wx:else class="product-cover placeholder">图</view>
|
||||
<view class="product-info">
|
||||
<view class="product-title-row">
|
||||
<text class="product-title">{{item.title}}</text>
|
||||
<text class="product-price">{{item.priceText}}</text>
|
||||
</view>
|
||||
<text class="product-meta">{{item.artistText}} · {{item.durationText || '时长待定'}}</text>
|
||||
<view class="tag-row">
|
||||
<text wx:for="{{item.tagList}}" wx:for-item="tag" wx:key="*this" class="tag-pill">{{tag}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{!productError && filteredProducts.length === 0}}" class="product-empty">暂无匹配作品</view>
|
||||
</scroll-view>
|
||||
<view class="manual-panel">
|
||||
<text class="manual-title required-label">手动新增预约作品</text>
|
||||
<view class="manual-grid">
|
||||
<input value="{{form.manualProductTitle}}" data-field="manualProductTitle" bindinput="onInput" placeholder="作品名称" />
|
||||
<input value="{{form.manualProductPrice}}" data-field="manualProductPrice" bindinput="onInput" type="digit" placeholder="价格" />
|
||||
</view>
|
||||
<textarea class="manual-textarea" value="{{form.manualProductDescription}}" data-field="manualProductDescription" bindinput="onInput" placeholder="作品描述(选填)" />
|
||||
<view class="manual-grid single">
|
||||
<input value="{{form.manualProductTags}}" data-field="manualProductTags" bindinput="onInput" placeholder="标签,多个用逗号分隔(选填)" />
|
||||
<input value="{{form.manualProductTargetAudience}}" data-field="manualProductTargetAudience" bindinput="onInput" placeholder="适合人群(选填)" />
|
||||
<input value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" placeholder="注意事项(选填)" />
|
||||
</view>
|
||||
<view class="manual-image-row">
|
||||
<image wx:if="{{form.manualProductImageUrl}}" class="manual-image" src="{{form.manualProductImageUrl}}" mode="aspectFill"></image>
|
||||
<view wx:else class="manual-image placeholder">图</view>
|
||||
<button class="secondary-btn image-btn" loading="{{manualImageUploading}}" bindtap="chooseManualProductImage">上传图片</button>
|
||||
<button wx:if="{{form.manualProductImageUrl}}" class="text-btn image-remove" bindtap="removeManualProductImage">移除</button>
|
||||
</view>
|
||||
<button class="secondary-btn manual-btn" bindtap="useManualProduct">使用手动预约作品</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{timeSheetVisible}}" class="modal-mask" bindtap="closeTimeSheet">
|
||||
<view class="time-modal" catchtap="stopTap">
|
||||
<view class="modal-head">
|
||||
<view>
|
||||
<text class="modal-title">选择预约时间</text>
|
||||
<text class="modal-subtitle">{{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟</text>
|
||||
</view>
|
||||
<view class="modal-close" bindtap="closeTimeSheet">×</view>
|
||||
</view>
|
||||
<view wx:if="{{timeLoading}}" class="time-empty">正在计算可约时间...</view>
|
||||
<view wx:elif="{{timeError}}" class="time-empty">{{timeError}}</view>
|
||||
<view wx:elif="{{availableTimeGroups.length === 0}}" class="time-empty">当前美甲师当天暂无可约时间</view>
|
||||
<scroll-view wx:else class="time-list" scroll-y>
|
||||
<view wx:for="{{availableTimeGroups}}" wx:key="key" class="time-group">
|
||||
<text class="time-group-title">{{item.title}}</text>
|
||||
<view class="time-grid">
|
||||
<view wx:for="{{item.times}}" wx:for-item="time" wx:key="value" class="time-chip {{form.appointmentTime === time.value ? 'active' : ''}}" data-value="{{time.value}}" bindtap="selectAvailableTime">
|
||||
<text>{{time.value}}</text>
|
||||
<text>{{time.rangeText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<view wx:if="{{canCreateAppointment}}" class="action-row">
|
||||
<button class="secondary-btn draft-btn" bindtap="saveDraft">保存草稿</button>
|
||||
<button class="primary-btn submit-btn" loading="{{loading}}" bindtap="submit">提交预约</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,577 @@
|
||||
.unit {
|
||||
color: #9a9288;
|
||||
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;
|
||||
justify-content: space-between;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.time-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.time-value > view {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.time-value.placeholder {
|
||||
color: #aaa096;
|
||||
}
|
||||
|
||||
.time-range {
|
||||
overflow: hidden;
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.time-arrow {
|
||||
flex: 0 0 auto;
|
||||
color: #b78b63;
|
||||
font-size: 38rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.manual-badge {
|
||||
flex: 0 0 auto;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff2df;
|
||||
color: #a26428;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.textarea-field {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.capacity-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
margin-top: 20rpx;
|
||||
padding: 22rpx;
|
||||
}
|
||||
|
||||
.tip-title {
|
||||
color: #4e4942;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
color: #90877e;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.availability-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
margin-top: 16rpx;
|
||||
padding: 22rpx;
|
||||
}
|
||||
|
||||
.availability-tip.free {
|
||||
background: #f3faf5;
|
||||
}
|
||||
|
||||
.availability-tip.warn {
|
||||
background: #fff8e8;
|
||||
}
|
||||
|
||||
.availability-tip.danger {
|
||||
background: #fff2f2;
|
||||
}
|
||||
|
||||
.availability-tip.free .tip-title {
|
||||
color: #4f7d62;
|
||||
}
|
||||
|
||||
.availability-tip.warn .tip-title {
|
||||
color: #a2763d;
|
||||
}
|
||||
|
||||
.availability-tip.danger .tip-title {
|
||||
color: #c36a6a;
|
||||
}
|
||||
|
||||
.draft-tip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
padding: 18rpx 22rpx;
|
||||
color: #6f655b;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.draft-clear {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.modal-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 80;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
background: rgba(18, 15, 12, 0.48);
|
||||
}
|
||||
|
||||
.product-modal {
|
||||
width: 100%;
|
||||
max-height: 88vh;
|
||||
padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 28rpx 28rpx 0 0;
|
||||
background: #fffaf4;
|
||||
box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
|
||||
}
|
||||
|
||||
.time-modal {
|
||||
width: 100%;
|
||||
max-height: 82vh;
|
||||
padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 28rpx 28rpx 0 0;
|
||||
background: #fffaf4;
|
||||
box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
|
||||
}
|
||||
|
||||
.modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
color: #27211d;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.modal-subtitle {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
color: #8d8278;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48rpx;
|
||||
min-width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
border: 1rpx solid #e4d8ca;
|
||||
background: #fffaf4;
|
||||
color: transparent;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.modal-close::before,
|
||||
.modal-close::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 22rpx;
|
||||
height: 3rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #61554c;
|
||||
}
|
||||
|
||||
.modal-close::before {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.modal-close::after {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.product-search {
|
||||
height: 74rpx;
|
||||
padding: 0 24rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f5eee6;
|
||||
color: #2a2521;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.product-list {
|
||||
max-height: 440rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.product-option {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 18rpx;
|
||||
min-height: 156rpx;
|
||||
margin-bottom: 16rpx;
|
||||
padding: 14rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 10rpx 24rpx rgba(92, 66, 43, 0.08);
|
||||
}
|
||||
|
||||
.product-option.active {
|
||||
border-color: #c9874d;
|
||||
background: #fff8ef;
|
||||
}
|
||||
|
||||
.product-cover {
|
||||
flex: 0 0 auto;
|
||||
width: 132rpx;
|
||||
height: 132rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #efe5da;
|
||||
}
|
||||
|
||||
.product-cover.placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #b79b82;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.product-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.product-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #2a2521;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
flex: 0 0 auto;
|
||||
color: #c56f36;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.product-meta {
|
||||
overflow: hidden;
|
||||
color: #8c8177;
|
||||
font-size: 24rpx;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
min-height: 34rpx;
|
||||
}
|
||||
|
||||
.tag-pill {
|
||||
max-width: 160rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 999rpx;
|
||||
background: #f3e9df;
|
||||
color: #826c5b;
|
||||
font-size: 22rpx;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-empty {
|
||||
padding: 44rpx 0;
|
||||
color: #9a9288;
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.time-list {
|
||||
max-height: 620rpx;
|
||||
padding-right: 2rpx;
|
||||
}
|
||||
|
||||
.time-group {
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
|
||||
.time-group:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.time-group-title {
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
color: #4d453e;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.time-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.time-chip {
|
||||
display: flex;
|
||||
min-height: 88rpx;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4rpx;
|
||||
border: 2rpx solid #eadfd2;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
color: #302923;
|
||||
box-shadow: 0 8rpx 18rpx rgba(92, 66, 43, 0.06);
|
||||
transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
|
||||
}
|
||||
|
||||
.time-chip:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.time-chip.active {
|
||||
border-color: #c9874d;
|
||||
background: #fff2df;
|
||||
color: #9f5f2d;
|
||||
}
|
||||
|
||||
.time-chip text:first-child {
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.time-chip text:last-child {
|
||||
color: #8c8177;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.time-chip.active text:last-child {
|
||||
color: #a26428;
|
||||
}
|
||||
|
||||
.time-empty {
|
||||
min-height: 220rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40rpx 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f7efe7;
|
||||
color: #8c8177;
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.manual-panel {
|
||||
margin-top: 12rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f7efe7;
|
||||
}
|
||||
|
||||
.manual-title {
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
color: #4e4740;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.manual-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 180rpx;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.manual-grid.single {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
|
||||
.manual-grid input {
|
||||
height: 70rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #fffaf4;
|
||||
color: #302923;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.manual-textarea {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
margin-top: 14rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #fffaf4;
|
||||
color: #302923;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.manual-image-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
|
||||
.manual-image {
|
||||
flex: 0 0 auto;
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #efe5da;
|
||||
}
|
||||
|
||||
.manual-image.placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #b79b82;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.image-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.image-remove {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.manual-btn {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.draft-btn,
|
||||
.submit-btn {
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
Reference in New Issue
Block a user