index.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. // 起卸填报弹窗S
  90. showPopup(e) {
  91. let { id } = e.currentTarget.dataset
  92. this.setData({
  93. show: true,
  94. qxnumber: '',
  95. id: id,
  96. });
  97. /*wx.navigateTo({
  98. url: '/pages/appointment/review?id='+e.currentTarget.dataset.id
  99. })*/
  100. },
  101. onClose() {
  102. this.setData({
  103. show: false,
  104. qxnumber:'',
  105. id: ''
  106. });
  107. },
  108. //起卸填报
  109. formSubmit: function (e) {
  110. let formData = e.detail.value;
  111. var warn = ""; //弹框时提示的内容
  112. if (formData.qxnumber == '') {
  113. warn = "请输入起卸数量!";
  114. }
  115. if (warn != '') {
  116. app.util.checkForm(warn);
  117. } else {
  118. app.request.POST({
  119. url: app.API.orderAudit,
  120. params: formData,
  121. page: this,
  122. isLoadingTxt: '填报中...',
  123. successFun: true
  124. }).then(res => {
  125. wx.showToast({
  126. title: '填报成功',
  127. icon: 'success',
  128. duration: 1000,
  129. mask: true
  130. })
  131. this.onClose()
  132. this.getListFun(); //刷新列表
  133. })
  134. }
  135. },
  136. // 起卸填报弹窗E
  137. /**
  138. * 生命周期函数--监听页面隐藏
  139. */
  140. onHide() {
  141. },
  142. /**
  143. * 生命周期函数--监听页面卸载
  144. */
  145. onUnload() {
  146. },
  147. /**
  148. * 页面相关事件处理函数--监听用户下拉动作
  149. */
  150. onPullDownRefresh: function () {
  151. this.setData({
  152. searchVal: ''
  153. })
  154. if (wx.getStorageSync('loginStatus')) {
  155. this.getListFun();
  156. } else {
  157. wx.stopPullDownRefresh();
  158. }
  159. },
  160. /**
  161. * 页面上拉触底事件的处理函数
  162. */
  163. onReachBottom: function () {
  164. this.data.page++;
  165. let params = {
  166. current: this.data.page,
  167. size: this.data.limit,
  168. licenseNumber:this.data.searchVal,
  169. }
  170. app.request.pageOther({
  171. url: app.API.appointmentList,
  172. page: this,
  173. params: params,
  174. loadType: true //加载类型,是否是下拉加载
  175. });
  176. },
  177. /**
  178. * 用户点击右上角分享
  179. */
  180. onShareAppMessage() {
  181. }
  182. })