acdr-ui/dist/dev/mp-weixin/pages/order/index.js

126 lines
4.0 KiB
JavaScript
Raw Normal View History

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());
});
};
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)();
}
const OrderItem = () => "./components/OrderItem.js";
const EmptyState = () => "../../components/EmptyState.js";
const _sfc_main = {
__name: "index",
setup(__props) {
const OrderStateMap = {
待付款: "待支付",
待接单: "已支付",
已预约: "已接单",
待评价: "已完成"
};
const activeTab = common_vendor.ref("全部");
const tabs = ["全部", "待付款", "待接单", "已预约", "待评价"];
const orders = common_vendor.ref([]);
const fetchOrders = () => __async(this, null, function* () {
try {
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);
}
} catch (error) {
console.error("订单数据获取失败", error);
}
});
const changeTab = (tab) => __async(this, null, function* () {
activeTab.value = tab;
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: "a4b7abaf-1-" + i0 + ",a4b7abaf-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 ? {} : {});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a4b7abaf"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=index.js.map