重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const mock = require('../../utils/mock')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ id: options.id || '' })
|
||||
this.loadDetail()
|
||||
},
|
||||
|
||||
async loadDetail() {
|
||||
try {
|
||||
const appointment = await planningApi.appointment(this.data.id)
|
||||
this.applyAppointment(appointment)
|
||||
} catch (error) {
|
||||
const demo = mock.buildCalendar(new Date()).appointments[0]
|
||||
this.applyAppointment(demo)
|
||||
}
|
||||
},
|
||||
|
||||
applyAppointment(appointment) {
|
||||
this.setData({
|
||||
appointment,
|
||||
avatarText: String(appointment.customerName || '客').slice(0, 1),
|
||||
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`
|
||||
})
|
||||
},
|
||||
|
||||
async updateStatus(status) {
|
||||
try {
|
||||
await planningApi.updateStatus(this.data.appointment.orderId, status)
|
||||
wx.showToast({ title: '已更新' })
|
||||
this.loadDetail()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.updateStatus(1)
|
||||
},
|
||||
|
||||
complete() {
|
||||
this.updateStatus(2)
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.updateStatus(3)
|
||||
},
|
||||
|
||||
goTransfer() {
|
||||
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${this.data.id}` })
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "预约详情"
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card detail-card">
|
||||
<view class="detail-head">
|
||||
<view class="detail-person">
|
||||
<view class="avatar">{{avatarText}}</view>
|
||||
<view>
|
||||
<text class="customer">{{appointment.customerName}}</text>
|
||||
<text class="phone">{{appointment.customerPhone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-actions">
|
||||
<text class="tag">{{appointment.statusText}}</text>
|
||||
<button class="small-action" bindtap="goTransfer">改派</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-grid">
|
||||
<view>
|
||||
<text class="label">项目</text>
|
||||
<text class="value">{{appointment.productTitle}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">美甲师</text>
|
||||
<text class="value">{{appointment.artistName}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">时间</text>
|
||||
<text class="value">{{timeText}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">时长</text>
|
||||
<text class="value">{{appointment.durationMinutes}}分钟</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">备注</view>
|
||||
<view class="card note-card">{{appointment.remark || '暂无备注'}}</view>
|
||||
</view>
|
||||
|
||||
<view 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>
|
||||
</view>
|
||||
@@ -0,0 +1,99 @@
|
||||
.detail-card {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.detail-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.detail-person {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 82rpx;
|
||||
height: 82rpx;
|
||||
border-radius: 50%;
|
||||
background: #e5eee9;
|
||||
color: #5d8175;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.customer,
|
||||
.phone {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.customer {
|
||||
color: #24211d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.phone {
|
||||
margin-top: 6rpx;
|
||||
color: #928a81;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.detail-actions {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 22rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.label,
|
||||
.value {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
margin-top: 8rpx;
|
||||
color: #2d2924;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.note-card {
|
||||
padding: 24rpx;
|
||||
color: #6d655d;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.action-row .primary-btn,
|
||||
.action-row .secondary-btn,
|
||||
.action-row .danger-btn {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user