info.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. isImage:true
  51. })
  52. });
  53. }
  54. this.setData({
  55. info : getInfo,
  56. fileList : fileList
  57. })
  58. // 预约类型
  59. if(getInfo.appointmentType == '5'){
  60. // 管桩预约
  61. this.getPipeplanData(getInfo.orderId)
  62. }
  63. 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'){
  64. this.makeCode(JSON.stringify({
  65. "id": getInfo.id,
  66. "licenseNumber":getInfo.licenseNumber
  67. }))
  68. }
  69. },
  70. // 二维码
  71. makeCode(data) {
  72. var qrcode;
  73. qrcode = new QRCode('canvas', {
  74. text: data,
  75. width: 220,
  76. height: 220,
  77. colorDark: "#000000",
  78. colorLight: "#ffffff",
  79. correctLevel: QRCode.CorrectLevel.H,
  80. });
  81. qrcode.makeCode(data);
  82. },
  83. // 管桩计划详情
  84. getPipeplanData: function (id) {
  85. app.request.GET({
  86. url: app.API.bizpipeplanDetail,
  87. params: {'id' : id},
  88. page: this,
  89. successFun: true
  90. }).then(res => {
  91. let getInfo = res.data.data;
  92. this.setData({
  93. planNumber : getInfo.planNumber,
  94. planName : getInfo.planName,
  95. planCount : getInfo.planCount,
  96. planAlreadyCount: getInfo.planAlreadyCount,
  97. })
  98. })
  99. },
  100. /**
  101. * 生命周期函数--监听页面初次渲染完成
  102. */
  103. onReady() {
  104. },
  105. /**
  106. * 生命周期函数--监听页面显示
  107. */
  108. onShow() {
  109. },
  110. /**
  111. * 生命周期函数--监听页面隐藏
  112. */
  113. onHide() {
  114. },
  115. /**
  116. * 生命周期函数--监听页面卸载
  117. */
  118. onUnload() {
  119. },
  120. /**
  121. * 页面相关事件处理函数--监听用户下拉动作
  122. */
  123. onPullDownRefresh() {
  124. },
  125. /**
  126. * 页面上拉触底事件的处理函数
  127. */
  128. onReachBottom() {
  129. },
  130. /**
  131. * 用户点击右上角分享
  132. */
  133. onShareAppMessage() {
  134. }
  135. })