C端小程序
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

355 líneas
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. // 返回
  59. wx.redirectTo({
  60. url: '/pages/passCar/passCar'
  61. });
  62. },
  63. handleTap: function (e) {
  64. this.buttonStatus();
  65. this.setData({
  66. choose: e.target.dataset.cardata,
  67. chooseClass: e.target.dataset.msg,
  68. chooseTop: e.target.dataset.cardata
  69. });
  70. if (e.target.dataset.cardata == "carData.title") {
  71. this.setData({
  72. titleShow: true,
  73. englishShow: false,
  74. numShow: false,
  75. specShow: false
  76. })
  77. } else if (e.target.dataset.cardata == "carData.numFir") {
  78. this.setData({
  79. titleShow: false,
  80. englishShow: true,
  81. numShow: false,
  82. specShow: false
  83. })
  84. } else {
  85. if (e.target.dataset.cardata == 'carData.numSix' && this.data.title == '粤') {
  86. this.setData({
  87. titleShow: false,
  88. englishShow: false,
  89. numShow: false,
  90. specShow: true
  91. })
  92. } else {
  93. this.setData({
  94. titleShow: false,
  95. englishShow: false,
  96. numShow: true,
  97. specShow: false
  98. })
  99. }
  100. }
  101. },
  102. chooseNum: function (e) {
  103. //console.log(this.data.choose)
  104. // console.log(e.target.dataset.msg);
  105. if (e.target.dataset.msg == 'I') {
  106. return
  107. }
  108. if (!!e.target.dataset.msg && e.target.dataset.msg != 'DEL') {
  109. switch (this.data.choose) {
  110. case "carData.title":
  111. this.setData({
  112. title: e.target.dataset.msg,
  113. chooseClass: e.target.dataset.msg,
  114. chooseTop: 'carData.numFir'
  115. });
  116. break;
  117. case "carData.numFir":
  118. this.setData({
  119. numFir: e.target.dataset.msg,
  120. chooseClass: e.target.dataset.msg,
  121. chooseTop: 'carData.numSco'
  122. });
  123. break;
  124. case "carData.numSco":
  125. this.setData({
  126. numSco: e.target.dataset.msg,
  127. chooseClass: e.target.dataset.msg,
  128. chooseTop: 'carData.numThr'
  129. });
  130. break;
  131. case "carData.numThr":
  132. this.setData({
  133. numThr: e.target.dataset.msg,
  134. chooseClass: e.target.dataset.msg,
  135. chooseTop: 'carData.numFor'
  136. });
  137. break;
  138. case "carData.numFor":
  139. this.setData({
  140. numFor: e.target.dataset.msg,
  141. chooseClass: e.target.dataset.msg,
  142. chooseTop: 'carData.numFive'
  143. });
  144. break;
  145. case "carData.numFive":
  146. this.setData({
  147. numFive: e.target.dataset.msg,
  148. chooseClass: e.target.dataset.msg,
  149. chooseTop: 'carData.numSix'
  150. });
  151. break;
  152. case "carData.numSix":
  153. this.setData({
  154. numSix: e.target.dataset.msg,
  155. chooseClass: e.target.dataset.msg
  156. });
  157. break;
  158. case "carData.numSource":
  159. this.setData({
  160. numSource: e.target.dataset.msg,
  161. chooseClass: e.target.dataset.msg
  162. });
  163. break;
  164. };
  165. switch (this.data.chooseTop) {
  166. case "carData.numFir":
  167. this.setData({
  168. choose: 'carData.numFir',
  169. titleShow: false,
  170. englishShow: true,
  171. numShow: false,
  172. specShow: false
  173. })
  174. break;
  175. case "carData.numSco":
  176. this.setData({
  177. choose: 'carData.numSco',
  178. titleShow: false,
  179. englishShow: false,
  180. numShow: true,
  181. specShow: false
  182. })
  183. break;
  184. case "carData.numThr":
  185. this.setData({
  186. choose: 'carData.numThr',
  187. titleShow: false,
  188. englishShow: false,
  189. numShow: true,
  190. specShow: false
  191. })
  192. break;
  193. case "carData.numFor":
  194. this.setData({
  195. choose: 'carData.numFor',
  196. titleShow: false,
  197. englishShow: false,
  198. numShow: true,
  199. specShow: false
  200. })
  201. break;
  202. case "carData.numFive":
  203. this.setData({
  204. choose: 'carData.numFive',
  205. titleShow: false,
  206. englishShow: false,
  207. numShow: true,
  208. specShow: false
  209. })
  210. break;
  211. case "carData.numSix":
  212. if (this.data.title == '粤') {
  213. this.setData({
  214. choose: 'carData.numSix',
  215. titleShow: false,
  216. englishShow: false,
  217. numShow: false,
  218. specShow: true
  219. })
  220. } else {
  221. this.setData({
  222. choose: 'carData.numSix',
  223. titleShow: false,
  224. englishShow: false,
  225. numShow: true,
  226. specShow: false
  227. })
  228. }
  229. break;
  230. }
  231. } else if (e.target.dataset.msg == 'DEL') {
  232. switch (this.data.choose) {
  233. case "carData.title":
  234. this.setData({
  235. title: '',
  236. chooseTop: 'carData.title',
  237. choose: 'carData.title',
  238. titleShow: true,
  239. englishShow: false,
  240. numShow: false,
  241. specShow: false
  242. });
  243. break;
  244. case "carData.numFir":
  245. this.setData({
  246. numFir: '',
  247. chooseTop: 'carData.title',
  248. choose: 'carData.title',
  249. titleShow: true,
  250. englishShow: false,
  251. numShow: false,
  252. specShow: false
  253. });
  254. break;
  255. case "carData.numSco":
  256. this.setData({
  257. numSco: '',
  258. // chooseClass: e.target.dataset.msg,
  259. chooseTop: 'carData.numFir',
  260. choose: 'carData.numFir',
  261. titleShow: false,
  262. englishShow: true,
  263. numShow: false,
  264. specShow: false
  265. });
  266. break;
  267. case "carData.numThr":
  268. this.setData({
  269. numThr: '',
  270. // chooseClass: e.target.dataset.msg,
  271. chooseTop: 'carData.numSco',
  272. choose: 'carData.numSco',
  273. titleShow: false,
  274. englishShow: false,
  275. numShow: true,
  276. specShow: false
  277. });
  278. break;
  279. case "carData.numFor":
  280. this.setData({
  281. numFor: '',
  282. // chooseClass: e.target.dataset.msg,
  283. chooseTop: 'carData.numThr',
  284. choose: 'carData.numThr',
  285. titleShow: false,
  286. englishShow: false,
  287. numShow: true,
  288. specShow: false
  289. });
  290. break;
  291. case "carData.numFive":
  292. this.setData({
  293. numFive: '',
  294. // chooseClass: e.target.dataset.msg,
  295. chooseTop: 'carData.numFor',
  296. choose: 'carData.numFor',
  297. titleShow: false,
  298. englishShow: false,
  299. numShow: true,
  300. specShow: false
  301. });
  302. break;
  303. case "carData.numSix":
  304. this.setData({
  305. numSix: '',
  306. // chooseClass: e.target.dataset.msg
  307. chooseTop: 'carData.numFive',
  308. choose: 'carData.numFive',
  309. titleShow: false,
  310. englishShow: false,
  311. numShow: true,
  312. specShow: false
  313. });
  314. break;
  315. case "carData.numSource":
  316. this.setData({
  317. numSource: ''
  318. });
  319. break;
  320. }
  321. }
  322. this.buttonStatus();
  323. },
  324. submit: function () {
  325. wx.navigateTo({
  326. url: '/pages/passCar/passCar',
  327. })
  328. },
  329. buttonStatus: function () {
  330. if (this.data.title != "" && this.data.numFir != "" && this.data.numSco != "" && this.data.numThr != "" && this.data.numFor != "" && this.data.numFive != "" && this.data.numSix != "") {
  331. this.setData({
  332. buttonStatus: true
  333. });
  334. } else {
  335. this.setData({
  336. buttonStatus: false
  337. });
  338. }
  339. }
  340. })