billDetail.js 5.82 KB
"use strict";
const common_vendor = require("../../common/vendor.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_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
  const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
  (_easycom_uni_forms_item2 + _easycom_uni_forms2)();
}
const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js";
const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js";
if (!Math) {
  (_easycom_uni_forms_item + _easycom_uni_forms)();
}
const _sfc_main = {
  __name: "billDetail",
  setup(__props) {
    const data = common_vendor.reactive({
      form: {
        messageObj: {}
      },
      detail: {}
    });
    const {
      form,
      detail
    } = common_vendor.toRefs(data);
    let orderId = "";
    common_vendor.onLoad((options) => {
      if ("detail" in options) {
        detail.value = JSON.parse(decodeURIComponent(options.detail));
      }
      console.log(detail.value);
      orderId = options.orderId;
      init();
    });
    function init() {
      getData();
    }
    function getData() {
      common_hotel.getRoomBilldetailbyId(orderId).then((res) => {
        form.value = res.data;
        form.value.messageObj = JSON.parse(form.value.message);
      });
    }
    function unsubscribe() {
      common_vendor.index.showModal({
        title: "提示",
        content: " 确定退订吗?",
        showCancel: true,
        success: function(res) {
          if (res.confirm) {
            common_vendor.index.showLoading({
              title: "退订中..."
            });
            common_hotel.cancelOrder(orderId).then((respon) => {
              common_vendor.index.hideLoading();
              if (respon.data) {
                common_vendor.index.showToast({
                  title: "已退订",
                  icon: "none",
                  duration: 2e3
                });
                init();
              } else {
                common_vendor.index.showToast({
                  title: "退订失败,请稍候重试",
                  icon: "none",
                  duration: 2e3
                });
              }
            });
          }
        }
      });
    }
    function cancel() {
      common_vendor.index.showModal({
        title: "提示",
        content: " 确定取消订单吗?",
        showCancel: true,
        success: function(res) {
          if (res.confirm) {
            common_vendor.index.showLoading({
              title: "操作中..."
            });
            common_hotel.cancelOrder2(orderId).then((respon) => {
              common_vendor.index.hideLoading();
              if (respon.data) {
                common_vendor.index.showToast({
                  title: "已取消",
                  icon: "none",
                  duration: 2e3
                });
                init();
              } else {
                common_vendor.index.showToast({
                  title: "取消失败,请稍候重试",
                  icon: "none",
                  duration: 2e3
                });
              }
            });
          }
        }
      });
    }
    return (_ctx, _cache) => {
      var _a, _b, _c;
      return common_vendor.e({
        a: common_vendor.t(common_vendor.unref(detail).name),
        b: common_vendor.t(common_vendor.unref(form).address),
        c: common_vendor.t((_a = common_vendor.unref(detail).messageObj) == null ? void 0 : _a.roomName),
        d: common_vendor.t(common_vendor.unref(detail).messageObj.roomInfo),
        e: common_vendor.t((_b = common_vendor.unref(form).messageObj) == null ? void 0 : _b.roomStayDate),
        f: common_vendor.p({
          label: "入住时间"
        }),
        g: common_vendor.t(common_vendor.unref(form).roomNum),
        h: common_vendor.p({
          label: "房间数"
        }),
        i: common_vendor.f((_c = common_vendor.unref(form).rzUsers) == null ? void 0 : _c.split(","), (n, index, i0) => {
          return {
            a: common_vendor.t(n),
            b: "f806955c-3-" + i0 + ",f806955c-0",
            c: common_vendor.p({
              label: `入住人${index + 1}`
            }),
            d: index
          };
        }),
        j: common_vendor.t(common_vendor.unref(form).ddDate),
        k: common_vendor.p({
          label: "预计到店"
        }),
        l: common_vendor.t(common_vendor.unref(form).phone),
        m: common_vendor.p({
          label: "联系电话"
        }),
        n: common_vendor.unref(form).addNum > 0
      }, common_vendor.unref(form).addNum > 0 ? {
        o: common_vendor.t(common_vendor.unref(form).addNum),
        p: common_vendor.p({
          label: "加床张数"
        })
      } : {}, {
        q: common_vendor.t(common_vendor.unref(detail).total),
        r: common_vendor.unref(form).viewStatus == "5"
      }, common_vendor.unref(form).viewStatus == "5" ? {
        s: common_vendor.o(unsubscribe)
      } : common_vendor.unref(form).viewStatus == "4" ? {} : common_vendor.unref(form).viewStatus == "2" ? {} : common_vendor.unref(form).viewStatus == "7" ? {} : common_vendor.unref(form).viewStatus == "0" ? {
        y: common_vendor.o(cancel)
      } : {}, {
        t: common_vendor.unref(form).viewStatus == "4",
        v: common_vendor.unref(form).viewStatus == "2",
        w: common_vendor.unref(form).viewStatus == "7",
        x: common_vendor.unref(form).viewStatus == "0"
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f806955c"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_hotel/hotel/billDetail.vue"]]);
wx.createPage(MiniProgramPage);