charginfo.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. import * as echarts from '../../ec-canvas/echarts';
  2. import * as lf from '../../ec-canvas/echarts-liquidfill';
  3. let log = require('../../utils/log.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. name:'',
  10. address:'',
  11. offlineServicecall:'',
  12. stationTagList:[],
  13. chargprice: '',
  14. serviceprice: '',
  15. chargid: '',
  16. sumprice: '',
  17. fastFree:0,
  18. slowFree:0,
  19. fastSum:0,
  20. slowSum:0,
  21. pagesize:10,
  22. pagenum:1,
  23. ele_pagenum:1,
  24. total:-1,
  25. ele_total:-1,
  26. loadTotal: 0,
  27. dataLoading: false,
  28. ele_dataLoading: false,
  29. finishedLoadTap: 0,
  30. ele_finishedLoadTap: 0,
  31. finishedLoadShowTimes: 0,
  32. ele_finishedLoadShowTimes: 0,
  33. chargList: [],
  34. ele_chargList: [],
  35. seeInfoChargPile:{},
  36. userInfo:{},
  37. chargfeatureList:[],
  38. isLogin: false,
  39. resultTable: [],
  40. // 是否减免停车费
  41. carParkingRate: false,
  42. // 停车时间
  43. parkTime: 0,
  44. activeTab: '0',
  45. scrollTop:0
  46. occupyFee:{},
  47. showOccupyFee:false
  48. },
  49. execParking(that,stationId){
  50. wx.request({
  51. url: getApp().globalData.postHeadAgreement + '/restapi/wechat/carParkingRate?stationId=' + stationId,
  52. // data: {
  53. // loginName: userInfo.loginName
  54. // },
  55. method: 'POST',
  56. success: function (res) {
  57. // 是否减免停车费
  58. // carParkingRate: false,
  59. // parkTime: 0,
  60. console.info(res)
  61. let reduceTime = res.data?.reduceTime;
  62. if(!reduceTime){
  63. that.setData({
  64. carParkingRate:false
  65. })
  66. return;
  67. }
  68. that.setData({
  69. carParkingRate:true
  70. })
  71. try{
  72. that.setData({
  73. parkTime: parseFloat((reduceTime/ 3600).toFixed(2))
  74. })
  75. }catch(e){
  76. that.setData({
  77. carParkingRate:false
  78. })
  79. }
  80. },
  81. fail(e) {
  82. console.log("用户数据同步失败");
  83. log.info('[扫码]', '[同步用户数据]', '[fail]', e);
  84. }
  85. });
  86. },
  87. /**
  88. * 生命周期函数--监听页面加载
  89. */
  90. onLoad: function(e) {
  91. let that = this;
  92. let stationTagList = [];
  93. let offlineServicecall ="";
  94. wx.getStorage({
  95. key: 'index_seeInfo_chargpile',
  96. success: function (res) {
  97. console.info(res)
  98. var seeInfoChargPile = res.data;
  99. stationTagList = seeInfoChargPile.stationTagList
  100. offlineServicecall = seeInfoChargPile.offlineServicecall
  101. that.setData({
  102. stationTagList,
  103. offlineServicecall,
  104. })
  105. console.info(stationTagList)
  106. // 异步更新
  107. console.info(seeInfoChargPile.chargStationId)
  108. that.execParking(that,seeInfoChargPile.chargStationId)
  109. let resultTable = seeInfoChargPile.resultList
  110. that.setData({
  111. resultTable
  112. })
  113. that.setData({
  114. resultTable
  115. })
  116. let chargfeatureList;
  117. if(seeInfoChargPile.chargfeatures){
  118. chargfeatureList = seeInfoChargPile.chargfeatures.split(',')
  119. }else{
  120. chargfeatureList = [];
  121. }
  122. seeInfoChargPile.sharpTotalPrice = parseFloat((seeInfoChargPile.sharpChargPrice==null || seeInfoChargPile.sharpServicePrice==null || seeInfoChargPile.sharpChargPrice=='暂无费用' || seeInfoChargPile.sharpServicePrice=='暂无费用')? null:(seeInfoChargPile.sharpChargPrice + seeInfoChargPile.sharpServicePrice).toFixed(6));
  123. seeInfoChargPile.peakTotalPrice = parseFloat((seeInfoChargPile.peakChargPrice==null || seeInfoChargPile.peakServicePrice==null || seeInfoChargPile.peakChargPrice=='暂无费用' || seeInfoChargPile.peakServicePrice=='暂无费用' )? null:(seeInfoChargPile.peakChargPrice + seeInfoChargPile.peakServicePrice).toFixed(6));
  124. seeInfoChargPile.flatTotalPrice = parseFloat((seeInfoChargPile.flatChargPrice==null || seeInfoChargPile.flatServicePrice==null || seeInfoChargPile.flatChargPrice=='暂无费用' || seeInfoChargPile.flatServicePrice=='暂无费用' )? null:(seeInfoChargPile.flatChargPrice + seeInfoChargPile.flatServicePrice).toFixed(6));
  125. seeInfoChargPile.valleyTotalPrice = parseFloat((seeInfoChargPile.valleyChargPrice==null || seeInfoChargPile.valleyServicePrice==null || seeInfoChargPile.valleyChargPrice=='暂无费用' || seeInfoChargPile.valleyServicePrice=='暂无费用' )? null:(seeInfoChargPile.valleyChargPrice + seeInfoChargPile.valleyServicePrice).toFixed(6));
  126. seeInfoChargPile.totalprice = parseFloat((seeInfoChargPile.chargprice==null || seeInfoChargPile.serviceprice==null || seeInfoChargPile.chargprice=='暂无费用' || seeInfoChargPile.serviceprice=='暂无费用')? null:(seeInfoChargPile.chargprice + seeInfoChargPile.serviceprice).toFixed(6));
  127. that.setData({
  128. seeInfoChargPile,
  129. chargfeatureList
  130. });
  131. console.info(seeInfoChargPile)
  132. console.info(chargfeatureList)
  133. wx.removeStorage({
  134. key: 'index_seeInfo_chargpile',
  135. success(res) {
  136. }
  137. });
  138. }
  139. });
  140. let { name, address, chargprice, serviceprice, chargid } = e;
  141. name = name=='null'?null:name;
  142. address = address=='null'?null:address;
  143. // stationTagList = !stationTagList?null:stationTagList;
  144. chargprice = chargprice=='null'?null:chargprice;
  145. serviceprice = serviceprice=='null'?null:serviceprice;
  146. chargid = chargid=='null'?null:chargid;
  147. // let sumprice = (chargprice==null || serviceprice==null)? null:chargprice+serviceprice;
  148. let sumprice = (chargprice==null || serviceprice==null)? null:chargprice+serviceprice;
  149. this.setData({
  150. name,
  151. address,
  152. // stationTagList,
  153. chargprice,
  154. serviceprice,
  155. chargid,
  156. sumprice
  157. });
  158. this.fastAndSlow()
  159. this.ori_getPage();
  160. this.ele_getPage();
  161. this.getOccupyFee();
  162. },
  163. fastAndSlow(e){
  164. let that = this;
  165. wx.request({
  166. url: getApp().globalData.postHeadAgreement +'/restapi/wechat/fastAndSlow',
  167. data: {
  168. id: that.data.chargid,
  169. ivType: 3,//统计桩和电池
  170. },
  171. method: 'POST',
  172. success(res) {
  173. that.setData({
  174. fastFree : res.data.fastFree,
  175. slowFree : res.data.slowFree,
  176. fastSum : res.data.fastSum,
  177. slowSum : res.data.slowSum
  178. });
  179. }
  180. });
  181. },
  182. previewImage(e){
  183. var that = this,
  184. //获取当前图片的下表
  185. index = e.currentTarget.dataset.index,
  186. //数据源
  187. pictures = this.data.chargfeatureList;
  188. wx.previewImage({
  189. //当前显示下表
  190. current: pictures[index],
  191. //数据源
  192. urls: pictures
  193. })
  194. },
  195. getPage(){
  196. let that = this;
  197. if(that.__data__.activeTab=='0'){
  198. that.ori_getPage();
  199. }else{
  200. that.ele_getPage();
  201. }
  202. },
  203. getOccupyFee(){
  204. // test对象对接后端服务传递过来的数据
  205. var test = {
  206. cost_cycle:2,
  207. max_fee_time:120,
  208. cost_time_period:'00:00-08:00,12:00-14:00,18:00-21:00,22:00-23:00,22:00-23:00',
  209. free_time:10
  210. }
  211. if (Object.keys(test).length > 0) { // 判断对象数据是否为空
  212. this.setData({
  213. occupyFee:test,
  214. showOccupyFee:true
  215. })
  216. }
  217. console.log("occupyFee",Object.keys(this.data.occupyFee).length > 0);
  218. },
  219. ori_getPage(){
  220. // ivType
  221. // 是否为无人车充电站(0否;1是)
  222. // 0:桩
  223. // 1:电池
  224. if(this.data.chargList.length == this.data.total){
  225. this.setData({
  226. finishedLoadTap:this.data.finishedLoadTap+1
  227. })
  228. if(this.data.finishedLoadTap>0 && this.data.finishedLoadShowTimes==0){
  229. this.setData({
  230. finishedLoadShowTimes:this.data.finishedLoadShowTimes+1
  231. })
  232. wx.showToast({
  233. title: '全部加载完毕',
  234. icon: 'success',
  235. duration: 2000
  236. })
  237. }
  238. return
  239. }
  240. if(this.data.dataLoading){
  241. return
  242. }
  243. this.setData({
  244. dataLoading: true
  245. })
  246. wx.showLoading({
  247. title: '数据加载中....',
  248. })
  249. let that = this;
  250. // 充电桩
  251. wx.request({
  252. url: getApp().globalData.postHeadAgreement +'/restapi/wechat/chargInfo',
  253. data: {
  254. id: that.data.chargid,
  255. pagenum: this.data.pagenum++,
  256. ivType: 0,
  257. pagesize: 10,
  258. },
  259. method: 'POST',
  260. success(res) {
  261. console.log(res);
  262. let chargList = res.data.chargList.rows;
  263. chargList.forEach(key => {
  264. let chargstatusname = '';
  265. let chargstatusclass = '';
  266. if(key.chargstatus == 2){
  267. chargstatusname='空闲中'
  268. chargstatusclass = 'chargstatus_kxz'
  269. }else if(key.chargstatus == 11){
  270. chargstatusname='已插枪'
  271. chargstatusclass = 'chargstatus_ycq'
  272. }else if(key.chargstatus == 3 || key.chargstatus == 10){
  273. chargstatusname='充电中'
  274. chargstatusclass = 'chargstatus_cdz'
  275. }else if(key.chargstatus == 0){
  276. chargstatusname='离线'
  277. chargstatusclass = 'chargstatus_lx'
  278. }else{
  279. chargstatusname='故障'
  280. chargstatusclass = 'chargstatus_gz'
  281. }
  282. key.chargstatusname = chargstatusname;
  283. key.chargstatusclass = chargstatusclass;
  284. })
  285. console.log(chargList);
  286. // that.rechargeTimeOrder(chargemoneylogs);
  287. wx.hideLoading()
  288. that.setData({
  289. chargList: that.data.chargList.concat(chargList),
  290. total: res.data.total,
  291. dataLoading: false,
  292. fastFree : res.data.fastFree,
  293. slowFree : res.data.slowFree,
  294. fastSum : res.data.fastSum,
  295. slowSum : res.data.slowSum
  296. });
  297. console.log("that.data:",that.data);
  298. }
  299. });
  300. },
  301. ele_getPage(){
  302. // ivType
  303. // 是否为无人车充电站(0否;1是)
  304. // 0:桩
  305. // 1:电池
  306. if(this.data.ele_chargList.length == this.data.ele_total){
  307. this.setData({
  308. ele_finishedLoadTap:this.data.ele_finishedLoadTap+1
  309. })
  310. if(this.data.ele_finishedLoadTap>0 && this.data.ele_finishedLoadShowTimes==0){
  311. this.setData({
  312. ele_finishedLoadShowTimes:this.data.ele_finishedLoadShowTimes+1
  313. })
  314. wx.showToast({
  315. title: '全部加载完毕',
  316. icon: 'success',
  317. duration: 2000
  318. })
  319. }
  320. return
  321. }
  322. if(this.data.ele_dataLoading){
  323. return
  324. }
  325. this.setData({
  326. ele_dataLoading: true
  327. })
  328. wx.showLoading({
  329. title: '数据加载中....',
  330. })
  331. let that = this;
  332. // that.setData({
  333. // pagenum:1
  334. // });
  335. // 充电桩
  336. wx.request({
  337. url: getApp().globalData.postHeadAgreement +'/restapi/wechat/chargInfo',
  338. data: {
  339. id: that.data.chargid,
  340. pagenum: this.data.ele_pagenum++,
  341. ivType: 1,
  342. pagesize: 10,
  343. },
  344. method: 'POST',
  345. success(res) {
  346. console.log(res);
  347. let chargList = res.data.chargList.rows;
  348. chargList.forEach(key => {
  349. let chargstatusname = '';
  350. let chargstatusclass = '';
  351. if(key.chargstatus == 2){
  352. chargstatusname='空闲中'
  353. chargstatusclass = 'chargstatus_kxz'
  354. }else if(key.chargstatus == 11){
  355. chargstatusname='已插枪'
  356. chargstatusclass = 'chargstatus_ycq'
  357. }else if(key.chargstatus == 3 || key.chargstatus == 10){
  358. chargstatusname='充电中'
  359. chargstatusclass = 'chargstatus_cdz'
  360. }else if(key.chargstatus == 0){
  361. chargstatusname='离线'
  362. chargstatusclass = 'chargstatus_lx'
  363. }else{
  364. chargstatusname='故障'
  365. chargstatusclass = 'chargstatus_gz'
  366. }
  367. key.chargstatusname = chargstatusname;
  368. key.chargstatusclass = chargstatusclass;
  369. })
  370. console.log(chargList);
  371. // that.rechargeTimeOrder(chargemoneylogs);
  372. wx.hideLoading()
  373. that.setData({
  374. ele_chargList: that.data.ele_chargList.concat(chargList),
  375. ele_total: res.data.chargList.total,
  376. ele_dataLoading: false,
  377. ele_fastFree : res.data.fastFree,
  378. ele_slowFree : res.data.slowFree,
  379. ele_fastSum : res.data.fastSum,
  380. ele_slowSum : res.data.slowSum
  381. });
  382. console.log("that.setData:",that.data);
  383. }
  384. });
  385. },
  386. refreshPage: function(e) {
  387. wx.showLoading({
  388. title: '数据加载中....',
  389. })
  390. let that = this;
  391. that.setData({
  392. pagenum:1,
  393. });
  394. // 清空数据 重新进行刷新
  395. this.data.ele_chargList = []
  396. this.data.ele_total = -1
  397. this.data.chargList=[]
  398. this.data.total = -1
  399. this.ori_getPage();
  400. this.ele_getPage();
  401. that.fastAndSlow()
  402. that.setData({
  403. scrollTop: 0
  404. });
  405. wx.hideLoading()
  406. },
  407. goEleCarMap(e){
  408. console.info("呼叫充电车");
  409. let that = this;
  410. wx.setStorageSync('eleCarMapPage', {
  411. chargid: that.data.chargid
  412. })
  413. let url = '/pages/charginfo/eleCarMap';
  414. wx.navigateTo({
  415. url
  416. });
  417. },
  418. goScanResult(e){
  419. // scan_result
  420. console.info('xxxxxxxxxxxxxx')
  421. let {
  422. keywords
  423. } = e.currentTarget.dataset;
  424. let userInfo = wx.getStorageSync('userInfo');
  425. let isLogin = wx.getStorageSync('isLogin');
  426. let chargid = keywords.chargPileId;
  427. let that = this;
  428. if(isLogin && userInfo.bindingPhone==0){
  429. console.info('xxxxxxxxxxxxxx1')
  430. wx.showModal({
  431. title: '提示',
  432. content: '当前账户未绑定手机号,请您进行手机号绑定操作',
  433. showCancel:false,
  434. confirmText: '去绑定',
  435. confirmColor:'#00AADD',
  436. success: function (res1) {
  437. let url = `/pages/bindPhone/bindPhone`;
  438. wx.navigateTo({
  439. url
  440. });
  441. }
  442. });
  443. return;
  444. }
  445. wx.showLoading({
  446. title: '努力加载中...',
  447. })
  448. if (!isLogin) {
  449. console.info('xxxxxxxxxxxxxx2')
  450. log.info('[首页]', '[未登陆跳转登录界面]');
  451. let url = `/pages/login/phone_login/phone_login`;
  452. wx.hideLoading();
  453. wx.navigateTo({
  454. url
  455. });
  456. // return;
  457. } else {
  458. log.info('[首页]', '[获取用户是否有未支付订单]', '[请求]', { userId: userInfo.userId });
  459. wx.request({
  460. url: getApp().globalData.postHeadAgreement + '/restapi/pileLog/wechatsettlement',
  461. data: {
  462. userId: userInfo.userId
  463. },
  464. method: 'POST',
  465. success(res) {
  466. let {
  467. data
  468. } = res;
  469. let {
  470. result: order
  471. } = data;
  472. log.info('[首页]', '[获取用户是否有未支付订单]', '[响应]', data);
  473. if (data && order && data.code == 200) {
  474. wx.hideLoading();
  475. log.info('[首页]', '[用户有未支付订单跳转订单支付界面]');
  476. wx.showModal({
  477. showCancel: false,
  478. content: '你有未支付的订单,请先支付',
  479. confirmColor:'#00AADD',
  480. success: function (res) {
  481. //console.log(res);
  482. if (!res.cancel) {
  483. //点击确定
  484. let url = `/pages/order/order?orderid=${order.orderid}&userId=${order.userId}&chargPileId=${order.chargPileId}`;
  485. wx.navigateTo({
  486. url
  487. });
  488. }
  489. }
  490. });
  491. //console.log(that.data.result);
  492. } else {
  493. //console.log('无订单');
  494. log.info('[首页]', '[用户无未支付订单]');
  495. wx.request({
  496. url: getApp().globalData.postHeadAgreement + '/restapi/wechat/chargPile',
  497. // data: scanResult,
  498. data: {
  499. chargPileId: chargid,
  500. userId: userInfo.userId
  501. },
  502. method: 'POST',
  503. success(res) {
  504. console.log(chargid);
  505. log.info('[首页]', '[获取扫一扫充电桩]', '[响应]', res.data);
  506. if (!res.data || res.data.code == 500) {
  507. that.scanFlag = false;
  508. wx.hideLoading();
  509. //没有该充电桩信息
  510. wx.showModal({
  511. showCancel: false,
  512. confirmColor:'#00AADD',
  513. content: res && res.data && res.data.msg ? res.data.msg :'无效的终端编号'
  514. });
  515. } else {
  516. res.data = res.data.result
  517. //充电状态0:离线、1:故障、2:空闲中、3:充电中、4:欠压故障、5:过压故障、6:过电流故障、8:预约、9:在线升级、10:操作中、11:已插枪等
  518. if (!res.data.chargstatus || res.data.chargstatus == 0 || res.data.chargstatus == 1 || res.data.chargstatus == 4 || res.data.chargstatus == 5 || res.data.chargstatus == 6 || res.data.chargstatus == 9) {
  519. //充电桩故障
  520. wx.showModal({
  521. showCancel: false,
  522. content: '终端故障,维修中',
  523. confirmColor:'#00AADD',
  524. });
  525. } else if (res.data.chargstatus == 3 || res.data.chargstatus == 8 || res.data.chargstatus == 10) {
  526. wx.showModal({
  527. showCancel: false,
  528. content: '正在充电中',
  529. confirmColor:'#00AADD',
  530. });
  531. } else if (res.data.chargstatus == 2 || res.data.chargstatus == 11) {
  532. wx.setStorage({
  533. key: "scan_chargpile",
  534. data: res.data
  535. });
  536. log.info('[首页]', '[扫一扫充电桩空闲跳转去充电界面]');
  537. let url = `/pages/scan_result/scan_result`;
  538. wx.hideLoading();
  539. wx.navigateTo({
  540. url
  541. });
  542. }
  543. wx.hideLoading();
  544. }
  545. },
  546. fail(e) {
  547. getApp().showNetworkError();
  548. }
  549. });
  550. }
  551. },
  552. fail(e) {
  553. that.scanFlag = false;
  554. wx.hideLoading();
  555. getApp().showNetworkError();
  556. }
  557. });
  558. }
  559. },
  560. seeReservation: function(e){
  561. let userInfo = wx.getStorageSync('userInfo');
  562. let isLogin = wx.getStorageSync('isLogin');
  563. let that = this;
  564. if(isLogin && userInfo.bindingPhone==0){
  565. console.info('xxxxxxxxxxxxxx1')
  566. wx.showModal({
  567. title: '提示',
  568. content: '当前账户未绑定手机号,请您进行手机号绑定操作',
  569. showCancel:false,
  570. confirmText: '去绑定',
  571. confirmColor:'#00AADD',
  572. success: function (res1) {
  573. let url = `/pages/bindPhone/bindPhone`;
  574. wx.navigateTo({
  575. url
  576. });
  577. }
  578. });
  579. return;
  580. }
  581. if (!isLogin) {
  582. console.info('xxxxxxxxxxxxxx2')
  583. log.info('[首页]', '[未登陆跳转登录界面]');
  584. let url = `/pages/login/phone_login/phone_login`;
  585. wx.hideLoading();
  586. wx.navigateTo({
  587. url
  588. });
  589. return;
  590. }
  591. let idx = e.currentTarget.dataset.idx;
  592. console.info(idx)
  593. let {
  594. chargStationId,
  595. chargPileName,
  596. chargPileId,
  597. chargStationName,
  598. id
  599. } = idx;
  600. let userId = userInfo.userId;
  601. let url = `/pages/reservation/reservation?chargStationId=` + chargStationId + `&chargPileName=` + chargPileName + `&chargPileId=` + chargPileId + `&chargPileIdId=` + id + "&chargStationName=" + chargStationName + "&userId=" + userId;
  602. wx.navigateTo({
  603. url
  604. });
  605. },
  606. /**
  607. * 生命周期函数--监听页面初次渲染完成
  608. */
  609. onReady: function() {
  610. },
  611. /**
  612. * 生命周期函数--监听页面显示
  613. */
  614. onShow: function(e) {
  615. let userInfo = wx.getStorageSync('userInfo');
  616. let isLogin = wx.getStorageSync('isLogin');
  617. //console.log(userInfo);
  618. // 页面显示
  619. if (userInfo && isLogin) {
  620. //userInfo.flag = true;
  621. this.setData({
  622. userInfo: userInfo,
  623. isLogin: isLogin
  624. });
  625. } else {
  626. //未登录信息
  627. this.setData({
  628. userInfo: {}
  629. });
  630. }
  631. },
  632. chargingLog(e){
  633. let idx = e.currentTarget.dataset.idx;
  634. let chargPileId = idx.chargPileId;
  635. console.info(chargPileId);
  636. let url = '/pages/ucenter/charginglog/opsCharginglog?chargPileId=' + chargPileId
  637. wx.navigateTo({
  638. url
  639. });
  640. return;
  641. },
  642. callphone(){
  643. let that = this
  644. let phonenum = that.data.offlineServicecall;
  645. wx.makePhoneCall({
  646. phoneNumber: that.data.offlineServicecall, //此号码并非真实电话号码,仅用于测试
  647. success:function(){
  648. console.log("拨打电话成功!" + phonenum)
  649. },
  650. fail:function(){
  651. console.log("拨打电话失败!" + phonenum)
  652. }
  653. })
  654. },
  655. toggleTabs(e){
  656. let idx = e.currentTarget.dataset.idx;
  657. this.setData({
  658. activeTab: idx
  659. })
  660. },
  661. /**
  662. * 生命周期函数--监听页面隐藏
  663. */
  664. onHide: function() {
  665. },
  666. /**
  667. * 生命周期函数--监听页面卸载
  668. */
  669. onUnload: function() {
  670. },
  671. bindScrollTolowerEvent: function(){
  672. this.getPage();
  673. console.log("触发滚动");
  674. },
  675. /**
  676. * 页面相关事件处理函数--监听用户下拉动作
  677. */
  678. onPullDownRefresh: function() {
  679. },
  680. /**
  681. * 页面上拉触底事件的处理函数
  682. */
  683. onReachBottom: function() {
  684. },
  685. /**
  686. * 用户点击右上角分享
  687. */
  688. onShareAppMessage: function() {
  689. }
  690. })