index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view v-if="isShowPage">
  3. <view :class="'top' + (isScroll ? ' top-background' : '')" :style="'height:' + systems.barHeight + 'rpx;'">
  4. <view class="top-nav ddflex"
  5. :style="'height:' + systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
  6. <navigator open-type="navigateBack" hover-class="none" class="back ddflex">
  7. <image src="../../../static/images/back.png"></image>
  8. </navigator>
  9. <view class="top-nav-title fflex" :style="'line-height:' + systems.navigationHeight + 'rpx;'">销售业绩
  10. </view>
  11. </view>
  12. </view>
  13. <view class="head">
  14. <image :src="picUrlss+'blue/yeji_bg.png'" class="bg"></image>
  15. <view class="userinfo ddflex">
  16. <image :src="params.avatar ? params.avatar : '../../../static/pages/images/userimg.png'"
  17. mode="aspectFill" class="userimg"></image>
  18. <view class="fflex">
  19. <view class="username">{{params.nickName}}</view>
  20. <view class="job">
  21. <block v-if="params.deptName">部门<text>{{params.deptName}}</text></block>
  22. <block v-if="params.titleName">职级<text>{{params.titleName}}</text></block>
  23. </view>
  24. </view>
  25. <view class="date">
  26. <picker :range="dateList" range-key="label" @change="changeDate">
  27. <view>{{dateList[dateIndex].label}}</view>
  28. <image src="../../../static/pages/images/bico_white.png" class="bico"></image>
  29. </picker>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="box">
  34. <view class="tit ddflex">我的收益<text>/ 元</text></view>
  35. <view class="yugu">
  36. <view class="yugu-money">{{toDecimal(params.estimate)}}</view>
  37. <view class="yugu-text ddflex">
  38. <image :src="picUrlss+'blue/yeji_bag.png'"></image>预估收入
  39. </view>
  40. </view>
  41. <view class="yeji-datas ddflex" v-for="(item,index) in params.saleTypeIndexResponses" :key="index" v-if="params.saleTypeIndexResponses&&params.saleTypeIndexResponses.length > 0">
  42. <view class="li">
  43. {{toDecimal(item.personal)}}
  44. <view class="ddflex" @click="jumpPromoteUrl(item.scaleType)">
  45. {{getSaleType(item.scaleType) + '业绩'}}
  46. <image src="../../../static/pages/images/more.png"></image>
  47. </view>
  48. </view>
  49. <view class="li"><!-- @click="jumpPromoteListUrl(item.scaleType)" -->
  50. {{toDecimal(item.estimate)}}
  51. <view class="ddflex">{{item.scaleType == 1 ? '佣金' : getSaleType(item.scaleType) + '提成'}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- <view class="box">
  56. <view class="tit ddflex">团队业绩<text>/ 元</text></view>
  57. <view class="yeji-datas ddflex">
  58. <view class="li">
  59. {{toDecimal(params.teamPersonal)}}
  60. <view class="ddflex" @click="jumpUrl('/promote/performance/team/index')">团队销售<image
  61. src="../../../static/pages/images/more.png"></image>
  62. </view>
  63. </view>
  64. <view class="li">
  65. {{toDecimal(params.teamEstimate)}}
  66. <view class="ddflex">团队提成</view>
  67. </view>
  68. </view>
  69. </view> -->
  70. <view class="box">
  71. <view class="tit ddflex">
  72. <view class="fflex">数据统计</view>
  73. <view class="date data">
  74. <picker :range="dataRules" range-key="label" @change="changeDataRule">
  75. <view>{{dataRules[dataRulesIndex].label}}</view>
  76. <image src="../../../static/pages/images/bico.png" class="bico1"></image>
  77. </picker>
  78. </view>
  79. </view>
  80. <view class="statistics">
  81. <qiun-data-charts type="column" canvasId="scrollevent" :opts="chartOpts" :ontouch="true" :canvas2d="true" :chartData="dataCharts" />
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. const app = getApp();
  88. const req = require('../../../utils/request.js');
  89. const api = require('../../../utils/api.js');
  90. const util = require('../../../utils/util.js');
  91. export default {
  92. components: {},
  93. data() {
  94. return {
  95. isShowPage: false,
  96. picUrlss: req.public.picUrls,
  97. isScroll: false, //是否滚动
  98. systems: {},
  99. params: {},
  100. dateIndex: 2,
  101. dateList: [{
  102. label: '今天',
  103. value: 1
  104. },
  105. {
  106. label: '本周',
  107. value: 2
  108. },
  109. {
  110. label: '本月',
  111. value: 3
  112. },
  113. {
  114. label: '季度',
  115. value: 4
  116. },
  117. {
  118. label: '今年',
  119. value: 5
  120. }
  121. ],
  122. dataRulesIndex: 1,
  123. dataRules: [{
  124. label: '按日',
  125. value: 1
  126. },
  127. {
  128. label: '按月',
  129. value: 3
  130. },
  131. ],
  132. dataCharts: '',
  133. chartOpts: {
  134. color: ["#13C685", "#FF6E52"],
  135. padding: [15, 0, 0, 5],
  136. legend: {
  137. float: 'right',
  138. padding: 20,
  139. fontColor: '#9297A2'
  140. },
  141. enableScroll: true,
  142. xAxis: {
  143. axisLineColor: '#f4f4f4',
  144. itemCount: 4,
  145. disableGrid: true,
  146. scrollShow: true,
  147. scrollAlign: 'right',
  148. fontSize: 12,
  149. fontColor: '#2F3440',
  150. },
  151. yAxis: {
  152. gridColor: "#f4f4f4",
  153. data: [{
  154. min: 0,
  155. axisLineColor: '#00000000',
  156. fontSize: 12,
  157. fontColor: '#999999',
  158. }]
  159. },
  160. extra: {
  161. column: {
  162. type: "group",
  163. width: 6,
  164. seriesGap: 4,
  165. barBorderCircle: true,
  166. activeBgColor: "#000000",
  167. activeBgOpacity: 0.08,
  168. }
  169. }
  170. }
  171. }
  172. },
  173. onLoad() {
  174. this.getPramas()
  175. this.getChart();
  176. },
  177. onShow() {},
  178. onHide() {},
  179. onReachBottom() {},
  180. methods: {
  181. toDecimal(num) {
  182. return util.toDecimal(num);
  183. },
  184. getSaleType(type){
  185. var text = '';
  186. switch (type) {
  187. case 1:
  188. text = '合伙人';
  189. break;
  190. case 2:
  191. text = '服务';
  192. break;
  193. case 3:
  194. text = '个人';
  195. break;
  196. case 4:
  197. text = '团队';
  198. break;
  199. case 5:
  200. text = '直播间';
  201. break;
  202. case 5:
  203. text = '公会';
  204. break;
  205. }
  206. return text;
  207. },
  208. getPramas() {
  209. req.getRequest(api.perfomance_statistics, {
  210. dayType: this.dateList[this.dateIndex].value
  211. }, data => {
  212. this.params = data;
  213. this.isShowPage = true;
  214. })
  215. },
  216. changeDate(e){
  217. this.dateIndex = e.detail.value;
  218. this.getPramas();
  219. },
  220. getServerData(data) {
  221. let res = {
  222. categories: data.timeList,
  223. series: [{
  224. name: "销量",//data.totalList
  225. data: data.totalList
  226. },
  227. {
  228. name: "销售额",//data.moneyList
  229. data: data.moneyList
  230. }
  231. ]
  232. };
  233. console.log(res.categories)
  234. return res;
  235. },
  236. getChart() {
  237. req.getRequest(api.perfomance_statistics_charts, {
  238. dayType: this.dataRules[this.dataRulesIndex].value
  239. }, data => {
  240. this.dataCharts = this.getServerData(data)
  241. })
  242. },
  243. changeDataRule(e){
  244. this.dataRulesIndex = e.detail.value;
  245. this.getChart();
  246. },
  247. jumpUrl(url) {
  248. uni.navigateTo({
  249. url: url
  250. })
  251. },
  252. jumpPromoteUrl(type){
  253. let url = '';
  254. switch (type){
  255. case 1:
  256. url = '/promote/team/team';
  257. break;
  258. case 3:
  259. url = '/promote/performance/personal/index';
  260. break;
  261. case 4:
  262. url = '/promote/performance/team/index';
  263. break;
  264. }
  265. this.jumpUrl(url);
  266. }
  267. },
  268. created() {
  269. const systemInfo = uni.getSystemInfoSync();
  270. // px转换到rpx的比例
  271. let pxToRpxScale = 750 / systemInfo.windowWidth;
  272. let systems = {
  273. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  274. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  275. };
  276. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  277. this.systems = systems;
  278. },
  279. onPageScroll(e) {
  280. const systemInfo = uni.getSystemInfoSync();
  281. let height = systemInfo.statusBarHeight + 44
  282. if (e.scrollTop > height) {
  283. this.isScroll = true
  284. } else {
  285. this.isScroll = false
  286. }
  287. }
  288. }
  289. </script>
  290. <style>
  291. @import "./index.css";
  292. </style>