StaffList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <view class="sort-box">
  3. <view class="top-view">
  4. <view class="search-view clearfix">
  5. <!-- <u-tabs-swiper font-size="28" ref="tabs" :list="tabs_list" :is-scroll="false" :current="tabs_current"
  6. @change="timeChange"></u-tabs-swiper> -->
  7. <view class="title" @click="month_show = true">
  8. {{time}}
  9. </view>
  10. <view class="title" @click="status_show = true">{{type}}</view>
  11. </view>
  12. <view class="thead">
  13. <view class="flex1 sort-li">排名</view>
  14. <view class="flex1 staff-li">销售员</view>
  15. <view class="flex1 cutomer-li" @click="sortChange('dealCustomerNum')">
  16. <text>成交客户</text>
  17. <view class="icon-up sort-icon"
  18. :class="[sortField === 'dealCustomerNum' && sort_k === 'ASC' ? 'active' : '']">
  19. <u-icon name="arrow-up-fill" size="14"></u-icon>
  20. </view>
  21. <view class="icon-down sort-icon"
  22. :class="[sortField === 'dealCustomerNum' && sort_k === 'DESC' ? 'active' : '']">
  23. <u-icon name="arrow-down-fill" size="14"></u-icon>
  24. </view>
  25. </view>
  26. <view class="flex1 sku-li" @click="sortChange('skuNum')">
  27. <text>SKU数</text>
  28. <view class="icon-up sort-icon"
  29. :class="[sortField === 'skuNum' && sort_k === 'ASC' ? 'active' : '']">
  30. <u-icon name="arrow-up-fill" size="14"></u-icon>
  31. </view>
  32. <view class="icon-down sort-icon"
  33. :class="[sortField === 'skuNum' && sort_k === 'DESC' ? 'active' : '']">
  34. <u-icon name="arrow-down-fill" size="14"></u-icon>
  35. </view>
  36. </view>
  37. <view class="flex1" @click="sortChange('orderNum')">
  38. <text>订单数</text>
  39. <view class="icon-up sort-icon"
  40. :class="[sortField === 'orderNum' && sort_k === 'ASC' ? 'active' : '']">
  41. <u-icon name="arrow-up-fill" size="14"></u-icon>
  42. </view>
  43. <view class="icon-down sort-icon"
  44. :class="[sortField === 'orderNum' && sort_k === 'DESC' ? 'active' : '']">
  45. <u-icon name="arrow-down-fill" size="14"></u-icon>
  46. </view>
  47. </view>
  48. <view class="flex1 sort-li" @click="sortChange('buyNum')">
  49. <text>销售量</text>
  50. <view class="icon-up sort-icon"
  51. :class="[sortField === 'buyNum' && sort_k === 'ASC' ? 'active' : '']">
  52. <u-icon name="arrow-up-fill" size="14"></u-icon>
  53. </view>
  54. <view class="icon-down sort-icon"
  55. :class="[sortField === 'buyNum' && sort_k === 'DESC' ? 'active' : '']">
  56. <u-icon name="arrow-down-fill" size="14"></u-icon>
  57. </view>
  58. </view>
  59. <view class="flex1" @click="sortChange('dealAmount')">
  60. <text>金额</text>
  61. <view class="icon-up sort-icon"
  62. :class="[sortField === 'dealAmount' && sort_k === 'ASC' ? 'active' : '']">
  63. <u-icon name="arrow-up-fill" size="14"></u-icon>
  64. </view>
  65. <view class="icon-down sort-icon"
  66. :class="[sortField === 'dealAmount' && sort_k === 'DESC' ? 'active' : '']">
  67. <u-icon name="arrow-down-fill" size="14"></u-icon>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <ul class="cont-ul">
  73. <li class="flex" v-for="(item, index) in rank_list" :key="index"
  74. :class="[staffId === item.salesManId ? 'on-staff' : '']">
  75. <view class="flex1 sort-li">{{ index + 1 }}</view>
  76. <view class="flex1 staff-li">{{ item.salesManName }}</view>
  77. <view class="flex1 cutomer-li">{{ item.dealCustomerNum }}</view>
  78. <view class="flex1 sku-li">{{ item.skuNum }}</view>
  79. <view class="flex1">{{ item.orderNum }}</view>
  80. <view class="flex1 sort-li">{{ item.buyNum ? $utils.formatNub(item.buyNum) : 0 }}</view>
  81. <view class="flex1">{{ $utils.formatNub($NP.divide(item.dealAmount, 10000), 1) }}万</view>
  82. </li>
  83. </ul>
  84. <view class="total-view flex" v-if="rank_list.length">
  85. <view class="flex1 text-li">合计:</view>
  86. <view class="flex1 cutomer-li">{{ totalObj.dealCustomerNum }}</view>
  87. <view class="flex1 sku-li">{{ totalObj.skuNum }}</view>
  88. <view class="flex1">{{ totalObj.orderNum }}</view>
  89. <view class="flex1 sort-li">{{ totalObj.buyNum ? $utils.formatNub(totalObj.buyNum) : 0 }}</view>
  90. <view class="flex1">
  91. {{ $utils.formatNub($NP.divide(totalObj.dealAmount, 10000), 1) }}
  92. <text style="font-size: 24rpx;font-weight: 400;margin-left: 4rpx;">万</text>
  93. </view>
  94. </view>
  95. <view v-if="!rank_list.length" class="empty-view">
  96. <u-empty text="暂无数据" mode="list"></u-empty>
  97. </view>
  98. <u-loadmore v-if="rank_list.length" :status="load_status" />
  99. <u-select @confirm="statusChange" v-model="status_show" :list="type_options"></u-select>
  100. <u-select v-model="month_show" :list="tabs_list" @confirm="confirm"></u-select>
  101. </view>
  102. </template>
  103. <script>
  104. export default {
  105. data() {
  106. return {
  107. order_status: 3,
  108. order_name: '待收货',
  109. time_name: '当日',
  110. tabs_list: [{
  111. label: '当月',
  112. value: 0
  113. },
  114. {
  115. label: '当日',
  116. value: 1
  117. }
  118. ],
  119. tabs_current: 1,
  120. type_options: [{
  121. label: '全部',
  122. value: ''
  123. },
  124. {
  125. label: '待审核',
  126. value: 2
  127. },
  128. {
  129. label: '待出库',
  130. value: 3
  131. },
  132. {
  133. label: '待收货',
  134. value: 4
  135. },
  136. {
  137. label: '已完成',
  138. value: 5
  139. },
  140. {
  141. label: '已关闭',
  142. value: 6
  143. }
  144. ],
  145. rank_list: [],
  146. time_show: false,
  147. status_show: false,
  148. sort_k: 'DESC', //sort 排序方式 ASC 正序 DESC 倒序
  149. load_status: 'nomore',
  150. page: 1,
  151. pageSize: 50,
  152. total: 0,
  153. start_time: '', //不传此参默认当天
  154. end_time: '', //不传此参默认当天
  155. sortField: 'dealAmount', //dealCustomerNum 成交客户数 orderNum 订单数 dealAmount 成交金额 skuNum 成交sku数
  156. month_show: false,
  157. time: '当日',
  158. type: '待出库'
  159. };
  160. },
  161. computed: {
  162. staffId() {
  163. return this.$store.state.userInfo.staffId;
  164. },
  165. totalObj() {
  166. let totalObj = {
  167. dealCustomerNum: 0,
  168. skuNum: 0,
  169. orderNum: 0,
  170. buyNum: 0,
  171. dealAmount: 0
  172. };
  173. this.rank_list.forEach(item => {
  174. totalObj.dealCustomerNum = this.$NP.plus(totalObj.dealCustomerNum, Number(item
  175. .dealCustomerNum));
  176. totalObj.skuNum = this.$NP.plus(totalObj.skuNum, Number(item.skuNum));
  177. totalObj.orderNum = this.$NP.plus(totalObj.orderNum, Number(item.orderNum));
  178. totalObj.buyNum = this.$NP.plus(totalObj.buyNum, Number(item.buyNum));
  179. totalObj.dealAmount = this.$NP.plus(totalObj.dealAmount, Number(item.dealAmount));
  180. });
  181. return totalObj;
  182. }
  183. },
  184. onLoad() {
  185. console.log(new Date().getDate());
  186. this.salesManRank();
  187. },
  188. onReachBottom() {
  189. if (this.total / this.pageSize > this.page) {
  190. this.page += 1;
  191. this.salesManRank();
  192. }
  193. },
  194. onPullDownRefresh() {
  195. this.page = 1;
  196. this.salesManRank();
  197. },
  198. methods: {
  199. openMode(key) {
  200. this[key] = true;
  201. },
  202. timeChange(index) {
  203. this.tabs_current = index;
  204. if (index === 0) {
  205. this.time_name = '当月';
  206. const day = new Date().getDate();
  207. const funDate = this.$utils.funDate(0 - day);
  208. this.start_time = this.$utils.timeByTimestamp(funDate + ' 00:00:00');
  209. this.end_time = parseInt(new Date().getTime() / 1000);
  210. } else {
  211. this.time_name = '当日';
  212. this.start_time = '';
  213. this.end_time = '';
  214. }
  215. this.searchData();
  216. },
  217. sortChange(key) {
  218. this.sortField = key;
  219. if (this.sort_k === 'DESC') {
  220. this.sort_k = 'ASC';
  221. } else {
  222. this.sort_k = 'DESC';
  223. }
  224. this.searchData();
  225. },
  226. searchData() {
  227. this.page = 1;
  228. this.salesManRank();
  229. },
  230. statusChange(val) {
  231. this.order_status = val[0].value;
  232. this.order_name = val[0].label;
  233. this.type = val[0].label
  234. this.searchData();
  235. },
  236. salesManRank() {
  237. this.load_status = 'loading';
  238. let arr = [];
  239. if (this.order_status) {
  240. arr.push(this.order_status);
  241. }
  242. this.$u.api
  243. .salesManRank({
  244. page: this.page,
  245. pageSize: this.pageSize,
  246. sortField: this.sortField,
  247. sort: this.sort_k, //DESC
  248. startTime: this.start_time,
  249. endTime: this.end_time,
  250. orderStatus: arr
  251. })
  252. .then(res => {
  253. uni.stopPullDownRefresh();
  254. if (this.page === 1) {
  255. this.rank_list = res.data;
  256. } else {
  257. this.rank_list = this.rank_list.concat(res.data);
  258. }
  259. this.total = res.pageTotal;
  260. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  261. });
  262. },
  263. confirm(val) {
  264. this.timeChange(val[0].value)
  265. this.time = val[0].label
  266. }
  267. }
  268. };
  269. </script>
  270. style
  271. <style lang="scss" scoped>
  272. .sort-box {
  273. padding-bottom: 90rpx;
  274. }
  275. .keyword-view {
  276. width: 100%;
  277. padding: 20rpx 24rpx;
  278. background-color: #ffffff;
  279. z-index: 9;
  280. .float_left {
  281. width: 640rpx;
  282. }
  283. .float_right {
  284. line-height: 64rpx;
  285. width: 50rpx;
  286. text-align: center;
  287. color: #666666;
  288. }
  289. }
  290. .cont-ul {
  291. background-color: #ffffff;
  292. padding-top: 140rpx;
  293. .flex {
  294. height: 70rpx;
  295. }
  296. }
  297. .flex {
  298. display: table;
  299. width: 750rpx;
  300. // line-height: 90rpx;
  301. font-size: 24rpx;
  302. }
  303. .flex1 {
  304. display: table-cell;
  305. width: 16%;
  306. text-align: center;
  307. position: relative;
  308. height: 100%;
  309. vertical-align: middle;
  310. &.on-staff {
  311. color: $uni-color-primary;
  312. }
  313. &.staff-li {
  314. width: 11%;
  315. }
  316. &.sort-li {
  317. width: 11%;
  318. }
  319. &.cutomer-li {
  320. width: 20%;
  321. }
  322. &.sku-li {
  323. width: 18%;
  324. }
  325. .sort-icon {
  326. position: absolute;
  327. right: 10rpx;
  328. height: 20rpx;
  329. line-height: 20rpx;
  330. color: #999999;
  331. &.active {
  332. color: $uni-color-primary;
  333. }
  334. }
  335. .icon-up {
  336. top: 10rpx;
  337. }
  338. .icon-down {
  339. bottom: 18rpx;
  340. }
  341. }
  342. .on-staff {
  343. color: $uni-color-primary;
  344. }
  345. .top-view {
  346. position: fixed;
  347. width: 750rpx;
  348. top: 0;
  349. left: 0;
  350. z-index: 9;
  351. .thead {
  352. line-height: 60rpx;
  353. height: 60rpx;
  354. font-size: 24rpx;
  355. background-color: #f5f5f5;
  356. display: flex;
  357. width: 100%;
  358. }
  359. .search-view {
  360. width: 100%;
  361. .title {
  362. width: 50%;
  363. height: 80rpx;
  364. float: left;
  365. text-align: center;
  366. font-size: 28rpx;
  367. font-weight: bold;
  368. line-height: 80rpx;
  369. }
  370. }
  371. }
  372. .total-view {
  373. position: fixed;
  374. z-index: 9;
  375. bottom: 0;
  376. left: 0;
  377. width: 100%;
  378. font-size: 28rpx;
  379. line-height: 88rpx;
  380. font-weight: 600;
  381. background-color: #ffffff;
  382. box-shadow: 0 -3rpx 32rpx 0 rgba(156, 170, 175, 0.16);
  383. .text-li {
  384. font-size: 24rpx;
  385. width: 22%;
  386. }
  387. }
  388. </style>