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

148 lines
4.5 KiB
JavaScript

var e, t;
(e = getApp()),
(t = (function (e) {
return e && e.__esModule ? e : { default: e };
})(require("../../utils/apis.js"))),
Page({
data: {
regdate: "",
mileage: "",
carName: "",
cityName: "",
cityid: 0,
provid: 0,
carId: 0,
engine: "",
imageUrl: "",
},
mileageChanage: function (e) {
this.setData({ mileage: e.detail.value });
},
getad: function () {},
queryVolation: function () {
var e = this;
this.tongzhi(),
e.data.mileage
? 17 == e.data.mileage.length
? e.queryVin()
: wx.showToast({
title: "车架号错误,请输入正确的车架号",
icon: "none",
duration: 2e3,
})
: wx.showToast({
title: "车架号不能为空",
icon: "none",
duration: 2e3,
});
},
saoys: function (e) {
wx.navigateTo({ url: "../xszsb/xszsb?type=1" });
},
queryVin: function (e) {
var a = this;
console.log(a.data.mileage),
t.default
.getCarInfo({
appType: "WECHAT",
vin: a.data.mileage,
engine: a.data.engine,
mileage: a.data.imageUrl,
queryType: 2,
drivingLicense: "",
})
.then(function (e) {
console.log(e),
"1000" === e.error_code
? (wx.setStorageSync("orderInfo", e.data),
wx.setStorageSync("mileage", a.data.mileage),
wx.navigateTo({ url: "../carwb/carInfo" }))
: wx.showToast({
title: e.message,
icon: "none",
duration: 3e3,
});
});
},
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: "../carwb/carwxjl" });
},
toSelectCar: function () {
wx.navigateTo({ url: "../carwb/selectCar/selectCar" });
},
toSelectCity: function () {
wx.navigateTo({ url: "../carwb/selectCity/selectCity" });
},
toSelectTime: function () {
wx.navigateTo({ url: "../carwb/selectTime/selectTime" });
},
onLoad: function (e) {
wx.getStorageSync("uid") || getApp().wxlogin(),
this.getad(),
wx.removeStorageSync("cardata"),
wx.removeStorageSync("xszimgurl"),
wx.removeStorageSync("carvehicle"),
wx.removeStorageSync("carprov"),
wx.removeStorageSync("carcity"),
wx.removeStorageSync("cartime"),
wx.removeStorageSync("cardatawx"),
this.setData({ mileage: wx.getStorageSync("mileage") });
},
onReady: function () {},
onShow: function () {
var e = wx.getStorageSync("cardata");
console.log("行驶证数据", e),
console.log("行驶证照片", wx.getStorageSync("xszimgurl")),
e &&
this.setData({
mileage: e.车辆识别代号.words,
engine: e.发动机号码.words,
});
var t = wx.getStorageSync("carvehicle"),
a = wx.getStorageSync("carprov"),
o = wx.getStorageSync("carcity"),
n = wx.getStorageSync("cartime"),
i = "";
"" != o && null != o && (i = a.name + "-" + o.name),
console.log("" == t),
"" != t &&
"" != n &&
parseInt(n.split("-")[0]) < parseInt(t.makeyear) &&
(n = ""),
this.setData({
carName: t.salesdesc,
cityName: i,
regdate: n,
cityid: o.id,
provid: a.id,
carId: t.autohomeid,
});
},
onHide: function () {},
onUnload: function () {},
onPullDownRefresh: function () {},
onReachBottom: function () {},
onShareAppMessage: function () {},
});