|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 |
- <template>
- <view class="pages">
-
- <view class="boxtittab">
- <view class="tabbox">
- <view :class="{ activecllasscet: activeTotal == 4 }" @click="tabtimetap(4)">近七天</view>
- </view>
- <view class="tabbox">
- <view :class="{ activecllasscet: activeTotal == 5 }" @click="tabtimetap(5)">近15天</view>
- </view>
- <view class="tabbox">
- <view :class="{ activecllasscet: activeTotal == 6 }" @click="tabtimetap(6)">近30天</view>
- </view>
- <view class="tabbox">
- <view :class="{ activecllasscet: activeTotal == 3 }" @click="tabtimetap(3)">自定义</view>
- </view>
- </view>
- <view class="container">
- <scroll-view style="height: calc(100vh - 92rpx - 32rpx);" class="lside" scroll-y="true">
- <view class="lside-scrollbox">
- <block v-for="(data, index) in lsideList">
- <view class="lside-scrollbox-items" @tap="chooseLside(data, index)"
- :class="{active: index === lsideListIndex}" :key="index">
- {{ data.title }}
- </view>
- </block>
- </view>
- </scroll-view>
-
- <scroll-view style="height: calc(100vh - 92rpx - 32rpx);" class="rside" scroll-y="true">
- <view class="rside-scrollbox">
- <!-- 接待量 -->
- <template v-if="lsideListIndex === 0">
- <view class="single">
- <view class="title">
- <view class="title1">接待量(TOP10)</view>
- </view>
- <view class="hejisan">
- <view class="sanbox1">
- <view class="text1-2">{{newTeam1||0}}</view>
- <view class="text1-1">项目</view>
- </view>
- <view class="sanbox1">
- <view class="text1-2">{{newAvg1||0}}</view>
- <view class="text1-1">均值</view>
- </view>
- </view>
- <block v-for="(item,index) in newlisttabinfo1">
- <view class="box">
- <view class="box-lside">
- <template v-if="index < 2">
- <image class="img"
- :src="'../../../static/images/ranking/ranking'+ (index+1) +'.png'"
- mode=""></image>
- </template>
- <template v-else>
- <view class="ranking">{{ index + 1 }}</view>
- </template>
- </view>
- <view class="box-rside">
- <view class="box-top">
- <view class="percent-name">{{item.name}}</view>
- <view class="percent-zxl">{{ !item.zxl ? 0 : item.zxl}}</view>
- </view>
- <view class="percent-box">
- <view class="percent" :style="'width:'+ getPercent(item.zxl,1) + '%'">
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- </template>
-
- <!-- 接待时长 -->
- <template v-if="lsideListIndex === 1">
- <view class="single">
- <view class="title">
- <view class="title1">接待时长(TOP10)</view>
- </view>
- <view class="hejisan">
- <view class="sanbox1">
- <view class="text1-2">{{newTeam2||0}}</view>
- <view class="text1-1">项目</view>
- </view>
- <view class="sanbox1">
- <view class="text1-2">{{newAvg2||0}}</view>
- <view class="text1-1">均值</view>
- </view>
- </view>
-
- <block v-for="(item,index) in newlisttabinfo2">
- <view class="box">
- <view class="box-lside">
- <template v-if="index < 2">
- <image class="img"
- :src="'../../../static/images/ranking/ranking'+ (index+1) +'.png'"
- mode=""></image>
- </template>
- <template v-else>
- <view class="ranking">{{ index + 1 }}</view>
- </template>
- </view>
- <view class="box-rside">
- <view class="box-top">
- <view class="percent-name">{{item.name}}</view>
- <view class="percent-zxl">{{ !item.zxl ? 0 : item.zxl}}</view>
- </view>
- <view class="percent-box">
- <view class="percent" :style="'width:'+ getPercent(item.zxl,2) + '%'">
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- </template>
-
- <!-- 销讲执行排名 -->
- <template v-if="lsideListIndex === 2">
-
- <view class="single">
- <view class="title">
- <view class="title1" style="flex: 1;">销讲执行排名(TOP10)</view>
- </view>
- <view class="hejisan">
- <view class="sanbox1">
- <view class="text1-2">{{newTeam3||0}}</view>
- <view class="text1-1">项目</view>
- </view>
- <view class="sanbox1">
- <view class="text1-2">{{newAvg3||0}}%</view>
- <view class="text1-1">均值</view>
- </view>
- </view>
-
-
- <block v-for="(item,index) in newlisttabinfo3">
- <view class="box">
- <view class="box-lside">
- <template v-if="index < 2">
- <image class="img"
- :src="'../../../static/images/ranking/ranking'+ (index+1) +'.png'"
- mode=""></image>
- </template>
- <template v-else>
- <view class="ranking">{{ index + 1 }}</view>
- </template>
- </view>
- <view class="box-rside">
- <view class="box-top">
- <view class="percent-name">{{item.name}}</view>
- <view class="percent-zxl">{{ !item.zxl ? 0 : item.zxl}}</view>
- </view>
- <view class="percent-box">
- <view class="percent" :style="'width:'+ getPercent1(item.zxl) + '%'">
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- </template>
-
- <!-- 顾问执行排名 -->
- <template v-if="lsideListIndex === 3">
- <view class="single">
- <view class="title">
- <view class="title1" style="flex: 1;">顾问执行排名(TOP10)</view>
- </view>
-
- <block v-for="(item,index) in newlisttabinfo4">
- <view class="box">
- <view class="box-lside">
- <template v-if="index < 2">
- <image class="img"
- :src="'../../../static/images/ranking/ranking'+ (index+1) +'.png'"
- mode=""></image>
- </template>
- <template v-else>
- <view class="ranking">{{ index + 1 }}</view>
- </template>
- </view>
- <view class="box-rside">
- <view class="box-top">
- <view class="percent-name">{{item.name}}</view>
- <view class="percent-zxl">{{ !item.zxl ? 0 : item.zxl}}</view>
- </view>
- <view class="percent-box">
- <view class="percent" :style="'width:'+ getPercent1(item.zxl) + '%'">
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- </template>
-
- <template v-if="lsideListIndex === 4">
- <view class="single">
- <view class="title" style="padding-right: 30rpx;">
- <view class="title1" style="flex: 1;">销讲能力</view>
- <view class="title2" style="flex: 1;justify-content: flex-end;" @click="staffShow=true">
- <view class="title2-che" style="width: auto;">{{staff.label}}
- <image class="righttochoose" src="@/static/images/down.png" mode="">
- </image>
- </view>
- </view>
- </view>
- <view class="uchaserbox">
- <view v-if="!emptyCharData" class="uchaserbox" style="display: flex;
- align-items: center;justify-content: center;">
- <u-empty style="margin: 09 0 0 0;" mode="data"></u-empty>
- </view>
- <qiun-data-charts v-else class="qiudatacharts" type="radar" :chartData="chartData"
- :canvas2d="true" canvasId="wangxiaohuaerlingeryilingwuyib88" background="none"
- :loadingType="0" :opts="opts" />
- </view>
- </view>
- </template>
- </view>
- </scroll-view>
- </view>
-
- <!-- 日期选择器 -->
- <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
-
- <!-- 选择项目 -->
- <u-select v-model="staffShow" :list="staffList" @confirm="staffSelectCallback" :default-value='selindex'>
- </u-select>
- <!-- 加载组件 -->
- <u-loadings v-model="LOADING"></u-loadings>
- </view>
- </template>
-
- <script>
- var app = getApp();
- var util = require("../../../utils/util.js");
- var config = require("../../../config");
- export default {
- data() {
- return {
- activeTotal: 4, // 时间选择下标
-
- // 日期选择器
- totalTimeShow: false, // 日期选择器
- lastStartDate: '', // 开始时间
- lastEndDate: '', // 结束时间
- // 项目选择器
- staffShow: false, // 展示项目选择器
- staffList: [], // 可选项目列表
- staff: {
- value: '',
- label: '',
- }, // 选择的项目数据
- houseId: '', // 项目id
-
-
- lsideList: [{
- title: '接待量',
- method: 'receptionCountList',
- methodParams: "1,groupComparisonReception",
- },
- {
- title: '接待时长',
- method: 'receptionCountList',
- methodParams: "2,groupComparisonReceptionTime"
- },
- {
- title: '销讲排名',
- method: 'receptionCountList',
- methodParams: "3,groupComparisonTalkRank"
- },
- {
- title: '顾问排名',
- method: 'receptionCountList',
- methodParams: "4,groupComparisonTalkRankByConsultant"
- },
- {
- title: '销讲能力',
- method: 'getPowerList',
- methodParams: ''
- },
- ],
- lsideListIndex: 0, // 默认选中下标
-
- // 右侧存放数据变量
- newlisttabinfo1: [{
- name: '接待量',
- zxl: '0'
- },
- {
- name: '平均执行率',
- zxl: '0'
- },
- {
- name: '接待客户',
- zxl: '0'
- },
- ], // 接待量
- // 接待量
- newTeam1: '',
- newAvg1: '',
-
- newlisttabinfo2: [{
- name: '接待量',
- zxl: '0'
- },
- {
- name: '平均执行率',
- zxl: '0'
- },
- {
- name: '接待客户',
- zxl: '0'
- },
- ], // 接待时长
- // 接待时长
- newTeam2: '',
- newAvg2: '',
-
- newlisttabinfo3: [{
- name: '接待量',
- zxl: '0'
- },
- {
- name: '平均执行率',
- zxl: '0'
- },
- {
- name: '接待客户',
- zxl: '0'
- },
- ], // 销讲排名
- // 销讲排名
- newTeam3: '',
- newAvg3: '',
-
- newlisttabinfo4: [{
- name: '接待量',
- zxl: '0'
- },
- {
- name: '平均执行率',
- zxl: '0'
- },
- {
- name: '接待客户',
- zxl: '0'
- },
- ], // 顾问排名
-
- // 顾问排名
- newTeam4: '',
- newAvg4: '',
- chartData: {
- categories: [],
- series: []
- }, // 销讲能力
-
- opts: {
- type: "radar",
- width: 300,
- fontSize: 10,
- extra: {
- radar: {
- max: 100
- }
- }
- },
- emptyCharData: false,
-
- };
- },
-
- onLoad() {
- this.LOADING = true
- uni.$on('updateGroup', (data) => {
- this.houseId = data.arr.join(',')
- // 获取销奖能力
- this.getPowerList()
- })
- this.getSectionList()
- },
-
- onPullDownRefresh() {},
-
- methods: {
-
- // 获取部门列表
- getSectionList() {
- this.$u.post('/user/getHouseByToken', )
- .then(res => {
- // console.log(res)
- this.staffList = []
- res.map((item, index) => {
- let obj = {}
- obj.value = item.id
- obj.label = item.propertyName
- this.staffList.push(obj)
- })
- this.houseId = this.staffList[0].value
- this.staff = this.staffList[0]
- this.getdata()
- })
-
- },
-
- // 获取数据
- getdata() {
- let params = this.lsideList[this.lsideListIndex].methodParams.split(',')
- this[this.lsideList[this.lsideListIndex].method](params[0], params[1])
-
- },
-
- // 转换百分比
- getPercent(num, type) {
- if (this.newlisttabinfo1 && this.newlisttabinfo1.length && type == 1) {
- let index0 = this.newlisttabinfo1[0]
- let percent = num / (index0.zxl) * 100
- return percent.toFixed(2)
- } else if (this.newlisttabinfo2 && this.newlisttabinfo2.length && type == 2) {
- let index0 = this.newlisttabinfo2[0]
- let percent = num / (index0.zxl) * 100
- return percent.toFixed(2)
- } else if (this.newlisttabinfo3 && this.newlisttabinfo3.length && type == 3) {
- let index0 = this.newlisttabinfo3[0]
- let percent = num / (index0.zxl) * 100
- return percent.toFixed(2)
- } else {
- return 0
- }
- },
-
- // 取数值
- getPercent1(num) {
- console.log(num)
- return num || 0
- },
-
- // 接待时长
- receptionCountList(index, url) {
- this.$u.post(`/cusLvStatistics/${url}`, {
- timeType: this.lastEndDate ? null : this.activeTotal + '',
- lastEndDate: this.lastEndDate,
- lastStartDate: this.lastStartDate
- })
- .then(res => {
- this.LOADING = false
- // console.log(res)
- let result = res.result
- this['newTeam' + index] = res.avg[0]
- this['newAvg' + index] = res.avg[1]
- this['newlisttabinfo' + index] = []
- // 当选择全部时
- let arr = []
- // 当两个都选择的时候
- result.map(item => {
- let obj = {}
- obj.name = item.houseName
- obj.zxl = item.data
- arr.push(obj)
- })
- arr = this.dealData(arr)
- this['newlisttabinfo' + index] = arr
- }).catch(() => {
- this.LOADING = false
- })
- },
-
- // 获取销奖能力
- getPowerList() {
- this.chartData = {
- categories: [],
- series: []
- }
- this.$u.post('/cusLvStatistics/groupComparisonMarketingAbility', {
- houseIds: this.houseId,
- timeType: this.lastEndDate ? null : this.activeTotal + '',
- lastEndDate: this.lastEndDate,
- lastStartDate: this.lastStartDate
- })
- .then(res => {
- this.LOADING = false
- let allobj = {
- categories: [],
- series: []
- }
- if (res.result.length > 0) {
- console.log(res, 'asdjkasl')
- res.result.map((item, index) => {
- let obj = {
- name: item.length > 0 ? item[0].houseName : '',
- data: []
- }
- item.map(item1 => {
- if (index == 0) {
- allobj.categories.push(item1.name)
- }
- obj.data.push(item1.avgExecutionRate)
- })
- allobj.series.push(obj)
- })
- this.chartData = allobj
- this.emptyCharData = true;
- } else {
- this.emptyCharData = false;
- }
- console.log(this.emptyCharData)
- this.$forceUpdate()
- }).catch(e => {
- this.LOADING = false
- })
- },
-
- //时间切换
- tabtimetap(index) {
- this.activeTotal = index;
- if (index == 3) {
- this.totalTimeShow = true;
- } else {
- this.lastEndDate = ''
- this.lastStartDate = ''
- this.getdata()
- }
- },
-
- //自定义时间
- totalTimeChange(e) {
- console.log(e.startDate, e.endDate)
- this.activeTotal = 3;
- this.lastEndDate = e.endDate
- this.lastStartDate = e.startDate
- this.getdata()
- },
-
- // 定义一个公共方法对数据进行处理
- dealData(arr) {
- // 获取最大值
- let num = Math.max.apply(Math, arr.map(function(o) {
- return o.zxl
- })) //结果:3
- if (num > 100) {
- // 获取最大值的下标
- arr.map(item => {
- item.zxl1 = Math.floor(item.zxl / num * 100)
- })
- return arr
- } else {
- arr.map(item => {
- item.zxl1 = item.zxl
- })
- return arr
- }
- },
-
- // 选择项目后更新数据
- staffSelectCallback(e) {
- this.staff = e[0]
- this.houseId = e[0].value
- this.getPowerList()
- },
-
- // 左侧菜单选中
- chooseLside(data, index) {
- this.lsideListIndex = index
- console.log(index)
- this.getdata()
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .pages {
- width: 100%;
- height: 100vh;
- display: flex;
- flex-direction: column;
- background: #F8F8F8;
-
- .boxtittab {}
-
- .container {
- padding: 16rpx 0;
- width: 100%;
- height: calc(100% - 92rpx - var(--window-top));
- display: grid;
- grid-template-columns: 160rpx calc(100vw - 160rpx);
-
- .lside {
- width: 100%;
- background: #F6F7FB;
-
- .lside-scrollbox {
- width: 100%;
- display: flex;
- flex-direction: column;
-
- .lside-scrollbox-items {
- width: 100%;
- height: 72rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 24rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #666666;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-
- &.active {
- font-weight: 600;
- color: #2671E2;
- background: #FFFFFF;
- }
- }
- }
-
- }
- }
-
- .rside {
- width: 100%;
-
- .rside-scrollbox {
- width: 100%;
- background: #fff;
- display: flex;
- flex-direction: column;
-
-
- .single {
- width: 100%;
- display: flex;
- flex-direction: column;
-
- .hejisan {
- margin: 0 auto 28rpx;
- width: 542rpx;
- height: 120rpx;
- display: flex;
- background: #F6F7FB;
- border-radius: 8rpx;
-
- .sanbox1 {
- position: relative;
- flex-grow: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-
- &:last-child::after {
- content: '';
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- width: 1rpx;
- height: 80rpx;
- background: #E0E0E0;
- }
- }
-
- .text1-1 {
- font-size: 24rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 32rpx;
- }
-
- .text1-2 {
- color: #333333;
- font-size: 40rpx;
- line-height: 46rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- margin-bottom: 10rpx;
- }
- }
-
-
-
- .uchaserbox {
- width: 100%;
- height: 470rpx;
- display: flex;
- flex-direction: column;
-
- #wangxiaohuaerlingeryilingwuyib88 {
- flex-grow: 1;
- }
-
- .qiudatacharts {
- flex-grow: 1;
- }
- }
-
-
- .box {
- margin: 0 0 28rpx;
- padding: 0 24rpx;
- width: 100%;
- display: flex;
-
-
- .box-lside {
- margin: 0 24rpx 0 0;
- flex-shrink: 0;
- display: flex;
- justify-content: center;
- align-items: center;
-
- .img {
- width: 42rpx;
- height: 44rpx;
- }
-
- .ranking {
- width: 42rpx;
- height: 44rpx;
- font-size: 24rpx;
- font-family: SFPro-SemiboldItalic, SFPro;
- font-weight: normal;
- color: #8A8D9F;
- }
- }
-
- .box-rside {
- flex-grow: 1;
-
- .box-top {
- margin-bottom: 14rpx;
- width: 470rpx;
- display: flex;
-
- .percent-name {
- flex-grow: 1;
- width: calc(100% - 42rpx);
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
-
- .percent-zxl {
- flex-shrink: 0;
- }
- }
-
- .percent-box {
- width: 100%;
- height: 30rpx;
-
- .percent {
- height: 100%;
- background: #F1F3FF;
- border-radius: 15px;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|