平板端快衣店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

107 lines
2.8 KiB

<template>
<view>
<uni-section class="mb-10" title="业绩查看范围" type="line">
<uni-datetime-picker v-model="range" type="daterange" @change="change" />
</uni-section>
<view class="">
<uni-card title="业绩排名">
<uni-list>
<uni-list-item direction="row" v-for="(item , index) in staffList" :key="index">
<template #body>
<view class="tag-wrap">
<view v-if="item.departmentTitle">
<u-tag :text="item.departmentTitle" size="12" />
</view>
</view>
</template>
<template #header>
<view class="avatar-wrap">
<u-avatar :src="item.avatar" size="24">
</u-avatar>
<text class="staff-name">{{ item.createByName }}</text>
</view>
</template>
<template #footer>
<view style="font-size: 24rpx;">
<text style="margin-right: 10px;">单数:{{item.totalCount}}单</text>
<text>总金额:{{item.totalPrice}}元</text>
</view>
</template>
</uni-list-item>
</uni-list>
</uni-card>
</view>
</view>
</template>
<script>
export default {
data() {
return {
range: [],
name: '',
staffList:[]
}
},
onLoad() {
this.getMonth();
this.getStaffList()
},
methods: {
//改变时间选择
change(e){
console.log(e)
var start = e[0]
var end = e[1]
this.range = [start,end]
this.getStaffList();
},
//获取业绩列表
getStaffList() {
this.tui.request('/app/sale/getSalesRankingByShopId', 'post', {
startTime:this.range[0],
endTime:this.range[1],
}, false, false, true).then((res) => {
if (res.code !== 200) return
this.staffList = res.result
})
},
//获取当月1日到当前时间
getMonth() {
//获取新的时间
let date = new Date()
//获取当前时间的年份转为字符串
let year = date.getFullYear().toString() //'年'
//获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
let month = date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1).toString():(date.getMonth()+1).toString() //'月'
//获取天,判断是否小于10,如果是在字符串前面拼接'0'
let da = date.getDate() < 10 ? '0'+date.getDate().toString():date.getDate().toString() //'日'
//字符串拼接,开始时间,结束时间
let end = year + '-' + month + '-' + da //当天
let beg = year + '-' + month + '-01' //当月第一天
this.range = [beg,end]
}
}
}
</script>
<style lang="scss" scoped>
.example-body {}
.tag-wrap {
width: 100rpx;
flex: 1;
display: flex;
view {
margin: 0 2upx;
}
}
.avatar-wrap {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24upx;
}
</style>