index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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:true,
  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. /*wx.navigateTo({
  128. url: '/pages/appointment/review?id='+e.currentTarget.dataset.id
  129. })*/
  130. },
  131. onClose() {
  132. this.setData({
  133. show: false,
  134. auditFlag:'false',
  135. auditReason:'',
  136. id: ''
  137. });
  138. },
  139. // 单选
  140. dangerStatusChange: function (e) {
  141. this.setData({
  142. [e.currentTarget.dataset.radiotype]: e.detail.value
  143. })
  144. if (e.detail.value == 'false') {
  145. this.setData({
  146. auditReason: ''
  147. })
  148. }
  149. },
  150. //审核
  151. formSubmit: function (e) {
  152. let formData = e.detail.value;
  153. var warn = ""; //弹框时提示的内容
  154. if (formData.auditFlag == '2' && formData.auditReason == '') {
  155. warn = "审核不通过时备注不能为空!";
  156. }
  157. formData.auditFlag = formData.auditFlag=='true'
  158. if (warn != '') {
  159. app.util.checkForm(warn);
  160. } else {
  161. app.request.POST({
  162. url: app.API.auditRecord,
  163. params: formData,
  164. page: this,
  165. isLoadingTxt: '审核中...',
  166. successFun: true
  167. }).then(res => {
  168. wx.showToast({
  169. title: '审核成功',
  170. icon: 'success',
  171. duration: 1000,
  172. mask: true
  173. })
  174. this.onClose()
  175. this.getListFun(); //刷新列表
  176. })
  177. }
  178. },
  179. // 审核E
  180. /**
  181. * 生命周期函数--监听页面隐藏
  182. */
  183. onHide() {
  184. },
  185. /**
  186. * 生命周期函数--监听页面卸载
  187. */
  188. onUnload() {
  189. },
  190. /**
  191. * 页面相关事件处理函数--监听用户下拉动作
  192. */
  193. onPullDownRefresh() {
  194. this.setData({
  195. searchVal: ''
  196. })
  197. if (wx.getStorageSync('loginStatus')) {
  198. this.getListFun();
  199. } else {
  200. wx.stopPullDownRefresh();
  201. }
  202. },
  203. /**
  204. * 页面上拉触底事件的处理函数
  205. */
  206. onReachBottom() {
  207. this.data.page++;
  208. let params = {
  209. current: this.data.page,
  210. size: this.data.limit,
  211. signFlag:'1',
  212. licensePlate:this.data.searchVal
  213. }
  214. app.request.pageOther({
  215. url: app.API.sendGoodsList,
  216. page: this,
  217. params: params,
  218. loadType: true //加载类型,是否是下拉加载
  219. });
  220. },
  221. /**
  222. * 用户点击右上角分享
  223. */
  224. onShareAppMessage() {
  225. }
  226. })