index.js 3.6 KB

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