index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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. <view class="fflex">
  17. <view class="ddflex">
  18. <image :src="params.avatar ? params.avatar : '../../static/pages/images/userimg.png'" mode="aspectFill" class="userimg"></image>
  19. <view class="username">{{params.nickName}}</view>
  20. </view>
  21. <view class="dept ddflex">
  22. <view class="hhr-tag ddflex">
  23. <image :src="picUrlss+'hhr_bg_l.png'"></image>
  24. <view>金牌合伙人</view>
  25. </view>
  26. <view class="job ddflex">
  27. <view v-if="params.deptName">{{params.deptName}}</view>
  28. <view v-if="params.titleName">{{params.titleName}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="date">
  33. <picker :range="dateList" range-key="label" @change="changeDate">
  34. <view>{{dateList[dateIndex].label}}</view>
  35. <image src="../../static/pages/images/bico_white.png" class="bico"></image>
  36. </picker>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="box qian" :style="'height:' + styleCss">
  41. <view class="tit ddflex">累计收益</text></view>
  42. <view class="yugu ddflex">
  43. <view class="fflex">
  44. <view class="yugu-money">{{toDecimal(params.estimate)}}</view>
  45. <view class="yugu-text ddflex">
  46. <image :src="picUrlss+'blue/yeji_bag.png'"></image>总收益
  47. </view>
  48. </view>
  49. <view class="tx-btn" @click="jumpUrl('/promote/withdrawal/index/index')">立即提现</view>
  50. </view>
  51. <view class="m-datas ddflex">
  52. <view class="li" @click="jumpUrl('/promote/settleDetail/settleDetail?tabIndex=' + 1 + '&timeIndex=' + 0 + '&state=1')">
  53. <view>{{toDecimal(params.settled)}}</view>待结算
  54. </view>
  55. <view class="li" @click="jumpUrl('/promote/settleDetail/settleDetail?tabIndex=' + 1 + '&timeIndex=' + 0 + '&state=2')">
  56. <view>{{toDecimal(params.withdrawal)}}</view>可提现
  57. </view>
  58. <view class="li" @click="jumpUrl('/promote/withdrawal/record/record')">
  59. <view>{{toDecimal(params.accumulatedWithdrawal)}}</view>累计提现
  60. </view>
  61. </view>
  62. <view class="more-datas">
  63. <view class="yeji-datas ddflex" v-for="(item,index) in params.saleTypeIndexResponses" :key="index" v-if="params.saleTypeIndexResponses&&params.saleTypeIndexResponses.length > 0">
  64. <view class="li">
  65. {{toDecimal(item.personal)}}
  66. <view class="ddflex" @click="jumpPromoteUrl(item.scaleType)">
  67. {{getSaleType(item.scaleType)}}
  68. <image src="../../static/pages/images/more.png"></image>
  69. </view>
  70. </view>
  71. <view class="li"><!-- @click="jumpPromoteListUrl(item.scaleType)" -->
  72. {{toDecimal(item.estimate)}}
  73. <view class="ddflex">{{getSaleTypeText(item.scaleType)}}</view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="colle">
  78. <view :class="'colle-c ddflex' + (isCollapse?' active':'')" @click="collapse"><image src="../static/promote/images/colle.png"></image></view>
  79. </view>
  80. </view>
  81. <view class="box">
  82. <view class="tit ddflex">我的客户</view>
  83. <view class="box-datas ddflex">
  84. <view class="li">
  85. <view>{{ customerCensus.shareCount }}</view>
  86. 分享次数
  87. </view>
  88. <view class="li">
  89. <view>{{ customerCensus.browseCount }}</view>
  90. 贡献流量
  91. </view>
  92. <view class="li" @click="jumpUrl('/promote/teamList/teamList?tab=0&IS_secondary_members=' + IS_secondary_members)">
  93. <view>{{ customerCensus.customerCount }}</view>
  94. 分享锁客
  95. </view>
  96. <!-- <view class="li" @click="jumpUrl('promote/products/products')">
  97. <view>{{ customerCensus.validCount }}</view>
  98. 分销商品
  99. </view> -->
  100. <!-- <view class="li" @click="jump('/clue/index/index')">
  101. <view>{{ customerCensus.validCount }}</view>
  102. 有效商机
  103. </view> -->
  104. </view>
  105. </view>
  106. <!-- <view class="box">
  107. <view class="tit ddflex">团队业绩<text>/ 元</text></view>
  108. <view class="yeji-datas ddflex">
  109. <view class="li">
  110. {{toDecimal(params.teamPersonal)}}
  111. <view class="ddflex" @click="jumpUrl('/promote/performance/team/index')">团队销售<image
  112. src="../../../static/pages/images/more.png"></image>
  113. </view>
  114. </view>
  115. <view class="li">
  116. {{toDecimal(params.teamEstimate)}}
  117. <view class="ddflex">团队提成</view>
  118. </view>
  119. </view>
  120. </view> -->
  121. <view class="box data-box">
  122. <view class="tit ddflex">
  123. <view class="fflex">推广数据分析</view>
  124. <view class="date data">
  125. <picker :range="dataRules" range-key="label" @change="changeMarketRule">
  126. <view>{{dataRules[marketRulesIndex].label}}</view>
  127. <image src="../../static/pages/images/bico.png" class="bico1"></image>
  128. </picker>
  129. </view>
  130. </view>
  131. <view class="statistics">
  132. <qiun-data-charts
  133. type="line"
  134. :opts="marketChartOpts"
  135. :ontouch="true"
  136. :chartData="marketCharts"
  137. />
  138. <!-- <qiun-data-charts type="line" canvasId="scrollevent" :opts="marketChartOpts" :ontouch="true" :canvas2d="true" :chartData="marketCharts" /> -->
  139. </view>
  140. </view>
  141. <view class="box data-box" v-if="params.deptName || params.titleName">
  142. <view class="tit ddflex">
  143. <view class="fflex">销售数据分析</view>
  144. <view class="date data">
  145. <picker :range="dataRules" range-key="label" @change="changeDataRule">
  146. <view>{{dataRules[dataRulesIndex].label}}</view>
  147. <image src="../../static/pages/images/bico.png" class="bico1"></image>
  148. </picker>
  149. </view>
  150. </view>
  151. <view class="statistics">
  152. <qiun-data-charts type="column" canvasId="scrollevent" :opts="chartOpts" :ontouch="true" :canvas2d="true" :chartData="dataCharts" />
  153. </view>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. const app = getApp();
  159. const req = require('../../utils/request.js');
  160. const api = require('../../utils/api.js');
  161. const util = require('../../utils/util.js');
  162. export default {
  163. components: {},
  164. data() {
  165. return {
  166. isShowPage: false,
  167. picUrlss: req.public.picUrls,
  168. isScroll: false, //是否滚动
  169. systems: {},
  170. params: {},
  171. styleCss: '333rpx',
  172. isCollapse: false,
  173. dateIndex: 2,
  174. dateList: [{
  175. label: '今天',
  176. value: 1
  177. },
  178. {
  179. label: '本周',
  180. value: 2
  181. },
  182. {
  183. label: '本月',
  184. value: 3
  185. },
  186. {
  187. label: '季度',
  188. value: 4
  189. },
  190. {
  191. label: '今年',
  192. value: 5
  193. }
  194. ],
  195. dataRulesIndex: 1,
  196. dataRules: [{
  197. label: '按日',
  198. value: 1
  199. },
  200. {
  201. label: '按月',
  202. value: 3
  203. },
  204. ],
  205. dataCharts: '',
  206. chartOpts: {
  207. color: ["#13C685", "#FF6E52"],
  208. padding: [15, 0, 0, 5],
  209. legend: {
  210. float: 'right',
  211. padding: 15,
  212. fontColor: '#9297A2'
  213. },
  214. enableScroll: true,
  215. xAxis: {
  216. axisLineColor: '#f4f4f4',
  217. itemCount: 4,
  218. disableGrid: true,
  219. scrollShow: true,
  220. scrollAlign: 'right',
  221. fontSize: 12,
  222. fontColor: '#2F3440',
  223. },
  224. yAxis: {
  225. gridColor: "#f4f4f4",
  226. data: [{
  227. min: 0,
  228. axisLineColor: '#00000000',
  229. fontSize: 12,
  230. fontColor: '#999999',
  231. }]
  232. },
  233. extra: {
  234. column: {
  235. type: "group",
  236. width: 6,
  237. seriesGap: 4,
  238. barBorderCircle: true,
  239. activeBgColor: "#000000",
  240. activeBgOpacity: 0.08,
  241. }
  242. }
  243. },
  244. IS_secondary_members: 0,
  245. customerCensus: {},
  246. marketRulesIndex: 1,
  247. marketCharts: '',
  248. marketChartOpts: {
  249. color: ["#5F50E6", "#FF7D00","#64C1D7"],
  250. padding: [15, 0, 0, 5],
  251. legend: {
  252. float: 'right',
  253. padding: 15,
  254. fontColor: '#9297A2'
  255. },
  256. enableScroll: true,
  257. xAxis: {
  258. itemCount: 5, disableGrid: true, scrollShow: true, scrollAlign: 'right'
  259. },
  260. yAxis: {
  261. gridType: "dash",
  262. dashLength: 2
  263. },
  264. extra: {
  265. line: {
  266. type: "straight",
  267. width: 2
  268. }
  269. }
  270. },
  271. }
  272. },
  273. onLoad() {
  274. this.getPramas();
  275. this.getCustomer();
  276. this.getChart();
  277. this.getMarketChart();
  278. },
  279. onShow() {
  280. if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
  281. let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
  282. this.IS_secondary_members= IS_secondary_members
  283. }
  284. },
  285. onHide() {},
  286. onReachBottom() {},
  287. methods: {
  288. collapse(){
  289. if(this.isCollapse){
  290. this.styleCss = '333rpx'
  291. }else{
  292. this.styleCss = 'auto'
  293. }
  294. this.isCollapse = !this.isCollapse
  295. },
  296. toDecimal(num) {
  297. return util.toDecimal(num);
  298. },
  299. getSaleType(type){
  300. var text = '';
  301. switch (type) {
  302. case 1:
  303. text = '合伙人业绩';
  304. break;
  305. case 2:
  306. text = '服务业绩';
  307. break;
  308. case 3:
  309. text = '个人业绩';
  310. break;
  311. case 4:
  312. text = '团队业绩';
  313. break;
  314. case 5:
  315. text = '直播间业绩';
  316. break;
  317. case 5:
  318. text = '公会业绩';
  319. break;
  320. }
  321. return text;
  322. },
  323. getSaleTypeText(type){
  324. var text = '';
  325. switch (type) {
  326. case 1:
  327. text = '佣金';
  328. break;
  329. case 2:
  330. text = '服务提成';
  331. break;
  332. case 3:
  333. text = '销售提成';
  334. break;
  335. case 4:
  336. text = '团队奖励';
  337. break;
  338. case 5:
  339. text = '直播间提成';
  340. break;
  341. case 5:
  342. text = '公会提成';
  343. break;
  344. }
  345. return text;
  346. },
  347. getPramas() {
  348. req.getRequest(api.perfomance_statistics, {
  349. dayType: this.dateList[this.dateIndex].value
  350. }, data => {
  351. this.params = data;
  352. this.isShowPage = true;
  353. })
  354. },
  355. getCustomer() {
  356. req.getRequest(api.commission_customer, {
  357. dayType: this.dateList[this.dateIndex].value
  358. }, data => {
  359. this.customerCensus = data;
  360. })
  361. },
  362. changeDate(e){
  363. this.dateIndex = e.detail.value;
  364. this.getPramas();
  365. this.getCustomer();
  366. },
  367. getServerData(data) {
  368. let res = {
  369. categories: data.timeList,
  370. series: [{
  371. name: "销量",//data.totalList
  372. data: data.totalList
  373. },
  374. {
  375. name: "销售额",//data.moneyList
  376. data: data.moneyList
  377. }
  378. ]
  379. };
  380. console.log(res.categories)
  381. return res;
  382. },
  383. getChart() {
  384. req.getRequest(api.perfomance_statistics_charts, {
  385. dayType: this.dataRules[this.dataRulesIndex].value
  386. }, data => {
  387. if(data&&data.length > 0){
  388. this.dataCharts = this.getServerData(data)
  389. }
  390. })
  391. },
  392. getMarketData(data) {
  393. let res = {
  394. categories: data.timeList,
  395. series: [
  396. {
  397. name: "分享次数",//data.shareList
  398. data: data.shareList
  399. },
  400. {
  401. name: "贡献流量",//data.browseList
  402. data: data.browseList
  403. },
  404. {
  405. name: "分享锁客",//data.customerList
  406. data: data.customerList
  407. }
  408. ]
  409. };
  410. return res;
  411. },
  412. getMarketChart() {
  413. req.getRequest(api.commission_marketChart, {
  414. dayType: this.dataRules[this.marketRulesIndex].value
  415. }, data => {
  416. this.marketCharts = this.getMarketData(data)
  417. })
  418. },
  419. changeDataRule(e){
  420. this.dataRulesIndex = e.detail.value;
  421. this.getChart();
  422. },
  423. changeMarketRule(e){
  424. this.marketRulesIndex = e.detail.value;
  425. this.getMarketChart();
  426. },
  427. jumpUrl(url) {
  428. console.log('url==',url)
  429. uni.navigateTo({
  430. url: url
  431. })
  432. },
  433. jumpPromoteUrl(type){
  434. let url = '';
  435. switch (type){
  436. case 1:
  437. url = '/promote/sales/sales';
  438. break;
  439. case 3:
  440. url = '/promote/performance/personal/index';
  441. break;
  442. case 4:
  443. url = '/promote/performance/team/index';
  444. break;
  445. }
  446. this.jumpUrl(url);
  447. }
  448. },
  449. created() {
  450. const systemInfo = uni.getSystemInfoSync();
  451. // px转换到rpx的比例
  452. let pxToRpxScale = 750 / systemInfo.windowWidth;
  453. let systems = {
  454. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  455. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  456. };
  457. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  458. this.systems = systems;
  459. },
  460. onPageScroll(e) {
  461. const systemInfo = uni.getSystemInfoSync();
  462. let height = systemInfo.statusBarHeight + 44
  463. if (e.scrollTop > height) {
  464. this.isScroll = true
  465. } else {
  466. this.isScroll = false
  467. }
  468. }
  469. }
  470. </script>
  471. <style>
  472. @import "./index.css";
  473. </style>