index.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. // pages/agent/serviceBillDetail/index.js
  2. import api from '../../api/api'
  3. import Dialog from 'weui-miniprogram/dialog/index';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. refresh:true,
  10. orderMainData:{},
  11. list:[]
  12. },
  13. async mainData () {
  14. const res = await api._post({
  15. "id": "20230206091603",
  16. "version":1,
  17. "content": {
  18. "sa_serviceorderid":this.data.id
  19. }
  20. })
  21. this.setData({
  22. orderMainData:res.data,
  23. sa_serviceorderid:res.data.sa_serviceorderid,
  24. sa_orderid:res.data.sa_orderid,
  25. })
  26. this.fileData()
  27. this.linkWorkOrder()
  28. },
  29. async fileData () {
  30. const res = await api._post({
  31. "method": "queryFileLink",
  32. "classname": "system.attachment.Attachment",
  33. "content": {
  34. "ownertable": "sa_serviceorder",
  35. "ownerid": this.data.id,
  36. "usetype":"附件"//传空返回有所
  37. }
  38. })
  39. this.setData({
  40. filelist:res.data,
  41. refresh:true
  42. })
  43. },
  44. addProduct () {
  45. wx.navigateTo({
  46. url: '/pages/agent/billCanUseProduct/index',
  47. })
  48. },
  49. async getAdd(selection) {
  50. const res = await api._post({
  51. "id": "20230206161803",
  52. "version": 1,
  53. "content": {
  54. "sa_serviceorderid": this.data.id,
  55. "iteminfos":selection.map(e=>{
  56. return {
  57. "sa_serviceorderitemsid": 0,
  58. "itemid": e,
  59. "reason": ""
  60. }
  61. })
  62. }
  63. })
  64. this.productmx()
  65. },
  66. async productmx () {
  67. const res = await api._post({
  68. "id": "20230206161903",
  69. "version": 1,
  70. "content": {
  71. "sa_serviceorderid": this.data.id
  72. }
  73. })
  74. this.setData({
  75. list:res.data
  76. })
  77. },
  78. async onDelete (data) {
  79. let itemid = data.detail.sa_serviceorderitemsid
  80. const res = await api._post({
  81. "id": "20230206162003",
  82. "content": {
  83. "sa_serviceorderitemsids": [itemid]
  84. }
  85. })
  86. this.productmx()
  87. },
  88. onEdit () {
  89. getApp().globalData.handelSelect = this
  90. wx.navigateTo({
  91. url: '/pages/agent/editServiceBill/index',
  92. })
  93. },
  94. onSubmit() {
  95. let that = this
  96. const dialogConfig = {
  97. context: this,
  98. title: '提示',
  99. content: '确认提交当前申请单吗',
  100. confirmBtn: '确定',
  101. cancelBtn: '取消',
  102. };
  103. Dialog.confirm(dialogConfig)
  104. .then(async () => {
  105. const res = await api._post({
  106. "id": "20230206101403",
  107. "version":1,
  108. "content": {
  109. "sa_serviceorderid":that.data.id,
  110. "issumbit":1,
  111. }
  112. })
  113. that.mainData()
  114. })
  115. .catch((err) => console.log(err))
  116. .finally(() => Dialog.close());
  117. },
  118. onDelete() {
  119. let that = this
  120. const dialogConfig = {
  121. context: this,
  122. title: '提示',
  123. content: '确认提交当前申请单吗',
  124. confirmBtn: '确定',
  125. cancelBtn: '取消',
  126. };
  127. Dialog.confirm(dialogConfig)
  128. .then(async () => {
  129. const res = await api._post({
  130. "id": "20230206091803",
  131. "version":1,
  132. "content": {
  133. "sa_serviceorderids":[that.data.id],
  134. }
  135. })
  136. wx.navigateBack()
  137. })
  138. .catch((err) => console.log(err))
  139. .finally(() => Dialog.close());
  140. },
  141. async linkWorkOrder() {
  142. const res = await api._post({
  143. "id": "20230207154203",
  144. "version":1,
  145. "content": {
  146. "sa_serviceorderid":this.data.id
  147. }
  148. })
  149. this.setData({
  150. linkWorkOrders:res.data
  151. })
  152. },
  153. tolinkWorkOrder (e) {
  154. let id = e.currentTarget.dataset.item.sa_workorderid
  155. let app = getApp()
  156. app.globalData.action = ['editLeader']
  157. wx.navigateTo({
  158. url: '/pages/workOrderDetail/index?class=stopClick&id=' + id
  159. })
  160. },
  161. /**
  162. * 生命周期函数--监听页面加载
  163. */
  164. onLoad(options) {
  165. this.setData({
  166. id:options.id
  167. })
  168. this.productmx()
  169. },
  170. /**
  171. * 生命周期函数--监听页面初次渲染完成
  172. */
  173. onReady() {
  174. },
  175. /**
  176. * 生命周期函数--监听页面显示
  177. */
  178. onShow() {
  179. this.mainData()
  180. },
  181. /**
  182. * 生命周期函数--监听页面隐藏
  183. */
  184. onHide() {
  185. },
  186. /**
  187. * 生命周期函数--监听页面卸载
  188. */
  189. onUnload() {
  190. },
  191. /**
  192. * 页面相关事件处理函数--监听用户下拉动作
  193. */
  194. onPullDownRefresh() {
  195. },
  196. /**
  197. * 页面上拉触底事件的处理函数
  198. */
  199. onReachBottom() {
  200. },
  201. /**
  202. * 用户点击右上角分享
  203. */
  204. onShareAppMessage() {
  205. }
  206. })