"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_request = require("../../../api/request.js");
const _sfc_main = {
  __name: "mineorders",
  setup(__props) {
    common_vendor.ref(0);
    common_vendor.onMounted(async () => {
      await Getorder();
      Status.displayedOrders = Status.orders;
    });
    common_vendor.ref({
      userInfo: common_vendor.index.getStorageSync("userInfo")
    });
    const Getorder = async () => {
      const res = await common_vendor.index.request({
        url: api_request.baseUrl + "/order/list",
        method: "POST",
        data: {
          // id:userInfo.value.userInfo.id,
          id: 215
        }
      });
      if (res.data.code === 1) {
        Status.value.orders = res.data.data;
      } else {
        console.log("没拿到用户数据");
      }
    };
    const Status = common_vendor.ref({
      orderStatus: "全部",
      orders: [],
      displayedOrders: []
    });
    const changeTab = (tab) => {
      if (tab === "全部") {
        Status.value.displayedOrders = Status.value.orders;
        Status.value.orderStatus = "全部";
      } else {
        Status.value.displayedOrders = Status.value.orders.filter((order) => {
          switch (tab) {
            case "待支付":
              return order.orderStatus === "待支付";
            case "待发货":
              return order.orderStatus === "待发货";
            case "已发货":
              return order.orderStatus === "已发货";
            case "售后":
              return order.orderStatus === "售后";
            default:
              return false;
          }
        });
        Status.value.orderStatus = tab;
      }
    };
    const isSelected = (tab) => Status.value.orderStatus === tab;
    return (_ctx, _cache) => {
      return {
        a: _ctx.orderStatus === "全部" ? 1 : "",
        b: isSelected("全部") ? 1 : "",
        c: common_vendor.o(($event) => changeTab("全部")),
        d: _ctx.orderStatus === "待支付" ? 1 : "",
        e: isSelected("待支付") ? 1 : "",
        f: common_vendor.o(($event) => changeTab("待支付")),
        g: _ctx.orderStatus === "待发货" ? 1 : "",
        h: isSelected("待发货") ? 1 : "",
        i: common_vendor.o(($event) => changeTab("待发货")),
        j: _ctx.orderStatus === "已发货" ? 1 : "",
        k: isSelected("已发货") ? 1 : "",
        l: common_vendor.o(($event) => changeTab("已发货")),
        m: _ctx.orderStatus === "售后" ? 1 : "",
        n: isSelected("售后") ? 1 : "",
        o: common_vendor.o(($event) => changeTab("售后")),
        p: common_vendor.f(Status.value.displayedOrders, (order, k0, i0) => {
          return common_vendor.e({
            a: common_vendor.t(order.orderStatus),
            b: common_vendor.f(order.orderItemList, (item, k1, i1) => {
              return {
                a: item.goodSnapshot.goodImg,
                b: item.id
              };
            }),
            c: common_vendor.f(order.orderItemList, (item, k1, i1) => {
              return {
                a: common_vendor.t(item.goodSnapshot.name),
                b: item.id
              };
            }),
            d: common_vendor.f(order.orderItemList, (item, k1, i1) => {
              return {
                a: common_vendor.t(item.goodSnapshot.type),
                b: item.id
              };
            }),
            e: common_vendor.f(order.orderItemList, (item, k1, i1) => {
              return {
                a: common_vendor.t(item.goodSnapshot.price),
                b: item.id
              };
            }),
            f: order.orderStatus === "待支付"
          }, order.orderStatus === "待支付" ? {} : {}, {
            g: order.orderStatus === "待发货"
          }, order.orderStatus === "待发货" ? {} : {}, {
            h: order.orderStatus === "已发货"
          }, order.orderStatus === "已发货" ? {} : {}, {
            i: order.orderStatus === "售后"
          }, order.orderStatus === "售后" ? {} : {}, {
            j: order.id
          });
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7d0f2622"], ["__file", "D:/jiangchengfeiyi-xiaochengxu/pages/mine/mineorders/mineorders.vue"]]);
wx.createPage(MiniProgramPage);
