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