bills.js 4.27 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_api = require("../../common/api.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.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: "bills",
  setup(__props) {
    const billsList = common_vendor.ref([]);
    common_vendor.ref(null);
    const isLoadMore = common_vendor.ref(false);
    const loadStatus = common_vendor.ref("loading");
    const contentText = common_vendor.ref({
      contentdown: "点击查看更多",
      contentrefresh: "正在加载...",
      contentnomore: "没有更多数据了"
    });
    const queryparam = common_vendor.ref({
      pageNum: 1,
      pageSize: 10
    });
    common_vendor.onShow(() => {
      billsList.value = [];
      getBills();
    });
    function clickLoadMore() {
      if (loadStatus.value == "nomore") {
        return;
      }
      queryparam.value.pageNum += 1;
      getBills();
    }
    function getBills() {
      isLoadMore.value = false;
      common_api.getMalist(queryparam.value).then((res) => {
        common_vendor._.each(res.rows, (r) => {
          billsList.value.push(r);
        });
        if (res.total < queryparam.value.pageSize * queryparam.value.pageNum) {
          isLoadMore.value = true;
          loadStatus.value = "nomore";
        } else {
          isLoadMore.value = true;
          loadStatus.value = "more";
        }
      });
    }
    function goBooking(b) {
      let path = `/pages/index/booking?id=${b.id}`;
      common_vendor.index.navigateTo({
        url: path
      });
    }
    function showDetail(b) {
      let path = `/pages/usercenter/billsDetail?id=${b.id}`;
      common_vendor.index.navigateTo({
        url: path
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.f(billsList.value, (b, k0, i0) => {
          return common_vendor.e({
            a: common_vendor.t(b.orderCode),
            b: b.verificationCode
          }, b.verificationCode ? {
            c: common_vendor.t(b.verificationCode)
          } : {}, {
            d: b.siteName
          }, b.siteName ? {
            e: common_vendor.t(b.projectName || b.sonList[0].projectName),
            f: common_vendor.t(b.siteName)
          } : {}, {
            g: b.orderDate
          }, b.orderDate ? {
            h: common_vendor.t(b.orderDate),
            i: common_vendor.t(b.orderTimePeriod.replace(/,/, "-"))
          } : {}, {
            j: b.payStatus == 1
          }, b.payStatus == 1 ? {
            k: common_vendor.t(b.payStatusStr)
          } : {
            l: common_vendor.t(b.payStatusStr)
          }, {
            m: b.payStatus == 0 && b.parentType == 2
          }, b.payStatus == 0 && b.parentType == 2 ? {} : {}, {
            n: b.payStatus == 0
          }, b.payStatus == 0 ? {
            o: common_vendor.t(b.orderAmount)
          } : {}, {
            p: b.payStatus > 0
          }, b.payStatus > 0 ? {
            q: common_vendor.t(b.finalOrderAmount)
          } : {}, {
            r: b.payStatus == 2 || b.payStatus == 3
          }, b.payStatus == 2 || b.payStatus == 3 ? {
            s: common_vendor.t(b.refundAmount)
          } : {}, {
            t: b.payStatusStr == "未支付" && b.parentType != 2
          }, b.payStatusStr == "未支付" && b.parentType != 2 ? {
            v: common_vendor.o(($event) => goBooking(b), b.id)
          } : {}, {
            w: common_vendor.o(($event) => showDetail(b), b.id),
            x: b.id
          });
        }),
        b: common_vendor.p({
          status: loadStatus.value,
          ["content-text"]: contentText.value
        }),
        c: isLoadMore.value,
        d: common_vendor.o(clickLoadMore),
        e: billsList.value.length == 0
      }, billsList.value.length == 0 ? {} : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c100b881"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages/usercenter/bills.vue"]]);
wx.createPage(MiniProgramPage);