2025-01-13 13:07:00 +00:00
|
|
|
import {url} from '../request'
|
2024-11-10 07:01:22 +00:00
|
|
|
Page({
|
2024-12-10 10:35:22 +00:00
|
|
|
data: {
|
2025-01-13 13:07:00 +00:00
|
|
|
myyuyue:[],
|
2024-12-10 10:35:22 +00:00
|
|
|
yuyue:[
|
|
|
|
{
|
|
|
|
name:'佳佳温馨提示:',
|
|
|
|
neirong:'您预约的小德美甲店铺-纯色半贴甲片款式订单…',
|
|
|
|
time:'13:00-14:00',
|
|
|
|
meijiashi:'梨儿',
|
|
|
|
data:'2024/06/18',
|
|
|
|
status:'正在进行中...'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'佳佳温馨提示:',
|
|
|
|
neirong:'您预约的小德美甲店铺-纯色半贴甲片款式订单…',
|
|
|
|
time:'13:00-14:00',
|
|
|
|
meijiashi:'梨儿',
|
|
|
|
data:'2024/06/18',
|
|
|
|
status:'正在进行中...'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'佳佳温馨提示:',
|
|
|
|
neirong:'您预约的小德美甲店铺-纯色半贴甲片款式订单…',
|
|
|
|
time:'13:00-14:00',
|
|
|
|
meijiashi:'梨儿',
|
|
|
|
data:'2024/06/18',
|
|
|
|
status:'正在进行中...'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'佳佳温馨提示:',
|
|
|
|
neirong:'您预约的小德美甲店铺-纯色半贴甲片款式订单…',
|
|
|
|
time:'13:00-14:00',
|
|
|
|
meijiashi:'梨儿',
|
|
|
|
data:'2024/06/18',
|
|
|
|
status:'正在进行中...'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'佳佳温馨提示:',
|
|
|
|
neirong:'您预约的小德美甲店铺-纯色半贴甲片款式订单…',
|
|
|
|
time:'13:00-14:00',
|
|
|
|
meijiashi:'梨儿',
|
|
|
|
data:'2024/06/18',
|
|
|
|
status:'正在进行中...'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2025-01-13 13:07:00 +00:00
|
|
|
onShow() {
|
|
|
|
my.getStorage({
|
|
|
|
key: 'userInfo',
|
|
|
|
success: (res) => {
|
|
|
|
const userInfo = res.data;
|
|
|
|
if (userInfo && userInfo.cookie) {
|
|
|
|
my.request({
|
|
|
|
url: url + '/api/appointments/query',
|
|
|
|
method: 'POST',
|
|
|
|
data: {
|
|
|
|
id: userInfo.id
|
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
'Cookie': userInfo.cookie,
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: (res) => {
|
|
|
|
console.log(res);
|
|
|
|
|
|
|
|
// 在这里处理后端返回的时间字段
|
|
|
|
const appointments = res.data.data.map(item => {
|
|
|
|
const appointmentTime = new Date(item.appointmentTime); // 将时间字符串转换为 Date 对象
|
|
|
|
|
|
|
|
// 格式化日期为 'YYYY-MM-DD HH:mm' 形式
|
|
|
|
const formattedDate = appointmentTime.getFullYear() + '-'
|
|
|
|
+ ('0' + (appointmentTime.getMonth() + 1)).slice(-2) + '-'
|
|
|
|
+ ('0' + appointmentTime.getDate()).slice(-2) + ' '
|
|
|
|
+ ('0' + appointmentTime.getHours()).slice(-2) + ':'
|
|
|
|
+ ('0' + appointmentTime.getMinutes()).slice(-2);
|
|
|
|
|
|
|
|
// 返回新的数组,带有格式化后的日期
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
formattedAppointmentTime: formattedDate
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
myyuyue: appointments
|
|
|
|
});
|
|
|
|
console.log(this.data.myyuyue);
|
|
|
|
},
|
|
|
|
fail: (error) => {
|
|
|
|
console.error('请求失败: ', JSON.stringify(error));
|
|
|
|
my.alert({ content: '请求失败,请稍后重试' });
|
|
|
|
},
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
my.alert({ content: '您未登录,请先登录' });
|
|
|
|
my.navigateTo({
|
|
|
|
url: '/pages/denglu/denglu'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2024-11-10 07:01:22 +00:00
|
|
|
});
|