client.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. const _Http = getApp().globalData.http;
  2. import {
  3. getTypes
  4. } from "./query";
  5. Component({
  6. options: {
  7. addGlobalClass: true,
  8. },
  9. properties: {
  10. update: {
  11. type: Function
  12. }
  13. },
  14. lifetimes: {
  15. attached: function () {
  16. getApp().globalData.Language.getLanguagePackage(this)
  17. this.data.organization = this.selectComponent("#organization");
  18. this.data.organization.initDepAndUser().then(active => {
  19. let userid = active.userid || wx.getStorageSync("userMsg").userid;
  20. this.setData({
  21. "content.dataid": userid,
  22. userid,
  23. })
  24. this.triggerEvent('update', "Client")
  25. });
  26. this.setFiltratelist();
  27. }
  28. },
  29. data: {
  30. list: [],
  31. filtratelist: [],
  32. total: null,
  33. searchShow: false,
  34. searchValue: "",
  35. showFiltrate: false,
  36. "content": {
  37. "pageNumber": 1,
  38. "pageSize": 20,
  39. "type": 0, // 1 按部门 0 按人员
  40. "dataid": 0, // 人员或部门数据id
  41. "where": {
  42. "condition": "",
  43. "tag": "",
  44. "status": "",
  45. "type": "",
  46. "tradingstatus": "",
  47. "begindate": "",
  48. "enddate": ""
  49. }
  50. }
  51. },
  52. methods: {
  53. async setFiltratelist() {
  54. let filtratelist = [{
  55. label: "医院类型",
  56. index: null,
  57. showName: "value", //显示字段
  58. valueKey: "type", //返回Key
  59. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  60. value: "", //选中值
  61. list: await getTypes('customertypemx')
  62. }, {
  63. label: "标签",
  64. index: null,
  65. type: "checkbox",
  66. showName: "tag", //显示字段
  67. valueKey: "tag", //返回Key
  68. selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
  69. value: "", //选中值
  70. list: await getTypes('tags')
  71. }, {
  72. label: "合作状态",
  73. index: null,
  74. showName: "value", //显示字段
  75. valueKey: "status", //返回Key
  76. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  77. value: "", //选中值
  78. list: [{
  79. value: "潜在"
  80. }, {
  81. value: "合作中"
  82. }, {
  83. value: "已终止"
  84. }, {
  85. value: "暂缓"
  86. }]
  87. }, {
  88. label: "成交状态",
  89. index: null,
  90. showName: "value", //显示字段
  91. valueKey: "tradingstatus", //返回Key
  92. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  93. value: "", //选中值
  94. list: [{
  95. value: "未成交"
  96. }, {
  97. value: "已成交"
  98. }, {
  99. value: "多次成交"
  100. }]
  101. }]
  102. this.setData({
  103. filtratelist
  104. })
  105. },
  106. getList(init = false) {
  107. _Http.init(this.data.content, init).then(content => {
  108. _Http.basic({
  109. "id": 20230713132804,
  110. content
  111. }).then(res => {
  112. console.log("客户画像", res)
  113. this.selectComponent('#ListBox').automaticSetHei();
  114. this.selectComponent('#ListBox').RefreshToComplete();
  115. if (res.code != '1') return wx.showToast({
  116. title: res.data,
  117. icon: "none"
  118. })
  119. this.setData({
  120. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  121. "content.pageNumber": res.pageNumber + 1,
  122. "content.pageSize": res.pageSize,
  123. "content.pageTotal": res.pageTotal,
  124. "total": res.total,
  125. })
  126. })
  127. })
  128. },
  129. handleFilter({
  130. detail
  131. }) {
  132. if (!detail.name) return;
  133. let content = this.data.content,
  134. organization = this.data.organization;
  135. if (detail.name == "reset") {
  136. organization.setData({
  137. isleave: 1
  138. })
  139. organization.initDepAndUser()
  140. content.type = 0;
  141. content.dataid = this.data.userid;
  142. content.where = {
  143. "condition": content.where.condition || '',
  144. "type": "",
  145. "tag": "",
  146. "status": "",
  147. "tradingstatus": "",
  148. "begindate": "",
  149. "enddate": ""
  150. }
  151. } else if (detail.name == "confirm") {
  152. const res = organization.data.result
  153. content.type = res.sa_saleareaid ? 1 : 0;
  154. content.dataid = res.sa_saleareaid || res.userid;
  155. content.where = {
  156. "condition": content.where.condition || '',
  157. "type": detail.type || '',
  158. "tag": detail.tag || '',
  159. "status": detail.status || '',
  160. "tradingstatus": detail.tradingstatus || '',
  161. "begindate": detail.startdate || '',
  162. "enddate": detail.enddate || ''
  163. }
  164. }
  165. this.setData({
  166. content
  167. });
  168. this.getList(true);
  169. },
  170. changeSearchShow() {
  171. this.setData({
  172. searchShow: !this.data.searchShow
  173. })
  174. setTimeout(() => {
  175. this.selectComponent('#ListBox').automaticSetHei();
  176. if (this.data.searchShow) {
  177. if (this.selectComponent("#Yl_Filtrate1").data.show) return
  178. this.setData({
  179. focus: true
  180. })
  181. } else {
  182. this.setData({
  183. focus: false
  184. })
  185. }
  186. }, 350)
  187. },
  188. onSearch() {
  189. this.data.content.where.condition = this.data.searchValue;
  190. this.getList(true);
  191. },
  192. onChange(event) {
  193. this.setData({
  194. searchValue: event.detail
  195. })
  196. },
  197. onClear() {
  198. this.setData({
  199. searchValue: "",
  200. "content.where.condition": ""
  201. })
  202. this.getList(true);
  203. },
  204. }
  205. })