index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view>
  3. <view class="date">
  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="yeji-info ddflex">
  17. <view class="lis">销售额<text>{{toDecimal(item.money)}}</text></view>
  18. <view class="lis">提成<text>{{toDecimal(item.commission)}}</text></view>
  19. </view>
  20. <view class="proinfo">
  21. <view class="lis ddflex" v-for="(pro,proindex) in item.productList" :key="proindex">
  22. <image :src="pro.pic" mode="aspectFill"></image>
  23. <view class="fflex">
  24. <view class="proname">{{pro.title}}</view>
  25. <view class="buy-info ddflex">
  26. <view><text>时间</text>{{item.createDate}}</view>
  27. <view><text>购买数</text>{{pro.quantity}}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="user-info">
  33. <view class="lis ddflex"><text>购买人</text>{{item.nickName}}<view @click="callPhone(item.phone)">{{item.phone}}</view></view>
  34. <view class="lis"><text>购买门店</text>{{item.merchantName}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="nodata" v-else>
  39. <image :src="picUrlss+'empty_dd.png'"></image>
  40. <text>暂无业绩</text>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. const app = getApp();
  46. const req = require('../../../utils/request.js');
  47. const api = require('../../../utils/api.js');
  48. const util = require('../../../utils/util.js');
  49. export default {
  50. components: {
  51. },
  52. data() {
  53. return {
  54. picUrlss: req.public.picUrls,
  55. dateIndex: 2,
  56. dateList: [{
  57. label: '今天',
  58. value: 1
  59. },
  60. {
  61. label: '本周',
  62. value: 2
  63. },
  64. {
  65. label: '本月',
  66. value: 3
  67. },
  68. {
  69. label: '季度',
  70. value: 4
  71. },
  72. {
  73. label: '今年',
  74. value: 5
  75. }
  76. ],
  77. form: {
  78. page: 1,
  79. limit: 10
  80. },
  81. pageList: [],
  82. isLoad: true,
  83. saleSort: '',
  84. commissionSort: ''
  85. }
  86. },
  87. onLoad() {
  88. this.getPageList()
  89. },
  90. onShow() {
  91. },
  92. onHide() {
  93. },
  94. onReachBottom() {
  95. this.form.page++
  96. this.getPageList()
  97. },
  98. methods: {
  99. changeDate(e){
  100. this.dateIndex = e.detail.value
  101. this.form.page = 1
  102. this.isLoad = true
  103. this.getPageList();
  104. },
  105. switchSaleType(){
  106. this.commissionSort = ''
  107. console.log('saleSort==',this.saleSort)
  108. if(this.saleSort == '') this.saleSort = 1
  109. else if(this.saleSort == 1) this.saleSort = 2
  110. else this.saleSort = 1
  111. this.form.page = 1
  112. this.isLoad = true
  113. this.getPageList()
  114. },
  115. switchCommissionType(){
  116. this.saleSort = ''
  117. if(this.commissionSort == '') this.commissionSort = 3
  118. else if(this.commissionSort == 3) this.commissionSort = 4
  119. else this.commissionSort = 3
  120. this.form.page = 1
  121. this.isLoad = true
  122. this.getPageList()
  123. },
  124. switchDefault(){
  125. this.commissionSort = ''
  126. this.saleSort = ''
  127. this.form.page = 1
  128. this.isLoad = true
  129. this.getPageList()
  130. },
  131. toDecimal(num) {
  132. return util.toDecimal(num);
  133. },
  134. getPageList(){
  135. if (!this.isLoad) return false;
  136. this.isLoad = false;
  137. let that = this;
  138. let form = that.form
  139. form.dayType = that.dateList[that.dateIndex].value
  140. if(this.saleSort) form.sort = this.saleSort
  141. if(this.commissionSort) form.sort =this.commissionSort
  142. if(form.page == 1){
  143. uni.showLoading()
  144. }
  145. req.getRequest(api.personal_achievementList,form,data=>{
  146. if (data && data.length >= 10) that.isLoad = true;
  147. if (that.form.page > 1) data = that.pageList.concat(data);
  148. that.pageList = data
  149. uni.hideLoading();
  150. })
  151. },
  152. callPhone(phone){
  153. uni.makePhoneCall({
  154. phoneNumber: phone
  155. })
  156. }
  157. }
  158. }
  159. </script>
  160. <style>
  161. @import "./index.css";
  162. </style>