info.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // pages/index/info.js
  2. const app = getApp()
  3. var QRCode = require('../../utils/weapp-qrcode.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. info: {},
  10. fileList:[], //司机回签图片
  11. appointmentTypeArray: [{
  12. dictValue: "",
  13. dictLabel: "全部状态"
  14. }],
  15. appointmentTypeIndex: 0,
  16. appointmentClassifyArray: [
  17. { label:'充电预约',value:'1' },
  18. { label:'管桩预约',value:'2' },
  19. { label:'其他预约',value:'3' },
  20. ], //预约类型
  21. },
  22. /**
  23. * 生命周期函数--监听页面加载
  24. */
  25. onLoad(options) {
  26. //订单类型
  27. let treeData = app.globalData.treeArr
  28. for (const element of treeData) {
  29. let arrStr;
  30. switch (element.dictValue) {
  31. case 'appointment_type':
  32. arrStr = "appointmentTypeArray";
  33. break;
  34. }
  35. this.setData({
  36. [arrStr]: element.children
  37. })
  38. }
  39. //获取详情
  40. var pages = getCurrentPages();
  41. var prevPage = pages[pages.length - 2];
  42. let getInfo = prevPage.data.resData[options.index]
  43. //司机回签图片
  44. let fileList = []
  45. if(getInfo.unloadImg){
  46. let unloadImgArr = getInfo.unloadImg.split(',')
  47. unloadImgArr.forEach(element => {
  48. fileList.push({
  49. url : app.host.BASEIMG_URL+element,
  50. imgUrl : element,
  51. isImage : true
  52. })
  53. });
  54. }
  55. this.setData({
  56. info : getInfo,
  57. fileList : fileList
  58. })
  59. // 预约类型
  60. if(getInfo.appointmentType == '5'){
  61. // 管桩预约
  62. this.getPipeplanData(getInfo.orderId)
  63. }
  64. if(getInfo.status!='1'||getInfo.status!='2'||getInfo.status!='10'||getInfo.status!='11'||getInfo.status!='12'||getInfo.status!='13'||getInfo.status!='14'||getInfo.status!='15'){
  65. this.makeCode(JSON.stringify({
  66. "id": getInfo.id,
  67. "licenseNumber":getInfo.licenseNumber
  68. }))
  69. }
  70. },
  71. // 二维码
  72. makeCode(data) {
  73. var qrcode;
  74. qrcode = new QRCode('canvas', {
  75. text: data,
  76. width: 220,
  77. height: 220,
  78. colorDark: "#000000",
  79. colorLight: "#ffffff",
  80. correctLevel: QRCode.CorrectLevel.H,
  81. });
  82. qrcode.makeCode(data);
  83. },
  84. // 管桩计划详情
  85. getPipeplanData: function (id) {
  86. app.request.GET({
  87. url: app.API.bizpipeplanDetail,
  88. params: {'id' : id},
  89. page: this,
  90. successFun: true
  91. }).then(res => {
  92. let getInfo = res.data.data;
  93. this.setData({
  94. planNumber : getInfo.planNumber,
  95. planName : getInfo.planName,
  96. planCount : getInfo.planCount,
  97. planAlreadyCount: getInfo.planAlreadyCount,
  98. beginTime : getInfo.beginTime,
  99. endTime : getInfo.endTime,
  100. })
  101. })
  102. },
  103. /**
  104. * 生命周期函数--监听页面初次渲染完成
  105. */
  106. onReady() {
  107. },
  108. /**
  109. * 生命周期函数--监听页面显示
  110. */
  111. onShow() {
  112. },
  113. /**
  114. * 生命周期函数--监听页面隐藏
  115. */
  116. onHide() {
  117. },
  118. /**
  119. * 生命周期函数--监听页面卸载
  120. */
  121. onUnload() {
  122. },
  123. /**
  124. * 页面相关事件处理函数--监听用户下拉动作
  125. */
  126. onPullDownRefresh() {
  127. },
  128. /**
  129. * 页面上拉触底事件的处理函数
  130. */
  131. onReachBottom() {
  132. },
  133. /**
  134. * 用户点击右上角分享
  135. */
  136. onShareAppMessage() {
  137. }
  138. })