zhenggaijindu.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. processData: [{
  28. name: '提交工单',
  29. start: '#fff',
  30. end: '#EFF3F6',
  31. icon: '../../img/process_1.png'
  32. },
  33. {
  34. name: '已接单',
  35. start: '#EFF3F6',
  36. end: '#EFF3F6',
  37. icon: '../../img/process_1.png'
  38. },
  39. {
  40. name: '开始维修',
  41. start: '#EFF3F6',
  42. end: '#EFF3F6',
  43. icon: '../../img/process_1.png'
  44. },
  45. {
  46. name: '维修结束',
  47. start: '#EFF3F6',
  48. end: '#EFF3F6',
  49. icon: '../../img/process_1.png'
  50. },
  51. {
  52. name: '已确认',
  53. start: '#EFF3F6',
  54. end: '#fff',
  55. icon: '../../img/process_1.png'
  56. }
  57. ],
  58. // 期限按钮
  59. buttons: [{ id: 1, name: "一天" }, { id: 2, name: "两天" }, { id: 3, name:"三天" }]
  60. },
  61. //进度条的状态
  62. setPeocessIcon: function () {
  63. var index = 0 //记录状态为1的最后的位置
  64. var processArr = this.data.processData
  65. // console.log("progress", this.data.detailData.progress)
  66. for (var i = 0; i < this.data.detailData.progress.length; i++) {
  67. var item = this.data.detailData.progress[i]
  68. processArr[i].name = item.word
  69. if (item.state == 1) {
  70. index = i
  71. processArr[i].icon = "../../img/process_3.png"
  72. processArr[i].start = "#45B2FE"
  73. processArr[i].end = "#45B2FE"
  74. } else {
  75. processArr[i].icon = "../../img/process_1.png"
  76. processArr[i].start = "#EFF3F6"
  77. processArr[i].end = "#EFF3F6"
  78. }
  79. }
  80. processArr[index].icon = "../../img/process_2.png"
  81. processArr[index].end = "#EFF3F6"
  82. processArr[0].start = "#fff"
  83. processArr[this.data.detailData.progress.length - 1].end = "#fff"
  84. this.setData({
  85. processData: processArr
  86. })
  87. },
  88. // 期限按钮
  89. onLoad: function (options) {
  90. this.data.buttons[0].checked = true;
  91. this.setData({
  92. buttons: this.data.buttons,
  93. })
  94. },
  95. radioButtonTap: function (e) {
  96. console.log(e)
  97. let id = e.currentTarget.dataset.id
  98. console.log(id)
  99. for (let i = 0; i < this.data.buttons.length; i++) {
  100. if (this.data.buttons[i].id == id) {
  101. //当前点击的位置为true即选中
  102. this.data.buttons[i].checked = true;
  103. }
  104. else {
  105. //其他的位置为false
  106. this.data.buttons[i].checked = false;
  107. }
  108. }
  109. this.setData({
  110. buttons: this.data.buttons,
  111. msg: "id:"+id
  112. })
  113. },
  114. checkButtonTap:function(e){
  115. console.log(e)
  116. let id = e.currentTarget.dataset.id
  117. console.log(id)
  118. for (let i = 0; i < this.data.buttons.length; i++) {
  119. if (this.data.buttons[i].id == id) {
  120. if (this.data.buttons[i].checked == true) {
  121. this.data.buttons[i].checked = false;
  122. } else {
  123. this.data.buttons[i].checked = true;
  124. }
  125. }
  126. }
  127. },
  128. })