C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

354 lines
9.3 KiB

  1. // pages/park/addPark/addPark.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. title: '京',
  9. numFir: '',
  10. numSco: '',
  11. numThr: '',
  12. numFor: '',
  13. numFive: '',
  14. numSix: '',
  15. numSource: '',
  16. titleShow: true,
  17. englishShow: '',
  18. numShow: '',
  19. specShow: '',
  20. chooseClass: '京',
  21. choose: 'carData.title',
  22. chooseTop: 'carData.title',
  23. buttonStatus: false,
  24. chooseTitle: [
  25. ['京', '津', '冀', '晋', '蒙', '辽', '吉'],
  26. ['黑', '沪', '苏', '浙', '皖', '闽', '赣'],
  27. ['鲁', '豫', '鄂', '湘', '粤', '桂', '琼'],
  28. ['渝', '川', '贵', '云', '藏', '陕', '甘'],
  29. ['青', '宁', '新', '台', '', '', 'DEL']
  30. ],
  31. chooseNumFir: [
  32. ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  33. ['H', 'I', 'J', 'K', 'L', 'M', 'N'],
  34. ['O', 'P', 'Q', 'R', 'S', 'T', 'U'],
  35. ['V', 'W', 'X', 'Y', 'Z', '', ''],
  36. ['', '', '', '', '', '', 'DEL']
  37. ],
  38. chooseNumSco: [
  39. ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  40. ['H', 'I', 'J', 'K', 'L', 'M', 'N'],
  41. ['O', 'P', 'Q', 'R', 'S', 'T', 'U'],
  42. ['V', 'W', 'X', 'Y', 'Z', '1', '2'],
  43. ['3', '4', '5', '6', '7', '8', '9'],
  44. ['0', '', '', '', '', '', 'DEL']
  45. ],
  46. chooseSpec: [
  47. ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  48. ['H', 'I', 'J', 'K', 'L', 'M', 'N'],
  49. ['O', 'P', 'Q', 'R', 'S', 'T', 'U'],
  50. ['V', 'W', 'X', 'Y', 'Z', '港', '澳'],
  51. ['1', '2', '3', '4', '5', '6', '7'],
  52. ['8', '9', '0', '', '', '', 'DEL']
  53. ],
  54. },
  55. onLoad: function () {
  56. },
  57. jumpTo: function () {
  58. wx.redirectTo({
  59. url: '/pages/passCar/passCar'
  60. });
  61. },
  62. handleTap: function (e) {
  63. this.buttonStatus();
  64. this.setData({
  65. choose: e.target.dataset.cardata,
  66. chooseClass: e.target.dataset.msg,
  67. chooseTop: e.target.dataset.cardata
  68. });
  69. if (e.target.dataset.cardata == "carData.title") {
  70. this.setData({
  71. titleShow: true,
  72. englishShow: false,
  73. numShow: false,
  74. specShow: false
  75. })
  76. } else if (e.target.dataset.cardata == "carData.numFir") {
  77. this.setData({
  78. titleShow: false,
  79. englishShow: true,
  80. numShow: false,
  81. specShow: false
  82. })
  83. } else {
  84. if (e.target.dataset.cardata == 'carData.numSix' && this.data.title == '粤') {
  85. this.setData({
  86. titleShow: false,
  87. englishShow: false,
  88. numShow: false,
  89. specShow: true
  90. })
  91. } else {
  92. this.setData({
  93. titleShow: false,
  94. englishShow: false,
  95. numShow: true,
  96. specShow: false
  97. })
  98. }
  99. }
  100. },
  101. chooseNum: function (e) {
  102. //console.log(this.data.choose)
  103. // console.log(e.target.dataset.msg);
  104. if (e.target.dataset.msg == 'I') {
  105. return
  106. }
  107. if (!!e.target.dataset.msg && e.target.dataset.msg != 'DEL') {
  108. switch (this.data.choose) {
  109. case "carData.title":
  110. this.setData({
  111. title: e.target.dataset.msg,
  112. chooseClass: e.target.dataset.msg,
  113. chooseTop: 'carData.numFir'
  114. });
  115. break;
  116. case "carData.numFir":
  117. this.setData({
  118. numFir: e.target.dataset.msg,
  119. chooseClass: e.target.dataset.msg,
  120. chooseTop: 'carData.numSco'
  121. });
  122. break;
  123. case "carData.numSco":
  124. this.setData({
  125. numSco: e.target.dataset.msg,
  126. chooseClass: e.target.dataset.msg,
  127. chooseTop: 'carData.numThr'
  128. });
  129. break;
  130. case "carData.numThr":
  131. this.setData({
  132. numThr: e.target.dataset.msg,
  133. chooseClass: e.target.dataset.msg,
  134. chooseTop: 'carData.numFor'
  135. });
  136. break;
  137. case "carData.numFor":
  138. this.setData({
  139. numFor: e.target.dataset.msg,
  140. chooseClass: e.target.dataset.msg,
  141. chooseTop: 'carData.numFive'
  142. });
  143. break;
  144. case "carData.numFive":
  145. this.setData({
  146. numFive: e.target.dataset.msg,
  147. chooseClass: e.target.dataset.msg,
  148. chooseTop: 'carData.numSix'
  149. });
  150. break;
  151. case "carData.numSix":
  152. this.setData({
  153. numSix: e.target.dataset.msg,
  154. chooseClass: e.target.dataset.msg
  155. });
  156. break;
  157. case "carData.numSource":
  158. this.setData({
  159. numSource: e.target.dataset.msg,
  160. chooseClass: e.target.dataset.msg
  161. });
  162. break;
  163. };
  164. switch (this.data.chooseTop) {
  165. case "carData.numFir":
  166. this.setData({
  167. choose: 'carData.numFir',
  168. titleShow: false,
  169. englishShow: true,
  170. numShow: false,
  171. specShow: false
  172. })
  173. break;
  174. case "carData.numSco":
  175. this.setData({
  176. choose: 'carData.numSco',
  177. titleShow: false,
  178. englishShow: false,
  179. numShow: true,
  180. specShow: false
  181. })
  182. break;
  183. case "carData.numThr":
  184. this.setData({
  185. choose: 'carData.numThr',
  186. titleShow: false,
  187. englishShow: false,
  188. numShow: true,
  189. specShow: false
  190. })
  191. break;
  192. case "carData.numFor":
  193. this.setData({
  194. choose: 'carData.numFor',
  195. titleShow: false,
  196. englishShow: false,
  197. numShow: true,
  198. specShow: false
  199. })
  200. break;
  201. case "carData.numFive":
  202. this.setData({
  203. choose: 'carData.numFive',
  204. titleShow: false,
  205. englishShow: false,
  206. numShow: true,
  207. specShow: false
  208. })
  209. break;
  210. case "carData.numSix":
  211. if (this.data.title == '粤') {
  212. this.setData({
  213. choose: 'carData.numSix',
  214. titleShow: false,
  215. englishShow: false,
  216. numShow: false,
  217. specShow: true
  218. })
  219. } else {
  220. this.setData({
  221. choose: 'carData.numSix',
  222. titleShow: false,
  223. englishShow: false,
  224. numShow: true,
  225. specShow: false
  226. })
  227. }
  228. break;
  229. }
  230. } else if (e.target.dataset.msg == 'DEL') {
  231. switch (this.data.choose) {
  232. case "carData.title":
  233. this.setData({
  234. title: '',
  235. chooseTop: 'carData.title',
  236. choose: 'carData.title',
  237. titleShow: true,
  238. englishShow: false,
  239. numShow: false,
  240. specShow: false
  241. });
  242. break;
  243. case "carData.numFir":
  244. this.setData({
  245. numFir: '',
  246. chooseTop: 'carData.title',
  247. choose: 'carData.title',
  248. titleShow: true,
  249. englishShow: false,
  250. numShow: false,
  251. specShow: false
  252. });
  253. break;
  254. case "carData.numSco":
  255. this.setData({
  256. numSco: '',
  257. // chooseClass: e.target.dataset.msg,
  258. chooseTop: 'carData.numFir',
  259. choose: 'carData.numFir',
  260. titleShow: false,
  261. englishShow: true,
  262. numShow: false,
  263. specShow: false
  264. });
  265. break;
  266. case "carData.numThr":
  267. this.setData({
  268. numThr: '',
  269. // chooseClass: e.target.dataset.msg,
  270. chooseTop: 'carData.numSco',
  271. choose: 'carData.numSco',
  272. titleShow: false,
  273. englishShow: false,
  274. numShow: true,
  275. specShow: false
  276. });
  277. break;
  278. case "carData.numFor":
  279. this.setData({
  280. numFor: '',
  281. // chooseClass: e.target.dataset.msg,
  282. chooseTop: 'carData.numThr',
  283. choose: 'carData.numThr',
  284. titleShow: false,
  285. englishShow: false,
  286. numShow: true,
  287. specShow: false
  288. });
  289. break;
  290. case "carData.numFive":
  291. this.setData({
  292. numFive: '',
  293. // chooseClass: e.target.dataset.msg,
  294. chooseTop: 'carData.numFor',
  295. choose: 'carData.numFor',
  296. titleShow: false,
  297. englishShow: false,
  298. numShow: true,
  299. specShow: false
  300. });
  301. break;
  302. case "carData.numSix":
  303. this.setData({
  304. numSix: '',
  305. // chooseClass: e.target.dataset.msg
  306. chooseTop: 'carData.numFive',
  307. choose: 'carData.numFive',
  308. titleShow: false,
  309. englishShow: false,
  310. numShow: true,
  311. specShow: false
  312. });
  313. break;
  314. case "carData.numSource":
  315. this.setData({
  316. numSource: ''
  317. });
  318. break;
  319. }
  320. }
  321. this.buttonStatus();
  322. },
  323. submit: function () {
  324. wx.navigateTo({
  325. url: '/pages/passCar/passCar',
  326. })
  327. },
  328. buttonStatus: function () {
  329. if (this.data.title != "" && this.data.numFir != "" && this.data.numSco != "" && this.data.numThr != "" && this.data.numFor != "" && this.data.numFive != "" && this.data.numSix != "") {
  330. this.setData({
  331. buttonStatus: true
  332. });
  333. } else {
  334. this.setData({
  335. buttonStatus: false
  336. });
  337. }
  338. }
  339. })