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

57 lines
1.3 KiB
JavaScript

Page({
data: {
winHeight: 0,
two_none: "none",
hasback: "none",
year_list: [],
mouth_list: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
],
year: "",
},
onLoad: function () {
var t = wx.getSystemInfoSync().windowHeight;
this.setData({ winHeight: t, year_list: this.getsortyear() });
},
getsortyear: function () {
var t = [],
e = wx.getStorageSync("carvehicle"),
a = new Date().getFullYear();
if (null != e && "" != e && null != e.makeyear)
for (var n = 0; n < a && a - n >= parseInt(e.makeyear); n++)
t.push(a - n);
else for (var o = 0; o < 18; o++) t.push(a--);
return t;
},
btn_pinpai: function (t) {
this.setData({
two_none: "block",
hasback: "block",
year: t.currentTarget.dataset.year,
});
},
btn_sel_name: function (t) {
var e = t.currentTarget.dataset.mouth;
wx.setStorageSync("cartime", this.data.year + "-" + e),
wx.navigateBack({ delta: 1 });
},
goback: function () {
"block" == this.data.three_none
? this.setData({ three_none: "none" })
: "block" == this.data.two_none
? this.setData({ two_none: "none", hasback: "none" })
: this.setData({ hasback: "none" });
},
});