"use strict";
const common_vendor = require("../../common/vendor.js");
const sheep_index = require("../../sheep/index.js");
const sheep_util_index = require("../../sheep/util/index.js");
const sheep_api_trade_brokerage = require("../../sheep/api/trade/brokerage.js");
const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");
require("../../sheep/api/index.js");
require("../../sheep/api/distri/score.js");
require("../../sheep/request/index.js");
require("../../sheep/config/index.js");
require("../../sheep/store/index.js");
require("../../sheep/store/app.js");
require("../../sheep/api/promotion/diy.js");
require("../../sheep/platform/index.js");
require("../../sheep/platform/provider/wechat/index.js");
require("../../sheep/platform/provider/wechat/miniProgram.js");
require("../../sheep/api/member/auth.js");
require("../../sheep/api/member/social.js");
require("../../sheep/api/member/user.js");
require("../../sheep/platform/provider/apple/index.js");
require("../../sheep/platform/share.js");
require("../../sheep/router/index.js");
require("../../sheep/hooks/useModal.js");
require("../../sheep/helper/index.js");
require("../../sheep/helper/test.js");
require("../../sheep/helper/digit.js");
require("../../sheep/api/member/signin.js");
require("../../sheep/helper/throttle.js");
require("../../sheep/url/index.js");
require("../../sheep/platform/pay.js");
require("../../sheep/api/pay/order.js");
require("../../sheep/store/user.js");
require("../../sheep/store/cart.js");
require("../../sheep/api/trade/cart.js");
require("../../sheep/api/pay/wallet.js");
require("../../sheep/api/trade/order.js");
require("../../sheep/api/promotion/coupon.js");
require("../../sheep/store/sys.js");
require("../../sheep/store/modal.js");
require("../../sheep/api/distri/share.js");
require("../../sheep/api/distri/team.js");
require("../../sheep/api/infra/file.js");
require("../../sheep/api/member/address.js");
require("../../sheep/api/member/point.js");
require("../../sheep/api/migration/app.js");
require("../../sheep/api/migration/chat.js");
require("../../sheep/api/migration/index.js");
require("../../sheep/api/migration/third.js");
require("../../sheep/api/pay/channel.js");
require("../../sheep/api/product/category.js");
require("../../sheep/api/product/comment.js");
require("../../sheep/api/product/favorite.js");
require("../../sheep/api/product/history.js");
require("../../sheep/api/product/spu.js");
require("../../sheep/api/promotion/activity.js");
require("../../sheep/api/promotion/article.js");
require("../../sheep/api/promotion/bargain.js");
require("../../sheep/api/promotion/combination.js");
require("../../sheep/api/promotion/rewardActivity.js");
require("../../sheep/api/promotion/seckill.js");
require("../../sheep/api/system/area.js");
require("../../sheep/api/system/voice.js");
require("../../sheep/api/trade/afterSale.js");
require("../../sheep/api/trade/config.js");
require("../../sheep/api/trade/delivery.js");
require("../../sheep/config/zIndex.js");
if (!Array) {
  const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
  const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");
  const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  (_easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
}
const _easycom_su_tabs = () => "../../sheep/ui/su-tabs/su-tabs.js";
const _easycom_su_sticky = () => "../../sheep/ui/su-sticky/su-sticky.js";
const _easycom_s_empty = () => "../../sheep/components/s-empty/s-empty.js";
const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
if (!Math) {
  (_easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
}
const _sfc_main = {
  __name: "order",
  setup(__props) {
    common_vendor.useCssVars((_ctx) => ({
      "83224c2e": common_vendor.unref(headerBg)
    }));
    const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
    const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
    common_vendor.onPageScroll((e) => {
      state.scrollTop = e.scrollTop <= 100;
    });
    const state = common_vendor.reactive({
      totals: 0,
      // 累计推广订单（单）
      scrollTop: false,
      currentTab: 0,
      loadStatus: "",
      pagination: {
        list: [],
        total: 0,
        pageNo: 1,
        pageSize: 1
      }
    });
    const tabMaps = [
      {
        name: "全部",
        value: "all"
      },
      {
        name: "待结算",
        value: "0"
        // 待结算
      },
      {
        name: "已结算",
        value: "1"
        // 已结算
      }
    ];
    function onTabsChange(e) {
      sheep_util_index.resetPagination(state.pagination);
      state.currentTab = e.index;
      getOrderList();
    }
    async function getOrderList() {
      state.loadStatus = "loading";
      let { code, data } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageRecordPage({
        pageSize: state.pagination.pageSize,
        pageNo: state.pagination.pageSize,
        bizType: 1,
        // 获得推广佣金
        status: state.currentTab > 0 ? state.currentTab : void 0
      });
      if (code !== 0) {
        return;
      }
      state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
      state.pagination.total = data.total;
      state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
      if (state.currentTab === 0) {
        state.totals = data.total;
      }
    }
    common_vendor.onLoad(() => {
      getOrderList();
    });
    function loadMore() {
      if (state.loadStatus === "noMore") {
        return;
      }
      state.pagination.pageNo++;
      getOrderList();
    }
    common_vendor.onReachBottom(() => {
      loadMore();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t(state.totals),
        b: common_vendor.s({
          marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
          paddingTop: Number(statusBarHeight + 108) + "rpx"
        }),
        c: common_vendor.o(onTabsChange),
        d: common_vendor.p({
          list: tabMaps,
          scrollable: false,
          current: state.currentTab
        }),
        e: common_vendor.p({
          bgColor: "#fff"
        }),
        f: common_vendor.f(state.pagination.list, (item, k0, i0) => {
          return {
            a: common_vendor.t(item.bizId),
            b: common_vendor.t(item.status === 0 ? "待结算" : item.status === 1 ? "已结算" : "已取消"),
            c: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price)),
            d: common_vendor.t(item.title),
            e: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(item.createTime, "yyyy-mm-dd hh:MM:ss")),
            f: item
          };
        }),
        g: state.pagination.total === 0
      }, state.pagination.total === 0 ? {
        h: common_vendor.p({
          icon: "/static/order-empty.png",
          text: "暂无订单"
        })
      } : {}, {
        i: state.pagination.total > 0
      }, state.pagination.total > 0 ? {
        j: common_vendor.o(loadMore),
        k: common_vendor.p({
          status: state.loadStatus,
          ["content-text"]: {
            contentdown: "上拉加载更多"
          }
        })
      } : {}, {
        l: common_vendor.n(state.scrollTop ? "order-warp" : ""),
        m: common_vendor.s(_ctx.__cssVars()),
        n: common_vendor.p({
          title: "分销订单",
          navbar: "inner"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3971f30d"], ["__file", "D:/zx/mall-front-app/pages/commission/order.vue"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);
