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