dataOverview.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. options: {
  4. addGlobalClass: true,
  5. },
  6. properties: {
  7. update: {
  8. type: Function
  9. }
  10. },
  11. lifetimes: {
  12. attached: function () {
  13. getApp().globalData.Language.getLanguagePackage(this)
  14. this.triggerEvent('update', "Clue")
  15. this.setData({
  16. dates: this.data.dates.map(v => {
  17. v.name = getApp().globalData.Language.getMapText(v.value);
  18. v.color = v.value == this.data.content.dateType ? "#3874F6" : "";
  19. return v
  20. })
  21. })
  22. }
  23. },
  24. data: {
  25. "content": {
  26. dateType: "本年",
  27. dataid: wx.getStorageSync('userMsg').userid,
  28. username: wx.getStorageSync('userMsg').name,
  29. "where": {
  30. isleave: "1"
  31. }
  32. },
  33. detaShow: false,
  34. dates: [{
  35. value: "全部"
  36. }, {
  37. value: "本年"
  38. }, {
  39. value: "本季"
  40. }, {
  41. value: "本月"
  42. }, {
  43. value: "去年"
  44. }, ],
  45. },
  46. methods: {
  47. getList(init = false) {
  48. let content = this.data.content
  49. const {
  50. dataid,
  51. type,
  52. username,
  53. isleave
  54. } = getCurrentPages()[getCurrentPages().length - 1].data;
  55. if (content.dataid != dataid || content.type != type || isleave != isleave) init = true
  56. content.dataid = dataid;
  57. content.type = type;
  58. content.username = username;
  59. content.where.isleave = isleave;
  60. _Http.basic({
  61. "id": 20231014114204,
  62. content
  63. }).then(res => {
  64. console.log("线索数据概况", res)
  65. this.selectComponent('#ListBox').RefreshToComplete();
  66. if (res.code != '1') return wx.showToast({
  67. title: res.msg,
  68. icon: "none"
  69. })
  70. const getMapText = getApp().globalData.Language.getMapText;
  71. let list = [{
  72. title: '线索总数',
  73. value: res.data.total,
  74. tips: getMapText('线索总数:包含待分配、已分配线索数。'),
  75. link: true
  76. },
  77. {
  78. title: '待分配未过期线索数',
  79. value: res.data.dfp,
  80. tips: getMapText('待分配未过期线索数:所有线索中,待分配未过期的线索数量。'),
  81. link: true
  82. },
  83. {
  84. title: '待跟进线索数',
  85. value: res.data.dgj,
  86. tips: getMapText('待跟进线索数:销售线索应用中,已分配给业务员,待跟进状态的线索数量。'),
  87. link: true
  88. },
  89. {
  90. title: '跟进中线索数',
  91. value: res.data.gjz,
  92. tips: getMapText('跟进中线索数:销售线索应用中,已分配给业务员,跟进中状态的线索数量。'),
  93. link: true
  94. },
  95. {
  96. title: '已转化线索数',
  97. value: res.data.yzh,
  98. tips: getMapText("①已转化线索数:销售线索应用中,已分配给业务员,已转化状态的线索数量。") + '\n\n' + getMapText('②一条线索可进行两次转化:转化客户、转化项目,因此,已转化线索数≠转化客户线索数+转化项目线索数。'),
  99. link: true
  100. },
  101. {
  102. title: '已无效线索数',
  103. value: res.data.ywx,
  104. tips: getMapText("已无效线索数:销售线索应用中,已分配给业务员,已无效状态的线索数量。"),
  105. link: true
  106. },
  107. {
  108. title: '待分配已过期线索数',
  109. value: res.data.ygq,
  110. tips: getMapText('待分配已过期线索数:所有线索中,待分配已过期的线索数量。'),
  111. link: true
  112. },
  113. {
  114. title: '过期比例',
  115. value: Math.round(((res.data.gqbl * 100) * 100) / 100) + '%',
  116. tips: getMapText('过期比例=已过期线索数÷待分配线索数×100%'),
  117. link: false
  118. },
  119. {
  120. title: '转化客户线索数',
  121. value: res.data.covercusomers,
  122. tips: getMapText('转化客户线索数:统计有转化客户操作的线索数'),
  123. link: true
  124. },
  125. {
  126. title: '转化项目线索数',
  127. value: res.data.coverproject,
  128. tips: getMapText('转化客户线索数:统计有转化项目操作的线索数'),
  129. link: true
  130. },
  131. {
  132. title: '线索转化率',
  133. value: Math.round(((res.data.zhl * 100) * 100) / 100) + '%',
  134. tips: getMapText('线索转化率=已转化线索数÷线索总数×100%'),
  135. link: false
  136. },
  137. {
  138. title: '线索成交数',
  139. value: res.data.dealqty,
  140. tips: getMapText('线索成交数:转化后有下订单的线索数量'),
  141. link: true
  142. },
  143. {
  144. title: '线索成交率',
  145. value: Math.round(((res.data.cjl * 100) * 100) / 100) + '%',
  146. tips: getMapText('线索成交率=转化后有下订单的线索数÷线索总数×100%'),
  147. link: false
  148. },
  149. {
  150. title: '参与线索数',
  151. value: res.data.joinordercluesize,
  152. tips: getMapText('参与线索数:参与的并且至少有一次跟进的线索数量'),
  153. link: true
  154. },
  155. {
  156. title: '参与线索转化数',
  157. value: res.data.joincoverorderclue,
  158. tips: getMapText('参与线索转化数:参与的并且至少有一次跟进的有发生转化的线索数量'),
  159. link: true
  160. },
  161. {
  162. title: '参与线索转化率',
  163. value: Math.round(((res.data.joinordercluezhl * 100) * 100) / 100) + '%',
  164. tips: getMapText('参与线索转化率=参与线索转化数 ÷ 参与线索数 ×100%'),
  165. link: false
  166. },
  167. {
  168. title: '参与线索成交数',
  169. value: res.data.joindealorderclue,
  170. tips: getMapText('参与线索成交数:参与的并且至少有一次跟进的转化后有下订单的线索数量'),
  171. link: true
  172. },
  173. {
  174. title: '参与线索成交率',
  175. value: Math.round(((res.data.joinordercluecjl * 100) * 100) / 100) + '%',
  176. tips: getMapText('参与线索成交率=参与线索成交率 ÷ 参与线索数 ×100%'),
  177. link: false
  178. },
  179. ]
  180. this.setData({
  181. list,
  182. })
  183. this.onCancel()
  184. })
  185. },
  186. openDateType() {
  187. this.setData({
  188. detaShow: true
  189. })
  190. },
  191. dateOnSelect(event) {
  192. const {
  193. value
  194. } = event.detail;
  195. if (this.data.content.dateType == value) return this.onCancel();
  196. this.setData({
  197. "content.dateType": value,
  198. dates: this.data.dates.map(item => {
  199. item.color = item.value == value ? "#3874F6" : "";
  200. item.loading = item.value == value ? true : false;
  201. return item
  202. }),
  203. })
  204. this.getList(true)
  205. },
  206. onCancel() {
  207. this.setData({
  208. actionShow: false,
  209. detaShow: false,
  210. list: this.data.list.map(item => {
  211. item.loading = false;
  212. return item
  213. }),
  214. dates: this.data.dates.map(item => {
  215. item.loading = false;
  216. return item
  217. })
  218. })
  219. },
  220. }
  221. })