zhenggaijindu.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import http from '../../base/httputil'
  2. const app = getApp()
  3. Page({
  4. onLoad(e) {
  5. this.getZhenggaijindu(e.busInspectionId)
  6. },
  7. getZhenggaijindu(busInspectionId) {
  8. let obj = new Object();
  9. obj.busInspectionId = busInspectionId
  10. http.post("/system/AppZhenggaijinduController/getZhenggaijindu", obj, this.getZhenggaijinduSuccess);
  11. },
  12. getZhenggaijinduSuccess(res) {
  13. console.log(res)
  14. this.data.pictureBasePath = res.pictureBasePath
  15. this.setData({
  16. pictureBasePath : res.pictureBasePath,
  17. zgjdList: res.zgjdList
  18. })
  19. },
  20. /**
  21. * 页面的初始数据
  22. */
  23. data: {
  24. host: app.globalData.host,
  25. pictureBasePath: null,
  26. zgjdList: null,
  27. isRefreshUP:true,
  28. processData: [{
  29. name: '提交工单',
  30. start: '#fff',
  31. end: '#EFF3F6',
  32. icon: '../../img/process_1.png'
  33. },
  34. {
  35. name: '已接单',
  36. start: '#EFF3F6',
  37. end: '#EFF3F6',
  38. icon: '../../img/process_1.png'
  39. },
  40. {
  41. name: '开始维修',
  42. start: '#EFF3F6',
  43. end: '#EFF3F6',
  44. icon: '../../img/process_1.png'
  45. },
  46. {
  47. name: '维修结束',
  48. start: '#EFF3F6',
  49. end: '#EFF3F6',
  50. icon: '../../img/process_1.png'
  51. },
  52. {
  53. name: '已确认',
  54. start: '#EFF3F6',
  55. end: '#fff',
  56. icon: '../../img/process_1.png'
  57. }
  58. ]
  59. },
  60. //进度条的状态
  61. setPeocessIcon: function () {
  62. var index = 0 //记录状态为1的最后的位置
  63. var processArr = this.data.processData
  64. // console.log("progress", this.data.detailData.progress)
  65. for (var i = 0; i < this.data.detailData.progress.length; i++) {
  66. var item = this.data.detailData.progress[i]
  67. processArr[i].name = item.word
  68. if (item.state == 1) {
  69. index = i
  70. processArr[i].icon = "../../img/process_3.png"
  71. processArr[i].start = "#45B2FE"
  72. processArr[i].end = "#45B2FE"
  73. } else {
  74. processArr[i].icon = "../../img/process_1.png"
  75. processArr[i].start = "#EFF3F6"
  76. processArr[i].end = "#EFF3F6"
  77. }
  78. }
  79. processArr[index].icon = "../../img/process_2.png"
  80. processArr[index].end = "#EFF3F6"
  81. processArr[0].start = "#fff"
  82. processArr[this.data.detailData.progress.length - 1].end = "#fff"
  83. this.setData({
  84. processData: processArr
  85. })
  86. },
  87. onUnload(){
  88. let page = getCurrentPages();
  89. let prevPage = page[page.length - 2];
  90. prevPage.setData({
  91. isRefresh :this.data.isRefreshUP,
  92. });
  93. }
  94. })