communityMembers.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. // lionfish_comshop/pages/groupCenter/communityMembers.js
  2. var page = 1;
  3. var app = getApp();
  4. var util = require('../../utils/util.js');
  5. var timeFormat = require("../../utils/timeFormat");
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. isCalling: false,
  12. queryData: {
  13. createTime: null,
  14. communityId: null,
  15. order: [],
  16. page: page,
  17. pageSize: 20
  18. },
  19. maxDate: (0, timeFormat.formatYMD)(new Date()),
  20. searchKey: "",
  21. date: "",
  22. containerHeight: 0,
  23. showLoadMore: false,
  24. no_order: 0,
  25. page: 1,
  26. hide_tip: true,
  27. order: [],
  28. tip: '正在加载',
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad: function(options) {
  34. var sysInfo = wx.getSystemInfoSync();
  35. this.setData({
  36. containerHeight: sysInfo.windowHeight - Math.round(sysInfo.windowWidth / 375 * 125)
  37. });
  38. page = 1;
  39. this.data.queryData.communityId = app.globalData.disUserInfo.communityId;
  40. this.data.queryData.createTime = null;
  41. this.getData();
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function() {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow: function() {
  52. var is_show_on = this.data.is_show_on;
  53. if (is_show_on > 0) {
  54. this.setData({
  55. page: 1,
  56. order: []
  57. })
  58. this.getData();
  59. } else {
  60. this.setData({
  61. is_show_on: is_show_on + 1
  62. })
  63. }
  64. },
  65. /**
  66. * 生命周期函数--监听页面隐藏
  67. */
  68. onHide: function() {
  69. },
  70. /**
  71. * 获取数据
  72. */
  73. getData: function() {
  74. wx.showLoading({
  75. title: "加载中...",
  76. mask: true
  77. });
  78. this.setData({
  79. isHideLoadMore: true
  80. })
  81. this.data.no_order = 1
  82. let that = this;
  83. var token = wx.getStorageSync('token');
  84. //currentTab
  85. app.util.request({
  86. 'url': 'entry/wxapp/index',
  87. 'data': {
  88. controller: 'community.get_community_member_orderlist',
  89. date: that.data.date,
  90. searchKey: that.data.searchKey,
  91. token: token,
  92. page: that.data.page
  93. },
  94. dataType: 'json',
  95. success: function(res) {
  96. if (res.data.code == 0) {
  97. console.log(that.data.page);
  98. let rushList = that.data.order.concat(res.data.data);
  99. that.setData({
  100. order: rushList,
  101. hide_tip: true,
  102. no_order: 0
  103. });
  104. wx.hideLoading();
  105. } else {
  106. that.setData({
  107. isHideLoadMore: true
  108. })
  109. wx.hideLoading();
  110. return false;
  111. }
  112. }
  113. })
  114. },
  115. /**
  116. * 获取时间
  117. */
  118. getTodayMs: function() {
  119. var t = new Date();
  120. return t.setHours(0), t.setMinutes(0), t.setSeconds(0), t.setMilliseconds(0), Date.parse(t);
  121. },
  122. /**
  123. * 监控输入框
  124. */
  125. bindSearchChange: function(e) {
  126. this.setData({
  127. searchKey: e.detail.value
  128. });
  129. },
  130. /**
  131. * 搜索
  132. */
  133. searchByKey: function() {
  134. page = 1;
  135. this.setData({
  136. order: [],
  137. no_order: 0,
  138. page: 1
  139. });
  140. this.data.queryData.memberNickName = this.data.searchKey;
  141. this.getData();
  142. },
  143. /**
  144. * 取消
  145. */
  146. cancel: function() {
  147. page = 1;
  148. this.setData({
  149. searchKey: "",
  150. order: []
  151. });
  152. this.data.queryData.memberNickName = null;
  153. this.getData();
  154. },
  155. /**
  156. * 监控日期
  157. */
  158. bindDateChange: function(e) {
  159. page = 1;
  160. this.setData({
  161. date: e.detail.value,
  162. order: [],
  163. no_order: 0,
  164. page: 1
  165. });
  166. this.data.queryData.createTime = new Date(e.detail.value).getTime() - 28800000;
  167. this.getData();
  168. },
  169. /**
  170. * 清除日期
  171. */
  172. clearDate: function() {
  173. page = 1;
  174. this.setData({
  175. date: "",
  176. order: [],
  177. no_order: 0,
  178. page: 1
  179. });
  180. this.data.queryData.createTime = null;
  181. this.getData();
  182. },
  183. /**
  184. * 拨打电话
  185. */
  186. callTelphone: function(e) {
  187. var that = this;
  188. var phoneNumber = e.currentTarget.dataset.phone;
  189. if (phoneNumber!="未下单"){
  190. this.data.isCalling || (this.data.isCalling = true, wx.makePhoneCall({
  191. phoneNumber: phoneNumber,
  192. complete: function() {
  193. that.data.isCalling = false;
  194. }
  195. }));
  196. }
  197. },
  198. /**
  199. * 获取更多
  200. */
  201. getMore: function() {
  202. console.log(222);
  203. if (this.data.no_order == 1) return false;
  204. this.data.page += 1;
  205. this.getData();
  206. this.setData({
  207. isHideLoadMore: false
  208. })
  209. },
  210. /**
  211. * 生命周期函数--监听页面卸载
  212. */
  213. onUnload: function() {
  214. },
  215. /**
  216. * 页面相关事件处理函数--监听用户下拉动作
  217. */
  218. onPullDownRefresh: function() {
  219. },
  220. /**
  221. * 页面上拉触底事件的处理函数
  222. */
  223. onReachBottom: function() {
  224. }
  225. })