index.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. lifetimes: {
  23. attached: function () {
  24. getApp().globalData.Language.getLanguagePackage(this)
  25. }
  26. },
  27. methods: {
  28. getList(id, init) {
  29. let content = this.data.content;
  30. content.sa_customersid = id;
  31. if (init) {
  32. content.pageNumber = 1
  33. content.pageTotal = 1
  34. }
  35. _Http.basic({
  36. "id": "20221208163302",
  37. content
  38. }).then(res => {
  39. console.log("线索列表", res)
  40. if (res.code != '1') return wx.showToast({
  41. title: res.data,
  42. icon: "none"
  43. })
  44. this.setData({
  45. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  46. "content.pageNumber": res.pageNumber + 1,
  47. "content.pageSize": res.pageSize,
  48. "content.pageTotal": res.pageTotal,
  49. "content.total": res.total,
  50. sa_customersid: id
  51. })
  52. this.getTags()
  53. })
  54. },
  55. /* 获取列表标签 */
  56. getTags() {
  57. let list = this.data.list,
  58. ownerids = list.map(v => v.sat_orderclueid);
  59. _Http.basic({
  60. "id": 20221018102001,
  61. "content": {
  62. nocache: true,
  63. "ownertable": "sat_orderclue",
  64. ownerids
  65. }
  66. }).then(res => {
  67. console.log("标签", res)
  68. for (let key in res.data) {
  69. let index = list.findIndex(v => v.sat_orderclueid == key);
  70. list[index].tags = res.data[key]
  71. };
  72. this.setData({
  73. list
  74. })
  75. })
  76. },
  77. /* 修改总数 */
  78. changeTotal() {
  79. this.setData({
  80. "content.total": this.data.content.total - 1
  81. })
  82. },
  83. toAdd(e) {
  84. let data = getCurrentPages()[getCurrentPages().length - 1].data.detail;
  85. wx.navigateTo({
  86. url: '/packageA/saleClue/addClue?rowData=' + JSON.stringify({
  87. enterprisename: data.enterprisename || "",
  88. city: data.city || "",
  89. county: data.county || "",
  90. province: data.province || "",
  91. address: data.address || "",
  92. cluesource: getApp().globalData.Language.getMapText('客户') + ":" + data.enterprisename || "",
  93. sa_customersid: data.sa_customersid
  94. }),
  95. });
  96. }
  97. }
  98. })