zhenggaijindu.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. buttons: [{ id: 1, name: "一天" }, { id: 2, name: "两天" }, { id: 3, name:"三天" }]
  61. },
  62. //进度条的状态
  63. setPeocessIcon: function () {
  64. var index = 0 //记录状态为1的最后的位置
  65. var processArr = this.data.processData
  66. // console.log("progress", this.data.detailData.progress)
  67. for (var i = 0; i < this.data.detailData.progress.length; i++) {
  68. var item = this.data.detailData.progress[i]
  69. processArr[i].name = item.word
  70. if (item.state == 1) {
  71. index = i
  72. processArr[i].icon = "../../img/process_3.png"
  73. processArr[i].start = "#45B2FE"
  74. processArr[i].end = "#45B2FE"
  75. } else {
  76. processArr[i].icon = "../../img/process_1.png"
  77. processArr[i].start = "#EFF3F6"
  78. processArr[i].end = "#EFF3F6"
  79. }
  80. }
  81. processArr[index].icon = "../../img/process_2.png"
  82. processArr[index].end = "#EFF3F6"
  83. processArr[0].start = "#fff"
  84. processArr[this.data.detailData.progress.length - 1].end = "#fff"
  85. this.setData({
  86. processData: processArr
  87. })
  88. },
  89. <<<<<<< HEAD
  90. onUnload(){
  91. let page = getCurrentPages();
  92. let prevPage = page[page.length - 2];
  93. prevPage.setData({
  94. isRefresh :this.data.isRefreshUP,
  95. });
  96. }
  97. =======
  98. // 期限按钮
  99. onLoad: function (options) {
  100. this.data.buttons[0].checked = true;
  101. this.setData({
  102. buttons: this.data.buttons,
  103. })
  104. },
  105. radioButtonTap: function (e) {
  106. console.log(e)
  107. let id = e.currentTarget.dataset.id
  108. console.log(id)
  109. for (let i = 0; i < this.data.buttons.length; i++) {
  110. if (this.data.buttons[i].id == id) {
  111. //当前点击的位置为true即选中
  112. this.data.buttons[i].checked = true;
  113. }
  114. else {
  115. //其他的位置为false
  116. this.data.buttons[i].checked = false;
  117. }
  118. }
  119. this.setData({
  120. buttons: this.data.buttons,
  121. msg: "id:"+id
  122. })
  123. },
  124. checkButtonTap:function(e){
  125. console.log(e)
  126. let id = e.currentTarget.dataset.id
  127. console.log(id)
  128. for (let i = 0; i < this.data.buttons.length; i++) {
  129. if (this.data.buttons[i].id == id) {
  130. if (this.data.buttons[i].checked == true) {
  131. this.data.buttons[i].checked = false;
  132. } else {
  133. this.data.buttons[i].checked = true;
  134. }
  135. }
  136. }
  137. },
  138. >>>>>>> 57f7980a209c37c9f7735fbe7e3a57926d779ed2
  139. })