distributionList.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. // lionfish_comshop/pages/groupCenter/distributionList.js
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. currentTab: 0,
  9. pageSize: 10,
  10. navList: [{
  11. name: "全部",
  12. status: "0"
  13. }, {
  14. name: "待确认",
  15. status: "1"
  16. }, {
  17. name: "已确认",
  18. status: "2"
  19. },
  20. {
  21. name: "无效",
  22. status: "3"
  23. }
  24. ],
  25. distributionList: [],
  26. loadText: "没有更多记录了~",
  27. containerHeight: 0,
  28. chooseDate: "",
  29. chooseDateTime: "",
  30. data: "",
  31. estimate: "",
  32. permoney: 0,
  33. communnityId: "",
  34. loadText: "",
  35. disUserId: "",
  36. no_order: 0,
  37. page: 1,
  38. hide_tip: true,
  39. order: [],
  40. tip: '正在加载',
  41. },
  42. /**
  43. * 生命周期函数--监听页面加载
  44. */
  45. onLoad: function(options) {
  46. var sysInfo = wx.getSystemInfoSync();
  47. this.setData({
  48. containerHeight: sysInfo.windowHeight - Math.round(sysInfo.windowHeight / 375 * 55)
  49. });
  50. },
  51. /**
  52. * 生命周期函数--监听页面初次渲染完成
  53. */
  54. onReady: function() {
  55. },
  56. /**
  57. * 生命周期函数--监听页面显示
  58. */
  59. onShow: function() {
  60. var dayTime = new Date(),
  61. year = dayTime.getFullYear(),
  62. mon = dayTime.getMonth() + 1,
  63. dateTime = Date.parse(dayTime);
  64. this.setData({
  65. page: 1,
  66. order: [],
  67. chooseDate: year + "年" + mon + "月",
  68. chooseDateTime: dateTime
  69. }), this.getData();
  70. this.get_month_money();
  71. },
  72. get_month_money: function() {
  73. var chooseDate = this.data.chooseDate;
  74. var that = this;
  75. var token = wx.getStorageSync('token');
  76. app.util.request({
  77. 'url': 'entry/wxapp/index',
  78. 'data': {
  79. controller: 'order.order_commission',
  80. token: token,
  81. chooseDate: chooseDate
  82. },
  83. method: 'post',
  84. dataType: 'json',
  85. success: function(res) {
  86. if (res.data.code == 0) {
  87. that.setData({
  88. permoney: res.data.money
  89. })
  90. } else {
  91. that.setData({
  92. permoney: 0
  93. })
  94. }
  95. }
  96. })
  97. },
  98. /**
  99. * 获取数据
  100. */
  101. getData: function() {
  102. wx.showLoading({
  103. title: "加载中...",
  104. mask: true
  105. });
  106. this.setData({
  107. isHideLoadMore: true
  108. })
  109. this.data.no_order = 1
  110. let that = this;
  111. var chooseDate = this.data.chooseDate;
  112. var token = wx.getStorageSync('token');
  113. var currentTab = this.data.currentTab;
  114. var order_status = -1;
  115. if (currentTab == 0) {
  116. order_status = -1;
  117. } else if (currentTab == 1) {
  118. order_status = 22;
  119. } else if (currentTab == 2) {
  120. order_status = 6;
  121. } else if (currentTab == 3) {
  122. order_status = 357;
  123. }
  124. //currentTab
  125. app.util.request({
  126. 'url': 'entry/wxapp/index',
  127. 'data': {
  128. controller: 'order.orderlist',
  129. is_tuanz: 1,
  130. token: token,
  131. chooseDate: chooseDate,
  132. page: that.data.page,
  133. order_status: order_status
  134. },
  135. method: 'post',
  136. dataType: 'json',
  137. success: function(res) {
  138. if (res.data.code == 0) {
  139. console.log(that.data.page);
  140. let data = res.data.data;
  141. let rushList = that.data.order.concat(data);
  142. that.setData({
  143. order: rushList,
  144. hide_tip: true,
  145. 'no_order': 0
  146. });
  147. wx.hideLoading();
  148. } else {
  149. that.setData({
  150. isHideLoadMore: true
  151. })
  152. wx.hideLoading();
  153. return false;
  154. }
  155. }
  156. })
  157. },
  158. /**
  159. * 刷新
  160. */
  161. refresh: function() {
  162. this.setData({
  163. page: 1,
  164. order: [],
  165. }, ()=>{
  166. this.getData();
  167. });
  168. },
  169. /**
  170. * 生命周期函数--监听页面隐藏
  171. */
  172. onHide: function() {
  173. },
  174. bindChange: function(t) {
  175. this.setData({
  176. currentTab: 1 * t.detail.current
  177. });
  178. this.setData({
  179. order: [],
  180. page: 1,
  181. no_order: 0
  182. }, () => {
  183. console.log('我变啦');
  184. this.getData();
  185. })
  186. },
  187. /**
  188. * 切换导航
  189. */
  190. switchNav: function(e) {
  191. if (this.data.currentTab === 1 * e.target.dataset.current) return false;
  192. this.setData({
  193. currentTab: 1 * e.target.dataset.current
  194. });
  195. },
  196. /**
  197. * 生命周期函数--监听页面卸载
  198. */
  199. onUnload: function() {
  200. },
  201. /**
  202. * 页面相关事件处理函数--监听用户下拉动作
  203. */
  204. onPullDownRefresh: function() {
  205. this.getData();
  206. },
  207. /**
  208. * 监控日期改变
  209. */
  210. bindDateChange: function(t) {
  211. console.log("picker发送选择改变,携带值为", t.detail.value), this.setData({
  212. date: t.detail.value
  213. });
  214. var a = this.data.date.split("-"),
  215. e = Date.parse(this.data.date);
  216. this.setData({
  217. chooseDate: a[0] + "年" + a[1] + "月",
  218. chooseDateTime: e,
  219. order: [],
  220. page: 1,
  221. no_order: 0
  222. }), this.getData();
  223. this.get_month_money();
  224. },
  225. getCurrentList: function() {
  226. console.log(this.data.no_order);
  227. if (this.data.no_order == 1) return false;
  228. this.data.page += 1;
  229. this.getData();
  230. this.setData({
  231. isHideLoadMore: false
  232. })
  233. },
  234. /**
  235. * 页面上拉触底事件的处理函数
  236. */
  237. onReachBottom: function() {
  238. console.log(this.data.no_order);
  239. if (this.data.no_order == 1) return false;
  240. this.data.page += 1;
  241. this.getData();
  242. this.setData({
  243. isHideLoadMore: false
  244. })
  245. },
  246. /**
  247. * 用户点击右上角分享
  248. */
  249. onShareAppMessage: function() {
  250. }
  251. })