"use strict";
const common_vendor = require("../../common/vendor.js");
const hooks_useNav = require("../../hooks/useNav.js");
const api_api = require("../../api/api.js");
if (!Array) {
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  const _easycom_up_tag2 = common_vendor.resolveComponent("up-tag");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
  (_easycom_up_icon2 + _easycom_up_tag2 + _easycom_z_paging2 + _easycom_up_button2)();
}
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up_tag = () => "../../uni_modules/uview-plus/components/u-tag/u-tag.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
  (_easycom_up_icon + _easycom_up_tag + _easycom_z_paging + _easycom_up_button)();
}
const _sfc_main = {
  __name: "invoice",
  setup(__props) {
    const { nav, navTo } = hooks_useNav.useNav();
    const dataList = common_vendor.ref([]);
    const paging = common_vendor.ref(null);
    const queryList = async (pageNo, pageSize) => {
      const params = {
        current: pageNo,
        pageSize
      };
      api_api.invoiceList(params).then((res) => {
        paging.value.complete(res);
        common_vendor.index.hideLoading();
      }).catch((res) => {
        paging.value.complete(false);
        common_vendor.index.hideLoading();
      });
    };
    let isPagingRefNotFound = () => {
      return !paging.value;
    };
    common_vendor.onPullDownRefresh(() => {
      if (isPagingRefNotFound())
        return;
      paging.value.reload().catch(() => {
      });
    });
    common_vendor.onPageScroll((e) => {
      if (isPagingRefNotFound())
        return;
      paging.value.updatePageScrollTop(e.scrollTop);
      e.scrollTop < 10 && paging.value.doChatRecordLoadMore();
    });
    common_vendor.onReachBottom(() => {
      if (isPagingRefNotFound())
        return;
      paging.value.pageReachBottom();
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          name: "error-circle-fill",
          color: "#3c9cff"
        }),
        b: common_vendor.f(dataList.value, (item, index, i0) => {
          return common_vendor.e({
            a: "d71576e1-2-" + i0 + ",d71576e1-1",
            b: common_vendor.t(item.createTime),
            c: "d71576e1-3-" + i0 + ",d71576e1-1",
            d: common_vendor.t(item.invoiceTitle),
            e: common_vendor.t(item.merchantInvoice || "-"),
            f: item.status == 0
          }, item.status == 0 ? {
            g: "d71576e1-4-" + i0 + ",d71576e1-1",
            h: common_vendor.p({
              text: "待开票",
              type: "warning",
              plain: true,
              plainFill: true
            })
          } : {}, {
            i: item.status == 1
          }, item.status == 1 ? {
            j: "d71576e1-5-" + i0 + ",d71576e1-1",
            k: common_vendor.p({
              text: "已开票",
              type: "success",
              plain: true,
              plainFill: true
            })
          } : {}, {
            l: item.status == -1
          }, item.status == -1 ? {
            m: "d71576e1-6-" + i0 + ",d71576e1-1",
            n: common_vendor.p({
              text: "取消",
              type: "error",
              plain: true,
              plainFill: true
            })
          } : {}, {
            o: common_vendor.t(item.invoiceAmount),
            p: index
          });
        }),
        c: common_vendor.p({
          name: "clock-fill"
        }),
        d: common_vendor.p({
          name: "arrow-right"
        }),
        e: () => ({
          r: paging,
          k: "paging"
        }),
        f: common_vendor.o(queryList),
        g: common_vendor.o(($event) => dataList.value = $event),
        h: common_vendor.p({
          ["use-page-scroll"]: true,
          modelValue: dataList.value
        }),
        i: common_vendor.o(($event) => common_vendor.unref(navTo)("/pageMake/invoice/applyFor")),
        j: common_vendor.p({
          customStyle: {
            height: "80rpx"
          },
          color: "#4879e6",
          text: "申请开票",
          shape: "circle"
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d71576e1"]]);
_sfc_main.__runtimeHooks = 1;
my.createPage(MiniProgramPage);
