index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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 class="department ddflex" @click="switchDepartment()" v-if="departmentList&&departmentList.length>0">部门<image src="../../../static/images/n_bico.png"></image></view>
  9. <!-- <view class="filters">
  10. <view class="point ddflex" @click="showFilters"><text></text><text></text><text></text></view>
  11. <view class="rules" v-if="isFilter">
  12. <view :class="'li' + (filterIndex == index ? ' active':'')" v-for="(item,index) in filterList" :key="index">{{item.label}}</view>
  13. </view>
  14. </view>
  15. <view class="ceng" v-if="isFilter" @click="hideFilters"></view> -->
  16. </view>
  17. <view class="total" v-if="totalPerfomance&&totalPerfomance.name">
  18. <view class="name">{{totalPerfomance.name}}</view>
  19. <view class="money">{{toDecimal(totalPerfomance.money)}}</view>
  20. <view class="team ddflex" @click="jumpUrl('/promote/performance/person/index?deptId=' + totalPerfomance.deptId + '&deptName='+totalPerfomance.name + '&dateIndex=' + dateIndex)">团队业绩<image src="../../../static/pages/images/more.png"></image></view>
  21. <view class="total-datas ddflex">
  22. <view class="li">
  23. <view>{{toDecimal(totalPerfomance.estimate)}}</view>团队奖励
  24. </view>
  25. <view class="li">
  26. <view :class="toDecimal(totalPerfomance.bl)>=0?'green':''">{{toDecimal(totalPerfomance.bl)}}%</view>较上月增长
  27. </view>
  28. </view>
  29. </view>
  30. <view class="filter ddflex">
  31. <view class="li" @click="switchDefault()">默认</view>
  32. <view class="li ddflex" @click="switchSaleType()">业绩<image :src="picUrlss+'blue/'+ (saleSort == 1 ? 'down.png' : saleSort == 2 ? 'up.png':'sort.png')"></image></view>
  33. <view class="li ddflex" @click="switchCommissionType()">奖励<image :src="picUrlss+'blue/'+ (commissionSort == 3 ? 'down.png' : commissionSort == 4 ? 'up.png':'sort.png')"></image></view>
  34. </view>
  35. <view class="list" v-if="pageList&&pageList.length>0">
  36. <view class="li" v-for="(item,index) in pageList" :key="index" @click="jumpUrl('/promote/performance/person/index?deptId=' + item.deptId + '&deptName='+item.name + '&dateIndex=' + dateIndex)">
  37. <view class="tit">{{item.name}}</view>
  38. <view class="datas ddflex">
  39. <view class="lis">
  40. <view>{{toDecimal(item.money)}}</view>团队业绩
  41. </view>
  42. <view class="lis spe">
  43. <view :class="toDecimal(item.bl)>=0?'green':''">{{toDecimal(item.bl)}}%</view>较上月增长
  44. </view>
  45. <view class="lis">
  46. <view>{{toDecimal(item.estimate)}}</view>团队奖励
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="nodata" v-else>
  52. <image :src="picUrlss+'empty_dd.png'"></image>
  53. <text>暂无业绩</text>
  54. </view>
  55. <block v-if="isShowPop">
  56. <view class="ceng" @click="hidePop"></view>
  57. <view class="popup">
  58. <view class="pop-tit">团队业绩</view>
  59. <view class="pop-con">
  60. <view class="pop-list ddflex">
  61. <view :class="'li' + (teamIndex == index ? ' active':'')" @click="switchTeam(item,index)" v-for="(item,index) in departmentList" :key="index">{{item.name}}</view>
  62. </view>
  63. </view>
  64. <view class="pop-btn ddflex">
  65. <view class="pop-cancel" @click="hidePop">取消</view>
  66. <view class="pop-confirm" @click="confirmSwitchTeam">确认</view>
  67. </view>
  68. </view>
  69. </block>
  70. </view>
  71. </template>
  72. <script>
  73. const app = getApp();
  74. const req = require('../../../utils/request.js');
  75. const api = require('../../../utils/api.js');
  76. const util = require('../../../utils/util.js');
  77. export default {
  78. components: {
  79. },
  80. data() {
  81. return {
  82. picUrlss: req.public.picUrls,
  83. dateIndex: 2,
  84. dateList: [{
  85. label: '今天',
  86. value: 1
  87. },
  88. {
  89. label: '本周',
  90. value: 2
  91. },
  92. {
  93. label: '本月',
  94. value: 3
  95. },
  96. {
  97. label: '季度',
  98. value: 4
  99. },
  100. {
  101. label: '今年',
  102. value: 5
  103. }
  104. ],
  105. form: {
  106. page: 1,
  107. limit: 10
  108. },
  109. pageList: [],
  110. isLoad: true,
  111. saleSort: '',
  112. commissionSort: '',
  113. isShowPop: false,
  114. teamIndex: 0,
  115. departmentList: [],
  116. totalPerfomance: {},
  117. deptId: ''
  118. }
  119. },
  120. onLoad() {
  121. this.getPageList()
  122. this.getDepartment()
  123. },
  124. onShow() {
  125. },
  126. onHide() {
  127. },
  128. onReachBottom() {
  129. this.form.page++
  130. this.getPageList()
  131. },
  132. methods: {
  133. changeDate(e){
  134. this.dateIndex = e.detail.value
  135. this.saleSort = ''
  136. this.commissionSort = ''
  137. this.form.page = 1
  138. this.isLoad = true
  139. this.getPageList();
  140. },
  141. switchDepartment(){
  142. this.isShowPop = true
  143. },
  144. hidePop(){
  145. this.isShowPop = false
  146. },
  147. switchTeam(item,index){
  148. if(this.teamIndex == index) return false
  149. this.teamIndex = index
  150. this.deptId = item.id
  151. this.form.page = 1
  152. this.isLoad = true
  153. this.getPageList()
  154. this.hidePop()
  155. },
  156. confirmSwitchTeam(){
  157. this.hidePop()
  158. },
  159. switchSaleType(){
  160. this.commissionSort = ''
  161. console.log('saleSort==',this.saleSort)
  162. if(this.saleSort == '') this.saleSort = 1
  163. else if(this.saleSort == 1) this.saleSort = 2
  164. else this.saleSort = 1
  165. this.form.page = 1
  166. this.isLoad = true
  167. this.getPageList()
  168. },
  169. switchCommissionType(){
  170. this.saleSort = ''
  171. if(this.commissionSort == '') this.commissionSort = 3
  172. else if(this.commissionSort == 3) this.commissionSort = 4
  173. else this.commissionSort = 3
  174. this.form.page = 1
  175. this.isLoad = true
  176. this.getPageList()
  177. },
  178. switchDefault(){
  179. this.commissionSort = ''
  180. this.saleSort = ''
  181. this.form.page = 1
  182. this.isLoad = true
  183. this.getPageList()
  184. },
  185. toDecimal(num) {
  186. return util.toDecimal(num);
  187. },
  188. getPageList(){
  189. if (!this.isLoad) return false;
  190. this.isLoad = false;
  191. let that = this;
  192. let form = that.form
  193. form.dayType = that.dateList[that.dateIndex].value
  194. if(this.saleSort) form.sort = this.saleSort
  195. if(this.commissionSort) form.sort =this.commissionSort
  196. if(this.deptId) form.deptId = this.deptId
  197. else form.deptId
  198. if(form.page == 1){
  199. uni.showLoading()
  200. }
  201. req.getRequest(api.team_achievementList,form,data=>{
  202. if (data && data.length >= 10) that.isLoad = true;
  203. if (that.form.page > 1) data = that.pageList.concat(data);
  204. if(data&&data.length>0){
  205. data.map(it=>{
  206. if(it.isTotal == 1){
  207. this.totalPerfomance = it
  208. }
  209. })
  210. let datas = data.filter(it=> it.isTotal == 0)
  211. that.pageList = datas
  212. }
  213. uni.hideLoading();
  214. })
  215. },
  216. getDepartment(){
  217. req.getRequest(api.team_nextDept,{},data=>{
  218. this.departmentList = data
  219. })
  220. },
  221. jumpUrl(url){
  222. uni.navigateTo({
  223. url: url
  224. })
  225. }
  226. }
  227. }
  228. </script>
  229. <style>
  230. @import "./index.css";
  231. </style>