bikeInfo.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. // pages/bikeInfo/bikeInfo.js
  2. const app = getApp();
  3. import {
  4. BluetoothManager,
  5. BtErrorCode
  6. } from '../../service/BlueMgr'
  7. const bluM = new BluetoothManager
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. iconList: [{ //车辆检测指令
  14. id: 1,
  15. imgUrl: 'http://resource.weilaibike.com/yunwei/open-lock.png',
  16. text: '鸣笛'
  17. },
  18. {
  19. id: 2,
  20. imgUrl: 'http://resource.weilaibike.com/yunwei/open-lock.png',
  21. text: '开电车锁'
  22. },
  23. {
  24. id: 3,
  25. imgUrl: 'http://resource.weilaibike.com/yunwei/close-lock.png',
  26. text: '关电车锁'
  27. },
  28. {
  29. id: 4,
  30. imgUrl: 'http://resource.weilaibike.com/yunwei/battery-load.png',
  31. text: '开电池锁'
  32. },
  33. {
  34. id: 5,
  35. imgUrl: 'http://resource.weilaibike.com/yunwei/online.png',
  36. text: '上线'
  37. },
  38. {
  39. id: 6,
  40. imgUrl: 'http://resource.weilaibike.com/yunwei/more.png',
  41. text: '更多'
  42. },
  43. ],
  44. moreList: [{
  45. id: 1,
  46. imgUrl: 'http://resource.weilaibike.com/yunwei/offline.png',
  47. text: '下线'
  48. },
  49. {
  50. id: 2,
  51. imgUrl: 'http://resource.weilaibike.com/yunwei/renewalPower.png',
  52. text: '更新电量'
  53. },
  54. {
  55. id: 3,
  56. imgUrl: 'http://resource.weilaibike.com/yunwei/renewalLocation.png',
  57. text: '更新位置'
  58. },
  59. {
  60. id: 4,
  61. imgUrl: 'http://resource.weilaibike.com/yunwei/renewal.png',
  62. text: '重启中控'
  63. },
  64. {
  65. id: 5,
  66. imgUrl: 'http://resource.weilaibike.com/bike_yunwei/park.png',
  67. text: '设置为停车区'
  68. },
  69. ],
  70. bikeDetail: '', //车辆信息
  71. bike_no: '', //车牌号
  72. typeName: '',
  73. workShow: false, //工单弹窗
  74. workCount: '', //侧边栏报修数量(未读)
  75. list: [], //工单列表
  76. workState: 1, //工单列表状态【1 待领取 2已领】
  77. repairsList: [], //报修列表
  78. repairsCount: '', //侧边栏工单数量(未认领)
  79. repairsState: 1, //报修列表状态【1 未读 2已读】
  80. repairsShow: false, //是否显示报修弹窗 【false 不显示 true 显示】
  81. topNum: 0,
  82. delBtnWidth: 200, //删除或完成 按钮宽度
  83. page: 1,
  84. switch1Checked: '',
  85. },
  86. /**
  87. * 生命周期函数--监听页面加载
  88. */
  89. onLoad: function (options) {
  90. let that = this;
  91. let switch1Checked = app.globalData.swichChecked
  92. that.setData({
  93. switch1Checked
  94. })
  95. console.log(that.data.swich1Checked)
  96. console.log(app.globalData.swichChecked)
  97. },
  98. scanCode: function () {
  99. var that = this;
  100. console.log('scanCode')
  101. wx.scanCode({
  102. success: function (res) {
  103. let index = res.result.lastIndexOf("\=");
  104. var code = res.result.substring(index + 1, res.result.length);
  105. that.setData({
  106. bike_no: code
  107. })
  108. that.getBike_info(code)
  109. },
  110. fail: function () {
  111. wx.showModal({
  112. title: '提示',
  113. content: '手动输入车辆标号',
  114. success: function (res) {
  115. if (res.confirm) {
  116. wx.navigateTo({
  117. url: '/pages/manualInp/manualInp',
  118. })
  119. }
  120. }
  121. })
  122. }
  123. })
  124. },
  125. // 获取车辆信息
  126. getBike_info: function (bike_no = false) {
  127. console.log(bike_no)
  128. wx.showLoading({
  129. title: '加载中...',
  130. })
  131. if (typeof bike_no === 'object') {
  132. bike_no = this.data.bike_no
  133. }
  134. this.setData({
  135. bike_no
  136. })
  137. if (!this.data.bike_no) {
  138. wx.showToast({
  139. title: '请先输入车牌号',
  140. icon: 'none'
  141. })
  142. } else {
  143. app.request('bike/getBikeInfo?bike_no=' + this.data.bike_no, '', 'GET').then(res => {
  144. wx.hideLoading();
  145. if (res.data.bike_info == '') {
  146. wx.showToast({
  147. title: '暂无该车辆信息~',
  148. })
  149. } else {
  150. this.setData({
  151. bikeDetail: res.data
  152. })
  153. }
  154. })
  155. }
  156. app.request("work_order/list?planned=" + 1 + "&bike_no=" + bike_no, '', 'GET').then(res => {
  157. if (res.statusCode == 200) {
  158. // console.log(res.data.meta.total, '工单数量')
  159. this.setData({
  160. workCount: res.data.meta.total
  161. })
  162. }
  163. })
  164. app.request('user/userRepaired?bike_no=' + bike_no + '&&status=' + 0, '', 'GET').then(res => {
  165. // console.log(res.data)
  166. // console.log(res.data.meta.total, '报修数量')
  167. this.setData({
  168. repairsCount: res.data.meta.total
  169. })
  170. })
  171. },
  172. bindKeyInput(e) {
  173. // console.log(e.detail.value, 11111)
  174. this.setData({
  175. bike_no: e.detail.value
  176. })
  177. },
  178. operate(e) {
  179. var that = this;
  180. let idx = e.currentTarget.dataset.id;
  181. let url = '';
  182. let title = "";
  183. console.log(idx, 'idx')
  184. if (idx == 6) {
  185. console.log(1111)
  186. this.setData({
  187. moreShow: true
  188. })
  189. } else {
  190. if (!that.data.bike_no) {
  191. wx.showToast({
  192. title: '请先输入车牌号',
  193. icon: 'none'
  194. })
  195. } else {
  196. let data = '?bike_id=' + that.data.bikeDetail.bike_info.id;
  197. switch (idx) {
  198. case 1: //鸣笛
  199. url = "bike/bikeBell";
  200. title = "鸣笛成功";
  201. break;
  202. case 2: //开电车锁
  203. url = "bike/openBikeLock";
  204. title = "开电车锁成功";
  205. break;
  206. case 3: //关电车锁
  207. url = "bike/closeBikeLock";
  208. title = "关电车锁成功";
  209. break;
  210. case 4: //开电池锁
  211. url = "bike/openBatteryLock";
  212. title = "开电池锁成功";
  213. break;
  214. case 5: //上线
  215. url = "bike/login";
  216. title = "上线成功";
  217. break;
  218. default:
  219. break;
  220. }
  221. if (that.data.switch1Checked) {
  222. wx.showLoading({
  223. title: '连接蓝牙中...',
  224. })
  225. bluM.connectDeivece(that.data.bikeDetail.bike_info.box_no).then(res => {
  226. wx.showToast({
  227. title,
  228. icon: 'none'
  229. })
  230. return bluM.boxReboot()
  231. })
  232. } else {
  233. app.request(url + data, '', 'GET').then(res => {
  234. if (res.statusCode == 200) {
  235. bluM.connectDeivece(that.data.bikeDetail.bike_info.box_no).then(res => {
  236. return bluM.boxReboot()
  237. })
  238. wx.showToast({
  239. title,
  240. icon: 'none'
  241. })
  242. }
  243. })
  244. }
  245. }
  246. }
  247. },
  248. moreOperat(e) {
  249. var that = this;
  250. let idx = e.currentTarget.dataset.id;
  251. let url = '';
  252. let title = "";
  253. switch (idx) {
  254. case 1: //下线
  255. url = "bike/logout";
  256. title = "下线成功";
  257. break;
  258. case 2: //更新电量
  259. url = "bike/newBikeBatteryMSG";
  260. title = "电量更新成功";
  261. break;
  262. case 3: //更新位置
  263. url = "bike/newBikeLocation";
  264. title = "更新位置成功";
  265. break;
  266. case 4: //重启中控
  267. url = "bike/rebootBox";
  268. title = "重启中控成功";
  269. break;
  270. case 5: //设为停车区
  271. url = "bike/repairInParking";
  272. title = "设为停车区成功";
  273. break;
  274. default:
  275. break;
  276. }
  277. if (!that.data.bike_no) {
  278. wx.showToast({
  279. title: '请先输入车牌号',
  280. icon: 'none'
  281. })
  282. } else if (that.data.switch1Checked) {
  283. wx.showLoading({
  284. title: '连接蓝牙中...',
  285. })
  286. bluM.connectDeivece(that.data.bikeDetail.bike_info.box_no).then(res => {
  287. wx.showToast({
  288. title,
  289. icon: 'none'
  290. })
  291. return bluM.boxReboot()
  292. })
  293. } else {
  294. let data = '?bike_id=' + that.data.bikeDetail.bike_info.id;
  295. app.request(url + data, '', 'GET').then(res => {
  296. if (res.statusCode == 200) {
  297. bluM.connectDeivece(that.data.bikeDetail.bike_info.box_no).then(res => {
  298. return bluM.boxReboot()
  299. })
  300. wx.showToast({
  301. title,
  302. icon: 'none'
  303. })
  304. }
  305. })
  306. }
  307. },
  308. modify: function () {
  309. //跳转修改车辆信息
  310. var bike = this.data.bikeDetail.bike_info
  311. wx.navigateTo({
  312. url: '/pages/amendCar/amendCar?id=' + bike.id + '&bike_no=' + bike.bike_no + '&box_no=' + bike.box_no,
  313. })
  314. },
  315. reqair: function () {
  316. var bike = this.data.bikeDetail.bike_info;
  317. wx.navigateTo({
  318. url: '/pages/reqair/reqair?bike_no=' + bike.bike_no,
  319. })
  320. },
  321. bike_detail: function () {
  322. //车辆详情页面
  323. var bike = this.data.bikeDetail.bike_info;
  324. wx.navigateTo({
  325. url: '/pages/carDetails/carDetails?bike_no=' + bike.bike_no + '&id=' + bike.id,
  326. })
  327. },
  328. /*
  329. * 工单弹窗 报修弹窗 begin
  330. */
  331. //关闭弹窗
  332. coverHidn(e) {
  333. let show = e.currentTarget.dataset.show;
  334. if (show == 1) {
  335. this.setData({
  336. moreShow: false,
  337. workState: 1
  338. })
  339. } else if (show == 2) {
  340. this.setData({
  341. workShow: false,
  342. typeName: ''
  343. })
  344. } else if (show == 3) {
  345. this.setData({
  346. repairsShow: false,
  347. typeName: '',
  348. repairsState: 1
  349. })
  350. }
  351. },
  352. //点击可拨打电话
  353. phone(e) {
  354. console.log(1111)
  355. wx.makePhoneCall({
  356. phoneNumber: e.currentTarget.dataset.phone
  357. })
  358. },
  359. showPop(e) {
  360. let show = e.currentTarget.dataset.idx;
  361. this.setData({
  362. typeName: show
  363. })
  364. if (show == 1) {
  365. this.setData({
  366. workShow: true
  367. });
  368. this.lookWork();
  369. } else if (show == 2) {
  370. this.setData({
  371. repairsShow: true
  372. });
  373. this.lookRepairs();
  374. }
  375. },
  376. workChoose(e) {
  377. wx.showLoading({
  378. title: '加载中...',
  379. })
  380. let state = e.currentTarget.dataset.state;
  381. this.setData({
  382. workState: state,
  383. list: []
  384. })
  385. this.lookWork();
  386. this.goTop();
  387. },
  388. //工单列表
  389. lookWork() {
  390. wx.showLoading({
  391. title: '加载中...',
  392. })
  393. let that = this;
  394. let planned = '';
  395. let url = "";
  396. let state = that.data.workState
  397. // console.log(state, 'workState')
  398. if (state == 1) {
  399. planned = 1
  400. url = "work_order/list?planned=" + planned + "&bike_no=" + that.data.bike_no
  401. } else {
  402. let planned = 2;
  403. url = 'work_order/myWorkOrderList?planned=' + planned + "&bike_no=" + that.data.bike_no
  404. }
  405. app.request(url, '', 'GET').then(res => {
  406. wx.hideLoading();
  407. let work = res.data.data;
  408. // console.log(work, '工单列表')
  409. if (work.length == 0) {
  410. // wx.showToast({
  411. // title: '暂无工单~',
  412. // icon: 'none'
  413. // })
  414. that.setData({
  415. list: ''
  416. })
  417. } else {
  418. work.map(i => {
  419. i.txtStyle = 'left:0rpx'
  420. })
  421. that.setData({
  422. workShow: true,
  423. list: work
  424. })
  425. // console.log(that.data.list, 'list')
  426. }
  427. })
  428. },
  429. //接单
  430. getWork(e) {
  431. wx.showLoading({
  432. title: '领取中...',
  433. })
  434. let id = e.currentTarget.dataset.id
  435. console.log(id, 'getWorkid');
  436. app.request('work_order/receive?work_order_id=' + id, '', 'GET').then(res => {
  437. wx.hideLoading();
  438. console.log(res)
  439. if (res.statusCode == 200) {
  440. wx.showToast({
  441. title: '接单成功',
  442. icon: "none"
  443. })
  444. let work = this.data.list;
  445. work.map((i, index) => {
  446. if (i.id == id) {
  447. work.splice(index, 1)
  448. console.log(i)
  449. }
  450. })
  451. let count = this.data.workCount
  452. count = count - 1
  453. this.setData({
  454. list: work,
  455. workCount: count
  456. })
  457. if (work.length == 0) {
  458. wx.showToast({
  459. title: '该车辆已无待领工单~',
  460. icon: 'none'
  461. })
  462. this.setData({
  463. workShow: false,
  464. workCount: ''
  465. })
  466. }
  467. }
  468. })
  469. },
  470. //完成
  471. finishWork(e) {
  472. wx.showLoading({
  473. title: '操作中...',
  474. })
  475. // console.log('finishWork')
  476. let id = e.currentTarget.dataset.id
  477. console.log(id, 'finishWorkId')
  478. app.request('work_order/over?work_order_id=' + id, '', 'GET').then(res => {
  479. wx.hideLoading();
  480. if (res.statusCode == 200) {
  481. console.log(res)
  482. wx.showToast({
  483. title: '操作成功',
  484. icon: "none"
  485. })
  486. let list = this.data.list
  487. list.map((i, index) => {
  488. if (i.id == id) {
  489. console.log(i)
  490. list.splice(index, 1)
  491. }
  492. })
  493. this.setData({
  494. list
  495. })
  496. if (list.length == 0) {
  497. wx.showToast({
  498. title: '已完成所有认领工单~',
  499. icon: 'none'
  500. })
  501. this.setData({
  502. workShow: false
  503. })
  504. }
  505. }
  506. })
  507. },
  508. //上拉加载
  509. moreWork() {
  510. wx.showLoading({
  511. title: '加载中...',
  512. })
  513. let that = this;
  514. var page = that.data.page + 1;
  515. let planned = '';
  516. let url = "";
  517. if (that.data.workState == 1) {
  518. planned = 1
  519. url = "work_order/list?planned=" + planned + "&bike_no=" + that.data.bike_no + '&page=' + page
  520. } else {
  521. planned = 2
  522. url = 'work_order/myWorkOrderList?planned=' + planned + "&bike_no=" + that.data.bike_no + '&page=' + page
  523. }
  524. app.request(url, '', 'GET').then(res => {
  525. console.log(res, '上拉')
  526. wx.hideLoading();
  527. if (res.data.data.length > 0) {
  528. let work = res.data.data
  529. work.map(i => {
  530. i.txtStyle = 'left:0rpx'
  531. })
  532. this.setData({
  533. workShow: true,
  534. list: that.data.list.concat(work),
  535. page
  536. })
  537. } else {
  538. wx.showToast({
  539. title: '没有更多数据了~',
  540. icon: 'none'
  541. })
  542. }
  543. })
  544. },
  545. //报修列表
  546. lookRepairs() {
  547. wx.showLoading({
  548. title: '加载中...',
  549. })
  550. let status = ''
  551. let state = this.data.repairsState
  552. if (state == 1) {
  553. status = 0
  554. } else if (state == 2) {
  555. status = 1
  556. }
  557. app.request('user/userRepaired?bike_no=' + this.data.bike_no + '&status=' + status, '', 'GET').then(res => {
  558. if (res.statusCode == 200) {
  559. wx.hideLoading();
  560. // console.log(res, '报修列表')
  561. let list = res.data.data;
  562. if (list.length == 0) {
  563. // wx.showToast({
  564. // title: '暂无报修记录~',
  565. // icon: 'none'
  566. // })
  567. this.setData({
  568. repairsList: []
  569. })
  570. } else {
  571. let repairs = res.data.data;
  572. repairs.map(i => {
  573. i.txtStyle = 'left:0rpx'
  574. })
  575. this.setData({
  576. repairsList: res.data.data
  577. })
  578. }
  579. }
  580. })
  581. },
  582. repairsChoose(e) {
  583. let state = e.currentTarget.dataset.state;
  584. this.setData({
  585. repairsState: state,
  586. repairsList: []
  587. })
  588. this.lookRepairs();
  589. this.goTop();
  590. },
  591. markRead(e) {
  592. let id = e.currentTarget.dataset.id
  593. app.request('user/userRepaired/status?id=' + id, '', 'GET').then(res => {
  594. if (res.statusCode == 200) {
  595. console.log(res)
  596. this.lookRepairs();
  597. let list = this.data.repairsList;
  598. if (list.length == 0) {
  599. wx.showToast({
  600. title: '暂无报修~',
  601. icon: 'none'
  602. })
  603. this.setData({
  604. repairsCount: ''
  605. })
  606. } else {
  607. let count = this.data.repairsCount;
  608. count = count - 1;
  609. this.setData({
  610. repairsCount: count
  611. })
  612. }
  613. }
  614. })
  615. },
  616. morkRepairs() {
  617. wx.showLoading({
  618. title: '加载中...',
  619. })
  620. let that = this;
  621. let status = '';
  622. var page = that.data.page + 1;
  623. let state = this.data.repairsState
  624. if (state == 1) {
  625. status = 0
  626. } else if (state == 2) {
  627. status = 1
  628. }
  629. app.request('user/userRepaired?bike_no=' + this.data.bike_no + '&status=' + status + '&page=' + page, '', 'GET').then(res => {
  630. wx.hideLoading();
  631. if (res.statusCode == 200) {
  632. let list = res.data.data;
  633. if (list.length > 0) {
  634. this.setData({
  635. repairsList: that.data.repairsList.concat(list),
  636. page
  637. })
  638. } else {
  639. wx.showToast({
  640. title: '没有更多数据了~',
  641. icon: 'none'
  642. })
  643. }
  644. }
  645. })
  646. },
  647. goTop: function (e) { // 一键回到顶部
  648. this.setData({
  649. topNum: 0
  650. });
  651. },
  652. touchS: function (e) {
  653. if (e.touches.length == 1) {
  654. this.setData({
  655. //设置触摸起始点水平方向位置
  656. startX: e.touches[0].clientX
  657. });
  658. }
  659. },
  660. touchM: function (e) {
  661. // console.log(this.data.list[index].txtStyle)
  662. // console.log(e);
  663. if (e.touches.length == 1) {
  664. //手指移动时水平方向位置
  665. var moveX = e.touches[0].clientX;
  666. //手指起始点位置与移动期间的差值
  667. var disX = this.data.startX - moveX;
  668. // console.log(disX,'disX')
  669. var delBtnWidth = this.data.delBtnWidth;
  670. var txtStyle = "";
  671. if (disX == 0 || disX < 0) { //如果移动距离小于等于0,文本层位置不变
  672. txtStyle = "left:0rpx";
  673. } else if (disX > 0) { //移动距离大于0,文本层left值等于手指移动距离
  674. txtStyle = "left:-" + disX + "rpx";
  675. if (disX >= delBtnWidth) {
  676. //控制手指移动距离最大值为删除按钮的宽度
  677. txtStyle = "left:-" + delBtnWidth + "rpx";
  678. }
  679. }
  680. //获取手指触摸的是哪一项
  681. var index = e.currentTarget.dataset.idx;
  682. var list = this.data.list;
  683. list[index].txtStyle = txtStyle;
  684. //更新列表的状态
  685. this.setData({
  686. list: list
  687. });
  688. }
  689. },
  690. touchE: function (e) {
  691. if (e.changedTouches.length == 1) {
  692. //手指移动结束后水平位置
  693. var endX = e.changedTouches[0].clientX;
  694. //触摸开始与结束,手指移动的距离
  695. var disX = this.data.startX - endX;
  696. var delBtnWidth = this.data.delBtnWidth;
  697. //如果距离小于删除按钮的1/2,不显示删除按钮
  698. var txtStyle = disX > delBtnWidth / 2 ? "left:-" + delBtnWidth + "rpx" : "left:0rpx";
  699. //获取手指触摸的是哪一项
  700. var index = e.currentTarget.dataset.idx;
  701. var list = this.data.list;
  702. list[index].txtStyle = txtStyle;
  703. //更新列表的状态
  704. this.setData({
  705. list: list
  706. });
  707. }
  708. },
  709. // 车辆检测信息里的刷新
  710. refresh_power: function () {
  711. this.getBike_info(this.data.bike_no), wx.showToast({
  712. title: '刷新完成',
  713. icon: 'none'
  714. })
  715. },
  716. skipDetail() {
  717. if (!this.data.bike_no) {
  718. wx.showToast({
  719. title: '请先输入车牌号',
  720. icon: 'none'
  721. })
  722. } else {
  723. wx.navigateTo({
  724. url: '/pages/carDetails/carDetails?bike_no=' + this.data.bike_no,
  725. })
  726. }
  727. },
  728. switch1Change: function (e) {
  729. console.log(e)
  730. var that = this;
  731. console.log(e.detail)
  732. wx.openBluetoothAdapter({
  733. success(res) {
  734. console.log(res)
  735. that.setData({
  736. switch1Checked: e.detail
  737. })
  738. app.globalData.swichChecked = e.detail.value;
  739. },
  740. fail(err) {
  741. console.log(err)
  742. wx.showModal({
  743. title: '提示',
  744. content: '请开启蓝牙',
  745. showCancel: false
  746. })
  747. that.setData({
  748. switch1Checked: false
  749. })
  750. app.globalData.swichChecked = false;
  751. }
  752. })
  753. },
  754. bikePosition: function () {
  755. wx.navigateTo({
  756. url: '/pages/carPosition/carPosition?id=' + this.data.bikeDetail.bike_info.id + '&bike_no=' + this.data.bikeDetail.bike_info.bike_no,
  757. })
  758. },
  759. recentOrder: function () {
  760. wx.navigateTo({
  761. url: '/pages/recentOrder/recentOrder?id=' + this.data.bikeDetail.bike_info.id,
  762. })
  763. },
  764. /*
  765. * 工单弹窗 报修弹窗 end
  766. */
  767. /**
  768. * 生命周期函数--监听页面初次渲染完成
  769. */
  770. onReady: function () {
  771. },
  772. /**
  773. * 生命周期函数--监听页面显示
  774. */
  775. onShow: function () {
  776. this.setData({
  777. switch1Checked: app.globalData.swichChecked,
  778. })
  779. console.log(this.data.switch1Checked)
  780. },
  781. /**
  782. * 生命周期函数--监听页面隐藏
  783. */
  784. onHide: function () {
  785. },
  786. /**
  787. * 生命周期函数--监听页面卸载
  788. */
  789. onUnload: function () {
  790. },
  791. /**
  792. * 页面相关事件处理函数--监听用户下拉动作
  793. */
  794. onPullDownRefresh: function () {
  795. },
  796. /**
  797. * 页面上拉触底事件的处理函数
  798. */
  799. onReachBottom: function () {
  800. },
  801. /**
  802. * 用户点击右上角分享
  803. */
  804. onShareAppMessage: function () {
  805. }
  806. })