index.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. // pages/upDownSubmit/index.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. str:' ',
  9. loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false,
  10. roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '',
  11. searchVal: '',
  12. //分页
  13. limit: 10,
  14. requestStatu: '加载中...',
  15. page: 1,
  16. totalPages: 1,
  17. more: false,
  18. nomore: '',
  19. resData:[],
  20. show: false, //弹窗
  21. qxnumber:'',
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad(options) {
  27. },
  28. /**
  29. * 生命周期函数--监听页面初次渲染完成
  30. */
  31. onReady() {
  32. },
  33. /**
  34. * 生命周期函数--监听页面显示
  35. */
  36. onShow() {
  37. const roleCodeList = wx.getStorageSync('roleCodeList')
  38. let loginStatus = wx.getStorageSync('loginStatus')
  39. this.setData({
  40. searchVal: '',
  41. roleCodeList: roleCodeList ? roleCodeList : '',
  42. loginStatus: loginStatus ? loginStatus : false
  43. })
  44. if(wx.getStorageSync('loginStatus')){
  45. this.getListFun();
  46. }
  47. },
  48. //页面跳转
  49. toLink: function (e) {
  50. let { url } = e.currentTarget.dataset
  51. wx.navigateTo({
  52. url: url
  53. })
  54. },
  55. //搜索框请求S
  56. onChange(e) {
  57. this.setData({
  58. searchVal: e.detail,
  59. });
  60. },
  61. onSearch: function (event) {
  62. this.setData({
  63. searchVal: event.detail
  64. })
  65. this.getListFun();
  66. },
  67. onCancel: function () {
  68. this.setData({})
  69. },
  70. toSearch: function (event) {
  71. this.getListFun();
  72. },
  73. //列表
  74. getListFun: function () {
  75. this.setData({
  76. page: 1
  77. })
  78. let params = {
  79. current: this.data.page,
  80. size: this.data.limit,
  81. licenseNumber:this.data.searchVal
  82. }
  83. app.request.pageFirst({
  84. url: app.API.appointmentList,
  85. page: this,
  86. params: params,
  87. })
  88. },
  89. //执行
  90. executeFun: function (e) {
  91. let _this = this
  92. let { id, tips } = e.currentTarget.dataset
  93. wx.showModal({
  94. title: '提示!',
  95. content: `执行【${tips}】任务后不可恢复。确定要执行吗?`,
  96. confirmColor: '#FF5B5B',
  97. success: function (res) {
  98. if (res.confirm) {
  99. app.request.POST({
  100. url: app.API.orderloadDelete,
  101. params: [{
  102. id: id
  103. }],
  104. page: _this,
  105. isLoadingTxt: '执行中...',
  106. successFun: true
  107. }).then(res => {
  108. wx.showToast({
  109. title: '执行成功',
  110. icon: 'success',
  111. duration: 1000,
  112. mask: true
  113. })
  114. _this.getListFun(); //刷新列表
  115. })
  116. } else if (res.cancel) {
  117. }
  118. }
  119. })
  120. },
  121. //结束
  122. finishFun: function (e) {
  123. let _this = this
  124. let { id, tips } = e.currentTarget.dataset
  125. wx.showModal({
  126. title: '提示!',
  127. content: `结束【${tips}】任务后不可恢复。确定要结束吗?`,
  128. confirmColor: '#FF5B5B',
  129. success: function (res) {
  130. if (res.confirm) {
  131. app.request.POST({
  132. url: app.API.orderloadDelete,
  133. params: [{
  134. id: id
  135. }],
  136. page: _this,
  137. isLoadingTxt: '操作中...',
  138. successFun: true
  139. }).then(res => {
  140. wx.showToast({
  141. title: '结束成功',
  142. icon: 'success',
  143. duration: 1000,
  144. mask: true
  145. })
  146. _this.getListFun(); //刷新列表
  147. })
  148. } else if (res.cancel) {
  149. }
  150. }
  151. })
  152. },
  153. /**
  154. * 生命周期函数--监听页面隐藏
  155. */
  156. onHide() {
  157. },
  158. /**
  159. * 生命周期函数--监听页面卸载
  160. */
  161. onUnload() {
  162. },
  163. /**
  164. * 页面相关事件处理函数--监听用户下拉动作
  165. */
  166. onPullDownRefresh: function () {
  167. this.setData({
  168. searchVal: ''
  169. })
  170. if (wx.getStorageSync('loginStatus')) {
  171. this.getListFun();
  172. } else {
  173. wx.stopPullDownRefresh();
  174. }
  175. },
  176. /**
  177. * 页面上拉触底事件的处理函数
  178. */
  179. onReachBottom: function () {
  180. this.data.page++;
  181. let params = {
  182. current: this.data.page,
  183. size: this.data.limit,
  184. licenseNumber:this.data.searchVal,
  185. }
  186. app.request.pageOther({
  187. url: app.API.appointmentList,
  188. page: this,
  189. params: params,
  190. loadType: true //加载类型,是否是下拉加载
  191. });
  192. },
  193. /**
  194. * 用户点击右上角分享
  195. */
  196. onShareAppMessage() {
  197. }
  198. })