C端小程序
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

377 lines
10 KiB

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