2024-09-19 07:20:14 +08:00
|
|
|
"use strict";
|
|
|
|
var __async = (__this, __arguments, generator) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
var fulfilled = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.next(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var rejected = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.throw(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
|
|
});
|
|
|
|
};
|
2024-10-01 09:15:35 +08:00
|
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
|
|
const utils_http = require("../../../utils/http.js");
|
2024-09-19 07:20:14 +08:00
|
|
|
if (!Array) {
|
|
|
|
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
|
|
|
|
_component_layout_default_uni();
|
|
|
|
}
|
|
|
|
if (!Math) {
|
2024-10-01 09:15:35 +08:00
|
|
|
(OrderItem + EmptyState + LocalLoader)();
|
2024-09-19 07:20:14 +08:00
|
|
|
}
|
|
|
|
const OrderItem = () => "./components/OrderItem.js";
|
2024-10-01 09:15:35 +08:00
|
|
|
const EmptyState = () => "../../../components/EmptyState.js";
|
|
|
|
const LocalLoader = () => "../../../components/LocalLoader.js";
|
2024-09-19 07:20:14 +08:00
|
|
|
const _sfc_main = {
|
|
|
|
__name: "index",
|
|
|
|
setup(__props) {
|
|
|
|
const OrderStateMap = {
|
|
|
|
待付款: "待支付",
|
2024-10-01 09:15:35 +08:00
|
|
|
待接单: "待接单",
|
2024-09-19 07:20:14 +08:00
|
|
|
已预约: "已接单",
|
|
|
|
待评价: "已完成"
|
|
|
|
};
|
|
|
|
const activeTab = common_vendor.ref("全部");
|
|
|
|
const tabs = ["全部", "待付款", "待接单", "已预约", "待评价"];
|
|
|
|
const orders = common_vendor.ref([]);
|
2024-10-01 09:15:35 +08:00
|
|
|
const loading = common_vendor.ref(false);
|
2024-09-19 07:20:14 +08:00
|
|
|
const fetchOrders = () => __async(this, null, function* () {
|
|
|
|
try {
|
2024-10-01 09:15:35 +08:00
|
|
|
loading.value = true;
|
2024-09-19 07:20:14 +08:00
|
|
|
const response = yield utils_http.httpPost(
|
|
|
|
"/order/query",
|
|
|
|
{
|
|
|
|
current: 1,
|
|
|
|
size: 1e3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
state: OrderStateMap[activeTab.value] || null
|
|
|
|
}
|
|
|
|
);
|
|
|
|
if (response.code === 200 || response.code === 204) {
|
|
|
|
orders.value = response.records;
|
|
|
|
} else {
|
|
|
|
console.error("订单数据获取失败", response.message);
|
|
|
|
}
|
2024-10-01 09:15:35 +08:00
|
|
|
loading.value = false;
|
2024-09-19 07:20:14 +08:00
|
|
|
} catch (error) {
|
2024-10-01 09:15:35 +08:00
|
|
|
loading.value = false;
|
2024-09-19 07:20:14 +08:00
|
|
|
console.error("订单数据获取失败", error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const changeTab = (tab) => __async(this, null, function* () {
|
|
|
|
activeTab.value = tab;
|
2024-10-01 09:15:35 +08:00
|
|
|
console.log(activeTab.value);
|
2024-09-19 07:20:14 +08:00
|
|
|
yield fetchOrders();
|
|
|
|
});
|
|
|
|
common_vendor.onLoad(() => __async(this, null, function* () {
|
|
|
|
yield fetchOrders();
|
|
|
|
}));
|
|
|
|
return (_ctx, _cache) => {
|
|
|
|
return common_vendor.e({
|
|
|
|
a: common_vendor.f(tabs, (tab, k0, i0) => {
|
|
|
|
return common_vendor.e({
|
|
|
|
a: common_vendor.t(tab),
|
|
|
|
b: activeTab.value === tab
|
|
|
|
}, activeTab.value === tab ? {} : {}, {
|
|
|
|
c: tab,
|
|
|
|
d: common_vendor.n({
|
|
|
|
"text-yellow-500": activeTab.value === tab
|
|
|
|
}),
|
|
|
|
e: common_vendor.o(($event) => changeTab(tab), tab)
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
b: common_vendor.f(orders.value, (order, k0, i0) => {
|
|
|
|
return {
|
|
|
|
a: common_vendor.o(fetchOrders, order.id),
|
|
|
|
b: order.id,
|
|
|
|
c: order.id,
|
2024-10-01 09:15:35 +08:00
|
|
|
d: "8fa84db7-1-" + i0 + ",8fa84db7-0",
|
2024-09-19 07:20:14 +08:00
|
|
|
e: common_vendor.p({
|
|
|
|
id: order.id,
|
|
|
|
userId: order.userId,
|
|
|
|
reservationTime: order.reservationTime,
|
|
|
|
serviceHours: order.serviceHours,
|
|
|
|
personalServiceId: order.personalServiceId,
|
|
|
|
personalServiceUserId: order.personalServiceUserId,
|
|
|
|
price: order.price,
|
|
|
|
isPay: order.isPay,
|
|
|
|
feedback: order.feedback,
|
|
|
|
star: order.star,
|
|
|
|
state: order.state,
|
|
|
|
paymentMethod: order.paymentMethod,
|
|
|
|
qrcode: order.qrcode,
|
|
|
|
createTime: order.createTime,
|
|
|
|
updateTime: order.updateTime,
|
|
|
|
address: order.address,
|
|
|
|
pet: order.pet,
|
|
|
|
user: order.user,
|
|
|
|
psUser: order.psUser,
|
|
|
|
serviceInfo: order.serviceInfo
|
|
|
|
}),
|
|
|
|
f: order.id
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
c: orders.value.length === 0
|
2024-10-01 09:15:35 +08:00
|
|
|
}, orders.value.length === 0 ? {} : {}, {
|
|
|
|
d: common_vendor.o(($event) => loading.value = $event),
|
|
|
|
e: common_vendor.p({
|
|
|
|
modelValue: loading.value
|
|
|
|
})
|
|
|
|
});
|
2024-09-19 07:20:14 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2024-10-01 09:15:35 +08:00
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8fa84db7"]]);
|
2024-09-19 07:20:14 +08:00
|
|
|
wx.createPage(MiniProgramPage);
|