var t;
(t = getApp()),
  Page({
    data: {
      table: {
        1: "待报价",
        2: "待付款",
        3: "待发货",
        4: "待收货",
        5: "已完成",
      },
      activeIndex: 1,
      orderList: [],
      nav_width: "",
      page: 1,
      isLast: !1,
      isLoad: !1,
    },
    onLoad: function (t) {
      var a = t.status,
        e = Object.keys(this.data.table).length;
      this.setData({ nav_width: 100 / e, activeIndex: a > 0 ? a : 1 });
    },
    getList: function () {
      var a = this;
      if (a.data.isLast) return !1;
      t.util.request({
        url: "entry/wxapp/Api",
        data: {

          r: "part.order.order_list",
          uid: t.getuid(),
          page: a.data.page,
          status: a.data.activeIndex,
        },
        success: function (t) {
          if (a.data.page > 1)
            if (t.data.data.length > 0) {
              var e = a.data.orderList;
              e.push.apply(
                e,
                (function (t) {
                  if (Array.isArray(t)) {
                    for (var a = 0, e = Array(t.length); a < t.length; a++)
                      e[a] = t[a];
                    return e;
                  }
                  return Array.from(t);
                })(t.data.data)
              ),
                a.setData({ orderList: e });
            } else a.setData({ isLast: !0 });
          else
            a.setData({ orderList: t.data.data }),
              t.data.data.length < 1 && a.setData({ isLast: !0 });
          a.setData({ page: a.data.page + 1 });
        },
      });
    },
    ActiveClick: function (t) {
      this.setData({
        activeIndex: t.currentTarget.dataset.index,
        page: 1,
        isLast: !1,
      }),
        this.getList();
    },
    onReachBottom: function () {
      this.getList();
    },
    goPay: function (a) {
      var e = t.getAttr(a, "id");
      wx.navigateTo({ url: "/pages/part/pay/index?id=" + e });
    },
    onShow: function () {
      this.setData({ page: 1, isLast: !1 }), this.getList();
    },
    confirmOrder: function (a) {
      var e = this,
        i = t.getAttr(a, "id");
      t.util.request({
        url: "entry/wxapp/Api",
        data: {

          r: "part.order.confirm_order",
          uid: t.getuid(),
          id: i,
        },
        success: function (t) {
          e.setData({ activeIndex: 5, page: 1, isLast: !1 }), e.getList();
        },
      });
    },
  });
