first commit
This commit is contained in:
174
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.js
vendored
Normal file
174
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.js
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const utils_api = require("../../utils/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_t_tab_panel2 = common_vendor.resolveComponent("t-tab-panel");
|
||||
const _easycom_t_tabs2 = common_vendor.resolveComponent("t-tabs");
|
||||
const _easycom_t_loading2 = common_vendor.resolveComponent("t-loading");
|
||||
const _easycom_t_empty2 = common_vendor.resolveComponent("t-empty");
|
||||
const _easycom_t_tag2 = common_vendor.resolveComponent("t-tag");
|
||||
const _easycom_t_button2 = common_vendor.resolveComponent("t-button");
|
||||
(_easycom_t_tab_panel2 + _easycom_t_tabs2 + _easycom_t_loading2 + _easycom_t_empty2 + _easycom_t_tag2 + _easycom_t_button2)();
|
||||
}
|
||||
const _easycom_t_tab_panel = () => "../../uni_modules/tdesign-uniapp/components/tab-panel/tab-panel.js";
|
||||
const _easycom_t_tabs = () => "../../uni_modules/tdesign-uniapp/components/tabs/tabs.js";
|
||||
const _easycom_t_loading = () => "../../uni_modules/tdesign-uniapp/components/loading/loading.js";
|
||||
const _easycom_t_empty = () => "../../uni_modules/tdesign-uniapp/components/empty/empty.js";
|
||||
const _easycom_t_tag = () => "../../uni_modules/tdesign-uniapp/components/tag/tag.js";
|
||||
const _easycom_t_button = () => "../../uni_modules/tdesign-uniapp/components/button/button.js";
|
||||
if (!Math) {
|
||||
(_easycom_t_tab_panel + _easycom_t_tabs + _easycom_t_loading + _easycom_t_empty + _easycom_t_tag + _easycom_t_button)();
|
||||
}
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "appointments",
|
||||
setup(__props) {
|
||||
const activeTab = common_vendor.ref("all");
|
||||
const appointments = common_vendor.ref([]);
|
||||
const loading = common_vendor.ref(false);
|
||||
common_vendor.onMounted(() => {
|
||||
loadAppointments();
|
||||
});
|
||||
const loadAppointments = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = {};
|
||||
if (activeTab.value !== "all") {
|
||||
params.status = activeTab.value;
|
||||
}
|
||||
appointments.value = await utils_api.api.appointments.getList(params);
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/appointments/appointments.vue:84", "加载预约失败", error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const onTabChange = (value) => {
|
||||
const tabValue = typeof value === "string" ? value : (value == null ? void 0 : value.value) || "all";
|
||||
activeTab.value = tabValue;
|
||||
loadAppointments();
|
||||
};
|
||||
const getStatusTheme = (status) => {
|
||||
const themes = {
|
||||
pending: "warning",
|
||||
confirmed: "success",
|
||||
completed: "primary",
|
||||
cancelled: "default"
|
||||
};
|
||||
return themes[status] || "default";
|
||||
};
|
||||
const getStatusText = (status) => {
|
||||
const texts = {
|
||||
pending: "待确认",
|
||||
confirmed: "已确认",
|
||||
completed: "已完成",
|
||||
cancelled: "已取消"
|
||||
};
|
||||
return texts[status] || status;
|
||||
};
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr)
|
||||
return "";
|
||||
try {
|
||||
return dateStr.replace("T", " ").split("+")[0];
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/appointments/appointments.vue:127", "Date format error:", error, dateStr);
|
||||
return dateStr;
|
||||
}
|
||||
};
|
||||
const formatTime = (timeStr) => {
|
||||
const timePart = timeStr.split("T")[1] || timeStr;
|
||||
const timeWithoutZone = timePart.split("+")[0].split("Z")[0];
|
||||
const [hours, minutes] = timeWithoutZone.split(":");
|
||||
return `${hours}:${minutes}`;
|
||||
};
|
||||
const cancelAppointment = (appointment) => {
|
||||
common_vendor.index.showModal({
|
||||
title: "确认取消",
|
||||
content: "确定要取消这个预约吗?",
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
await utils_api.api.appointments.cancel(appointment.id);
|
||||
common_vendor.index.showToast({
|
||||
title: "取消成功",
|
||||
icon: "success"
|
||||
});
|
||||
loadAppointments();
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/appointments/appointments.vue:157", "取消预约失败", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
value: "all",
|
||||
label: "全部"
|
||||
}),
|
||||
b: common_vendor.p({
|
||||
value: "pending",
|
||||
label: "待确认"
|
||||
}),
|
||||
c: common_vendor.p({
|
||||
value: "confirmed",
|
||||
label: "已确认"
|
||||
}),
|
||||
d: common_vendor.p({
|
||||
value: "completed",
|
||||
label: "已完成"
|
||||
}),
|
||||
e: common_vendor.p({
|
||||
value: "cancelled",
|
||||
label: "已取消"
|
||||
}),
|
||||
f: common_vendor.o(onTabChange),
|
||||
g: common_vendor.p({
|
||||
value: activeTab.value
|
||||
}),
|
||||
h: loading.value
|
||||
}, loading.value ? {
|
||||
i: common_vendor.p({
|
||||
loading: true
|
||||
})
|
||||
} : appointments.value.length === 0 ? {
|
||||
k: common_vendor.p({
|
||||
description: "暂无预约记录"
|
||||
})
|
||||
} : {
|
||||
l: common_vendor.f(appointments.value, (appointment, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(getStatusText(appointment.status)),
|
||||
b: "7c6f8f1a-8-" + i0,
|
||||
c: common_vendor.p({
|
||||
theme: getStatusTheme(appointment.status),
|
||||
size: "small"
|
||||
}),
|
||||
d: common_vendor.t(formatDate(appointment.created_at)),
|
||||
e: common_vendor.t(appointment.time_slot ? appointment.time_slot.date.split("T")[0] : ""),
|
||||
f: common_vendor.t(appointment.time_slot ? formatTime(appointment.time_slot.start_time) : ""),
|
||||
g: common_vendor.t(appointment.time_slot ? formatTime(appointment.time_slot.end_time) : ""),
|
||||
h: common_vendor.t(appointment.people_count),
|
||||
i: appointment.status === "pending"
|
||||
}, appointment.status === "pending" ? {
|
||||
j: common_vendor.o(($event) => cancelAppointment(appointment), appointment.id),
|
||||
k: "7c6f8f1a-9-" + i0,
|
||||
l: common_vendor.p({
|
||||
size: "small",
|
||||
theme: "danger",
|
||||
variant: "outline"
|
||||
})
|
||||
} : {}, {
|
||||
m: appointment.id
|
||||
});
|
||||
})
|
||||
}, {
|
||||
j: appointments.value.length === 0
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7c6f8f1a"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/appointments/appointments.js.map
|
||||
11
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.json
vendored
Normal file
11
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的预约",
|
||||
"usingComponents": {
|
||||
"t-tab-panel": "../../uni_modules/tdesign-uniapp/components/tab-panel/tab-panel",
|
||||
"t-tabs": "../../uni_modules/tdesign-uniapp/components/tabs/tabs",
|
||||
"t-loading": "../../uni_modules/tdesign-uniapp/components/loading/loading",
|
||||
"t-empty": "../../uni_modules/tdesign-uniapp/components/empty/empty",
|
||||
"t-tag": "../../uni_modules/tdesign-uniapp/components/tag/tag",
|
||||
"t-button": "../../uni_modules/tdesign-uniapp/components/button/button"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="container data-v-7c6f8f1a"><view class="tabs data-v-7c6f8f1a"><t-tabs wx:if="{{g}}" class="data-v-7c6f8f1a" u-s="{{['d']}}" bindchange="{{f}}" u-i="7c6f8f1a-0" bind:__l="__l" u-p="{{g}}"><t-tab-panel wx:if="{{a}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-1,7c6f8f1a-0" bind:__l="__l" u-p="{{a}}"/><t-tab-panel wx:if="{{b}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-2,7c6f8f1a-0" bind:__l="__l" u-p="{{b}}"/><t-tab-panel wx:if="{{c}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-3,7c6f8f1a-0" bind:__l="__l" u-p="{{c}}"/><t-tab-panel wx:if="{{d}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-4,7c6f8f1a-0" bind:__l="__l" u-p="{{d}}"/><t-tab-panel wx:if="{{e}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-5,7c6f8f1a-0" bind:__l="__l" u-p="{{e}}"/></t-tabs></view><view class="appointments-list data-v-7c6f8f1a"><t-loading wx:if="{{h}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-6" bind:__l="__l" u-p="{{i}}"/><view wx:elif="{{j}}" class="empty-state data-v-7c6f8f1a"><t-empty wx:if="{{k}}" class="data-v-7c6f8f1a" u-i="7c6f8f1a-7" bind:__l="__l" u-p="{{k}}"/></view><view wx:else class="data-v-7c6f8f1a"><view wx:for="{{l}}" wx:for-item="appointment" wx:key="m" class="appointment-card data-v-7c6f8f1a"><view class="appointment-header data-v-7c6f8f1a"><view class="appointment-status data-v-7c6f8f1a"><t-tag wx:if="{{appointment.c}}" class="data-v-7c6f8f1a" u-s="{{['d']}}" u-i="{{appointment.b}}" bind:__l="__l" u-p="{{appointment.c}}">{{appointment.a}}</t-tag></view><view class="appointment-date data-v-7c6f8f1a">{{appointment.d}}</view></view><view class="appointment-body data-v-7c6f8f1a"><view class="appointment-row data-v-7c6f8f1a"><text class="row-label data-v-7c6f8f1a">时间段:</text><text class="row-value data-v-7c6f8f1a">{{appointment.e}} {{appointment.f}} - {{appointment.g}}</text></view><view class="appointment-row data-v-7c6f8f1a"><text class="row-label data-v-7c6f8f1a">人数:</text><text class="row-value data-v-7c6f8f1a">{{appointment.h}}人</text></view></view><view wx:if="{{appointment.i}}" class="appointment-footer data-v-7c6f8f1a"><t-button wx:if="{{appointment.l}}" u-s="{{['d']}}" class="btn-outline data-v-7c6f8f1a" bindclick="{{appointment.j}}" u-i="{{appointment.k}}" bind:__l="__l" u-p="{{appointment.l}}"> 取消预约 </t-button></view></view></view></view></view>
|
||||
61
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.wxss
vendored
Normal file
61
unpackage/dist/dev/mp-weixin/pages/appointments/appointments.wxss
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
.container.data-v-7c6f8f1a {
|
||||
height: calc(100vh - var(--window-top));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #F8F9FA;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tabs.data-v-7c6f8f1a {
|
||||
flex-shrink: 0;
|
||||
background: #ffffff;
|
||||
}
|
||||
.appointments-list.data-v-7c6f8f1a {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 20rpx 32rpx;
|
||||
}
|
||||
.empty-state.data-v-7c6f8f1a {
|
||||
padding: 120rpx 0;
|
||||
}
|
||||
.appointment-card.data-v-7c6f8f1a {
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.appointment-header.data-v-7c6f8f1a {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
.appointment-date.data-v-7c6f8f1a {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.appointment-body.data-v-7c6f8f1a {
|
||||
padding: 24rpx 0;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
.appointment-row.data-v-7c6f8f1a {
|
||||
display: flex;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.row-label.data-v-7c6f8f1a {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
min-width: 120rpx;
|
||||
}
|
||||
.row-value.data-v-7c6f8f1a {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
.appointment-footer.data-v-7c6f8f1a {
|
||||
padding-top: 24rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
Reference in New Issue
Block a user