index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="person_cards_wrap">
  3. <view class="cards_container">
  4. <!-- 今天消耗 -->
  5. <view class="card_item today">
  6. <view class="card_item_content">
  7. <view class="card_header">
  8. <text class="card_title">今天消耗(元)</text>
  9. </view>
  10. <view class="card_content">
  11. <text class="card_value">{{ cardData.todayConsume }}</text>
  12. </view>
  13. </view>
  14. <view class="card_item_content">
  15. <view class="card_header">
  16. <text class="card_title">今天业绩(元)</text>
  17. </view>
  18. <view class="card_content">
  19. <text class="card_value">{{ cardData.todayPerformance }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 条数统计 -->
  24. <view class="card_item card_item_full">
  25. <view class="card_header count">
  26. <image class="count_icon" src="../../../static/icons/statistics.png" alt=""></image>
  27. <text class="card_title">条数统计</text>
  28. </view>
  29. <view class="card_content">
  30. <view class="count_stats">
  31. <view class="count_item">
  32. <text class="count_value">{{ cardData.countTypeA }}</text>
  33. <text class="count_label">A类</text>
  34. </view>
  35. <view class="count_item">
  36. <text class="count_value">{{ cardData.countTypeB }}</text>
  37. <text class="count_label">B类</text>
  38. </view>
  39. <view class="count_item">
  40. <text class="count_value">{{ cardData.countTypeC }}</text>
  41. <text class="count_label">C类</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 上门 -->
  47. <view class="card_item card_item_full">
  48. <view class="card_content">
  49. <view class="visit_stats">
  50. <view class="visit_item">
  51. <text class="visit_label">上门</text>
  52. <text class="visit_value visitc_count">{{ cardData.visitCount }}</text>
  53. </view>
  54. <view class="visit_item">
  55. <text class="visit_label">上门率</text>
  56. <text class="visit_value">{{ cardData.visitRate }}</text>
  57. </view>
  58. <view class="visit_item">
  59. <text class="visit_label">成交率</text>
  60. <text class="visit_value">{{ cardData.dealRate }}</text>
  61. </view>
  62. <view class="visit_item">
  63. <text class="visit_label">投产比</text>
  64. <text class="visit_value">{{ cardData.roi }}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 当前排名 -->
  70. <view class="card_item card_item_full">
  71. <view class="card_content">
  72. <view class="ranking_stats">
  73. <view class="ranking_info">
  74. <view class="ranking_icon">
  75. <image class="ranking_icon_img" src="../../../static/icons/trophy.png" alt=""></image>
  76. </view>
  77. <view class="ranking_info_text">
  78. <text class="card_title">当前排名</text>
  79. <text class="ranking_text">击败了{{ cardData.beatRate }}%的同事</text>
  80. </view>
  81. </view>
  82. <view class="ranking_details">
  83. <view class="ranking_detail_item">
  84. <text class="ranking_detail_value">{{ cardData.level }}</text>
  85. <text class="ranking_detail_label">等级</text>
  86. </view>
  87. <view class="ranking_detail_item">
  88. <text class="ranking_detail_value">{{ cardData.score }}</text>
  89. <text class="ranking_detail_label">评分</text>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- 折线图 -->
  96. <view class="card_item" v-if="false">
  97. <view class="chart_header">
  98. <image class="chart_icon" src="../../../static/icons/line.png" alt=""></image>
  99. <text class="card_title">近7天排名折线图</text>
  100. </view>
  101. <view class="charts_box">
  102. <qiun-data-charts type="line" :chartData="chartData" canvasId="uniqueLineChart" :opts="opts"
  103. width="700rpx" height="350rpx" backgroundColor="#ffffff" />
  104. </view>
  105. </view>
  106. </view>
  107. <!-- 最新线索 -->
  108. <view class="latest_clue" v-if="clueList.length > 0">
  109. <view class="clue_header">
  110. <text class="card_title">最新线索</text>
  111. <view class="more_btn" @click="toPrivateClue">
  112. <text>更多</text>
  113. <u-icon name="arrow-right" size="16" color="#2563eb"></u-icon>
  114. </view>
  115. </view>
  116. <view class="clue_list">
  117. <view class="clue_item" v-for="(item, index) in clueList" :key="index">
  118. <view class="clue_star">
  119. <u-icon name="star-fill" size="20" color="#facc15"></u-icon>
  120. <text class="clue_name">{{ item.star }}</text>
  121. </view>
  122. <text class="clue_name">{{ item.name }}</text>
  123. <view class="clue_info">
  124. <text class="clue_title">{{ item.prodTitle }}</text>
  125. <text class="clue_desc">{{ item.desc }}</text>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </template>
  132. <script>
  133. export default {
  134. data() {
  135. return {
  136. // 卡片数据
  137. cardData: {
  138. todayConsume: '-',
  139. todayPerformance: '-',
  140. countTypeA: '-',
  141. countTypeB: '-',
  142. countTypeC: '-',
  143. visitCount: '-',
  144. visitRate: '-',
  145. dealRate: '-',
  146. roi: '-',
  147. beatRate: '-',
  148. level: '-',
  149. score: '-'
  150. },
  151. chartData: {},
  152. opts: {
  153. color: ["#1890FF"],
  154. padding: [10, 10, 0, 0],
  155. dataLabel: false,
  156. dataPointShape: false,
  157. enableScroll: false,
  158. legend: {
  159. show: false
  160. },
  161. xAxis: {
  162. disableGrid: true
  163. },
  164. yAxis: {
  165. gridType: "dash",
  166. dashLength: 2,
  167. axisLabel:{
  168. show: false
  169. }
  170. },
  171. extra: {
  172. line: {
  173. type: "curve",
  174. width: 3,
  175. activeType: "hollow",
  176. linearType: "custom",
  177. onShadow: true,
  178. animation: "horizontal"
  179. }
  180. }
  181. },
  182. clueList: [],
  183. };
  184. },
  185. methods: {
  186. getCardData() {
  187. uni.$u.api.getPersonCards({ userId: this.$store.state.user.userInfo.userId }).then(res => {
  188. if (res.code === 200) {
  189. this.cardData = res.data;
  190. }
  191. });
  192. },
  193. getClueList() {
  194. uni.$u.api.getPersonLatestClue({ userId: this.$store.state.user.userInfo.userId }).then(res => {
  195. if (res.code === 200) {
  196. this.clueList = res.data;
  197. }
  198. });
  199. },
  200. async getChartData() {
  201. const res = await uni.$u.api.getPersonRanking({ userId: this.$store.state.user.userInfo.userId });
  202. if (res.code === 200) {
  203. let data = {
  204. categories: res.data.map(item => item.x),
  205. series: [
  206. {
  207. name: "近7天排名",
  208. data: res.data.map(item => item.y),
  209. setShadow: [
  210. 3,
  211. 8,
  212. 15,
  213. "#1890FF"
  214. ],
  215. }
  216. ]
  217. }
  218. this.chartData = JSON.parse(JSON.stringify(data))
  219. }
  220. },
  221. // 跳转私有线索页面
  222. toPrivateClue() {
  223. uni.switchTab({ url: '/pages/privateClue/index' });
  224. },
  225. },
  226. mounted() {
  227. if (this.$store.state.user.userInfo.userId === '12234') {
  228. this.getCardData();
  229. this.getClueList();
  230. this.$nextTick(() => {
  231. this.getChartData();
  232. })
  233. }
  234. },
  235. };
  236. </script>
  237. <style lang="scss" scoped>
  238. @import './styles/index.scss';
  239. </style>