|
- // pages/park/addPark/addPark.js
- const app = getApp();
- const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
- const imgurl = require("../../utils/imgurl");
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- navigationBarHeight,
- shanchuGrayUrl: imgurl.shanchuGray.url,
- shanchuUrl: imgurl.shanchu.url,
- title: '京',
- numFir: '',
- numSco: '',
- numThr: '',
- numFor: '',
- numFive: '',
- numSix: '',
- numSource: '',
- titleShow: true,
- englishShow: '',
- numShow: '',
- specShow: '',
- chooseClass: '京',
- choose: 'carData.title',
- chooseTop: 'carData.title',
- buttonStatus: false,
- chooseTitle: [
- ['京', '津', '冀', '晋', '蒙', '辽', '吉'],
- ['黑', '沪', '苏', '浙', '皖', '闽', '赣'],
- ['鲁', '豫', '鄂', '湘', '粤', '桂', '琼'],
- ['渝', '川', '贵', '云', '藏', '陕', '甘'],
- ['青', '宁', '新', '台', '', '', 'DEL']
- ],
- chooseNumFir: [
- ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
- ['H', 'J', 'K', 'L', 'M', 'N', 'O'],
- ['P', 'Q', 'R', 'S', 'T', 'U', 'V'],
- ['X', 'Y', 'Z', 'W', '', '', 'DEL'],
- ],
- chooseNumSco: [
- ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
- ['H', 'J', 'K', 'L', 'M', 'N', 'P'],
- ['Q', 'R', 'S', 'T', 'U', 'V', 'W'],
- ['X', 'Y', 'Z', '1', '2', '3', '4'],
- ['5', '6', '7', '8', '9', '0', 'DEL'],
- ],
- chooseSpec: [
- ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
- ['H', 'J', 'K', 'L', 'M', 'N', 'P'],
- ['Q', 'R', 'S', 'T', 'U', 'V', 'W'],
- ['X', 'Y', 'Z', '港', '澳', '1', '2'],
- ['3', '4', '5', '6', '7', '8', '9'],
- ['0', '', '', '', "", "", 'DEL']
- ],
- },
-
-
- onLoad: function (options) {
- let that = this;
-
- if (Object.keys(options).length != 0) {
- that.setData({
- flags: options.flags
- })
- }
- },
- jumpTo: function () {
- // 返回
- wx.navigateBack({
- url: '/index/passCar'
- })
- },
- handleTap: function (e) {
- this.buttonStatus();
- this.setData({
- choose: e.target.dataset.cardata,
- chooseClass: e.target.dataset.msg,
- chooseTop: e.target.dataset.cardata
- });
- if (e.target.dataset.cardata == "carData.title") {
- this.setData({
- titleShow: true,
- englishShow: false,
- numShow: false,
- specShow: false
-
- })
- } else if (e.target.dataset.cardata == "carData.numFir") {
- this.setData({
- titleShow: false,
- englishShow: true,
- numShow: false,
- specShow: false
- })
- } else {
- if (e.target.dataset.cardata == 'carData.numSix' && this.data.title == '粤') {
- this.setData({
- titleShow: false,
- englishShow: false,
- numShow: false,
- specShow: true
- })
- } else {
- this.setData({
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- })
- }
-
- }
- },
- chooseNum: function (e) {
- if (e.target.dataset.msg == 'I') {
- return
- }
- if (!!e.target.dataset.msg && e.target.dataset.msg != 'DEL') {
-
- switch (this.data.choose) {
- case "carData.title":
- this.setData({
- title: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numFir'
- });
- break;
- case "carData.numFir":
- this.setData({
- numFir: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numSco'
- });
- break;
- case "carData.numSco":
- this.setData({
- numSco: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numThr'
- });
- break;
- case "carData.numThr":
- this.setData({
- numThr: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numFor'
- });
- break;
- case "carData.numFor":
- this.setData({
- numFor: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numFive'
- });
- break;
- case "carData.numFive":
- this.setData({
- numFive: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numSix'
- });
- break;
- case "carData.numSix":
-
- this.setData({
- numSix: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg
- });
- break;
- case "carData.numSource":
- this.setData({
- numSource: e.target.dataset.msg,
- chooseClass: e.target.dataset.msg
- });
- break;
- };
- switch (this.data.chooseTop) {
- case "carData.numFir":
- this.setData({
- choose: 'carData.numFir',
- titleShow: false,
- englishShow: true,
- numShow: false,
- specShow: false
- })
- break;
- case "carData.numSco":
- this.setData({
- choose: 'carData.numSco',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- })
- break;
- case "carData.numThr":
- this.setData({
- choose: 'carData.numThr',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- })
- break;
- case "carData.numFor":
- this.setData({
- choose: 'carData.numFor',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- })
- break;
- case "carData.numFive":
- this.setData({
- choose: 'carData.numFive',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- })
- break;
- case "carData.numSix":
- if (this.data.title == '粤') {
- this.setData({
- choose: 'carData.numSix',
- titleShow: false,
- englishShow: false,
- numShow: false,
- specShow: true
- })
- } else {
- this.setData({
- choose: 'carData.numSix',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- })
- }
- break;
- }
- } else if (e.target.dataset.msg == 'DEL') {
- switch (this.data.choose) {
- case "carData.title":
- this.setData({
- title: '',
- chooseTop: 'carData.title',
- choose: 'carData.title',
- titleShow: true,
- englishShow: false,
- numShow: false,
- specShow: false
- });
- break;
- case "carData.numFir":
- this.setData({
- numFir: '',
- chooseTop: 'carData.title',
- choose: 'carData.title',
- titleShow: true,
- englishShow: false,
- numShow: false,
- specShow: false
- });
- break;
- case "carData.numSco":
- this.setData({
- numSco: '',
- // chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numFir',
- choose: 'carData.numFir',
- titleShow: false,
- englishShow: true,
- numShow: false,
- specShow: false
- });
- break;
- case "carData.numThr":
- this.setData({
- numThr: '',
- // chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numSco',
- choose: 'carData.numSco',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- });
- break;
- case "carData.numFor":
- this.setData({
- numFor: '',
- // chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numThr',
- choose: 'carData.numThr',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- });
- break;
- case "carData.numFive":
- this.setData({
- numFive: '',
- // chooseClass: e.target.dataset.msg,
- chooseTop: 'carData.numFor',
- choose: 'carData.numFor',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- });
- break;
- case "carData.numSix":
- this.setData({
- numSix: '',
- // chooseClass: e.target.dataset.msg
- chooseTop: 'carData.numFive',
- choose: 'carData.numFive',
- titleShow: false,
- englishShow: false,
- numShow: true,
- specShow: false
- });
-
- break;
- case "carData.numSource":
- this.setData({
- numSource: ''
- });
- break;
- }
- }
- this.buttonStatus();
- },
-
- submit: function () {
- if (this.data.title != "" && this.data.numFir != "" && this.data.numSco != "" && this.data.numThr != "" && this.data.numFor != "" && this.data.numFive != "" && this.data.numSix != "") {
- var carNumber = ''
- carNumber += this.data.title + this.data.numFir + this.data.numSco + this.data.numThr + this.data.numFor + this.data.numFive + this.data.numSix
- if (this.data.numSource != "")
- carNumber += this.data.numSource
- var pages = getCurrentPages();
- var prevPage = pages[pages.length - 2];
- prevPage.setData({
- addCar: carNumber
- })
- if (this.data.flags == 'managepalte') {
- wx.navigateBack({
- url: '/pages/managelicenseplate/managelicenseplate?addcar=' + carNumber,
- })
- } else {
- wx.navigateBack({
- url: '/index/passCar?addcar=' + carNumber,
- })
- }
- }
- },
-
- buttonStatus: function () {
- if (this.data.title != "" && this.data.numFir != "" && this.data.numSco != "" && this.data.numThr != "" && this.data.numFor != "" && this.data.numFive != "" && this.data.numSix != "") {
- this.setData({
- buttonStatus: true
- });
- } else {
- this.setData({
- buttonStatus: false
- });
- }
- }
- })
|