dataOverview.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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.setData({
  15. dates: this.data.dates.map(v => {
  16. v.name = getApp().globalData.Language.getMapText(v.value);
  17. v.color = v.value == this.data.content.dateType ? "#3874F6" : "";
  18. return v
  19. }),
  20. "content.dataid": wx.getStorageSync('userMsg').userid,
  21. "content.username": wx.getStorageSync('userMsg').name,
  22. })
  23. }
  24. },
  25. data: {
  26. "content": {
  27. dateType: "本年",
  28. type: 0,
  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. value: "去年"
  46. }, ],
  47. },
  48. methods: {
  49. getList() {
  50. let content = this.data.content;
  51. const {
  52. dataid,
  53. type,
  54. username,
  55. isleave
  56. } = getCurrentPages()[getCurrentPages().length - 1].data;
  57. content.dataid = dataid;
  58. content.type = type;
  59. content.username = username;
  60. content.where.isleave = isleave;
  61. _Http.basic({
  62. "id": 20231014114204,
  63. content
  64. }).then(res => {
  65. console.log("线索数据概况", res)
  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. content
  183. })
  184. this.onCancel()
  185. })
  186. },
  187. showTips(e) {
  188. const {
  189. tips
  190. } = e.currentTarget.dataset;
  191. wx.showModal({
  192. content: tips,
  193. showCancel: false,
  194. confirmText: getApp().globalData.Language.getMapText('确定'),
  195. })
  196. },
  197. toDetail(e) {
  198. const {
  199. item
  200. } = e.currentTarget.dataset,
  201. content = this.data.content;
  202. content.typemx = item.title;
  203. wx.navigateTo({
  204. url: '/salesPanel/dataOverview/OverviewAndDetails/Clue?content=' + JSON.stringify(content),
  205. })
  206. },
  207. openDateType() {
  208. this.setData({
  209. detaShow: true
  210. })
  211. },
  212. dateOnSelect(event) {
  213. const {
  214. value
  215. } = event.detail;
  216. if (this.data.content.dateType == value) return this.onCancel();
  217. this.setData({
  218. "content.dateType": value,
  219. dates: this.data.dates.map(item => {
  220. item.color = item.value == value ? "#3874F6" : "";
  221. item.loading = item.value == value ? true : false;
  222. return item
  223. }),
  224. })
  225. this.getList(true)
  226. },
  227. onCancel() {
  228. this.setData({
  229. actionShow: false,
  230. detaShow: false,
  231. list: this.data.list.map(item => {
  232. item.loading = false;
  233. return item
  234. }),
  235. dates: this.data.dates.map(item => {
  236. item.loading = false;
  237. return item
  238. })
  239. })
  240. },
  241. }
  242. })