C端小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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