dataOverview.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. if (res.code != '1') return wx.showToast({
  66. title: res.msg,
  67. icon: "none"
  68. })
  69. const getMapText = getApp().globalData.Language.getMapText;
  70. let list = [{
  71. title: '线索总数',
  72. value: res.data.total,
  73. tips: getMapText('线索总数:包含待分配、已分配线索数。'),
  74. link: true
  75. },
  76. {
  77. title: '待分配未过期线索数',
  78. value: res.data.dfp,
  79. tips: getMapText('待分配未过期线索数:所有线索中,待分配未过期的线索数量。'),
  80. link: true
  81. },
  82. {
  83. title: '待跟进线索数',
  84. value: res.data.dgj,
  85. tips: getMapText('待跟进线索数:销售线索应用中,已分配给业务员,待跟进状态的线索数量。'),
  86. link: true
  87. },
  88. {
  89. title: '跟进中线索数',
  90. value: res.data.gjz,
  91. tips: getMapText('跟进中线索数:销售线索应用中,已分配给业务员,跟进中状态的线索数量。'),
  92. link: true
  93. },
  94. {
  95. title: '已转化线索数',
  96. value: res.data.yzh,
  97. tips: getMapText("①已转化线索数:销售线索应用中,已分配给业务员,已转化状态的线索数量。") + '\n\n' + getMapText('②一条线索可进行两次转化:转化客户、转化项目,因此,已转化线索数≠转化客户线索数+转化项目线索数。'),
  98. link: true
  99. },
  100. {
  101. title: '已无效线索数',
  102. value: res.data.ywx,
  103. tips: getMapText("已无效线索数:销售线索应用中,已分配给业务员,已无效状态的线索数量。"),
  104. link: true
  105. },
  106. {
  107. title: '待分配已过期线索数',
  108. value: res.data.ygq,
  109. tips: getMapText('待分配已过期线索数:所有线索中,待分配已过期的线索数量。'),
  110. link: true
  111. },
  112. {
  113. title: '过期比例',
  114. value: Math.round(((res.data.gqbl * 100) * 100) / 100) + '%',
  115. tips: getMapText('过期比例=已过期线索数÷待分配线索数×100%'),
  116. link: false
  117. },
  118. {
  119. title: '转化客户线索数',
  120. value: res.data.covercusomers,
  121. tips: getMapText('转化客户线索数:统计有转化客户操作的线索数'),
  122. link: true
  123. },
  124. {
  125. title: '转化项目线索数',
  126. value: res.data.coverproject,
  127. tips: getMapText('转化客户线索数:统计有转化项目操作的线索数'),
  128. link: true
  129. },
  130. {
  131. title: '线索转化率',
  132. value: Math.round(((res.data.zhl * 100) * 100) / 100) + '%',
  133. tips: getMapText('线索转化率=已转化线索数÷线索总数×100%'),
  134. link: false
  135. },
  136. {
  137. title: '线索成交数',
  138. value: res.data.dealqty,
  139. tips: getMapText('线索成交数:转化后有下订单的线索数量'),
  140. link: true
  141. },
  142. {
  143. title: '线索成交率',
  144. value: Math.round(((res.data.cjl * 100) * 100) / 100) + '%',
  145. tips: getMapText('线索成交率=转化后有下订单的线索数÷线索总数×100%'),
  146. link: false
  147. },
  148. {
  149. title: '参与线索数',
  150. value: res.data.joinordercluesize,
  151. tips: getMapText('参与线索数:参与的并且至少有一次跟进的线索数量'),
  152. link: true
  153. },
  154. {
  155. title: '参与线索转化数',
  156. value: res.data.joincoverorderclue,
  157. tips: getMapText('参与线索转化数:参与的并且至少有一次跟进的有发生转化的线索数量'),
  158. link: true
  159. },
  160. {
  161. title: '参与线索转化率',
  162. value: Math.round(((res.data.joinordercluezhl * 100) * 100) / 100) + '%',
  163. tips: getMapText('参与线索转化率=参与线索转化数 ÷ 参与线索数 ×100%'),
  164. link: false
  165. },
  166. {
  167. title: '参与线索成交数',
  168. value: res.data.joindealorderclue,
  169. tips: getMapText('参与线索成交数:参与的并且至少有一次跟进的转化后有下订单的线索数量'),
  170. link: true
  171. },
  172. {
  173. title: '参与线索成交率',
  174. value: Math.round(((res.data.joinordercluecjl * 100) * 100) / 100) + '%',
  175. tips: getMapText('参与线索成交率=参与线索成交率 ÷ 参与线索数 ×100%'),
  176. link: false
  177. },
  178. ]
  179. this.setData({
  180. list,
  181. })
  182. this.onCancel()
  183. })
  184. },
  185. showTips(e) {
  186. const {
  187. tips
  188. } = e.currentTarget.dataset;
  189. wx.showModal({
  190. content: tips,
  191. showCancel: false,
  192. confirmText: getApp().globalData.Language.getMapText('确定'),
  193. })
  194. },
  195. toDetail(e) {
  196. const {
  197. item
  198. } = e.currentTarget.dataset;
  199. },
  200. openDateType() {
  201. this.setData({
  202. detaShow: true
  203. })
  204. },
  205. dateOnSelect(event) {
  206. const {
  207. value
  208. } = event.detail;
  209. if (this.data.content.dateType == value) return this.onCancel();
  210. this.setData({
  211. "content.dateType": value,
  212. dates: this.data.dates.map(item => {
  213. item.color = item.value == value ? "#3874F6" : "";
  214. item.loading = item.value == value ? true : false;
  215. return item
  216. }),
  217. })
  218. this.getList(true)
  219. },
  220. onCancel() {
  221. this.setData({
  222. actionShow: false,
  223. detaShow: false,
  224. list: this.data.list.map(item => {
  225. item.loading = false;
  226. return item
  227. }),
  228. dates: this.data.dates.map(item => {
  229. item.loading = false;
  230. return item
  231. })
  232. })
  233. },
  234. }
  235. })