index.js 4.4 KB

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