123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <template>
- <view class="sort-box">
- <view class="top-view">
- <view class="search-view clearfix">
- <!-- <u-tabs-swiper font-size="28" ref="tabs" :list="tabs_list" :is-scroll="false" :current="tabs_current"
- @change="timeChange"></u-tabs-swiper> -->
- <view class="title" @click="month_show = true">
- {{time}}
- </view>
- <view class="title" @click="status_show = true">{{type}}</view>
- </view>
- <view class="thead">
- <view class="flex1 sort-li">排名</view>
- <view class="flex1 staff-li">销售员</view>
- <view class="flex1 cutomer-li" @click="sortChange('dealCustomerNum')">
- <text>成交客户</text>
- <view class="icon-up sort-icon"
- :class="[sortField === 'dealCustomerNum' && sort_k === 'ASC' ? 'active' : '']">
- <u-icon name="arrow-up-fill" size="14"></u-icon>
- </view>
- <view class="icon-down sort-icon"
- :class="[sortField === 'dealCustomerNum' && sort_k === 'DESC' ? 'active' : '']">
- <u-icon name="arrow-down-fill" size="14"></u-icon>
- </view>
- </view>
- <view class="flex1 sku-li" @click="sortChange('skuNum')">
- <text>SKU数</text>
- <view class="icon-up sort-icon"
- :class="[sortField === 'skuNum' && sort_k === 'ASC' ? 'active' : '']">
- <u-icon name="arrow-up-fill" size="14"></u-icon>
- </view>
- <view class="icon-down sort-icon"
- :class="[sortField === 'skuNum' && sort_k === 'DESC' ? 'active' : '']">
- <u-icon name="arrow-down-fill" size="14"></u-icon>
- </view>
- </view>
- <view class="flex1" @click="sortChange('orderNum')">
- <text>订单数</text>
- <view class="icon-up sort-icon"
- :class="[sortField === 'orderNum' && sort_k === 'ASC' ? 'active' : '']">
- <u-icon name="arrow-up-fill" size="14"></u-icon>
- </view>
- <view class="icon-down sort-icon"
- :class="[sortField === 'orderNum' && sort_k === 'DESC' ? 'active' : '']">
- <u-icon name="arrow-down-fill" size="14"></u-icon>
- </view>
- </view>
- <view class="flex1 sort-li" @click="sortChange('buyNum')">
- <text>销售量</text>
- <view class="icon-up sort-icon"
- :class="[sortField === 'buyNum' && sort_k === 'ASC' ? 'active' : '']">
- <u-icon name="arrow-up-fill" size="14"></u-icon>
- </view>
- <view class="icon-down sort-icon"
- :class="[sortField === 'buyNum' && sort_k === 'DESC' ? 'active' : '']">
- <u-icon name="arrow-down-fill" size="14"></u-icon>
- </view>
- </view>
- <view class="flex1" @click="sortChange('dealAmount')">
- <text>金额</text>
- <view class="icon-up sort-icon"
- :class="[sortField === 'dealAmount' && sort_k === 'ASC' ? 'active' : '']">
- <u-icon name="arrow-up-fill" size="14"></u-icon>
- </view>
- <view class="icon-down sort-icon"
- :class="[sortField === 'dealAmount' && sort_k === 'DESC' ? 'active' : '']">
- <u-icon name="arrow-down-fill" size="14"></u-icon>
- </view>
- </view>
- </view>
- </view>
- <ul class="cont-ul">
- <li class="flex" v-for="(item, index) in rank_list" :key="index"
- :class="[staffId === item.salesManId ? 'on-staff' : '']">
- <view class="flex1 sort-li">{{ index + 1 }}</view>
- <view class="flex1 staff-li">{{ item.salesManName }}</view>
- <view class="flex1 cutomer-li">{{ item.dealCustomerNum }}</view>
- <view class="flex1 sku-li">{{ item.skuNum }}</view>
- <view class="flex1">{{ item.orderNum }}</view>
- <view class="flex1 sort-li">{{ item.buyNum ? $utils.formatNub(item.buyNum) : 0 }}</view>
- <view class="flex1">{{ $utils.formatNub($NP.divide(item.dealAmount, 10000), 1) }}万</view>
- </li>
- </ul>
- <view class="total-view flex" v-if="rank_list.length">
- <view class="flex1 text-li">合计:</view>
- <view class="flex1 cutomer-li">{{ totalObj.dealCustomerNum }}</view>
- <view class="flex1 sku-li">{{ totalObj.skuNum }}</view>
- <view class="flex1">{{ totalObj.orderNum }}</view>
- <view class="flex1 sort-li">{{ totalObj.buyNum ? $utils.formatNub(totalObj.buyNum) : 0 }}</view>
- <view class="flex1">
- {{ $utils.formatNub($NP.divide(totalObj.dealAmount, 10000), 1) }}
- <text style="font-size: 24rpx;font-weight: 400;margin-left: 4rpx;">万</text>
- </view>
- </view>
- <view v-if="!rank_list.length" class="empty-view">
- <u-empty text="暂无数据" mode="list"></u-empty>
- </view>
- <u-loadmore v-if="rank_list.length" :status="load_status" />
- <u-select @confirm="statusChange" v-model="status_show" :list="type_options"></u-select>
- <u-select v-model="month_show" :list="tabs_list" @confirm="confirm"></u-select>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- order_status: 3,
- order_name: '待收货',
- time_name: '当日',
- tabs_list: [{
- label: '当月',
- value: 0
- },
- {
- label: '当日',
- value: 1
- }
- ],
- tabs_current: 1,
- type_options: [{
- label: '全部',
- value: ''
- },
- {
- label: '待审核',
- value: 2
- },
- {
- label: '待出库',
- value: 3
- },
- {
- label: '待收货',
- value: 4
- },
- {
- label: '已完成',
- value: 5
- },
- {
- label: '已关闭',
- value: 6
- }
- ],
- rank_list: [],
- time_show: false,
- status_show: false,
- sort_k: 'DESC', //sort 排序方式 ASC 正序 DESC 倒序
- load_status: 'nomore',
- page: 1,
- pageSize: 50,
- total: 0,
- start_time: '', //不传此参默认当天
- end_time: '', //不传此参默认当天
- sortField: 'dealAmount', //dealCustomerNum 成交客户数 orderNum 订单数 dealAmount 成交金额 skuNum 成交sku数
- month_show: false,
- time: '当日',
- type: '待出库'
- };
- },
- computed: {
- staffId() {
- return this.$store.state.userInfo.staffId;
- },
- totalObj() {
- let totalObj = {
- dealCustomerNum: 0,
- skuNum: 0,
- orderNum: 0,
- buyNum: 0,
- dealAmount: 0
- };
- this.rank_list.forEach(item => {
- totalObj.dealCustomerNum = this.$NP.plus(totalObj.dealCustomerNum, Number(item
- .dealCustomerNum));
- totalObj.skuNum = this.$NP.plus(totalObj.skuNum, Number(item.skuNum));
- totalObj.orderNum = this.$NP.plus(totalObj.orderNum, Number(item.orderNum));
- totalObj.buyNum = this.$NP.plus(totalObj.buyNum, Number(item.buyNum));
- totalObj.dealAmount = this.$NP.plus(totalObj.dealAmount, Number(item.dealAmount));
- });
- return totalObj;
- }
- },
- onLoad() {
- console.log(new Date().getDate());
- this.salesManRank();
- },
- onReachBottom() {
- if (this.total / this.pageSize > this.page) {
- this.page += 1;
- this.salesManRank();
- }
- },
- onPullDownRefresh() {
- this.page = 1;
- this.salesManRank();
- },
- methods: {
- openMode(key) {
- this[key] = true;
- },
- timeChange(index) {
- this.tabs_current = index;
- if (index === 0) {
- this.time_name = '当月';
- const day = new Date().getDate();
- const funDate = this.$utils.funDate(0 - day);
- this.start_time = this.$utils.timeByTimestamp(funDate + ' 00:00:00');
- this.end_time = parseInt(new Date().getTime() / 1000);
- } else {
- this.time_name = '当日';
- this.start_time = '';
- this.end_time = '';
- }
- this.searchData();
- },
- sortChange(key) {
- this.sortField = key;
- if (this.sort_k === 'DESC') {
- this.sort_k = 'ASC';
- } else {
- this.sort_k = 'DESC';
- }
- this.searchData();
- },
- searchData() {
- this.page = 1;
- this.salesManRank();
- },
- statusChange(val) {
- this.order_status = val[0].value;
- this.order_name = val[0].label;
- this.type = val[0].label
- this.searchData();
- },
- salesManRank() {
- this.load_status = 'loading';
- let arr = [];
- if (this.order_status) {
- arr.push(this.order_status);
- }
- this.$u.api
- .salesManRank({
- page: this.page,
- pageSize: this.pageSize,
- sortField: this.sortField,
- sort: this.sort_k, //DESC
- startTime: this.start_time,
- endTime: this.end_time,
- orderStatus: arr
- })
- .then(res => {
- uni.stopPullDownRefresh();
- if (this.page === 1) {
- this.rank_list = res.data;
- } else {
- this.rank_list = this.rank_list.concat(res.data);
- }
- this.total = res.pageTotal;
- this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
- });
- },
- confirm(val) {
- this.timeChange(val[0].value)
- this.time = val[0].label
- }
- }
- };
- </script>
- style
- <style lang="scss" scoped>
- .sort-box {
- padding-bottom: 90rpx;
- }
- .keyword-view {
- width: 100%;
- padding: 20rpx 24rpx;
- background-color: #ffffff;
- z-index: 9;
- .float_left {
- width: 640rpx;
- }
- .float_right {
- line-height: 64rpx;
- width: 50rpx;
- text-align: center;
- color: #666666;
- }
- }
- .cont-ul {
- background-color: #ffffff;
- padding-top: 140rpx;
- .flex {
- height: 70rpx;
- }
- }
- .flex {
- display: table;
- width: 750rpx;
- // line-height: 90rpx;
- font-size: 24rpx;
- }
- .flex1 {
- display: table-cell;
- width: 16%;
- text-align: center;
- position: relative;
- height: 100%;
- vertical-align: middle;
- &.on-staff {
- color: $uni-color-primary;
- }
- &.staff-li {
- width: 11%;
- }
- &.sort-li {
- width: 11%;
- }
- &.cutomer-li {
- width: 20%;
- }
- &.sku-li {
- width: 18%;
- }
- .sort-icon {
- position: absolute;
- right: 10rpx;
- height: 20rpx;
- line-height: 20rpx;
- color: #999999;
- &.active {
- color: $uni-color-primary;
- }
- }
- .icon-up {
- top: 10rpx;
- }
- .icon-down {
- bottom: 18rpx;
- }
- }
- .on-staff {
- color: $uni-color-primary;
- }
- .top-view {
- position: fixed;
- width: 750rpx;
- top: 0;
- left: 0;
- z-index: 9;
- .thead {
- line-height: 60rpx;
- height: 60rpx;
- font-size: 24rpx;
- background-color: #f5f5f5;
- display: flex;
- width: 100%;
- }
- .search-view {
- width: 100%;
- .title {
- width: 50%;
- height: 80rpx;
- float: left;
- text-align: center;
- font-size: 28rpx;
- font-weight: bold;
- line-height: 80rpx;
- }
- }
- }
- .total-view {
- position: fixed;
- z-index: 9;
- bottom: 0;
- left: 0;
- width: 100%;
- font-size: 28rpx;
- line-height: 88rpx;
- font-weight: 600;
- background-color: #ffffff;
- box-shadow: 0 -3rpx 32rpx 0 rgba(156, 170, 175, 0.16);
- .text-li {
- font-size: 24rpx;
- width: 22%;
- }
- }
- </style>
|