index.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. // pages/signReview/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. auditFlag:'false',
  22. auditReason:'',//审核备注
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad(options) {
  28. },
  29. /**
  30. * 生命周期函数--监听页面初次渲染完成
  31. */
  32. onReady() {
  33. },
  34. /**
  35. * 生命周期函数--监听页面显示
  36. */
  37. onShow() {
  38. const roleCodeList = wx.getStorageSync('roleCodeList')
  39. let loginStatus = wx.getStorageSync('loginStatus')
  40. this.setData({
  41. searchVal: '',
  42. roleCodeList: roleCodeList ? roleCodeList : '',
  43. loginStatus: loginStatus ? loginStatus : false
  44. })
  45. //动态tabbar
  46. // if (roleCodeList == 'bizAdmin') {
  47. // this.getTabBar().setData({
  48. // list: app.globalData.allList[0].list2,
  49. // })
  50. // } else if(roleCodeList == 'send') {
  51. // this.getTabBar().setData({
  52. // list: app.globalData.allList[0].list3,
  53. // })
  54. // } else if(roleCodeList == 'sale') {
  55. // this.getTabBar().setData({
  56. // list: app.globalData.allList[0].list4,
  57. // })
  58. // }else if(roleCodeList == 'customer') {
  59. // this.getTabBar().setData({
  60. // list: app.globalData.allList[0].list5,
  61. // })
  62. // } else if (roleCodeList=='driver'||roleCodeList==''){
  63. // this.getTabBar().setData({
  64. // list: app.globalData.allList[0].list1,
  65. // })
  66. // }
  67. // if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  68. // this.getTabBar().setData({
  69. // selected: 1
  70. // })
  71. // }
  72. if(wx.getStorageSync('loginStatus')){
  73. this.getListFun();
  74. }
  75. },
  76. //搜索框请求S
  77. onChange(e) {
  78. this.setData({
  79. searchVal: e.detail,
  80. });
  81. },
  82. onSearch: function (event) {
  83. this.setData({
  84. searchVal: event.detail
  85. })
  86. this.getListFun();
  87. },
  88. onCancel: function () {
  89. this.setData({})
  90. },
  91. toSearch: function (event) {
  92. this.getListFun();
  93. },
  94. //搜索框请求E
  95. //列表
  96. getListFun: function () {
  97. this.setData({
  98. page: 1
  99. })
  100. let params = {
  101. current: this.data.page,
  102. size: this.data.limit,
  103. signFlag:'1',
  104. licensePlate:this.data.searchVal
  105. }
  106. app.request.pageFirst({
  107. url: app.API.sendGoodsList,
  108. page: this,
  109. params: params,
  110. })
  111. },
  112. //页面跳转
  113. toLink: function (e) {
  114. let { url } = e.currentTarget.dataset
  115. wx.navigateTo({
  116. url: url
  117. })
  118. },
  119. // 审核S
  120. showPopup(e) {
  121. let { id } = e.currentTarget.dataset
  122. this.setData({
  123. show: true,
  124. auditReason: '',
  125. id: id
  126. });
  127. },
  128. onClose() {
  129. this.setData({
  130. show: false,
  131. auditFlag:'false',
  132. auditReason:'',
  133. id: ''
  134. });
  135. },
  136. // 单选
  137. dangerStatusChange: function (e) {
  138. this.setData({
  139. [e.currentTarget.dataset.radiotype]: e.detail.value
  140. })
  141. },
  142. //审核
  143. formSubmit: function (e) {
  144. let formData = e.detail.value;
  145. var warn = ""; //弹框时提示的内容
  146. if (formData.auditFlag == '') {
  147. warn = "选择审核结果!";
  148. } else if (formData.auditFlag == 'false' && formData.auditReason == '') {
  149. warn = "审核不通过时备注不能为空!";
  150. }
  151. formData.auditFlag = formData.auditFlag=='true'
  152. if (warn != '') {
  153. app.util.checkForm(warn);
  154. } else {
  155. app.request.POST({
  156. url: app.API.auditRecord,
  157. params: formData,
  158. page: this,
  159. isLoadingTxt: '审核中...',
  160. successFun: true
  161. }).then(res => {
  162. wx.showToast({
  163. title: '审核成功',
  164. icon: 'success',
  165. duration: 1000,
  166. mask: true
  167. })
  168. this.onClose()
  169. this.getListFun(); //刷新列表
  170. })
  171. }
  172. },
  173. // 审核E
  174. /**
  175. * 生命周期函数--监听页面隐藏
  176. */
  177. onHide() {
  178. },
  179. /**
  180. * 生命周期函数--监听页面卸载
  181. */
  182. onUnload() {
  183. },
  184. /**
  185. * 页面相关事件处理函数--监听用户下拉动作
  186. */
  187. onPullDownRefresh() {
  188. this.setData({
  189. searchVal: ''
  190. })
  191. if (wx.getStorageSync('loginStatus')) {
  192. this.getListFun();
  193. } else {
  194. wx.stopPullDownRefresh();
  195. }
  196. },
  197. /**
  198. * 页面上拉触底事件的处理函数
  199. */
  200. onReachBottom() {
  201. this.data.page++;
  202. let params = {
  203. current: this.data.page,
  204. size: this.data.limit,
  205. signFlag:'1',
  206. licensePlate:this.data.searchVal
  207. }
  208. app.request.pageOther({
  209. url: app.API.sendGoodsList,
  210. page: this,
  211. params: params,
  212. loadType: true //加载类型,是否是下拉加载
  213. });
  214. },
  215. /**
  216. * 用户点击右上角分享
  217. */
  218. onShareAppMessage() {
  219. }
  220. })