index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. disabled: {
  5. type: Boolean
  6. }
  7. },
  8. data: {
  9. list: [],
  10. sa_customersid: "",
  11. content: {
  12. "nacache": true,
  13. "pageNumber": 1,
  14. "pageSize": 10,
  15. "pageTotal": 1,
  16. "total": null,
  17. "where": {
  18. "condition": "",
  19. }
  20. },
  21. },
  22. methods: {
  23. getList(id, init) {
  24. let content = this.data.content;
  25. content.sa_customersid = id;
  26. if (init) {
  27. content.pageNumber = 1
  28. content.pageTotal = 1
  29. }
  30. _Http.basic({
  31. "id": "20221208163302",
  32. content
  33. }).then(res => {
  34. console.log("线索列表", res)
  35. if (res.msg != '成功') return wx.showToast({
  36. title: res.data,
  37. icon: "none"
  38. })
  39. this.setData({
  40. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  41. "content.pageNumber": res.pageNumber + 1,
  42. "content.pageSize": res.pageSize,
  43. "content.pageTotal": res.pageTotal,
  44. "content.total": res.total,
  45. sa_customersid: id
  46. })
  47. this.getTags()
  48. })
  49. },
  50. /* 获取列表标签 */
  51. getTags() {
  52. let list = this.data.list,
  53. ownerids = list.map(v => v.sat_orderclueid);
  54. _Http.basic({
  55. "id": 20221018102001,
  56. "content": {
  57. nocache: true,
  58. "ownertable": "sat_orderclue",
  59. ownerids
  60. }
  61. }).then(res => {
  62. console.log("标签", res)
  63. for (let key in res.data) {
  64. let index = list.findIndex(v => v.sat_orderclueid == key);
  65. list[index].tags = res.data[key]
  66. };
  67. this.setData({
  68. list
  69. })
  70. })
  71. },
  72. /* 修改总数 */
  73. changeTotal() {
  74. this.setData({
  75. "content.total": this.data.content.total - 1
  76. })
  77. },
  78. toAdd(e) {
  79. let data = getCurrentPages()[getCurrentPages().length - 1].data.detail;
  80. wx.navigateTo({
  81. url: '/packageA/saleClue/addClue?rowData=' + JSON.stringify({
  82. enterprisename: data.enterprisename || "",
  83. city: data.city || "",
  84. county: data.county || "",
  85. province: data.province || "",
  86. address: data.address || "",
  87. cluesource: "客户:" + data.enterprisename || "",
  88. sa_customersid: data.sa_customersid
  89. }),
  90. });
  91. }
  92. }
  93. })