完善店务预约状态与详情流程
This commit is contained in:
@@ -2,6 +2,12 @@ const planningApi = require('../../api/planning')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
const { chooseImageFilePaths, uploadObjectFile, resolveUploadedImagePreviewUrl } = require('../../utils/upload')
|
||||
|
||||
const MAX_APPOINTMENT_IMAGE_COUNT = 9
|
||||
const SIGNED_IMAGE_EXPIRE_MINUTES = 60
|
||||
const STATUS_PENDING_SERVICE = 1
|
||||
const STATUS_COMPLETED = 2
|
||||
const STATUS_CANCELLED = 3
|
||||
|
||||
function canTransferAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
@@ -15,11 +21,68 @@ function splitImageValues(value) {
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function resolveProductImageUrls(appointment) {
|
||||
if (appointment && Array.isArray(appointment.productImageUrls)) {
|
||||
return appointment.productImageUrls.filter(Boolean)
|
||||
function splitTagValues(value) {
|
||||
return String(value || '')
|
||||
.split(/[;,,、]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function normalizeImageUrlArray(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value
|
||||
.map(item => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
return []
|
||||
return splitImageValues(value)
|
||||
}
|
||||
|
||||
function resolveProductImageFileIds(appointment) {
|
||||
if (!appointment || typeof appointment !== 'object') {
|
||||
return []
|
||||
}
|
||||
return splitImageValues(appointment.productImageFileIds || appointment.imageFileIds)
|
||||
}
|
||||
|
||||
function resolveProductImageUrls(appointment) {
|
||||
if (!appointment || typeof appointment !== 'object') {
|
||||
return []
|
||||
}
|
||||
const productImageUrls = normalizeImageUrlArray(appointment.productImageUrls)
|
||||
if (productImageUrls.length > 0) {
|
||||
return productImageUrls
|
||||
}
|
||||
const imageUrls = normalizeImageUrlArray(appointment.imageUrls)
|
||||
if (imageUrls.length > 0) {
|
||||
return imageUrls
|
||||
}
|
||||
return normalizeImageUrlArray(appointment.productImageUrl || appointment.imageUrl)
|
||||
}
|
||||
|
||||
async function resolveSignedImageUrls(fileIds) {
|
||||
const imageUrls = []
|
||||
for (let index = 0; index < fileIds.length; index += 1) {
|
||||
const fileId = fileIds[index]
|
||||
const signedUrl = await planningApi.signedImageUrl(fileId, SIGNED_IMAGE_EXPIRE_MINUTES)
|
||||
const imageUrl = String(signedUrl || '').trim()
|
||||
if (!imageUrl) {
|
||||
throw new Error(`文件 ${fileId} 未返回可访问图片链接`)
|
||||
}
|
||||
imageUrls.push(imageUrl)
|
||||
}
|
||||
return imageUrls
|
||||
}
|
||||
|
||||
async function resolveDisplayImageUrls(appointment) {
|
||||
const imageUrls = resolveProductImageUrls(appointment)
|
||||
if (imageUrls.length > 0) {
|
||||
return imageUrls
|
||||
}
|
||||
const fileIds = resolveProductImageFileIds(appointment)
|
||||
if (fileIds.length === 0) {
|
||||
return []
|
||||
}
|
||||
return resolveSignedImageUrls(fileIds)
|
||||
}
|
||||
|
||||
async function uploadAppointmentImageFiles(limit) {
|
||||
@@ -40,16 +103,133 @@ async function uploadAppointmentImageFiles(limit) {
|
||||
return { fileIds, imageUrls }
|
||||
}
|
||||
|
||||
function isPriceUndetermined(value) {
|
||||
const amount = Number(value)
|
||||
return Number.isFinite(amount) && amount === 0
|
||||
}
|
||||
|
||||
function formatMoneyValue(value) {
|
||||
const amount = Number(value)
|
||||
if (!Number.isFinite(amount) || amount <= 0) {
|
||||
return ''
|
||||
}
|
||||
return amount.toFixed(2).replace(/\.00$/, '')
|
||||
}
|
||||
|
||||
function formatAppointmentPrice(value) {
|
||||
if (value === undefined || value === null || value === '' || isPriceUndetermined(value)) {
|
||||
return '未定'
|
||||
}
|
||||
const moneyText = formatMoneyValue(value)
|
||||
return moneyText ? `¥${moneyText}` : '未定'
|
||||
}
|
||||
|
||||
function sanitizePriceInput(value) {
|
||||
const rawValue = String(value || '')
|
||||
let nextValue = ''
|
||||
let hasDot = false
|
||||
for (let index = 0; index < rawValue.length; index += 1) {
|
||||
const char = rawValue[index]
|
||||
if (char >= '0' && char <= '9') {
|
||||
nextValue += char
|
||||
continue
|
||||
}
|
||||
if (char === '.' && !hasDot) {
|
||||
nextValue += char
|
||||
hasDot = true
|
||||
}
|
||||
}
|
||||
if (nextValue.startsWith('.')) {
|
||||
return `0${nextValue}`
|
||||
}
|
||||
return nextValue
|
||||
}
|
||||
|
||||
function normalizeConfirmedPrice(value) {
|
||||
const priceText = sanitizePriceInput(value).trim()
|
||||
if (!/^\d+(\.\d+)?$/.test(priceText)) {
|
||||
return ''
|
||||
}
|
||||
const price = Number(priceText)
|
||||
if (!Number.isFinite(price) || price < 0) {
|
||||
return ''
|
||||
}
|
||||
return String(price)
|
||||
}
|
||||
|
||||
function buildPriceForm(amount) {
|
||||
const pricePending = isPriceUndetermined(amount)
|
||||
return {
|
||||
pricePending,
|
||||
priceText: pricePending ? '' : formatMoneyValue(amount)
|
||||
}
|
||||
}
|
||||
|
||||
function buildDetailTags(appointment) {
|
||||
const tags = []
|
||||
const productTags = splitTagValues(appointment && appointment.productTags)
|
||||
for (let index = 0; index < productTags.length; index += 1) {
|
||||
tags.push({ key: `product-${index}-${productTags[index]}`, label: productTags[index], type: 'product' })
|
||||
}
|
||||
if (appointment && appointment.fromMeituan) {
|
||||
tags.push({ key: 'source-meituan', label: '美团', type: 'source' })
|
||||
}
|
||||
if (appointment && appointment.needRemoval) {
|
||||
tags.push({ key: 'flag-need-removal', label: '需卸甲', type: 'warning' })
|
||||
}
|
||||
if (appointment && appointment.depositPaid) {
|
||||
tags.push({ key: 'flag-deposit-paid', label: '已交定金', type: 'paid' })
|
||||
}
|
||||
if (appointment && isPriceUndetermined(appointment.amount)) {
|
||||
tags.push({ key: 'flag-price-pending', label: '价格未定', type: 'price' })
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
function isAppointmentResponse(value) {
|
||||
return value && typeof value === 'object' && (value.orderItemId || value.orderId)
|
||||
}
|
||||
|
||||
function confirmAction(title, content, confirmText, confirmColor) {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.showModal({
|
||||
title,
|
||||
content,
|
||||
cancelText: '取消',
|
||||
confirmText,
|
||||
confirmColor,
|
||||
success(result) {
|
||||
resolve(Boolean(result.confirm))
|
||||
},
|
||||
fail(error) {
|
||||
reject(new Error(`打开确认弹窗失败:${error.errMsg || '未知错误'}`))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: '',
|
||||
priceText: '未定',
|
||||
detailTags: [],
|
||||
productImageUrls: [],
|
||||
productImageFileIds: '',
|
||||
imageUploading: false,
|
||||
canEditAppointment: false,
|
||||
canTransferAppointment: false,
|
||||
showActionRow: false,
|
||||
showPendingActions: false,
|
||||
showRestoreAction: false,
|
||||
priceModalVisible: false,
|
||||
priceSaving: false,
|
||||
priceForm: {
|
||||
priceText: '',
|
||||
pricePending: false
|
||||
},
|
||||
loadError: ''
|
||||
},
|
||||
|
||||
@@ -64,53 +244,95 @@ Page({
|
||||
async loadDetail() {
|
||||
try {
|
||||
const appointment = await planningApi.appointment(this.data.id)
|
||||
this.applyAppointment(appointment)
|
||||
await this.applyAppointment(appointment)
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: '',
|
||||
priceText: '未定',
|
||||
detailTags: [],
|
||||
productImageUrls: [],
|
||||
productImageFileIds: '',
|
||||
canEditAppointment: false,
|
||||
showActionRow: false,
|
||||
showPendingActions: false,
|
||||
showRestoreAction: false,
|
||||
loadError: error.message || '预约详情加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
applyAppointment(appointment) {
|
||||
const imageUrls = resolveProductImageUrls(appointment)
|
||||
async applyAppointment(appointment) {
|
||||
if (!appointment || typeof appointment !== 'object') {
|
||||
throw new Error('预约详情数据为空')
|
||||
}
|
||||
const imageUrls = await resolveDisplayImageUrls(appointment)
|
||||
const status = Number(appointment.status)
|
||||
const showPendingActions = status === STATUS_PENDING_SERVICE
|
||||
const showRestoreAction = status === STATUS_COMPLETED || status === STATUS_CANCELLED
|
||||
this.setData({
|
||||
appointment,
|
||||
avatarText: String(appointment.customerName || '客').slice(0, 1),
|
||||
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
|
||||
priceText: formatAppointmentPrice(appointment.amount),
|
||||
detailTags: buildDetailTags(appointment),
|
||||
productImageUrls: imageUrls,
|
||||
productImageFileIds: String(appointment.productImageFileIds || ''),
|
||||
productImageFileIds: resolveProductImageFileIds(appointment).join(','),
|
||||
canEditAppointment: Boolean(appointment.canEdit),
|
||||
canTransferAppointment: canTransferAppointment(),
|
||||
showActionRow: showPendingActions || showRestoreAction,
|
||||
showPendingActions,
|
||||
showRestoreAction,
|
||||
loadError: ''
|
||||
})
|
||||
},
|
||||
|
||||
async updateStatus(status) {
|
||||
try {
|
||||
if (!this.data.appointment.orderId) {
|
||||
throw new Error('预约订单ID为空,无法修改状态')
|
||||
}
|
||||
await planningApi.updateStatus(this.data.appointment.orderId, status)
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '已更新' })
|
||||
this.loadDetail()
|
||||
await this.loadDetail()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.updateStatus(1)
|
||||
async complete() {
|
||||
try {
|
||||
const confirmed = await confirmAction('完成预约', '确认将此预约标记为已完成?', '完成', '#6f8f83')
|
||||
if (confirmed) {
|
||||
await this.updateStatus(STATUS_COMPLETED)
|
||||
}
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
complete() {
|
||||
this.updateStatus(2)
|
||||
async deleteAppointment() {
|
||||
try {
|
||||
const confirmed = await confirmAction('删除此订单', '确认删除此订单?删除后订单会进入已取消状态。', '删除', '#d98d8d')
|
||||
if (confirmed) {
|
||||
await this.updateStatus(STATUS_CANCELLED)
|
||||
}
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.updateStatus(3)
|
||||
async restorePending() {
|
||||
try {
|
||||
const confirmed = await confirmAction('修改状态', '确认将此预约改回待完成?', '修改', '#6f8f83')
|
||||
if (confirmed) {
|
||||
await this.updateStatus(STATUS_PENDING_SERVICE)
|
||||
}
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
goTransfer() {
|
||||
@@ -122,11 +344,15 @@ Page({
|
||||
},
|
||||
|
||||
async persistAppointmentImages(fileIds, previewImageUrls) {
|
||||
const appointment = await planningApi.updateAppointmentImages(this.data.id, {
|
||||
const result = await planningApi.updateAppointmentImages(this.data.id, {
|
||||
imageFileIds: fileIds.join(',')
|
||||
})
|
||||
markPlanningRefresh()
|
||||
this.applyAppointment(appointment)
|
||||
if (isAppointmentResponse(result)) {
|
||||
await this.applyAppointment(result)
|
||||
} else {
|
||||
await this.loadDetail()
|
||||
}
|
||||
if (Array.isArray(previewImageUrls) && previewImageUrls.length > 0) {
|
||||
this.setData({ productImageUrls: previewImageUrls })
|
||||
}
|
||||
@@ -136,14 +362,22 @@ Page({
|
||||
if (this.data.imageUploading) {
|
||||
return
|
||||
}
|
||||
if (!this.data.canEditAppointment) {
|
||||
wx.showToast({ title: '当前预约状态不可修改图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const currentFileIds = splitImageValues(this.data.productImageFileIds)
|
||||
const remainingCount = 9 - currentFileIds.length
|
||||
const remainingCount = MAX_APPOINTMENT_IMAGE_COUNT - currentFileIds.length
|
||||
if (remainingCount <= 0) {
|
||||
wx.showToast({ title: '最多上传 9 张作品图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ imageUploading: true })
|
||||
try {
|
||||
const confirmed = await confirmAction('上传图片', '确认添加作品图片到此预约?', '上传', '#6f8f83')
|
||||
if (!confirmed) {
|
||||
return
|
||||
}
|
||||
this.setData({ imageUploading: true })
|
||||
const uploaded = await uploadAppointmentImageFiles(remainingCount)
|
||||
if (uploaded.fileIds.length === 0) {
|
||||
return
|
||||
@@ -160,39 +394,33 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
async replaceAppointmentImages() {
|
||||
if (this.data.imageUploading) {
|
||||
return
|
||||
}
|
||||
this.setData({ imageUploading: true })
|
||||
try {
|
||||
const uploaded = await uploadAppointmentImageFiles(9)
|
||||
if (uploaded.fileIds.length === 0) {
|
||||
return
|
||||
}
|
||||
await this.persistAppointmentImages(uploaded.fileIds, uploaded.imageUrls)
|
||||
wx.showToast({ title: '图片已保存' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '图片上传失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ imageUploading: false })
|
||||
}
|
||||
},
|
||||
|
||||
async removeAppointmentImage(event) {
|
||||
if (this.data.imageUploading) {
|
||||
return
|
||||
}
|
||||
if (!this.data.canEditAppointment) {
|
||||
wx.showToast({ title: '当前预约状态不可删除图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const index = Number(event.currentTarget.dataset.index)
|
||||
const currentFileIds = splitImageValues(this.data.productImageFileIds)
|
||||
if (currentFileIds.length === 0) {
|
||||
wx.showToast({ title: '缺少图片文件ID,无法删除', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!Number.isInteger(index) || index < 0 || index >= currentFileIds.length) {
|
||||
wx.showToast({ title: '图片序号无效,无法删除', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const currentImageUrls = Array.isArray(this.data.productImageUrls) ? this.data.productImageUrls : []
|
||||
const nextFileIds = currentFileIds.filter((item, itemIndex) => itemIndex !== index)
|
||||
const nextImageUrls = currentImageUrls.filter((item, itemIndex) => itemIndex !== index)
|
||||
this.setData({ imageUploading: true })
|
||||
try {
|
||||
const confirmed = await confirmAction('删除图片', '确认删除这张作品图片?', '删除', '#d98d8d')
|
||||
if (!confirmed) {
|
||||
return
|
||||
}
|
||||
const currentImageUrls = Array.isArray(this.data.productImageUrls) ? this.data.productImageUrls : []
|
||||
const nextFileIds = currentFileIds.filter((item, itemIndex) => itemIndex !== index)
|
||||
const nextImageUrls = currentImageUrls.filter((item, itemIndex) => itemIndex !== index)
|
||||
this.setData({ imageUploading: true })
|
||||
await this.persistAppointmentImages(nextFileIds, nextImageUrls)
|
||||
wx.showToast({ title: '图片已保存' })
|
||||
} catch (error) {
|
||||
@@ -213,6 +441,86 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
openPriceEditor() {
|
||||
if (this.data.priceSaving) {
|
||||
return
|
||||
}
|
||||
if (!this.data.canEditAppointment) {
|
||||
wx.showToast({ title: '当前预约状态不可修改价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
priceModalVisible: true,
|
||||
priceForm: buildPriceForm(this.data.appointment.amount)
|
||||
})
|
||||
},
|
||||
|
||||
closePriceEditor() {
|
||||
if (this.data.priceSaving) {
|
||||
return
|
||||
}
|
||||
this.setData({ priceModalVisible: false })
|
||||
},
|
||||
|
||||
onPriceInput(event) {
|
||||
const value = sanitizePriceInput(event.detail.value)
|
||||
this.setData({ 'priceForm.priceText': value })
|
||||
return value
|
||||
},
|
||||
|
||||
togglePricePending() {
|
||||
if (this.data.priceSaving) {
|
||||
return
|
||||
}
|
||||
const pricePending = !this.data.priceForm.pricePending
|
||||
const patch = {
|
||||
'priceForm.pricePending': pricePending
|
||||
}
|
||||
if (pricePending) {
|
||||
patch['priceForm.priceText'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
},
|
||||
|
||||
async savePrice() {
|
||||
if (this.data.priceSaving) {
|
||||
return
|
||||
}
|
||||
const form = this.data.priceForm
|
||||
const priceText = form.pricePending ? '0' : normalizeConfirmedPrice(form.priceText)
|
||||
if (!priceText) {
|
||||
wx.showToast({ title: '请填写正确的价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const price = Number(priceText)
|
||||
const priceLabel = price === 0 ? '未定' : `¥${formatMoneyValue(price)}`
|
||||
try {
|
||||
const confirmed = await confirmAction('保存价格', `确认将本次价格保存为${priceLabel}?`, '保存', '#6f8f83')
|
||||
if (!confirmed) {
|
||||
return
|
||||
}
|
||||
this.setData({ priceSaving: true })
|
||||
const result = await planningApi.updateAppointmentPrice(this.data.id, {
|
||||
price
|
||||
})
|
||||
markPlanningRefresh()
|
||||
if (isAppointmentResponse(result)) {
|
||||
await this.applyAppointment(result)
|
||||
} else {
|
||||
await this.loadDetail()
|
||||
}
|
||||
this.setData({ priceModalVisible: false })
|
||||
wx.showToast({ title: '价格已保存' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '价格保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ priceSaving: false })
|
||||
}
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
||||
@@ -15,14 +15,23 @@
|
||||
</view>
|
||||
<view class="detail-actions">
|
||||
<text class="tag">{{appointment.statusText}}</text>
|
||||
<button wx:if="{{canTransferAppointment && appointment.canEdit}}" class="small-action" bindtap="goTransfer">改派</button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{detailTags.length}}" class="detail-tag-row">
|
||||
<text wx:for="{{detailTags}}" wx:key="key" class="detail-tag {{item.type}}">{{item.label}}</text>
|
||||
</view>
|
||||
<view class="detail-grid">
|
||||
<view>
|
||||
<text class="label">项目</text>
|
||||
<text class="value">{{appointment.productTitle}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">价格</text>
|
||||
<view class="price-value-row">
|
||||
<text class="value price-value">{{priceText}}</text>
|
||||
<button wx:if="{{canEditAppointment}}" class="price-edit-btn" bindtap="openPriceEditor">修改</button>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">美甲师</text>
|
||||
<text class="value">{{appointment.artistName}}</text>
|
||||
@@ -41,19 +50,21 @@
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="section-head">
|
||||
<view class="section-title">作品图片</view>
|
||||
<button class="text-btn image-action" loading="{{imageUploading}}" disabled="{{imageUploading}}" bindtap="replaceAppointmentImages">{{productImageUrls.length ? '重新上传' : '上传图片'}}</button>
|
||||
</view>
|
||||
<view class="card image-card">
|
||||
<view wx:if="{{productImageUrls.length}}" class="detail-image-list">
|
||||
<view wx:for="{{productImageUrls}}" wx:key="*this" class="detail-image-item">
|
||||
<image class="detail-image" src="{{item}}" mode="aspectFill" data-index="{{index}}" bindtap="previewProductImage"></image>
|
||||
<view class="detail-image-remove" data-index="{{index}}" catchtap="removeAppointmentImage">×</view>
|
||||
<view wx:if="{{canEditAppointment}}" class="detail-image-remove" data-index="{{index}}" catchtap="removeAppointmentImage">×</view>
|
||||
</view>
|
||||
<view wx:if="{{productImageUrls.length < 9}}" class="detail-image-add {{imageUploading ? 'disabled' : ''}}" bindtap="chooseAppointmentImages">
|
||||
<view wx:if="{{canEditAppointment && productImageUrls.length < 9}}" class="detail-image-add {{imageUploading ? 'disabled' : ''}}" bindtap="chooseAppointmentImages">
|
||||
<text>{{imageUploading ? '...' : '+'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else class="detail-image-empty">暂无图片</view>
|
||||
<view wx:else class="detail-image-empty">
|
||||
<text>{{imageUploading ? '上传中...' : '暂无图片'}}</text>
|
||||
<button wx:if="{{canEditAppointment}}" class="text-btn image-empty-action" loading="{{imageUploading}}" disabled="{{imageUploading}}" bindtap="chooseAppointmentImages">上传图片</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -62,9 +73,33 @@
|
||||
<view class="card note-card">{{appointment.remark || '暂无备注'}}</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="fixed-bottom action-row">
|
||||
<button class="secondary-btn" bindtap="confirm">确认</button>
|
||||
<button class="primary-btn" bindtap="complete">完成</button>
|
||||
<button class="danger-btn" bindtap="cancel">取消</button>
|
||||
<view wx:if="{{priceModalVisible}}" class="detail-modal-mask" catchtap="stopTap">
|
||||
<view class="price-modal" catchtap="stopTap">
|
||||
<view class="price-modal-head">
|
||||
<text class="price-modal-title">修改价格</text>
|
||||
<view class="price-modal-close" bindtap="closePriceEditor">×</view>
|
||||
</view>
|
||||
<view class="price-pending-option {{priceForm.pricePending ? 'active' : ''}}" bindtap="togglePricePending">
|
||||
<view class="price-pending-check">{{priceForm.pricePending ? '✓' : ''}}</view>
|
||||
<text>价格未定</text>
|
||||
</view>
|
||||
<view class="price-field {{priceForm.pricePending ? 'disabled' : ''}}">
|
||||
<text class="price-field-label">本次价格</text>
|
||||
<view class="price-input-wrap">
|
||||
<input value="{{priceForm.priceText}}" disabled="{{priceForm.pricePending}}" bindinput="onPriceInput" type="digit" placeholder="请输入价格" />
|
||||
<text>元</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price-modal-actions">
|
||||
<button class="secondary-btn" bindtap="closePriceEditor">取消</button>
|
||||
<button class="primary-btn" loading="{{priceSaving}}" disabled="{{priceSaving}}" bindtap="savePrice">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError && showActionRow}}" class="fixed-bottom action-row {{showRestoreAction ? 'single' : ''}}">
|
||||
<button wx:if="{{showPendingActions}}" class="primary-btn" bindtap="complete">完成</button>
|
||||
<button wx:if="{{showPendingActions}}" class="danger-btn" bindtap="deleteAppointment">删除此订单</button>
|
||||
<button wx:if="{{showRestoreAction}}" class="secondary-btn" bindtap="restorePending">修改状态</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -72,6 +72,45 @@
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.detail-tag-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10rpx;
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.detail-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 40rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f0ece5;
|
||||
color: #6d675f;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.detail-tag.source {
|
||||
background: #e8f2f7;
|
||||
color: #4c7890;
|
||||
}
|
||||
|
||||
.detail-tag.warning {
|
||||
background: #fff0e2;
|
||||
color: #b36a34;
|
||||
}
|
||||
|
||||
.detail-tag.paid {
|
||||
background: #e8f3ec;
|
||||
color: #5b8067;
|
||||
}
|
||||
|
||||
.detail-tag.price {
|
||||
background: #f5e8e8;
|
||||
color: #a75353;
|
||||
}
|
||||
|
||||
.label,
|
||||
.value {
|
||||
display: block;
|
||||
@@ -89,6 +128,37 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.price-value-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 12rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.price-edit-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
width: 82rpx;
|
||||
min-width: 82rpx;
|
||||
max-width: 82rpx;
|
||||
height: 42rpx;
|
||||
min-height: 42rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.note-card {
|
||||
padding: 24rpx;
|
||||
color: #6d655d;
|
||||
@@ -102,15 +172,6 @@
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.image-action {
|
||||
flex: 0 0 auto;
|
||||
width: 156rpx;
|
||||
min-width: 156rpx;
|
||||
max-width: 156rpx;
|
||||
padding: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.image-card {
|
||||
padding: 20rpx;
|
||||
}
|
||||
@@ -173,8 +234,10 @@
|
||||
|
||||
.detail-image-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 14rpx;
|
||||
min-height: 142rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f7efe7;
|
||||
@@ -182,12 +245,153 @@
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.image-empty-action {
|
||||
min-height: 48rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.detail-modal-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 30;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
padding: 24rpx;
|
||||
background: rgba(32, 27, 22, 0.34);
|
||||
}
|
||||
|
||||
.price-modal {
|
||||
width: 100%;
|
||||
max-width: 680rpx;
|
||||
padding: 26rpx;
|
||||
border-radius: 24rpx 24rpx 16rpx 16rpx;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 -12rpx 34rpx rgba(58, 48, 34, 0.12);
|
||||
}
|
||||
|
||||
.price-modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.price-modal-title {
|
||||
color: #2d2924;
|
||||
font-size: 30rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.price-modal-close {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
border-radius: 50%;
|
||||
background: #f0ece5;
|
||||
color: #6d655d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.price-pending-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
min-height: 76rpx;
|
||||
margin-top: 24rpx;
|
||||
padding: 0 18rpx;
|
||||
border: 1rpx solid #eee2d5;
|
||||
border-radius: 16rpx;
|
||||
background: #fff8ef;
|
||||
color: #554c44;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.price-pending-option.active {
|
||||
border-color: #7d9d90;
|
||||
background: #edf6f1;
|
||||
color: #55786d;
|
||||
}
|
||||
|
||||
.price-pending-check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border: 2rpx solid #d5c6b8;
|
||||
border-radius: 50%;
|
||||
color: #55786d;
|
||||
font-size: 22rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.price-pending-option.active .price-pending-check {
|
||||
border-color: #7d9d90;
|
||||
background: #dfeee7;
|
||||
}
|
||||
|
||||
.price-field {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.price-field.disabled {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.price-field-label {
|
||||
display: block;
|
||||
margin-bottom: 10rpx;
|
||||
color: #625c55;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.price-input-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 76rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #fffaf4;
|
||||
}
|
||||
|
||||
.price-input-wrap input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #2d2924;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.price-input-wrap text {
|
||||
flex: 0 0 auto;
|
||||
color: #9a9288;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.price-modal-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 14rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.action-row.single {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.action-row .primary-btn,
|
||||
.action-row .secondary-btn,
|
||||
.action-row .danger-btn {
|
||||
|
||||
Reference in New Issue
Block a user