dataOverview.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. _Http.basic({
  52. "id": 20231018110404,
  53. content
  54. }).then(res => {
  55. console.log("项目数据概况", res)
  56. if (res.code != '1') return wx.showToast({
  57. title: res.msg,
  58. icon: "none"
  59. })
  60. const getMapText = getApp().globalData.Language.getMapText;
  61. let list = [{
  62. title: '项目总数',
  63. value: res.data.totalqty,
  64. tips: getMapText('项目总数:统计所有项目的数量'),
  65. link: true
  66. },
  67. {
  68. title: '报备项目数',
  69. value: res.data.reportProject,
  70. tips: getMapText('报备项目数:统计已报备的项目数量'),
  71. link: true
  72. },
  73. {
  74. title: '进行中项目数',
  75. value: res.data.dealProject,
  76. tips: getMapText('进行中项目数:进行中状态的项目数量'),
  77. link: true
  78. },
  79. {
  80. title: '项目成交数',
  81. value: res.data.dealProject,
  82. tips: getMapText('项目成交数:统计有关联审核过的订单的项目数量'),
  83. link: true
  84. },
  85. {
  86. title: '项目成交率',
  87. value: res.data.cjl + '%',
  88. tips: getMapText('项目成交率=有关联审核订单的项目数÷项目总数×100%'),
  89. link: false
  90. },
  91. {
  92. title: '项目失败数',
  93. value: res.data.failedproject,
  94. tips: getMapText('项目失败数:已失败状态的项目数量'),
  95. link: true
  96. },
  97. {
  98. title: '项目失败率',
  99. value: Math.round(((res.data.sbl) * 100) / 100) + '%',
  100. tips: getMapText('项目失败率=已失败项目数÷项目总数×100%'),
  101. link: false
  102. },
  103. {
  104. title: '参与项目数',
  105. value: res.data.joinProject,
  106. tips: getMapText('参与项目数:参与的并且至少有一次跟进的项目数量'),
  107. link: true
  108. },
  109. {
  110. title: '参与项目成交数',
  111. value: res.data.joinDealProject,
  112. tips: getMapText('参与项目成交数:参与的并且至少有一次跟进的项目的成交数量'),
  113. link: true
  114. },
  115. {
  116. title: '参与项目成交率',
  117. value: Math.round(((res.data.joinDealProjectcjl) * 100) / 100) + '%',
  118. tips: getMapText('参与项目成交率=参与项目成交数 ÷ 参与项目数 ×100%'),
  119. link: false
  120. },
  121. ];
  122. try {
  123. list = list.concat(res.data.projecttype.map(v => {
  124. return {
  125. title: v.value,
  126. value: v.qty,
  127. tips: "",
  128. link: true
  129. }
  130. }))
  131. } catch (error) {
  132. }
  133. this.setData({
  134. list,
  135. content
  136. })
  137. this.onCancel()
  138. })
  139. },
  140. showTips(e) {
  141. const {
  142. tips
  143. } = e.currentTarget.dataset;
  144. wx.showModal({
  145. content: tips,
  146. showCancel: false,
  147. confirmText: getApp().globalData.Language.getMapText('确定'),
  148. })
  149. },
  150. toDetail(e) {
  151. const {
  152. item
  153. } = e.currentTarget.dataset,
  154. content = this.data.content;
  155. content.typemx = item.title;
  156. wx.navigateTo({
  157. url: '/salesPanel/dataOverview/OverviewAndDetails/project?content=' + JSON.stringify(content),
  158. })
  159. },
  160. openDateType() {
  161. this.setData({
  162. detaShow: true
  163. })
  164. },
  165. dateOnSelect(event) {
  166. const {
  167. value
  168. } = event.detail;
  169. if (this.data.content.dateType == value) return this.onCancel();
  170. this.setData({
  171. "content.dateType": value,
  172. dates: this.data.dates.map(item => {
  173. item.color = item.value == value ? "#3874F6" : "";
  174. item.loading = item.value == value ? true : false;
  175. return item
  176. }),
  177. })
  178. this.getList(true)
  179. },
  180. onCancel() {
  181. this.setData({
  182. actionShow: false,
  183. detaShow: false,
  184. list: this.data.list.map(item => {
  185. item.loading = false;
  186. return item
  187. }),
  188. dates: this.data.dates.map(item => {
  189. item.loading = false;
  190. return item
  191. })
  192. })
  193. },
  194. }
  195. })