"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_checkbox2 = common_vendor.resolveComponent("up-checkbox");
  const _easycom_up_checkbox_group2 = common_vendor.resolveComponent("up-checkbox-group");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
  (_easycom_up_icon2 + _easycom_up_checkbox2 + _easycom_up_checkbox_group2 + _easycom_z_paging2 + _easycom_up_button2)();
}
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox.js";
const _easycom_up_checkbox_group = () => "../../uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group.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_checkbox + _easycom_up_checkbox_group + _easycom_z_paging + _easycom_up_button)();
}
const _sfc_main = {
  __name: "applyFor",
  setup(__props) {
    const { nav, navTo } = hooks_useNav.useNav();
    let checkboxValue1 = common_vendor.ref([]);
    const dataList = common_vendor.ref([]);
    const paging = common_vendor.ref(null);
    let allCel = common_vendor.ref(false);
    const allCheck = (e) => {
      if (e) {
        checkboxValue1.value = dataList.value.map((item, index) => {
          return item.id;
        });
      } else {
        checkboxValue1.value = [];
      }
      allCel.value = e;
      common_vendor.index.__f__("log", "at pageMake/invoice/applyFor.vue:94", e);
    };
    const queryList = async (pageNo, pageSize) => {
      const params = {
        current: pageNo,
        pageSize
      };
      api_api.orderList(params).then((res) => {
        paging.value.complete(res);
        common_vendor.index.hideLoading();
      }).catch((res) => {
        paging.value.complete(false);
        common_vendor.index.hideLoading();
      });
    };
    const checkboxChange = (e) => {
      if (e.length == dataList.value.length) {
        allCel.value = true;
      } else {
        allCel.value = false;
      }
      common_vendor.index.__f__("log", "at pageMake/invoice/applyFor.vue:119", e);
    };
    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 {
            a: "d81cafaf-3-" + i0 + ",d81cafaf-2",
            b: common_vendor.p({
              shape: "circle",
              customStyle: {
                margin: "0"
              },
              name: item.id
            }),
            c: common_vendor.t(item.orderNo),
            d: common_vendor.t(item.electricityAmount),
            e: common_vendor.t(item.serviceAmount),
            f: common_vendor.t(item.actuallyAmount),
            g: index
          };
        }),
        c: common_vendor.o(checkboxChange),
        d: common_vendor.o(($event) => common_vendor.isRef(checkboxValue1) ? checkboxValue1.value = $event : checkboxValue1 = $event),
        e: common_vendor.p({
          placement: "column",
          modelValue: common_vendor.unref(checkboxValue1)
        }),
        f: common_vendor.sr(paging, "d81cafaf-1", {
          "k": "paging"
        }),
        g: common_vendor.o(queryList),
        h: common_vendor.o(($event) => dataList.value = $event),
        i: common_vendor.p({
          ["use-page-scroll"]: true,
          modelValue: dataList.value
        }),
        j: common_vendor.o(allCheck),
        k: common_vendor.o(($event) => common_vendor.isRef(allCel) ? allCel.value = $event : allCel = $event),
        l: common_vendor.p({
          label: "本页全选",
          shape: "circle",
          usedAlone: true,
          customStyle: {
            margin: "0 10rpx 0 0"
          },
          checked: common_vendor.unref(allCel)
        }),
        m: common_vendor.o(($event) => common_vendor.unref(navTo)(`/pageMake/invoice/applyForDay?list=${encodeURIComponent(JSON.stringify(common_vendor.unref(checkboxValue1)))}`)),
        n: common_vendor.p({
          customStyle: {
            height: "80rpx",
            width: "230rpx"
          },
          color: "#4879e6",
          text: "下一步",
          shape: "circle",
          disabled: common_vendor.unref(checkboxValue1).length == 0
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d81cafaf"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pageMake/invoice/applyFor.js.map
