dataOverview.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. })
  21. }
  22. },
  23. data: {
  24. "content": {
  25. dateType: "本年",
  26. dataid: wx.getStorageSync('userMsg').userid,
  27. type: 0,
  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() {
  48. let content = this.data.content;
  49. const {
  50. dataid,
  51. type,
  52. username,
  53. isleave
  54. } = getCurrentPages()[getCurrentPages().length - 1].data;
  55. content.dataid = dataid;
  56. content.type = type;
  57. content.username = username;
  58. content.where.isleave = isleave;
  59. _Http.basic({
  60. "id": 20231014114204,
  61. content
  62. }).then(res => {
  63. console.log("线索数据概况", res)
  64. if (res.code != '1') return wx.showToast({
  65. title: res.msg,
  66. icon: "none"
  67. })
  68. const getMapText = getApp().globalData.Language.getMapText;
  69. let list = [{
  70. title: '线索总数',
  71. value: res.data.total,
  72. tips: getMapText('线索总数:包含待分配、已分配线索数。'),
  73. link: true
  74. },
  75. {
  76. title: '待分配未过期线索数',
  77. value: res.data.dfp,
  78. tips: getMapText('待分配未过期线索数:所有线索中,待分配未过期的线索数量。'),
  79. link: true
  80. },
  81. {
  82. title: '待跟进线索数',
  83. value: res.data.dgj,
  84. tips: getMapText('待跟进线索数:销售线索应用中,已分配给业务员,待跟进状态的线索数量。'),
  85. link: true
  86. },
  87. {
  88. title: '跟进中线索数',
  89. value: res.data.gjz,
  90. tips: getMapText('跟进中线索数:销售线索应用中,已分配给业务员,跟进中状态的线索数量。'),
  91. link: true
  92. },
  93. {
  94. title: '已转化线索数',
  95. value: res.data.yzh,
  96. tips: getMapText("①已转化线索数:销售线索应用中,已分配给业务员,已转化状态的线索数量。") + '\n\n' + getMapText('②一条线索可进行两次转化:转化客户、转化项目,因此,已转化线索数≠转化客户线索数+转化项目线索数。'),
  97. link: true
  98. },
  99. {
  100. title: '已无效线索数',
  101. value: res.data.ywx,
  102. tips: getMapText("已无效线索数:销售线索应用中,已分配给业务员,已无效状态的线索数量。"),
  103. link: true
  104. },
  105. {
  106. title: '待分配已过期线索数',
  107. value: res.data.ygq,
  108. tips: getMapText('待分配已过期线索数:所有线索中,待分配已过期的线索数量。'),
  109. link: true
  110. },
  111. {
  112. title: '过期比例',
  113. value: Math.round(((res.data.gqbl * 100) * 100) / 100) + '%',
  114. tips: getMapText('过期比例=已过期线索数÷待分配线索数×100%'),
  115. link: false
  116. },
  117. {
  118. title: '转化客户线索数',
  119. value: res.data.covercusomers,
  120. tips: getMapText('转化客户线索数:统计有转化客户操作的线索数'),
  121. link: true
  122. },
  123. {
  124. title: '转化项目线索数',
  125. value: res.data.coverproject,
  126. tips: getMapText('转化客户线索数:统计有转化项目操作的线索数'),
  127. link: true
  128. },
  129. {
  130. title: '线索转化率',
  131. value: Math.round(((res.data.zhl * 100) * 100) / 100) + '%',
  132. tips: getMapText('线索转化率=已转化线索数÷线索总数×100%'),
  133. link: false
  134. },
  135. {
  136. title: '线索成交数',
  137. value: res.data.dealqty,
  138. tips: getMapText('线索成交数:转化后有下订单的线索数量'),
  139. link: true
  140. },
  141. {
  142. title: '线索成交率',
  143. value: Math.round(((res.data.cjl * 100) * 100) / 100) + '%',
  144. tips: getMapText('线索成交率=转化后有下订单的线索数÷线索总数×100%'),
  145. link: false
  146. },
  147. {
  148. title: '参与线索数',
  149. value: res.data.joinordercluesize,
  150. tips: getMapText('参与线索数:参与的并且至少有一次跟进的线索数量'),
  151. link: true
  152. },
  153. {
  154. title: '参与线索转化数',
  155. value: res.data.joincoverorderclue,
  156. tips: getMapText('参与线索转化数:参与的并且至少有一次跟进的有发生转化的线索数量'),
  157. link: true
  158. },
  159. {
  160. title: '参与线索转化率',
  161. value: Math.round(((res.data.joinordercluezhl * 100) * 100) / 100) + '%',
  162. tips: getMapText('参与线索转化率=参与线索转化数 ÷ 参与线索数 ×100%'),
  163. link: false
  164. },
  165. {
  166. title: '参与线索成交数',
  167. value: res.data.joindealorderclue,
  168. tips: getMapText('参与线索成交数:参与的并且至少有一次跟进的转化后有下订单的线索数量'),
  169. link: true
  170. },
  171. {
  172. title: '参与线索成交率',
  173. value: Math.round(((res.data.joinordercluecjl * 100) * 100) / 100) + '%',
  174. tips: getMapText('参与线索成交率=参与线索成交率 ÷ 参与线索数 ×100%'),
  175. link: false
  176. },
  177. ]
  178. this.setData({
  179. list,
  180. content
  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. content = this.data.content;
  200. content.typemx = item.title;
  201. wx.navigateTo({
  202. url: '/salesPanel/dataOverview/OverviewAndDetails/Clue?content=' + JSON.stringify(content),
  203. })
  204. },
  205. openDateType() {
  206. this.setData({
  207. detaShow: true
  208. })
  209. },
  210. dateOnSelect(event) {
  211. const {
  212. value
  213. } = event.detail;
  214. if (this.data.content.dateType == value) return this.onCancel();
  215. this.setData({
  216. "content.dateType": value,
  217. dates: this.data.dates.map(item => {
  218. item.color = item.value == value ? "#3874F6" : "";
  219. item.loading = item.value == value ? true : false;
  220. return item
  221. }),
  222. })
  223. this.getList(true)
  224. },
  225. onCancel() {
  226. this.setData({
  227. actionShow: false,
  228. detaShow: false,
  229. list: this.data.list.map(item => {
  230. item.loading = false;
  231. return item
  232. }),
  233. dates: this.data.dates.map(item => {
  234. item.loading = false;
  235. return item
  236. })
  237. })
  238. },
  239. }
  240. })