myBills.js 8.62 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_countdown2 = common_vendor.resolveComponent("uni-countdown");
  _easycom_uni_countdown2();
}
const _easycom_uni_countdown = () => "../../uni_modules/uni-countdown/components/uni-countdown/uni-countdown.js";
if (!Math) {
  _easycom_uni_countdown();
}
const _sfc_main = {
  __name: "myBills",
  setup(__props) {
    const app = getApp();
    const billsList = common_vendor.ref([]);
    common_vendor.ref(null);
    common_vendor.ref({
      start: true,
      minute: 0,
      second: 0
    });
    const currUser = common_vendor.index.getStorageSync("currUser");
    common_vendor.onShow(() => {
      billsList.value = [];
      getBills();
    });
    function timeup() {
      getBills();
    }
    function getBills() {
      common_vendor.index.showLoading({
        title: "加载中"
      });
      const venueId = app.globalData.venue.id;
      common_hotel.newbilllist(currUser.userId, venueId).then((res) => {
        billsList.value = res.rows;
        for (var b of billsList.value) {
          b.messageObj = JSON.parse(b.message);
        }
        common_vendor.index.hideLoading();
      });
    }
    function showDetail(b) {
      const detail = encodeURIComponent(JSON.stringify(b));
      if (b.orderType == 0) {
        let path = `/pages_hotel/hotel/billDetail?orderId=${b.id}&detail=${detail}`;
        common_vendor.index.navigateTo({
          url: path
        });
      } else if (b.orderType == 1) {
        let path = `/pages_hotel/car/billDetail?orderId=${b.id}&detail=${detail}`;
        common_vendor.index.navigateTo({
          url: path
        });
      } else if (b.orderType == 2) {
        let path = `/pages_hotel/eat/billDetail?orderId=${b.id}&detail=${detail}`;
        common_vendor.index.navigateTo({
          url: path
        });
      }
    }
    function goPay(r) {
      common_hotel.getbilldetailbyId(r.id).then((res) => {
        let path = `/pages_hotel/hotel/pay?money=${r.total}&orderId=${r.id}&surplus=${res.data.surplus}`;
        common_vendor.index.redirectTo({
          url: path
        });
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.f(billsList.value, (b, k0, i0) => {
          return common_vendor.e({
            a: b.orderType == 0
          }, b.orderType == 0 ? common_vendor.e({
            b: common_vendor.t(b.id),
            c: common_vendor.t(b.name),
            d: common_vendor.t(b.messageObj.roomStayDate),
            e: common_vendor.t(b.messageObj.roomName),
            f: common_vendor.t(b.messageObj.roomInfo),
            g: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {} : {}, {
            h: b.status == "0" && (b.surplus == "0,0" || b.surplus == "0")
          }, b.status == "0" && (b.surplus == "0,0" || b.surplus == "0") ? {} : {}, {
            i: b.status == "1"
          }, b.status == "1" ? {} : {}, {
            j: b.status == "2"
          }, b.status == "2" ? {} : {}, {
            k: b.status == "3" || b.status == "4"
          }, b.status == "3" || b.status == "4" ? {} : {}, {
            l: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {
            m: common_vendor.o(timeup, b.id),
            n: "1463c2ed-0-" + i0,
            o: common_vendor.p({
              ["font-size"]: 12,
              color: "#999",
              splitorColor: "#999",
              ["show-day"]: false,
              ["show-hour"]: false,
              start: true,
              minute: Number(b.surplus.split(",")[0]),
              second: Number(b.surplus.split(",")[1])
            })
          } : {}, {
            p: common_vendor.t(b.total),
            q: common_vendor.o(($event) => showDetail(b), b.id),
            r: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {
            s: common_vendor.o(($event) => goPay(b), b.id)
          } : {}) : {}, {
            t: b.orderType == 2
          }, b.orderType == 2 ? common_vendor.e({
            v: common_vendor.t(b.id),
            w: common_vendor.t(b.name),
            x: common_vendor.f(b.messageObj.foodsList, (n, index, i1) => {
              return common_vendor.e({
                a: n.num > 0
              }, n.num > 0 ? {
                b: common_vendor.t(n.name),
                c: common_vendor.t(n.categoryName),
                d: common_vendor.t(n.num)
              } : {}, {
                e: index
              });
            }),
            y: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {} : {}, {
            z: b.status == "0" && (b.surplus == "0,0" || b.surplus == "0")
          }, b.status == "0" && (b.surplus == "0,0" || b.surplus == "0") ? {} : {}, {
            A: b.status == "1"
          }, b.status == "1" ? {} : {}, {
            B: b.status == "2"
          }, b.status == "2" ? {} : {}, {
            C: b.status == "3" || b.status == "4"
          }, b.status == "3" || b.status == "4" ? {} : {}, {
            D: b.status == "0"
          }, b.status == "0" ? {
            E: common_vendor.o(timeup, b.id),
            F: "1463c2ed-1-" + i0,
            G: common_vendor.p({
              ["font-size"]: 12,
              color: "#999",
              splitorColor: "#999",
              ["show-day"]: false,
              ["show-hour"]: false,
              start: true,
              minute: Number(b.surplus.split(",")[0]),
              second: Number(b.surplus.split(",")[1])
            })
          } : {}, {
            H: common_vendor.t(b.total),
            I: common_vendor.o(($event) => showDetail(b), b.id),
            J: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {
            K: common_vendor.o(($event) => goPay(b), b.id)
          } : {}) : {}, {
            L: b.orderType == 1
          }, b.orderType == 1 ? common_vendor.e({
            M: common_vendor.t(b.id),
            N: common_vendor.t(b.name),
            O: common_vendor.f(b.messageObj.carsList, (car, index, i1) => {
              return common_vendor.e({
                a: car.num > 0
              }, car.num > 0 ? {
                b: common_vendor.t(car.name),
                c: common_vendor.t(car.num)
              } : {}, {
                d: index
              });
            }),
            P: common_vendor.t(b.handleDate),
            Q: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {} : {}, {
            R: b.status == "0" && (b.surplus == "0,0" || b.surplus == "0")
          }, b.status == "0" && (b.surplus == "0,0" || b.surplus == "0") ? {} : {}, {
            S: b.status == "1"
          }, b.status == "1" ? {} : {}, {
            T: b.status == "2"
          }, b.status == "2" ? {} : {}, {
            U: b.status == "3" || b.status == "4"
          }, b.status == "3" || b.status == "4" ? {} : {}, {
            V: b.surplus != "0"
          }, b.surplus != "0" ? {
            W: common_vendor.o(timeup, b.id),
            X: "1463c2ed-2-" + i0,
            Y: common_vendor.p({
              ["font-size"]: 12,
              color: "#999",
              splitorColor: "#999",
              ["show-day"]: false,
              ["show-hour"]: false,
              start: true,
              minute: Number(b.surplus.split(",")[0]),
              second: Number(b.surplus.split(",")[1])
            })
          } : {}, {
            Z: common_vendor.t(b.total),
            aa: common_vendor.o(($event) => showDetail(b), b.id),
            ab: b.status == "0" && b.surplus != "0,0" && b.surplus != "0"
          }, b.status == "0" && b.surplus != "0,0" && b.surplus != "0" ? {
            ac: common_vendor.o(($event) => goPay(b), b.id)
          } : {}) : {}, {
            ad: b.id
          });
        }),
        b: billsList.value.length == 0
      }, billsList.value.length == 0 ? {
        c: common_assets._imports_0$4
      } : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1463c2ed"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_hotel/hotel/myBills.vue"]]);
wx.createPage(MiniProgramPage);