search.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. content: {
  5. "type": 0,
  6. "pageNumber": 1,
  7. "pageSize": 20,
  8. "isExport": 0,
  9. "where": {
  10. "condition": "",
  11. "status": "", //状态
  12. "startdate": "",
  13. "enddate": ""
  14. },
  15. },
  16. list: []
  17. },
  18. onLoad(options) {
  19. this.getList();
  20. },
  21. /* 开始搜索 */
  22. startSearch({
  23. detail
  24. }) {
  25. this.setData({
  26. "content.where.condition": detail
  27. });
  28. this.getList(true);
  29. },
  30. onClear() {
  31. this.setData({
  32. "content.where.condition": ""
  33. });
  34. this.getList(true);
  35. },
  36. getList(init = false) {
  37. //init 用于初始化分页
  38. let content = this.data.content;
  39. if (init) content.pageNumber = 1;
  40. if (content.pageNumber > content.pageTotal) return;
  41. _Http.basic({
  42. "id": 20221012164402,
  43. content
  44. }).then(res => {
  45. console.log("搜索客户列表", res)
  46. if (res.msg != '成功') return wx.showToast({
  47. title: res.data,
  48. icon: "none"
  49. })
  50. // this.getTags(res.data.map(v => v.sys_enterpriseid));
  51. this.setData({
  52. 'content.pageNumber': res.pageNumber + 1,
  53. 'content.pageTotal': res.pageTotal,
  54. 'content.total': res.total,
  55. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  56. })
  57. })
  58. },
  59. onReachBottom() {
  60. this.getList();
  61. },
  62. })