var t, a;
(t = getApp()),
  (a = getApp()),
  Page({
    data: {
      winWidth: 0,
      winHeight: 0,
      currentTab: 0,
      autoplay: !1,
      circular: !0,
      indicatorDots: !0,
      scrollTop: "",
      navFixed: !1,
      currentData: 0,
      repairList: [],
      dangerList: [],
      detailList: [],
      valutionList: [],
      theInterval: null,
      type: 0,
      page: 1,
      inputValue: "",
      inputVal: "",
    },
    onLoad: function (t) {
      t.type
        ? (this.setData({ currentData: t.type, type: t.type }),
          this.getDetail())
        : this.getDetail(0),
        this.showModal(),
        this._notice();
    },
    bindKeyInput: function (t) {
      var a = t.detail.value;
      this.setData({ inputVal: a });
    },
    clickcx: function (t) {
      this.data.inputVal
        ? (this.setData({ repairList: [], page: 1 }), this.getDetail())
        : wx.showToast({
            title: "请输入车架号查询",
            icon: "none",
            duration: 3e3,
          });
    },
    _notice: function () {
      var t = this;
      a.util.request({
        url: "entry/wxapp/Api",
        data: { m: "monai_market", r: "home.index.home1" },
        cachetime: "0",
        success: function (a) {
          console.log(a),
            a.data.data.info_name.name &&
              wx.setNavigationBarTitle({
                title: a.data.data.info_name.name + "",
              }),
            t.setData({
              banner: a.data.data.banner,
              market: a.data.data.market,
              brand: a.data.data.brand,
              textJson: a.data.data.notice,
              info_name: a.data.data.info_name.name,
              recom: a.data.data.info_name.recom,
            });
        },
      });
    },
    showModal: function (t) {
      1 != wx.getStorageSync("showModal") &&
        wx.showModal({
          title: "温馨提示",
          content: "绑定手机号码后,查询完成将收到短信通知更加及时~",
          showCancel: !0,
          cancelText: "不再提示",
          confirmText: "立即设置",
          success: function (t) {
            t.cancel
              ? (console.log("您点击了取消"), wx.setStorageSync("showModal", 1))
              : t.confirm && wx.navigateTo({ url: "/pages/mine/info/index" });
          },
        });
    },
    previewImage: function (t) {
      console.log(t),
        wx.showToast({
          title: "长按图片保存截图",
          icon: "none",
          duration: 3e3,
        }),
        wx.previewImage({
          current: t.currentTarget.dataset.id,
          urls: [t.currentTarget.dataset.id],
        });
    },
    previewImageb: function (t) {
      console.log(t),
        wx.showToast({
          title: "长按图片保存截图",
          icon: "none",
          duration: 3e3,
        }),
        wx.previewImage({
          current: JSON.parse(t.currentTarget.dataset.id)[0],
          urls: [JSON.parse(t.currentTarget.dataset.id)[0]],
        });
    },
    checkCurrent: function (a) {
      if (
        (t.appdengl(),
        console.log("点击切换"),
        console.log(a.target.dataset.current),
        this.data.currentData === a.target.dataset.current)
      )
        return !1;
      var e = a.target.dataset.current;
      this.setData({
        currentData: a.target.dataset.current,
        type: e,
        repairList: [],
        inputVal: "",
        page: 1,
      }),
        this.getDetail();
    },
    onReachBottom: function () {
      console.log("加上"), this.getDetail();
    },
    getDetail: function () {
      var a = this.data.type,
        e = this,
        n = {
          uid: wx.getStorageSync("uid"),
          type: a,
          page: this.data.page,
          keyword: this.data.inputVal,
        };
      t.getdata(n, "carorder").then((t) => {
        if ((console.log("回调数据:", t), t.data)) {
          if (1 == e.data.page) var a = t.data;
          else (a = e.data.repairList).push.apply(a, t.data);
          e.setData({ repairList: a, page: e.data.page + 1 });
        }
      });
    },
    layoutScroll: function (t) {
      (this.data.scrollTop = 1 * this.data.scrollTop + 1 * t.detail.deltaY),
        this.data.scrollTop <= -160
          ? this.setData({ navFixed: !0 })
          : this.setData({ navFixed: !1 });
    },
    tongzhi: function (a) {
      t.getdata({ type: "4" }, "getdyxx").then((a) => {
        console.log(a.data),
          wx.requestSubscribeMessage({
            tmplIds: [a.data],
            success(e) {
              "accept" == e[a.data]
                ? (wx.showToast({ title: "订阅成功" }),
                  t.util.request({
                    url: "entry/wxapp/addtemplateid",
                    data: { templateid: a.data, uid: wx.getStorageSync("uid") },
                    header: { "content-type": "application/json" },
                    success: function (t) {
                      console.log(t);
                    },
                  }))
                : wx.showToast({ title: "订阅失败" });
            },
          });
      });
    },
    showRenMsg: function () {
      this.tongzhi(),
        wx.showModal({
          title: "温馨提示",
          content:
            "人工线下查询比较耗时,请耐心等待,一般晚上11点以后的订单次日10点前出完",
          success: function (t) {
            t.confirm
              ? console.log("点击确认回调")
              : console.log("点击取消回调");
          },
        });
    },
    showGaoMsg: function () {
      wx.showToast({
        title: "查不到记录,建议使用高级出险查询。",
        icon: "none",
        duration: 3e3,
      });
    },
    getvin: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carvin/carvin?orderid=" + a,
        success: function () {},
      });
    },
    getjqx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carjqx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    njcx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carnj/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    wzcx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/cphy/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getRepairDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carwbjzb/carwxjl?orderid=" + a,
        success: function () {},
      });
    },
    getDangerDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carcx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getdzbdDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/cardzbd/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getcarclztDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carclzt/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getBaseDetail: function (t) {
      var a = t.currentTarget.dataset.vin,
        e = t.currentTarget.dataset.logo,
        n = t.currentTarget.dataset.time,
        i = t.currentTarget.dataset.brand;
      t.currentTarget.dataset.version,
        wx.navigateTo({
          url:
            "/pages/carinfoDetail/carinfoDetail?vin=" +
            a +
            "&logo=" +
            e +
            "&brand=" +
            i +
            "&time=" +
            n,
          success: function () {},
        });
    },
    getValuationDetail: function (t) {
      var a = t.currentTarget.dataset.id;
      wx.navigateTo({
        url: "/packageA/pages/caresgz/carpg/carpg?orderid=" + a,
        success: function () {},
      });
    },
    toRepairExample: function () {
      wx.navigateTo({
        url: "/packageA/pages/carwbjzb/carwxjl?orderid=D167578460646744394799",
        success: function () {},
      });
    },
    toDangerExample: function () {
      wx.navigateTo({
        url: "/packageA/pages/carcx/carcxjl?orderid=D166847888078046949494",
        success: function () {},
      });
    },
    toBaseExample: function () {
      wx.navigateTo({
        url: "/pages/carinfoDetail/carinfoDetail",
        success: function () {},
      });
    },
    toValuationExample: function () {
      wx.navigateTo({ url: "/pages/carpg/carpg", success: function () {} });
    },
    onReady: function () {},
    onShow: function () {
      var t = this;
      wx.getSystemInfo({
        success: function (a) {
          t.setData({
            pixelRatio: a.pixelRatio,
            winHeight: a.windowHeight,
            winWidth: a.windowWidth,
            page: 1,
          });
        },
      }),
        this.userdata(),
        this.getDetail();
    },
    userdata: function () {
      var a = this;
      t.util.getUserInfo(function (t) {
        t.memberInfo
          ? (a.setData({ memberInfo: t.memberInfo }),
            wx.setStorageSync("uid", t.memberInfo.uid),
            a.firstin(t.memberInfo, 0))
          : a.setData({ isShow: !0 });
      });
    },
    firstin: function (a, e) {
      var n = this;
      console.log("提交数据", a),
        t.util.request({
          url: "entry/wxapp/Api",
          data: {
            m: "monai_market",
            r: "me.detail",
            uid: a.uid,
            type: e,
            head_image: a.avatar,
            nickname: a.nickname,
          },
          success: function (t) {
            console.log(t),
              n.setData({
                detail: t.data.data,
                admin: t.data.data.user.is_admin,
              });
          },
        });
    },
    copyText: function (t) {
      console.log(t),
        wx.setClipboardData({
          data: t.currentTarget.dataset.text,
          success: function (t) {
            wx.getClipboardData({
              success: function (t) {
                wx.showToast({ title: "订单号复制成功" });
              },
            });
          },
        });
    },
    onHide: function () {
      clearInterval(this.data.theInterval);
    },
    onUnload: function () {
      clearInterval(this.data.theInterval);
    },
    onPullDownRefresh: function () {
      this.onShow();
    },
    onShareAppMessage: function () {},
  });