2024-01-22 18:48:00 +08:00

96 lines
2.8 KiB
JavaScript

!(function () {
var e = getApp();
!(function (e) {
e && e.__esModule;
})(require("../../utils/apis.js"));
Page({
data: {
regdate: "",
mileage: "",
carName: "",
cityName: "",
cityid: 0,
provid: 0,
carId: 0,
},
mileageChanage: function (e) {
this.setData({ mileage: e.detail.value });
},
queryVolation: function () {
this.tongzhi(),
this.data.mileage
? this.getDetail()
: wx.showToast({
title: "请输入OBD故障码",
icon: "none",
duration: 2e3,
});
},
getDetail: function () {
var t = { uid: wx.getStorageSync("uid"), obd: this.data.mileage };
e.getdata(t, "obdjc").then((e) => {
console.log("回调数据:", e.data),
e.data && wx.navigateTo({ url: "../carobd/carcxjl?id=" + e.data });
});
},
tongzhi: function (t) {
e.getdata({ type: "4" }, "getdyxx").then((t) => {
console.log(t.data),
wx.requestSubscribeMessage({
tmplIds: [t.data],
success(a) {
"accept" == a[t.data]
? (wx.showToast({ title: "订阅成功" }),
e.util.request({
url: "entry/wxapp/addtemplateid",
data: { templateid: t.data, uid: wx.getStorageSync("uid") },
header: { "content-type": "application/json" },
success: function (e) {
console.log(e);
},
}))
: wx.showToast({ title: "订阅失败" });
},
});
});
},
toDetailExample: function () {
wx.navigateTo({ url: "../carobd/carcxjl?id=6" });
},
onLoad: function (e) {
wx.getStorageSync("uid") || getApp().wxlogin(),
wx.removeStorageSync("carvehicle"),
wx.removeStorageSync("carprov"),
wx.removeStorageSync("carcity"),
wx.removeStorageSync("cartime"),
wx.removeStorageSync("cardatawx");
},
onReady: function () {},
onShow: function () {
var e = wx.getStorageSync("carvehicle"),
t = wx.getStorageSync("carprov"),
a = wx.getStorageSync("carcity"),
o = wx.getStorageSync("cartime"),
n = "";
"" != a && null != a && (n = t.name + "-" + a.name),
console.log("" == e),
"" != e &&
"" != o &&
parseInt(o.split("-")[0]) < parseInt(e.makeyear) &&
(o = ""),
this.setData({
carName: e.salesdesc,
cityName: n,
regdate: o,
cityid: a.id,
provid: t.id,
carId: e.autohomeid,
});
},
onHide: function () {},
onUnload: function () {},
onPullDownRefresh: function () {},
onReachBottom: function () {},
});
})();