AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

343 lines
8.0 KiB

  1. <template>
  2. <view class="pages">
  3. <view class="boxtittab">
  4. <view class="tabbox">
  5. <view :class="{ activecllasscet: activeTotal == 4 }" @click="tabtimetap(4)">近七天</view>
  6. </view>
  7. <view class="tabbox">
  8. <view :class="{ activecllasscet: activeTotal == 5 }" @click="tabtimetap(5)">近15天</view>
  9. </view>
  10. <view class="tabbox">
  11. <view :class="{ activecllasscet: activeTotal == 6 }" @click="tabtimetap(6)">近30天</view>
  12. </view>
  13. <view class="tabbox">
  14. <view :class="{ activecllasscet: activeTotal == 3 }" @click="tabtimetap(3)">自定义</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. var app = getApp();
  21. var util = require("../../../utils/util.js");
  22. var config = require("../../../config");
  23. export default {
  24. data() {
  25. return {
  26. activeTotal: 4,
  27. activeTotal2: 0,
  28. bocindex: 0,
  29. totalTimeShow: false,
  30. // 项目id
  31. houseId: '',
  32. staffShow: false,
  33. staffList: [],
  34. lastStartDate: '',
  35. lastEndDate: '',
  36. newTeam1: '',
  37. newAvg1: '',
  38. newTeam2: '',
  39. newAvg2: '',
  40. newTeam3: '',
  41. newAvg3: '',
  42. newTeam4: '',
  43. newAvg4: '',
  44. staff: {
  45. value: '',
  46. label: ''
  47. },
  48. newlisttabinfo1: [{
  49. name: '接待量',
  50. zxl: '10'
  51. },
  52. {
  53. name: '平均执行率',
  54. zxl: '50'
  55. },
  56. {
  57. name: '接待客户',
  58. zxl: '80'
  59. },
  60. ],
  61. newlisttabinfo2: [{
  62. name: '接待量',
  63. zxl: '10'
  64. },
  65. {
  66. name: '平均执行率',
  67. zxl: '50'
  68. },
  69. {
  70. name: '接待客户',
  71. zxl: '80'
  72. },
  73. ],
  74. newlisttabinfo3: [{
  75. name: '接待量',
  76. zxl: '10'
  77. },
  78. {
  79. name: '平均执行率',
  80. zxl: '50'
  81. },
  82. {
  83. name: '接待客户',
  84. zxl: '80'
  85. },
  86. ],
  87. newlisttabinfo4: [{
  88. name: '接待量',
  89. zxl: '10'
  90. },
  91. {
  92. name: '平均执行率',
  93. zxl: '50'
  94. },
  95. {
  96. name: '接待客户',
  97. zxl: '80'
  98. },
  99. ],
  100. chartData: {
  101. "categories": [],
  102. "series": [
  103. ]
  104. },
  105. emptyCharData: true,
  106. opts: {
  107. fontSize: 10,
  108. extra: {
  109. radar: {
  110. max: 100
  111. }
  112. }
  113. }
  114. };
  115. },
  116. onLoad() {
  117. this.LOADING = true
  118. let that = this
  119. uni.$on('updateGroup', function(data) {
  120. console.log(data)
  121. that.houseId = data.arr.join(',')
  122. // 获取销奖能力
  123. that.getPowerList()
  124. })
  125. this.getSectionList()
  126. },
  127. onPullDownRefresh() {
  128. this.getSectionList()
  129. setTimeout(function() {
  130. uni.stopPullDownRefresh();
  131. }, 1000);
  132. },
  133. methods: {
  134. getPercent(num, type) {
  135. if (this.newlisttabinfo1 && this.newlisttabinfo1.length && type == 1) {
  136. console.log(this.newlisttabinfo1)
  137. let index0 = this.newlisttabinfo1[0]
  138. let percent = num / (index0.zxl) * 100
  139. return percent.toFixed(2)
  140. } else if (this.newlisttabinfo2 && this.newlisttabinfo2.length && type == 2) {
  141. let index0 = this.newlisttabinfo2[0]
  142. let percent = num / (index0.zxl) * 100
  143. return percent.toFixed(2)
  144. } else if (this.newlisttabinfo3 && this.newlisttabinfo3.length && type == 3) {
  145. let index0 = this.newlisttabinfo3[0]
  146. let percent = num / (index0.zxl) * 100
  147. return percent.toFixed(2)
  148. } else {
  149. return 0
  150. }
  151. },
  152. getPercent1(num) {
  153. console.log(num)
  154. return num || 0
  155. },
  156. // 获取部门列表
  157. getSectionList() {
  158. this.$u.post('/user/getHouseByToken', )
  159. .then(res => {
  160. // console.log(res)
  161. this.staffList = []
  162. res.map((item, index) => {
  163. let obj = {}
  164. obj.value = item.id
  165. obj.label = item.propertyName
  166. this.staffList.push(obj)
  167. })
  168. this.houseId = this.staffList[0].value
  169. this.staff = this.staffList[0]
  170. this.getdata()
  171. // console.log(this.staffList,this.staffList,this.houseId)
  172. })
  173. },
  174. //指标执行率分析tab
  175. tapspagek2(index) {
  176. this.bocindex = index;
  177. },
  178. staffSelectCallback(e) {
  179. this.staff = e[0]
  180. this.houseId = e[0].value
  181. this.getPowerList()
  182. },
  183. getdata() {
  184. // 请求接口获取接待量
  185. this.receptionCountList('1', '/cusLvStatistics/groupComparisonReception')
  186. // 接待时长
  187. this.receptionCountList('2', '/cusLvStatistics/groupComparisonReceptionTime')
  188. // 小将排名
  189. this.receptionCountList('3', '/cusLvStatistics/groupComparisonTalkRank')
  190. // 顾问牌名
  191. this.receptionCountList('4', '/cusLvStatistics/groupComparisonTalkRankByConsultant')
  192. // 销奖能力
  193. this.getPowerList()
  194. },
  195. //时间切换
  196. tabtimetap(index) {
  197. this.activeTotal = index;
  198. if (index == 3) {
  199. this.totalTimeShow = true;
  200. } else {
  201. this.lastEndDate = ''
  202. this.lastStartDate = ''
  203. this.getdata()
  204. // // 获取数据
  205. // // 团队对比接待量
  206. // this.receptionCountList(0,1,'/cusLvStatistics/teamAnalysisReception')
  207. // // 团队对比接待时长
  208. // this.receptionCountList(0,2,'/cusLvStatistics/teamAnalysisReceptionTime')
  209. // /* 销奖执行率 */
  210. // this.receptionCountList(0,3,'/cusLvStatistics/teamAnalysisExecutionRate')
  211. // // 获取销奖能力
  212. // this.getPowerList()
  213. }
  214. },
  215. // 接待时长
  216. receptionCountList(index, url) {
  217. this.$u.post(url, {
  218. timeType: this.lastEndDate ? null : this.activeTotal + '',
  219. lastEndDate: this.lastEndDate,
  220. lastStartDate: this.lastStartDate
  221. })
  222. .then(res => {
  223. // console.log(res)
  224. let result = res.result
  225. this['newTeam' + index] = res.avg[0]
  226. this['newAvg' + index] = res.avg[1]
  227. // return
  228. // 处理数据
  229. // 先处理牌名数据,需要进行判断全部还是单个
  230. // 当为全部时
  231. this['newlisttabinfo' + index] = []
  232. // 当选择全部时
  233. let arr = []
  234. // 当两个都选择的时候
  235. result.map(item => {
  236. let obj = {}
  237. obj.name = item.houseName
  238. obj.zxl = item.data
  239. arr.push(obj)
  240. })
  241. arr = this.dealData(arr)
  242. this['newlisttabinfo' + index] = arr
  243. })
  244. },
  245. // 获取销奖能力
  246. getPowerList() {
  247. this.chartData = {
  248. categories: [],
  249. series: []
  250. }
  251. this.$u.post('/cusLvStatistics/groupComparisonMarketingAbility', {
  252. houseIds: this.houseId,
  253. timeType: this.lastEndDate ? null : this.activeTotal + '',
  254. lastEndDate: this.lastEndDate,
  255. lastStartDate: this.lastStartDate
  256. })
  257. .then(res => {
  258. this.LOADING = false
  259. let allobj = {
  260. categories: [],
  261. series: []
  262. }
  263. if (res.result.length != 0) {
  264. res.result.map((item, index) => {
  265. let obj = {
  266. name: item.length > 0 ? item[0].houseName : '',
  267. data: []
  268. }
  269. item.map(item1 => {
  270. if (index == 0) {
  271. allobj.categories.push(item1.name)
  272. }
  273. obj.data.push(item1.avgExecutionRate)
  274. })
  275. allobj.series.push(obj)
  276. })
  277. this.chartData = allobj
  278. this.$forceUpdate()
  279. this.emptyCharData = true;
  280. } else {
  281. this.emptyCharData = false;
  282. }
  283. }).catch(e => {
  284. this.LOADING = false
  285. })
  286. },
  287. //自定义时间
  288. totalTimeChange(e) {
  289. console.log(e.startDate, e.endDate)
  290. this.activeTotal = 3;
  291. this.lastEndDate = e.endDate
  292. this.lastStartDate = e.startDate
  293. this.getdata()
  294. },
  295. //集团对比
  296. Groupcontrast() {
  297. uni.navigateTo({
  298. url: `/pages/center/Piabodata/selectGroup?ids=${this.houseId}`
  299. });
  300. },
  301. // 定义一个公共方法对数据进行处理
  302. dealData(arr) {
  303. // 获取最大值
  304. let num = Math.max.apply(Math, arr.map(function(o) {
  305. return o.zxl
  306. })) //结果:3
  307. // console.log(num)
  308. if (num > 100) {
  309. // 获取最大值的下标
  310. // let idx=arr.findIndex(item=>item.zxl==num)
  311. // console.log(idx,123)
  312. arr.map(item => {
  313. item.zxl1 = Math.floor(item.zxl / num * 100)
  314. })
  315. // console.log(arr)
  316. return arr
  317. } else {
  318. arr.map(item => {
  319. item.zxl1 = item.zxl
  320. })
  321. return arr
  322. }
  323. },
  324. }
  325. };
  326. </script>
  327. <style lang="scss" scoped>
  328. .pages {
  329. width: 100%;
  330. height: 100vh;
  331. .boxtittab {}
  332. }
  333. </style>