index.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. // index.js
  2. // 获取应用实例
  3. //获取应用实例
  4. const app = getApp();
  5. var token = my.getStorageSync({'key':'token'}).data;
  6. const util = require('../../utils/utils.js');
  7. var mytime = null;
  8. let testToken = ''
  9. Page({
  10. data: {
  11. cardBottom: [
  12. {
  13. id: 1,
  14. name: '故障上报',
  15. icon: 'icon-banshou',
  16. url: '/pages/breakdown/breakdown'
  17. },
  18. {
  19. id: 2,
  20. name: '输码用车',
  21. icon: 'icon-17-saoma',
  22. url: '/pages/inputcode/inputcode'
  23. },
  24. {
  25. id: 3,
  26. name: '计费规则',
  27. icon: 'icon-wenhao',
  28. url: '/pages/charge_rule/charge_rule'
  29. },
  30. {
  31. id: 4,
  32. name: '个人中心',
  33. icon: 'icon-wode',
  34. url: '/pages/mine/mine'
  35. }
  36. ],
  37. adFrame: false,//首页中间广告弹框
  38. markers: [], //显示单车、停车的P
  39. polygons: [], //区域
  40. longitude: '', //113.786111
  41. latitude: '', //34.78304
  42. height1: '', //兼容自定义导航栏的高度
  43. id: '', //停车区域的ID
  44. stopP: false, //判断是否显示停车区域
  45. polygons1: [], //可骑行区域 先用这个变量代表
  46. controls: [], //地图上当前定位的箭头
  47. background: false, //弹窗的背景颜色
  48. realname: false, //当前是否已经实名
  49. deposit: false, //当前是否交押金
  50. userStatus: '', //用户的一些状态 是否交押金等 0
  51. scanfail: false, //扫码失败弹窗
  52. is_pay_order: false, //检测当前是否有订单未支付
  53. is_ride_order: false,//是否有骑行中订单
  54. is_punishment: false,//有违章订单
  55. code: '', //点击立即用车 把编号赋值给code
  56. over: false, //关闭图标
  57. over1: false, //扫码失败关闭图标
  58. location: '', //是否有位置权限
  59. screenHeight: '', //屏幕可视高度
  60. box_no: '', //中控编号
  61. abnormal: '', //提示账号异常
  62. mid: [],//顶部广告
  63. ads: [],//首页中间广告
  64. currentSwiper: 0,
  65. center_currentSwiper: 0,
  66. bike_no: undefined,
  67. stopShow: false,
  68. stop_info: [],
  69. notice: [], //公告内容
  70. animationData: {},
  71. tabbar_index: 0,
  72. zoom: 18,
  73. versions: false, //版本过低弹窗
  74. chooseSize: false,
  75. animationData1: {},
  76. arrowDown: '',
  77. stop_type: '',
  78. marqueePace: 0.6, //滚动速度
  79. marqueeDistance: 520, //初始滚动距离 用到
  80. size: 26, //用到
  81. marqueeWidth: 520, //用到
  82. length: '',
  83. swiperCurrent: 0,
  84. midbolear: '',
  85. per_money: '',
  86. img: app.globalData.imgUrl,
  87. new_user_coupons: [],
  88. scanCodeErr: false,//扫码失败弹框
  89. },
  90. onLoad: function (query) {
  91. var that = this;
  92. console.log(query)
  93. my.setNavigationBar({
  94. title: app.globalData.title
  95. })
  96. // if (query.scene) {
  97. // app.globalData.id = query.scene
  98. // }
  99. this.setData({
  100. height1: app.globalData.statusBarHeight,
  101. screenHeight: app.globalData.screenHeight
  102. })
  103. my.getSystemInfo({
  104. success: (res) => {
  105. }
  106. })
  107. },
  108. onShow: function () {
  109. var that = this;
  110. my.setNavigationBar({
  111. title: app.globalData.title
  112. })
  113. token = my.getStorageSync({'key':'token'}).data
  114. this.setData({
  115. show: false,
  116. midbolear: my.getStorageSync({'key':'midTimes'}).data,
  117. polygons: []
  118. })
  119. that.location();
  120. testToken = setInterval(function () {
  121. let token=my.getStorageSync({'key':'token'}).data
  122. if (token) {
  123. console.log('0000')
  124. clearInterval(testToken)
  125. that.userState();
  126. that.getUser();
  127. } else {
  128. console.log(token,'1')
  129. }
  130. }, 1000)
  131. my.hideBackHome();
  132. },
  133. detail: function () {
  134. var that = this;
  135. if (that.data.mid[0].type == 'url') {
  136. my.navigateTo({
  137. url: '/' + that.data.mid[0].detail
  138. })
  139. }
  140. },
  141. //广告列表
  142. adsList: function (id) {
  143. var that = this;
  144. var area_id = ''
  145. if (id != undefined) {
  146. area_id = id
  147. } else {
  148. area_id = 0
  149. }
  150. app.request("/ads?area_id=" + area_id + "&position[]=mid&position[]=header&position[]=footer", '', "GET").then(res => {
  151. console.log(res)
  152. if (res.status == 200 && res.data != '') {
  153. if (res.data.header) {
  154. console.log(res.data, 'ppppppppppppppppppppppppp')
  155. that.setData({
  156. ads: res.data.header
  157. })
  158. }
  159. if (res.data.mid) {
  160. that.setData({
  161. mid: res.data.mid,
  162. adFrame: true
  163. })
  164. }
  165. }
  166. }).catch(err => {
  167. console.log(err)
  168. })
  169. },
  170. //点击广告页
  171. swiper: util.throttle(function (e) {
  172. // console.log(e)
  173. var type = e.currentTarget.dataset.type;
  174. var index = e.currentTarget.dataset.index;
  175. var name = e.currentTarget.dataset.name;
  176. var detail = e.currentTarget.dataset.detail;
  177. var id = e.currentTarget.dataset.id;
  178. if (type != 'clilk_null') {
  179. if (type == 'wxUrl') {
  180. my.navigateTo({
  181. url: '/' + detail,
  182. })
  183. } else if (type == 'phone') {
  184. my.makePhoneCall({
  185. number: detail,
  186. })
  187. } else if (type == 'toMiniProgram') {
  188. my.navigateToMiniProgram({
  189. appId: detail,
  190. extraData: {
  191. foo: 'bar'
  192. },
  193. // envVersion: 'develop',
  194. success(res) {
  195. // 打开成功
  196. }
  197. })
  198. } else {
  199. my.navigateTo({
  200. url: '../swiper/swiper?type=' + type + '&url=' + id + '&name=' + name + '&detail=' + detail,
  201. })
  202. }
  203. }
  204. }, 1000),
  205. //点击轮播图
  206. swiperChange: function (e) {
  207. if (this.data.currentSwiper == 0 && this.data.swiperCurrent > 1) { //卡死时,重置current为正确索引
  208. this.setData({
  209. currentSwiper: this.data.swiperCurrent
  210. });
  211. } else { //正常轮转时,记录正确页码索引
  212. this.setData({
  213. swiperCurrent: e.detail.current
  214. });
  215. }
  216. },
  217. //定位当前位置
  218. posi: util.throttle(function () {
  219. //点击定位
  220. //这是一段注
  221. var that = this;
  222. my.showLoading({
  223. content: '定位中'
  224. })
  225. my.getLocation({
  226. type: 'gcj02',
  227. success: (res) => {
  228. console.log('经纬度为:+++++++++++++++++++++' + res.latitude + '++++++++' + res.longitude)
  229. my.hideLoading()
  230. that.setData({
  231. longitude: res.longitude,
  232. latitude: res.latitude
  233. })
  234. },
  235. fail: function (err) {
  236. my.hideLoading()
  237. console.log(err, '定位失败打印')
  238. my.showToast({
  239. content: '定位失败',
  240. icon: 'none'
  241. })
  242. }
  243. })
  244. }, 1000),
  245. //点击扫描二维码
  246. sweepCode: util.throttle(function () {
  247. let that = this
  248. console.log('点击扫码,‘iooooo')
  249. if (!that.data.latitude && !that.data.longitude) {
  250. that.setData({
  251. background: true,
  252. location: true
  253. })
  254. } else {
  255. that.sweep_code()
  256. }
  257. }, 1500),
  258. //骑行区禁停区车辆
  259. home: function () {
  260. //请求首页接口和一些设置。
  261. console.log('测试')
  262. var that = this;
  263. if (that.data.longitude != '' && that.data.latitude != '') {
  264. //116.411027
  265. var data = {
  266. 'lat': that.data.latitude,
  267. 'lng': that.data.longitude
  268. }
  269. app.request("/pages/home?include=setting", data, "POST").then(res => {
  270. console.log(res)
  271. if (res.status == 200) {
  272. var data = res.data;
  273. console.log(data, '区域')
  274. if (data.points != []) {
  275. that.setData({
  276. id: data.id,
  277. polygons1: that.data.polygons.concat(data),
  278. setting: data.setting,
  279. per_money: Number(data.setting.starting_price),
  280. polygons: []
  281. })
  282. if (!data.id) return
  283. that.adsList(data.id),
  284. that.ban_stop(data.id), that.setData({
  285. polygons: that.data.polygons.concat(data)
  286. })
  287. }
  288. clearInterval(mytime)
  289. setTimeout(function () {
  290. // that.notice();
  291. }, 500)
  292. if (res.data.status_code == 423) {
  293. my.getLocation({
  294. success: function (res) {
  295. my.alert({
  296. title: '提示',
  297. content: '您附近暂无运营区域~',
  298. })
  299. var setting = {
  300. is_deposit: 1
  301. }
  302. that.setData({
  303. setting
  304. })
  305. },
  306. fail: function (err) {
  307. that.setData({
  308. location: true
  309. })
  310. }
  311. })
  312. }
  313. my.setStorageSync({'key':'setting',data:data.setting})
  314. my.setStorageSync({'key':'home',data: data})
  315. }
  316. }).catch(err => {
  317. console.log(err)
  318. })
  319. }
  320. },
  321. //停车区域
  322. ban_stop: function (id) {
  323. var that = this;
  324. var data1 = {
  325. 'area_id': id
  326. }
  327. app.request('/parking/stop-sites', data1, 'GET').then(res => {
  328. console.log(res)
  329. if (res.status == 200) {
  330. var data = res.data
  331. console.log(data)
  332. that.setData({
  333. polygons2: data.polygons,
  334. markers: that.data.markers.concat(data.centres),
  335. polygons: that.data.polygons1.concat(data.polygons)
  336. })
  337. }
  338. })
  339. },
  340. //附近车辆坐标
  341. nearbyCars: function () {
  342. //附近的车
  343. var that = this;
  344. that.setData({
  345. markers: []
  346. })
  347. var data = {
  348. "lat": that.data.latitude,
  349. "lng": that.data.longitude
  350. }
  351. app.request("/bikes", data, "POST").then(res => {
  352. // console.log(res)
  353. if (res.status == 200) {
  354. var makers = res.data
  355. if (makers == '') {
  356. my.showToast({
  357. content: '附近暂无车辆',
  358. icon: 'none'
  359. })
  360. that.setData({
  361. markers: []
  362. })
  363. } else {
  364. that.setData({
  365. markers: makers
  366. })
  367. }
  368. }
  369. }).catch(err => {
  370. console.log(err)
  371. })
  372. },
  373. //点击刷新
  374. refresh: util.throttle(function () {
  375. var that = this;
  376. that.setData({
  377. polygons: []
  378. })
  379. if (this.data.stopP == true) {
  380. that.stopP(), my.showToast({
  381. content: '刷新成功',
  382. icon: 'none'
  383. })
  384. } else {
  385. this.location(),
  386. my.showToast({
  387. content: '刷新成功',
  388. icon: 'none'
  389. })
  390. }
  391. }, 1500),
  392. // //点击去实名认证
  393. authentication: util.throttle(function () {
  394. var state = my.getStorageSync({'key':'userState'}).data
  395. if (state.is_bind_mobile == 0) {
  396. my.navigateTo({
  397. url: '/pages/real_name/real_name?state1=1&index=0',
  398. })
  399. } else if (state.is_bind_mobile == 1) {
  400. my.navigateTo({
  401. url: '/pages/real_name/real_name?state2=2&index=1',
  402. })
  403. }
  404. this.setData({
  405. background: false,
  406. realname: false,
  407. over: false
  408. })
  409. }, 1500),
  410. //点击扫码开锁
  411. sweep_code: util.throttle(function () {
  412. var that = this;
  413. console.log('ooooooo')
  414. var userStatus = that.data.userStatus;
  415. if (!userStatus) {
  416. my.navigateTo({
  417. url: '/pages/authorization/authorization',
  418. })
  419. } else {
  420. that.jiance('scan');
  421. }
  422. }, 1500),
  423. //扫码用车检测不可用车条件
  424. jiance: function (source) {
  425. var that = this;
  426. var userStatus = that.data.userStatus;
  427. var setting = my.getStorageSync({'key':'setting'}).data
  428. //未绑定手机号
  429. if (userStatus.is_bind_mobile == 0) {
  430. my.navigateTo({
  431. url: '/pages/authorization/authorization',
  432. })
  433. //未实名认证
  434. } else if (userStatus.is_card_certified == 0 && setting.is_card == 1) {
  435. my.navigateTo({
  436. url: '/pages/real_name/real_name',
  437. })
  438. } else {
  439. //有违章订单
  440. if (userStatus.is_punishment) {
  441. my.showToast({
  442. content: '您当前有违章订单需要处理,请处理后再来用车吧',
  443. icon: 'none'
  444. })
  445. return;
  446. } else if (userStatus.is_ride_order != false && userStatus.is_ride_order != undefined) {
  447. my.showToast({
  448. content: '您有一个正在骑行中的订单',
  449. icon: 'none'
  450. })
  451. return;
  452. } else {
  453. //有待支付骑行订单
  454. if (userStatus.is_pay_order != false && userStatus.is_pay_order != undefined) {
  455. my.showToast({
  456. content: '你有未支付订单,请先支付',
  457. icon: 'none'
  458. })
  459. return;
  460. } else {
  461. //没有押金没有免押券
  462. if (userStatus.is_deposit == 0 && that.data.setting.is_deposit != 0 && userStatus.is_coupon_deposit_free == false) {
  463. console.log('没有押金没有免押券')
  464. my.navigateTo({
  465. url: '/pages/ride_zige/ride_zige',
  466. })
  467. // my.navigateTo({
  468. // url: '/pages/inputcode/inputcode',
  469. // })
  470. } else {
  471. that.saoMa()
  472. }
  473. }
  474. }
  475. }
  476. },
  477. //扫码事件
  478. saoMa:function(){
  479. let that=this
  480. this.setData({
  481. scanCodeErr: false
  482. })
  483. my.scan({
  484. onlyFromCamera: true,
  485. success: function (res) {
  486. console.log(res, '扫码结果')
  487. var index = res.result.lastIndexOf("\=");
  488. var code = res.result.substring(index + 1, res.result.length);
  489. console.log(code.length)
  490. if (code.length == 9) {
  491. that.getBikeMessage(code)
  492. // my.navigateTo({
  493. // url: '/pages/use_bike/use_bike?code=' + code,
  494. // })
  495. } else {
  496. console.log(res,'错误码')
  497. // my.showModal({
  498. // title:'提示',
  499. // content:'非法码,请核对车码',
  500. // showCancel:false
  501. // })
  502. that.setData({
  503. scanCodeErr: true
  504. })
  505. }
  506. },
  507. fail: function (err) {
  508. console.log('tuihui')
  509. // that.setData({
  510. // scanCodeErr: true
  511. // })
  512. }
  513. })
  514. },
  515. //获取车辆信息
  516. getBikeMessage: function (code) {
  517. var that = this;
  518. app.request('/bike/' + code, '', 'GET').then(res => {
  519. console.log(res, '车辆信息--------------------')
  520. my.hideLoading()
  521. if (res.status == 200) {
  522. if (res.data.is_link == 0) {
  523. my.alert({
  524. title: '提示',
  525. content: '当前车子已下线请换辆车子骑行吧~',
  526. success: function (res) {
  527. my.reLaunch({
  528. url: '/pages/index/index',
  529. })
  530. }
  531. })
  532. return;
  533. } else if (res.data.put_status == 0) {
  534. my.alert({
  535. title: '提示',
  536. content: '当前车子还未投放请换辆车子骑行吧~',
  537. })
  538. return;
  539. } else if (res.data.is_low_battery_power == 0) {
  540. my.alert({
  541. title: '提示',
  542. content: '当前车子电量过低请换辆车子骑行吧~',
  543. })
  544. return;
  545. } else if (res.data.is_trouble == 1) {
  546. my.alert({
  547. title: '提示',
  548. content: '当前车子出现故障请换辆车子骑行吧~',
  549. })
  550. return;
  551. } else if (res.data.is_riding == 1) {
  552. my.alert({
  553. title: '提示',
  554. content: '当前车子正在骑行请换辆车子骑行吧~',
  555. })
  556. return;
  557. } else {
  558. my.reLaunch({
  559. url: '/pages/use_bike/use_bike?code=' + code,
  560. })
  561. }
  562. }else{
  563. my.alert({
  564. title: '提示',
  565. content: res.data.message,
  566. })
  567. }
  568. })
  569. },
  570. //去支付未支付订单
  571. go_pay: util.throttle(function () {
  572. //点击去支付
  573. this.setData({
  574. is_pay_order: false,
  575. })
  576. var pay_order = ''
  577. if (this.data.userStatus.is_pay_order !== false && this.data.userStatus.is_pay_order !== undefined) {
  578. pay_order = this.data.userStatus.is_pay_order
  579. }
  580. my.navigateTo({
  581. url: '/pages/pay/pay?order=' + pay_order,
  582. })
  583. }, 1500),
  584. //点击查看正在进行中的订单
  585. goUseBike: function () {
  586. console.log(this.data.is_ride_order, 'this.data.is_ride_order')
  587. my.navigateTo({
  588. url: '/pages/use_bike/use_bike?order=' + this.data.is_ride_order,
  589. })
  590. },
  591. //有违章订单
  592. havePunishment: function () {
  593. my.navigateTo({
  594. url: '/pages/weizhang/weizhang',
  595. })
  596. },
  597. onReady: function () {
  598. },
  599. kefu: util.throttle(function () {
  600. my.makePhoneCall({
  601. number: my.getStorageSync({'key':'home'}).data.customer_service_phone,
  602. })
  603. }, 1500),
  604. //用户状态
  605. userState: function () {
  606. var that = this;
  607. var data = {
  608. 'area_id': that.data.id
  609. }
  610. app.request("/user/status", data, "GET").then(res => {
  611. console.log(res)
  612. if (res.status == 200) {
  613. that.setData({
  614. userStatus: res.data,
  615. is_pay_order: res.data.is_pay_order,
  616. is_ride_order: res.data.is_ride_order,
  617. is_punishment: res.data.is_punishment,
  618. }), my.setStorageSync({'key':'userState',data: res.data})
  619. }
  620. }).catch(err => {
  621. console.log(err)
  622. })
  623. },
  624. getUser() {
  625. app.request("/me", '', "GET").then(res => {
  626. console.log(res)
  627. 200 == res.status && my.setStorageSync({'key':'userInfo',data:res.data})
  628. }).catch(err => {
  629. console.log(err)
  630. })
  631. },
  632. go_setting: util.throttle(function () {
  633. //点击去设置位置权限
  634. this.setData({
  635. background: false,
  636. location: false
  637. })
  638. my.openSetting({
  639. success: function (res) {
  640. }
  641. })
  642. }, 1500),
  643. //点击已开启位置权限
  644. open: util.throttle(function () {
  645. this.setData({
  646. background: false,
  647. location: false
  648. })
  649. }, 1500),
  650. location: function () {
  651. //获取当前经纬度 如果未授权让用户去授权
  652. console.log('dingwei')
  653. var that = this;
  654. my.showLoading({
  655. content: '定位中...',
  656. mask: true
  657. })
  658. my.getLocation({
  659. type: 'gcj02',
  660. success: (res) => {
  661. console.log('经纬度为:+++++++++++++++++++++' + res.latitude + '++++++++' + res.longitude)
  662. that.setData({
  663. longitude: res.longitude,
  664. latitude: res.latitude,
  665. show: false
  666. })
  667. console.log(res, 'ppp')
  668. that.home(), that.nearbyCars()
  669. if (that.data.stopP == false) {
  670. console.log('false')
  671. } else {
  672. that.stop()
  673. }
  674. my.hideLoading()
  675. },
  676. fail: function () {
  677. my.hideLoading()
  678. my.getSetting({
  679. success: function (res) {
  680. // console.log(res)
  681. var statu = res.authSetting;
  682. if (statu['scope.userLocation'] == false) {
  683. that.setData({
  684. background: true,
  685. location: true
  686. })
  687. }
  688. }
  689. })
  690. }
  691. })
  692. },
  693. //底部跳转页面按钮(用户未授权和未实名认证的时候不可以跳转)
  694. skipPage: function (e) {
  695. console.log(e, 'oooooo')
  696. let data = e.currentTarget.dataset.id
  697. let that = this
  698. var userStatus = that.data.userStatus;
  699. console.log(that.data.latitude)
  700. if (!that.data.latitude && !that.data.longitude) {
  701. that.setData({
  702. background: true,
  703. location: true
  704. })
  705. } else {
  706. if (data.id == 2) {
  707. console.log(that.data.userStatus,'')
  708. if (!userStatus) {
  709. my.navigateTo({
  710. url: '/pages/authorization/authorization',
  711. })
  712. } else {
  713. that.jiance1();
  714. }
  715. } else {
  716. if (!userStatus) {
  717. my.navigateTo({
  718. url: '/pages/authorization/authorization',
  719. })
  720. } else {
  721. my.navigateTo({
  722. url: data.url,
  723. })
  724. }
  725. }
  726. }
  727. },
  728. //输码开锁检测
  729. jiance1: function (source) {
  730. var that = this;
  731. let setting = my.getStorageSync({'key':'setting'}).data
  732. var userStatus = that.data.userStatus;
  733. //未绑定手机号
  734. if (userStatus.is_bind_mobile == 0) {
  735. my.navigateTo({
  736. url: '/pages/authorization/authorization',
  737. })
  738. //未实名认证
  739. } else if (userStatus.is_card_certified == 0 && setting.is_card == 1) {
  740. my.navigateTo({
  741. url: '/pages/real_name/real_name',
  742. })
  743. } else {
  744. //有违章订单
  745. if (that.data.userStatus.is_punishment) {
  746. my.showToast({
  747. content: '您当前有违章订单需要处理,请处理后再来用车吧',
  748. icon: 'none'
  749. })
  750. return;
  751. } else if (userStatus.is_ride_order != false && userStatus.is_ride_order != undefined) {
  752. my.showToast({
  753. content: '您有一个正在骑行中的订单',
  754. icon: 'none'
  755. })
  756. return;
  757. }
  758. else {
  759. //有待支付骑行订单
  760. if (userStatus.is_pay_order != false && userStatus.is_pay_order != undefined) {
  761. my.showToast({
  762. content: '你有未支付订单,请先支付',
  763. icon: 'none'
  764. })
  765. return;
  766. } else {
  767. //没有押金没有免押券
  768. if (userStatus.is_deposit == 0 && that.data.setting.is_deposit != 0 && userStatus.is_coupon_deposit_free == false) {
  769. console.log('没有押金没有免押券')
  770. my.navigateTo({
  771. url: '/pages/ride_zige/ride_zige',
  772. })
  773. } else {
  774. my.navigateTo({
  775. url: '/pages/inputcode/inputcode',
  776. })
  777. }
  778. }
  779. }
  780. }
  781. },
  782. // 客服
  783. kefu: function () {
  784. my.makePhoneCall({
  785. number: my.getStorageSync({'key':'home'}).data.customer_service_phone,
  786. })
  787. },
  788. //附近还车点
  789. findPark: function () {
  790. my.navigateTo({
  791. url: '/pages/parking/parking',
  792. })
  793. },
  794. //关闭中间广告弹框
  795. closeAdframe: function () {
  796. this.setData({
  797. adFrame: false
  798. })
  799. },
  800. onHide: function () {
  801. console.log('onHide')
  802. this.setData({
  803. bike_no: undefined,
  804. background: false,
  805. bluetooth: false,
  806. location: false,
  807. scanfail: false,
  808. over1: false
  809. })
  810. // clearInterval(mytime)
  811. },
  812. // 去输码弹框
  813. cancelErrFrame: function () {
  814. this.setData({
  815. scanCodeErr: false
  816. })
  817. },
  818. goInputCode: function () {
  819. my.navigateTo({
  820. url: '/pages/inputcode/inputcode',
  821. })
  822. }
  823. })