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.
 
 
 

480 lines
10 KiB

  1. <template>
  2. <view class="box">
  3. <view class="boxtittab">
  4. <view class="tabbox">
  5. <view :class="{ activecllasscet: activeTotal == 0 }" @click="tabtimetap(0)">今日</view>
  6. </view>
  7. <view class="tabbox">
  8. <view :class="{ activecllasscet: activeTotal == 1 }" @click="tabtimetap(1)">昨日</view>
  9. </view>
  10. <view class="tabbox">
  11. <view :class="{ activecllasscet: activeTotal == 2 }" @click="tabtimetap(2)">近一周</view>
  12. </view>
  13. <view class="tabbox">
  14. <view :class="{ activecllasscet: activeTotal == 3 }" @click="tabtimetap(3)">自定义</view>
  15. </view>
  16. </view>
  17. <view class="boxzonglan">
  18. <view class="zonglantit">客群特征总览</view>
  19. <view class="zonglanbox">
  20. <view class="grid" v-for="(item,index) in numlist" :key="index" v-if="item.isshow">
  21. <view class="audonum">{{item.name}}<text v-if="index!=0">触达次数</text></view>
  22. <view class="num">{{item.num}}</view>
  23. </view>
  24. </view>
  25. <view v-if="Afolding==true" class="anclack" @click="anclick(1)">展开 <u-icon style="margin-left: 8rpx;" label-color='#666666' name="arrow-down"></u-icon></view>
  26. <view v-if="Afolding==false" class="anclack" @click="anclick(2)">收起 <u-icon style="margin-left: 8rpx;" label-color='#666666' name="arrow-up"></u-icon></view>
  27. </view>
  28. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  29. <view class="centerfor" v-for="(item,index) in objlist" :key="index">
  30. <view class="fortit">
  31. <view class="left">
  32. <view class="lefti"></view>
  33. <view class="lefttext">{{item.name}}触达排名</view>
  34. </view>
  35. <view class="right">
  36. <view :class="{ activeclass: item.activeTab == 0 }" @click="charttoswitch(index,0)">表格</view>
  37. <view style="margin-left: 16rpx;" :class="{ activeclass: item.activeTab == 1 }"
  38. @click="charttoswitch(index,1)">饼状图</view>
  39. </view>
  40. </view>
  41. <view v-if="item.activeTab==0" class="tabdada">
  42. <view class="tabth">
  43. <view>排名</view>
  44. <view>画像语意词/触达客户</view>
  45. <view>触达占比</view>
  46. <view>沟通记录</view>
  47. </view>
  48. <view v-if="item.total==0" style="color: #999999;width: 100%;height: 500rpx;line-height: 500rpx;text-align: center;" >暂无数据</view>
  49. <view class="tabtd" v-if="item.total!=0" v-for="(chend,i) in item.matchKeywords" :key="i">
  50. <view>
  51. <image v-if="i==0" class="ranking" src="../../../static/images/ranking1.png" mode=""></image>
  52. <image v-else-if="i==1" class="ranking" src="../../../static/images/ranking2.png" mode=""></image>
  53. <image v-else-if="i==2" class="ranking" src="../../../static/images/ranking3.png" mode=""></image>
  54. <view class="ranking1" v-else>{{i+1}}</view>
  55. </view>
  56. <view>{{chend.name}}({{chend.total}})</view>
  57. <view>{{chend.proportion}}%</view>
  58. <view @click="Toview(item,i)">查看</view>
  59. </view>
  60. </view>
  61. <view v-if="item.activeTab==1" class="tabech">
  62. <qiun-data-charts
  63. :key="item.id"
  64. type="ring"
  65. :chartData="item.chartData"
  66. :canvas2d="true"
  67. :canvasId="'wangxiaohuahahahahaha'+item.id"
  68. :opts='item.opts'
  69. background="none" />
  70. </view>
  71. </view>
  72. <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
  73. <u-back-top :scroll-top="scrollTop"></u-back-top>
  74. </view>
  75. </template>
  76. <script>
  77. var app = getApp();
  78. var util = require("../../../utils/util.js");
  79. var config = require("../../../config");
  80. export default {
  81. data() {
  82. return {
  83. scrollTop: 0,
  84. activeTotal: 2,
  85. timeobj:{
  86. statDateStart:'',
  87. statDateEnd:''
  88. },
  89. buildingID:'',
  90. totalTimeShow: false,
  91. activeTab: 0,
  92. numlist:[],
  93. objlist:[],
  94. Afolding:true
  95. };
  96. },
  97. onPageScroll(e) {
  98. this.scrollTop = e.scrollTop;
  99. },
  100. onLoad() {
  101. this.buildingID=uni.getStorageSync('buildingID').id;
  102. this.gitinit()
  103. },
  104. onPullDownRefresh() {
  105. this.gitinit()
  106. setTimeout(function () {
  107. uni.stopPullDownRefresh();
  108. }, 1000);
  109. },
  110. methods: {
  111. anclick(i){
  112. console.log(i)
  113. this.Afolding=!this.Afolding;
  114. this.numlist.forEach((citem,index)=>{
  115. if(index<6){
  116. citem.isshow=true;
  117. }else{
  118. citem.isshow=!citem.isshow;
  119. }
  120. })
  121. this.$forceUpdate()
  122. },
  123. //获取数据
  124. gitinit(){
  125. this.objlist=[];
  126. this.numlist=[];
  127. var dateType='';
  128. if(this.activeTotal==3){
  129. dateType=null;
  130. }else{
  131. dateType=this.activeTotal;
  132. }
  133. let parames={
  134. dateType:dateType,
  135. statDateStart:this.timeobj.statDateStart,
  136. statDateEnd:this.timeobj.statDateEnd,
  137. houseId:this.buildingID
  138. }
  139. this.$u.post("/matchKeywords/findmatchdata", parames).then(data => {
  140. this.numlist.push({
  141. name:"客户数量",
  142. num:data.total
  143. })
  144. data.list.forEach((item,index)=>{
  145. this.numlist.push({
  146. name:item.name,
  147. num:item.total
  148. })
  149. item.activeTab=0;
  150. item.opts={
  151. "title": {
  152. "name": item.total,
  153. "color": '#666666',
  154. "fontSize": 20
  155. },
  156. "subtitle": {
  157. "name": '总触达次数',
  158. "color": '#32363D',
  159. "fontSize": 12,
  160. "offsetY": 4
  161. }
  162. }
  163. item.chartData={
  164. "categories": [],
  165. "series": [{
  166. "data": []
  167. }],
  168. };
  169. item.matchKeywords.forEach(chend=>{
  170. item.chartData.series[0].data.push({
  171. "name":chend.name,
  172. "value": chend.proportion
  173. })
  174. })
  175. })
  176. data.list.forEach(item=>{
  177. item.matchKeywords.forEach(chend=>{
  178. if(chend.isInterval==0){
  179. chend.name=chend.name+chend.unit+'-'+chend.endName+chend.unit
  180. }else{
  181. chend.name=chend.name
  182. }
  183. })
  184. })
  185. this.objlist=data.list;
  186. this.Afolding=true;
  187. this.numlist.forEach((citem,index)=>{
  188. if(index<6){
  189. citem.isshow=true
  190. }else{
  191. citem.isshow=false
  192. }
  193. })
  194. })
  195. },
  196. //查看
  197. Toview(item,i){
  198. console.log(item)
  199. let keywordsid = 0
  200. if (item.matchKeywords[i].children && item.matchKeywords[i].children.length > 0) {
  201. keywordsid = item.matchKeywords[i].children[0].keywordsId
  202. } else {
  203. keywordsid = item.matchKeywords[i].keywordsId
  204. }
  205. uni.navigateTo({
  206. url: '/pages/center/Piabodata/Customerportrait/Receivingrecords?datatype='+this.activeTotal+"&keywordsId="+keywordsid+"&starttime="+this.timeobj.statDateStart+"&endoftime="+this.timeobj.statDateEnd
  207. })
  208. },
  209. //时间切换
  210. tabtimetap(index) {
  211. if (index == 3) {
  212. this.totalTimeShow = true;
  213. } else {
  214. this.activeTotal = index;
  215. this.gitinit()
  216. }
  217. },
  218. //自定义时间
  219. totalTimeChange(e) {
  220. this.timeobj.statDateStart = e.startDate;
  221. this.timeobj.statDateEnd = e.endDate;
  222. this.activeTotal=3;
  223. this.gitinit()
  224. },
  225. charttoswitch(index,num) {
  226. this.objlist[index].activeTab=num
  227. }
  228. }
  229. };
  230. </script>
  231. <style lang="scss" scoped>
  232. .anclack{
  233. width: 100%;
  234. height: 78rpx;
  235. text-align: center;
  236. line-height: 78rpx;
  237. font-size: 30rpx;
  238. border: 1rpx solid #E0E0E0;
  239. font-weight: 400;
  240. color: #666666;
  241. }
  242. .box {
  243. width: 100%;
  244. height: 100%;
  245. background: #FAFAFA;
  246. padding-bottom: 60rpx;
  247. }
  248. .boxtittab {
  249. width: 100;
  250. height: 92rpx;
  251. background: #FFFFFF;
  252. border: 1px solid #E0E0E0;
  253. display: flex;
  254. align-items: center;
  255. .tabbox {
  256. flex: 1;
  257. height: 100%;
  258. text-align: center;
  259. line-height: 92rpx;
  260. color: #666666;
  261. font-size: 28rpx;
  262. display: flex;
  263. justify-content: center;
  264. .activecllasscet {
  265. width: 96rpx;
  266. border-bottom: 2px solid #2671E2;
  267. }
  268. }
  269. }
  270. .tabtime {
  271. width: 100%;
  272. height: 50rpx;
  273. text-align: center;
  274. line-height: 50rpx;
  275. font-size: 24rpx;
  276. color: #666666;
  277. }
  278. .boxzonglan {
  279. width: 100%;
  280. min-height: 496rpx;
  281. background: #FFFFFF;
  282. padding: 30rpx 30rpx 30rpx 30rpx;
  283. .zonglantit {
  284. font-size: 30rpx;
  285. color: #333333;
  286. font-family: PingFangSC-Semibold, PingFang SC;
  287. font-weight: 600;
  288. }
  289. .zonglanbox {
  290. width: 100%;
  291. display: flex;
  292. flex-wrap: wrap;
  293. margin-top: 24rpx;
  294. .grid {
  295. width: 50%;
  296. height: 128rpx;
  297. border: 1px solid #E0E0E0;
  298. .audonum {
  299. color: #666666;
  300. text-indent: 40rpx;
  301. font-size: 26rpx;
  302. margin-top: 20rpx;
  303. }
  304. .num {
  305. color: #333333;
  306. text-indent: 40rpx;
  307. font-size: 32rpx;
  308. font-weight: 600;
  309. margin-top: 10rpx;
  310. }
  311. }
  312. }
  313. }
  314. .centerfor {
  315. width: 100%;
  316. height: 686rpx;
  317. background: #FFFFFF;
  318. padding-left: 30rpx;
  319. padding-right: 30rpx;
  320. margin-top: 20rpx;
  321. .fortit {
  322. width: 100%;
  323. height: 86rpx;
  324. display: flex;
  325. border-bottom: 1px solid #E0E0E0;
  326. .left {
  327. width: 70%;
  328. height: 100%;
  329. display: flex;
  330. align-items: center;
  331. .lefti {
  332. width: 6rpx;
  333. height: 30rpx;
  334. background: #2671E2;
  335. }
  336. .lefttext {
  337. font-size: 30rpx;
  338. font-family: PingFangSC-Semibold, PingFang SC;
  339. font-weight: 600;
  340. color: #333333;
  341. margin-left: 10rpx;
  342. }
  343. }
  344. .right {
  345. width: 30%;
  346. height: 70rpx;
  347. display: flex;
  348. font-size: 28rpx;
  349. align-items: center;
  350. margin-top: 16rpx;
  351. }
  352. .right view {
  353. width: 92rpx;
  354. height: 50rpx;
  355. text-align: center;
  356. }
  357. }
  358. }
  359. .activeclass {
  360. color: #2671E2;
  361. border-bottom: 2px solid #2671E2;
  362. }
  363. .tabdada {
  364. width: 100%;
  365. height: 580rpx;
  366. overflow-y: auto;
  367. padding-bottom: 20rpx;
  368. }
  369. .tabth {
  370. width: 100%;
  371. height: 28rpx;
  372. display: flex;
  373. font-size: 28rpx;
  374. line-height: 28rpx;
  375. color: #666666;
  376. margin-top: 28rpx;
  377. }
  378. .tabth>view:nth-of-type(1) {
  379. width: 10%;
  380. text-align: center;
  381. }
  382. .tabth>view:nth-of-type(2) {
  383. width: 46%;
  384. text-align: center;
  385. }
  386. .tabth>view:nth-of-type(3) {
  387. width: 22%;
  388. text-align: center;
  389. }
  390. .tabth>view:nth-of-type(4) {
  391. width: 22%;
  392. text-align: center;
  393. }
  394. .tabtd {
  395. width: 100%;
  396. height: 30rpx;
  397. display: flex;
  398. font-size: 26rpx;
  399. line-height: 30rpx;
  400. margin-top: 32rpx;
  401. }
  402. .tabtd>view:nth-of-type(1) {
  403. width: 10%;
  404. text-align: center;
  405. line-height: 30rpx;
  406. }
  407. .tabtd>view:nth-of-type(2) {
  408. width: 46%;
  409. text-align: center;
  410. color: #333333;
  411. }
  412. .tabtd>view:nth-of-type(3) {
  413. width: 22%;
  414. text-align: center;
  415. color: #333333;
  416. }
  417. .tabtd>view:nth-of-type(4) {
  418. width: 22%;
  419. text-align: center;
  420. color: #2671E2;
  421. }
  422. .ranking {
  423. width: 34rpx;
  424. height: 34rpx;
  425. }
  426. .ranking1 {
  427. width: 30rpx;
  428. height: 30rpx;
  429. background: #ECF1FF;
  430. color: #424D64;
  431. font-size: 18rpx;
  432. text-align: center;
  433. line-height: 30rpx;
  434. border-radius: 50%;
  435. margin: 0 auto;
  436. }
  437. .tabech {
  438. width: 100%;
  439. height: 600rpx;
  440. }
  441. </style>