"use strict"; const common_vendor = require("../../common/vendor.js"); const API_api = require("../../API/api.js"); if (!Array) { const _easycom_uni_steps2 = common_vendor.resolveComponent("uni-steps"); const _easycom_uni_pagination2 = common_vendor.resolveComponent("uni-pagination"); (_easycom_uni_steps2 + _easycom_uni_pagination2)(); } const _easycom_uni_steps = () => "../../uni_modules/uni-steps/components/uni-steps/uni-steps.js"; const _easycom_uni_pagination = () => "../../uni_modules/uni-pagination/components/uni-pagination/uni-pagination.js"; if (!Math) { (_easycom_uni_steps + _easycom_uni_pagination)(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "orderStateFive", setup(__props) { const currentPage = common_vendor.ref(1); const pageSize = common_vendor.ref(10); const totalPage = common_vendor.ref(1); const orderList = common_vendor.ref([]); const getOrder = (page) => { common_vendor.index.request({ url: `${API_api.apiImageUrl}/api/orders/my/page`, method: "POST", data: { current: page, endTime: "", id: "", pageSize: pageSize.value, pickupMethod: "", sortField: "", sortOrder: "", startTime: "", state: 5 }, header: { "Content-Type": "application/json", "cookie": common_vendor.index.getStorageSync("cookie") || "" }, success(res) { if (res.data.code === 0) { const records = res.data.data.records; orderList.value = records.reverse(); totalPage.value = Math.ceil(res.data.data.total / pageSize.value); console.log("订单数据:", orderList.value); } }, fail() { console.log("出错啦"); } }); }; common_vendor.onMounted(() => { getOrder(currentPage.value); }); const onPageChange = (e) => { currentPage.value = e.current; getOrder(e.current); }; const deleteOrder = (order) => { const orderId = order.id; common_vendor.index.request({ url: `${API_api.apiImageUrl}/api/orders/delete`, method: "POST", data: { id: orderId }, header: { "Content-Type": "application/json", "cookie": common_vendor.index.getStorageSync("cookie") || "" }, success(res) { console.log(res); getOrder(currentPage.value); }, fail(Error) { console.log(Error); } }); }; const evaluation = (order) => { common_vendor.index.setStorageSync("evaluationOrderID", order.id); common_vendor.index.navigateTo({ url: "/pages/orderEvaluation/orderEvaluation" }); }; common_vendor.onMounted(() => { getOrder(currentPage.value); }); const tell = (phone) => { console.log(phone); common_vendor.index.makePhoneCall({ phoneNumber: phone }); }; const merchantDetail = (order) => { var _a, _b, _c; console.log((_a = order.businessVO) == null ? void 0 : _a.id); common_vendor.index.setStorageSync("businessItem", (_b = order.businessVO) == null ? void 0 : _b.id); const merchantId = (_c = order.businessVO) == null ? void 0 : _c.id; common_vendor.index.navigateTo({ url: `/pages/merchant/merchant?merchantId=${merchantId}` }); }; return (_ctx, _cache) => { var _a; return { a: common_vendor.f(orderList.value, (order, index, i0) => { var _a2, _b; return common_vendor.e({ a: common_vendor.t((_a2 = order.businessVO) == null ? void 0 : _a2.businessName), b: common_vendor.o(($event) => merchantDetail(order), index), c: common_vendor.t(order.id), d: common_vendor.f(1, (sku, k1, i1) => { return { a: common_vendor.f(order.orderDetailsVOList, (item, index2, i2) => { var _a3; return { a: common_vendor.t((_a3 = item.dishesVO) == null ? void 0 : _a3.dishesName), b: common_vendor.t(item.attributeNames) }; }), b: sku }; }), e: (_b = order.businessVO) == null ? void 0 : _b.businessAvatar, f: "24b321b6-0-" + i0 }, { g: common_vendor.o(() => deleteOrder(order), index), h: common_vendor.o(() => { var _a3; return tell((_a3 = order.businessVO) == null ? void 0 : _a3.businessPhone); }, index), i: common_vendor.o(() => evaluation(order), index) }, { k: index }); }), b: `/pagesOrder/detail/detail?id=1`, c: common_vendor.p({ options: _ctx.list1, active: _ctx.active }), d: common_vendor.t("没有更多数据~"), e: ((_a = _ctx.safeAreaInsets) == null ? void 0 : _a.bottom) + "px", f: common_vendor.o(onPageChange), g: common_vendor.p({ title: "订单列表", ["show-icon"]: true, current: currentPage.value, total: totalPage.value * pageSize.value }) }; }; } }); wx.createComponent(_sfc_main);