index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. const api = require("../api/api")
  2. import Dialog from 'tdesign-miniprogram/dialog/index';
  3. // pages/workOrderDetail/index.js
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. },
  10. async mainData () {
  11. const res = await api._post({
  12. "id": "20230208140103",
  13. "content": {
  14. "sa_workorderid":this.data.id
  15. }
  16. })
  17. this.setData({
  18. billData:res.data
  19. })
  20. setTimeout(() => {
  21. if (this.data.billData.status === '待开始') {
  22. getApp().globalData.handelSelect = this
  23. wx.navigateTo({
  24. url: '/Eservice/workBillConfirmInfo/index',
  25. })
  26. }
  27. }, 1000);
  28. },
  29. changeBillStatus(data) {
  30. let id = data.currentTarget.dataset.id
  31. const dialogConfig = {
  32. context: this,
  33. title: '提示',
  34. content: '确认执行当前操作吗?',
  35. confirmBtn: '确定',
  36. cancelBtn: '取消',
  37. };
  38. Dialog.confirm(dialogConfig)
  39. .then(async () => {
  40. const res = await api._post({
  41. "id": id,
  42. "content": {
  43. "sa_workorderid":this.data.id
  44. }
  45. })
  46. this.mainData()
  47. })
  48. .catch(() => console.log('点击了取消'))
  49. .finally(() => Dialog.close());
  50. },
  51. async addConfirmBill () {
  52. const res = await api._post({
  53. "id": "20230211105703",
  54. "version":1,
  55. "content": {
  56. "sa_workorder_confirmationid":0,
  57. "sa_workorderid":this.data.id,
  58. "attitudescore":0,
  59. "responsescore":0,
  60. }
  61. })
  62. if (this.data.billData.type === '安装培训') {
  63. wx.navigateTo({
  64. url: '/Eservice/trainConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  65. })
  66. } else if (this.data.billData.type === '安装调试') {
  67. wx.navigateTo({
  68. url: '/Eservice/installConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  69. })
  70. } else {
  71. wx.navigateTo({
  72. url: '/Eservice/serviceConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  73. })
  74. }
  75. },
  76. toConfirmBill (data) {
  77. if (this.data.billData.type === '安装培训') {
  78. wx.navigateTo({
  79. url: '/Eservice/trainConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
  80. })
  81. } else if (this.data.billData.type === '安装调试') {
  82. wx.navigateTo({
  83. url: '/Eservice/installConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
  84. })
  85. } else {
  86. wx.navigateTo({
  87. url: '/Eservice/serviceConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
  88. })
  89. }
  90. },
  91. async confirmBillList () {
  92. const res = await api._post({
  93. "id": "20230211105903",
  94. "content": {
  95. "where":{
  96. "condition":"",
  97. "sa_workorderid":this.data.id
  98. }
  99. }
  100. })
  101. this.setData({
  102. confirmBills:res.data
  103. })
  104. },
  105. toWorkConfirmInfo () {
  106. getApp().globalData.handelSelect = this
  107. wx.navigateTo({
  108. url: '/Eservice/workBillConfirmInfo/index?class=' + this.data.stopClick,
  109. })
  110. },
  111. /**
  112. * 生命周期函数--监听页面加载
  113. */
  114. onLoad(options) {
  115. this.setData({
  116. id:options.id,
  117. stopClick:options.class
  118. })
  119. },
  120. /**
  121. * 生命周期函数--监听页面初次渲染完成
  122. */
  123. onReady() {
  124. },
  125. /**
  126. * 生命周期函数--监听页面显示
  127. */
  128. onShow() {
  129. this.mainData()
  130. this.confirmBillList()
  131. },
  132. /**
  133. * 生命周期函数--监听页面隐藏
  134. */
  135. onHide() {
  136. },
  137. /**
  138. * 生命周期函数--监听页面卸载
  139. */
  140. onUnload() {
  141. },
  142. /**
  143. * 页面相关事件处理函数--监听用户下拉动作
  144. */
  145. onPullDownRefresh() {
  146. },
  147. /**
  148. * 页面上拉触底事件的处理函数
  149. */
  150. onReachBottom() {
  151. },
  152. /**
  153. * 用户点击右上角分享
  154. */
  155. onShareAppMessage() {
  156. }
  157. })