myInvoice.js 4.16 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const common_hotel = require("../../common/hotel.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.js");
require("../../common/api.js");
if (!Array) {
  const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  _easycom_uni_load_more2();
}
const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
if (!Math) {
  _easycom_uni_load_more();
}
const _sfc_main = {
  __name: "myInvoice",
  setup(__props) {
    const app = getApp();
    const list = common_vendor.ref([]);
    common_vendor.ref(null);
    const isLoadMore = common_vendor.ref(false);
    common_vendor.ref(true);
    const loadStatus = common_vendor.ref("loading");
    const contentText = common_vendor.ref({
      contentdown: "点击查看更多",
      contentrefresh: "正在加载...",
      contentnomore: "没有更多数据了"
    });
    const queryparam = common_vendor.ref({
      pageNum: 1,
      pageSize: 10
    });
    const currUser = common_vendor.index.getStorageSync("currUser");
    common_vendor.onShow(() => {
      list.value = [];
      getList();
    });
    common_vendor.onLoad((option) => {
    });
    function clickLoadMore() {
      if (loadStatus.value == "nomore") {
        return;
      }
      queryparam.value.pageNum += 1;
      getList();
    }
    function getList() {
      console.log("currUser", currUser);
      isLoadMore.value = false;
      const venueId = app.globalData.venue.id;
      common_hotel.getInvoiceByUserId(currUser.userId, venueId).then((res) => {
        common_vendor._.each(res.rows, (r) => {
          list.value.push(r);
        });
        if (res.total < 10) {
          isLoadMore.value = false;
        } else if (res.total < queryparam.value.pageSize * queryparam.value.pageNum) {
          isLoadMore.value = true;
          loadStatus.value = "nomore";
        } else {
          isLoadMore.value = true;
          loadStatus.value = "more";
        }
      });
    }
    function showDetail(b) {
      let path = `/pages_hotel/hotel/invoiceDetail?invoiceId=${b.id}`;
      common_vendor.index.navigateTo({
        url: path
      });
    }
    function editDetail(b) {
      common_hotel.getActivityDetail(b.activeId).then((res) => {
        let path = `/pages_hotel/hotel/addInvoice?invoiceId=${b.id}&isEdit=true&kpType=${res.data.kpType}`;
        common_vendor.index.navigateTo({
          url: path
        });
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.f(list.value, (b, k0, i0) => {
          return common_vendor.e({
            a: common_vendor.t(b.createTime),
            b: b.invoiceForm == "1"
          }, b.invoiceForm == "1" ? {} : {}, {
            c: b.invoiceForm == "2"
          }, b.invoiceForm == "2" ? {} : {}, {
            d: b.invoiceForm == "3"
          }, b.invoiceForm == "3" ? {} : {}, {
            e: common_vendor.t(b.total),
            f: b.isInvoice == "1"
          }, b.isInvoice == "1" ? {} : {}, {
            g: b.isInvoice == "0"
          }, b.isInvoice == "0" ? {} : {}, {
            h: b.isInvoice == "3"
          }, b.isInvoice == "3" ? {} : {}, {
            i: b.isInvoice == "2"
          }, b.isInvoice == "2" ? {} : {}, {
            j: b.isInvoice == "0"
          }, b.isInvoice == "0" ? {
            k: common_vendor.o(($event) => editDetail(b), b.id)
          } : {}, {
            l: common_vendor.o(($event) => showDetail(b), b.id),
            m: b.id
          });
        }),
        b: common_vendor.p({
          status: loadStatus.value,
          ["content-text"]: contentText.value
        }),
        c: isLoadMore.value,
        d: common_vendor.o(clickLoadMore),
        e: list.value.length == 0
      }, list.value.length == 0 ? {
        f: common_assets._imports_0$4
      } : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4c905687"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_hotel/hotel/myInvoice.vue"]]);
wx.createPage(MiniProgramPage);