"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()); }); }; const common_vendor = require("../../../common/vendor.js"); const utils_http = require("../../../utils/http.js"); if (!Array) { const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni"); _component_layout_default_uni(); } if (!Math) { (OrderItem + EmptyState + LocalLoader)(); } const OrderItem = () => "./components/OrderItem.js"; const EmptyState = () => "../../../components/EmptyState.js"; const LocalLoader = () => "../../../components/LocalLoader.js"; const _sfc_main = { __name: "index", setup(__props) { const OrderStateMap = { 待付款: "待支付", 待接单: "待接单", 已预约: "已接单", 待评价: "已完成" }; const activeTab = common_vendor.ref("全部"); const tabs = ["全部", "待付款", "待接单", "已预约", "待评价"]; const orders = common_vendor.ref([]); const loading = common_vendor.ref(false); const fetchOrders = () => __async(this, null, function* () { try { loading.value = true; 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); } loading.value = false; } catch (error) { loading.value = false; console.error("订单数据获取失败", error); } }); const changeTab = (tab) => __async(this, null, function* () { activeTab.value = tab; console.log(activeTab.value); 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, d: "8fa84db7-1-" + i0 + ",8fa84db7-0", 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 }, orders.value.length === 0 ? {} : {}, { d: common_vendor.o(($event) => loading.value = $event), e: common_vendor.p({ modelValue: loading.value }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8fa84db7"]]); wx.createPage(MiniProgramPage);