"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_file = require("../../utils/file.js");
const utils_utils = require("../../utils/utils.js");
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const activeTab = common_vendor.ref("current");
    const searchKeyword = common_vendor.ref("");
    const currentOrders = common_vendor.ref([
      {
        id: 1,
        orderNo: "1929065620709298441",
        storeName: "正旗手选海鲜烧烤(东港店)",
        createTime: "2025-06-01 14:40:58",
        totalPrice: 19.9,
        goodsCount: 2,
        statusText: "进行中",
        statusClass: "status-active",
        goodsImages: ["/static/demo.png", "/static/demo.png"]
      }
    ]);
    const historyOrders = common_vendor.ref([]);
    const currentOrderList = common_vendor.computed(() => {
      const orders = activeTab.value === "current" ? currentOrders.value : historyOrders.value;
      if (!searchKeyword.value) {
        return orders;
      }
      return orders.filter(
        (order) => order.orderNo.includes(searchKeyword.value) || order.storeName.includes(searchKeyword.value)
      );
    });
    const handleOrderDetail = (order) => {
      common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:113", "订单详情");
      utils_utils.go("/pages/orderInfo/orderDetail");
    };
    const switchTab = (tab) => {
      activeTab.value = tab;
    };
    const handleStoreClick = (order) => {
      common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:124", "点击店铺:", order);
    };
    const handleAddFood = (order) => {
      common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:130", "去加餐:", order);
      utils_utils.go("/pages/orderFood/index");
    };
    const handleCheckout = (order) => {
      common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:137", "去结算:", order);
      utils_utils.go("/pages/placeOrder/index");
    };
    common_vendor.onLoad((e) => {
      common_vendor.index.setNavigationBarTitle({
        title: "我的订单"
      });
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(utils_file.getFileUrl)("img/personal/search.png"),
        b: searchKeyword.value,
        c: common_vendor.o(($event) => searchKeyword.value = $event.detail.value),
        d: activeTab.value === "current" ? 1 : "",
        e: common_vendor.o(($event) => switchTab("current")),
        f: activeTab.value === "history" ? 1 : "",
        g: common_vendor.o(($event) => switchTab("history")),
        h: common_vendor.f(currentOrderList.value, (order, index, i0) => {
          return {
            a: common_vendor.t(order.orderNo),
            b: common_vendor.t(order.storeName),
            c: common_vendor.t(order.statusText),
            d: common_vendor.n(order.statusClass),
            e: common_vendor.o(($event) => handleStoreClick(order), order.id || index),
            f: common_vendor.t(order.createTime),
            g: common_vendor.f(order.goodsImages, (image, imgIndex, i1) => {
              return {
                a: imgIndex,
                b: common_vendor.unref(utils_file.getFileUrl)(image)
              };
            }),
            h: common_vendor.t(order.totalPrice),
            i: common_vendor.t(order.goodsCount),
            j: common_vendor.o(($event) => handleOrderDetail(), order.id || index),
            k: common_vendor.o(($event) => handleAddFood(order), order.id || index),
            l: common_vendor.o(($event) => handleCheckout(order), order.id || index),
            m: order.id || index
          };
        }),
        i: currentOrderList.value.length === 0
      }, currentOrderList.value.length === 0 ? {} : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c0232ef0"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/orderInfo/index.js.map
