!(function () {
  !(function (a) {
    a && a.__esModule;
  })(require("../../utils/apis.js"));
  var a = getApp(),
    t = getApp();
  Page({
    data: { orderInfo: null },
    onLoad: function (a) {
      var t = wx.getStorageSync("orderInfo"),
        e = wx.getStorageSync("cardatawx");
      this.setData({ orderInfo: t, cardatawx: e }), this.getmoney();
    },
    getmoney: function () {
      var t = this,
        e = { type: "syxcx_money", uid: wx.getStorageSync("uid") };
      a.getdata(e, "getcarmoney").then((a) => {
        console.log("money", a.data), a.data && t.setData({ fee: a.data });
      });
    },
    orderid: function () {
      let a = "";
      for (var t = 0; t < 8; t++) a += Math.floor(10 * Math.random());
      (a = "D" + new Date().getTime() + a), this.setData({ orderid: a });
    },
    queryVin: function () {
      var a = this;
      a.orderid(),
        console.log(wx.getStorageSync("uid")),
        wx.getStorageSync("uid")
          ? (console.log(wx.getStorageSync("uid")),
            t.util.request({
              url: "entry/wxapp/paynum",
              method: "post",
              dataType: "json",
              data: {

                type: "syxcx_money",
                orderid: a.data.orderid,
                uid: wx.getStorageSync("uid"),
                vin: a.data.cardatawx.vin,
                chepai: a.data.cardatawx.chepai,
                engine: a.data.cardatawx.engine,
                cpimg: a.data.cardatawx.imageUrl,
                postcardata: JSON.stringify(a.data),
              },
              success: function (e) {
                e.data && e.data.data && 1e3 == e.data.message
                  ? t.util.request({
                      url: "entry/wxapp/Api",
                      data: {

                        uid: wx.getStorageSync("uid"),
                        r: "home.weizhang.paynum",
                        orderid: e.data.data.orderid,
                      },
                      success: function (t) {
                        wx.showModal({ content: t.data.message }),
                          a.setData({
                            weizhang_num: 1 * a.data.weizhang_num + 10,
                          }),
                          a.getDetail();
                      },
                    })
                  : e.data &&
                    e.data.data &&
                    e.data.code!=200 &&
                    wx.requestPayment({
                      timeStamp: e.data.data.timeStamp,
                      nonceStr: e.data.data.nonceStr,
                      package: e.data.data.package,
                      signType: "MD5",
                      paySign: e.data.data.paySign,
                      success: function (n) {
                        t.util.request({
                          url: "entry/wxapp/Api",
                          data: {

                            uid: wx.getStorageSync("uid"),
                            r: "home.weizhang.paynum",
                            orderid: e.data.data.orderid,
                          },
                          success: function (t) {
                            a.setData({
                              weizhang_num: 1 * a.data.weizhang_num + 10,
                            }),
                              wx.showModal({ content: t.data.message }),
                              a.getDetail();
                          },
                        });
                      },
                    });
              },
            }))
          : wx.showModal({
              title: "温馨提醒",
              content: "使用本功能请先登录后在使用~",
              showCancel: !1,
              success: function (a) {
                a.confirm && wx.reLaunch({ url: "/pages/mine/index" });
              },
            });
    },
    getDetail: function () {
      wx.showModal({
        title: "温馨提醒",
        content:
          "恭喜下单成功，人工查询早上8点-晚上10点20分钟内出结果~点击确定后进入订单列表",
        showCancel: !1,
        success: function (a) {
          a.confirm &&
            wx.reLaunch({ url: "/pages/reporlist/reporlist?type=26" });
        },
      });
    },
    toDisclaimers: function () {
      wx.navigateTo({ url: "/pages/disclaimers/disclaimers" });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {},
    onShareAppMessage: function () {},
  });
})();
