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.

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