contacts.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. content: {
  5. nocache: true,
  6. pageNumber: 1,
  7. pageSize: 20,
  8. ownertable: "",
  9. ownerid: "",
  10. pageTotal: 1,
  11. total: 0,
  12. where: {
  13. "condition": "",
  14. }
  15. },
  16. list: [],
  17. },
  18. getList(init = false) {
  19. _Http.init(this.data.content, init).then(content => {
  20. try {
  21. content.phonenumber = getCurrentPages()[getCurrentPages().length - 2].selectComponent("#Form").query().phonenumber || '';
  22. } catch (error) {
  23. }
  24. _Http.basic({
  25. "id": 20240531152004,
  26. content
  27. }).then(res => {
  28. this.selectComponent('#ListBox').RefreshToComplete();
  29. console.log("通讯录列表", res)
  30. if (res.code != '1') return wx.showToast({
  31. title: res.data,
  32. icon: "none"
  33. });
  34. this.setData({
  35. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  36. content: _Http.paging(content, res),
  37. })
  38. })
  39. })
  40. },
  41. onLoad(options) {
  42. this.getList();
  43. getApp().globalData.Language.getLanguagePackage(this, '选择联系人');
  44. },
  45. onClick(e) {
  46. const {
  47. item
  48. } = e.currentTarget.dataset;
  49. getApp().globalData.handleSelect(item)
  50. },
  51. onSearch({
  52. detail
  53. }) {
  54. this.setData({
  55. 'content.where.condition': detail ? detail : ""
  56. });
  57. this.getList(true);
  58. },
  59. onClear() {
  60. this.setData({
  61. 'content.where.condition': ""
  62. });
  63. this.getList(true);
  64. },
  65. })