index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view>
  3. <view class="date ddflex">
  4. <picker :range="dateList" range-key="label" @change="changeDate">
  5. <view>{{dateList[dateIndex].label}}</view>
  6. <image :src="picUrlss+'blue/yeji_rico.png'" class="rico"></image>
  7. </picker>
  8. </view>
  9. <view class="filter ddflex">
  10. <view class="li" @click="switchDefault()">默认</view>
  11. <view class="li ddflex" @click="switchSaleType()">业绩<image :src="picUrlss+'blue/'+ (saleSort == 1 ? 'down.png' : saleSort == 2 ? 'up.png':'sort.png')"></image></view>
  12. <view class="li ddflex" @click="switchCommissionType()">提成<image :src="picUrlss+'blue/'+ (commissionSort == 3 ? 'down.png' : commissionSort == 4 ? 'up.png':'sort.png')"></image></view>
  13. </view>
  14. <view class="list" v-if="pageList&&pageList.length>0">
  15. <view class="li" v-for="(item,index) in pageList" :key="index">
  16. <view class="tit">{{item.realName}}</view>
  17. <view class="datas ddflex">
  18. <view class="lis">
  19. <view>{{toDecimal(item.personal)}}</view>个人销售
  20. </view>
  21. <view class="lis spe">
  22. <view :class="toDecimal(item.bl)>=0?'green':''">{{toDecimal(item.bl)}}%</view>较上月增长
  23. </view>
  24. <view class="lis">
  25. <view>{{toDecimal(item.estimate)}}</view>提成
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="nodata" v-else>
  31. <image :src="picUrlss+'empty_dd.png'"></image>
  32. <text>暂无业绩</text>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. const app = getApp();
  38. const req = require('../../../utils/request.js');
  39. const api = require('../../../utils/api.js');
  40. const util = require('../../../utils/util.js');
  41. export default {
  42. components: {
  43. },
  44. data() {
  45. return {
  46. picUrlss: req.public.picUrls,
  47. dateIndex: 2,
  48. dateList: [{
  49. label: '今天',
  50. value: 1
  51. },
  52. {
  53. label: '本周',
  54. value: 2
  55. },
  56. {
  57. label: '本月',
  58. value: 3
  59. },
  60. {
  61. label: '季度',
  62. value: 4
  63. },
  64. {
  65. label: '今年',
  66. value: 5
  67. }
  68. ],
  69. form: {
  70. page: 1,
  71. limit: 10
  72. },
  73. pageList: [],
  74. isLoad: true,
  75. saleSort: '',
  76. commissionSort: '',
  77. }
  78. },
  79. onLoad(options) {
  80. this.deptId = options.deptId
  81. this.dateIndex = options.dateIndex
  82. uni.setNavigationBarTitle({
  83. title: options.deptName
  84. })
  85. this.getPageList()
  86. },
  87. onShow() {
  88. },
  89. onHide() {
  90. },
  91. onReachBottom() {
  92. this.form.page++
  93. this.getPageList()
  94. },
  95. methods: {
  96. changeDate(e){
  97. this.dateIndex = e.detail.value
  98. this.saleSort = ''
  99. this.commissionSort = ''
  100. this.form.page = 1
  101. this.isLoad = true
  102. this.getPageList();
  103. },
  104. switchDepartment(){
  105. this.isShowPop = true
  106. },
  107. hidePop(){
  108. this.isShowPop = false
  109. },
  110. switchTeam(item,index){
  111. if(this.teamIndex == index) return false
  112. this.teamIndex = index
  113. this.form.page = 1
  114. this.isLoad = true
  115. this.getPageList(item.id)
  116. this.hidePop()
  117. },
  118. confirmSwitchTeam(){
  119. this.hidePop()
  120. },
  121. switchSaleType(){
  122. this.commissionSort = ''
  123. console.log('saleSort==',this.saleSort)
  124. if(this.saleSort == '') this.saleSort = 1
  125. else if(this.saleSort == 1) this.saleSort = 2
  126. else this.saleSort = 1
  127. this.form.page = 1
  128. this.isLoad = true
  129. this.getPageList()
  130. },
  131. switchCommissionType(){
  132. this.saleSort = ''
  133. if(this.commissionSort == '') this.commissionSort = 3
  134. else if(this.commissionSort == 3) this.commissionSort = 4
  135. else this.commissionSort = 3
  136. this.form.page = 1
  137. this.isLoad = true
  138. this.getPageList()
  139. },
  140. switchDefault(){
  141. this.commissionSort = ''
  142. this.saleSort = ''
  143. this.form.page = 1
  144. this.isLoad = true
  145. this.getPageList()
  146. },
  147. toDecimal(num) {
  148. return util.toDecimal(num);
  149. },
  150. getPageList(){
  151. if (!this.isLoad) return false;
  152. this.isLoad = false;
  153. let that = this;
  154. let form = that.form
  155. form.dayType = that.dateList[that.dateIndex].value
  156. form.deptId = this.deptId
  157. if(this.saleSort) form.sort = this.saleSort
  158. if(this.commissionSort) form.sort =this.commissionSort
  159. if(form.page == 1){
  160. uni.showLoading()
  161. }
  162. req.getRequest(api.team_personAchievementList,form,data=>{
  163. if (data && data.length >= 10) that.isLoad = true;
  164. if (that.form.page > 1) data = that.pageList.concat(data);
  165. that.pageList = data
  166. uni.hideLoading();
  167. })
  168. }
  169. }
  170. }
  171. </script>
  172. <style>
  173. @import "./index.css";
  174. </style>