Commit 7145b469 by 王志慧

commit

1 parent e28ef25f
const url = '/rop-scrm-carlife/router' const url = '/rop-scrm-carlife/router'
export default { const customer = '/rop-scrm-entmicro/router'
/**获取当前门店周报月报产值统计 */ // const customer = 'http://192.168.2.90:8064/rop-scrm-entmicro/router'
getReport(data) { /**获取当前门店周报月报产值统计 */
export function getReportData(data) {
data.method = 'scrm.api.carlife.weekly.report.get' data.method = 'scrm.api.carlife.weekly.report.get'
return window.$HTTP({ return window.$HTTP({
url, url,
data, data,
returnAll:true returnAll: true
}) })
}
} }
/**获取当前门店周报月报客户统计 */
export function getCumerchantReportData(data) {
data.method = 'entmicro.api.customer.merchant.report'
return window.$HTTP({
url: customer,
data,
returnAll: true
})
}
/**获取当前集团周报月报客户统计 */
export function getCugroupReportData(data) {
data.method = 'entmicro.api.customer.group.report'
return window.$HTTP({
url: customer,
data,
returnAll: true
})
}
export function scriptData(data) {
data.method ='entmicro.api.customer.merchant.report.script'
return window.$HTTP({
url: customer,
data,
returnAll: true
})
}
...@@ -38,7 +38,16 @@ img { ...@@ -38,7 +38,16 @@ img {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.flex-around{
display: flex;
align-items: center;
justify-content: space-around;
}
.flex-between{
display: flex;
align-items: center;
justify-content: space-between;
}
.x-center { .x-center {
position: absolute; position: absolute;
left: 50%; left: 50%;
...@@ -58,3 +67,112 @@ img { ...@@ -58,3 +67,112 @@ img {
canvas { canvas {
user-select: none; user-select: none;
} }
.head-bg {
width: 375px;
height: 260px;
background: #3975c6;
border-radius: 0px 0px 16px 16px;
position: absolute;
top: 0;
left: 0;
z-index:0;
}
.layout-wrap{
width:100%;
height:100%;
position: absolute;
top: 0;
left: 0;
z-index:99;
}
.small-text{
height: 15px;
font-size: 12px;
font-weight: 400;
color: #FFFFFF;
line-height: 15px;
}
.num-text{
height: 33px;
font-size: 24px;
font-weight: 600;
color: #FFFFFF;
line-height: 33px;
}
.headline{
height: 25px;
font-size: 18px;
font-weight: 500;
color: #FFFFFF;
line-height: 25px;
}
.text-half{
width:50%;
text-align:left;
}
.text-message{
height: 15px;
font-size: 10px;
font-weight: 400;
color: #666666;
line-height: 15px;
margin-bottom: 2px;
}
.mb{
margin-bottom:5px;
}
.gray-text{
height: 15px;
font-size: 12px;
font-weight: 400;
color: #333333;
line-height: 15px;
}
// tooltip样式
.chart-wrapper {
position: relative;
background-color:#fff ;
padding: 5px;
border-radius: 3px;
text-align: center;
width:160px;
height:100px;
}
.f2-tooltip {
box-shadow: 0px 3px 10px 0px rgba(223, 228, 234, 0.81);
border-radius: 4px;
position: absolute;
z-index: 99;
background-color: #fff;
padding: 5px;
border-radius: 3px;
text-align: center;
width: 120px;
opacity: 0;
.time{
font-size: 10px;
font-weight: 400;
color: #666666;
line-height: 15px;
text-align:left;
}
span {
font-size: 11px;
color: #333333;
line-height: 15px;
margin-top:4px;
.info{
margin-left:2px;
color:#333333;
}
}
}
// .f2-tooltip
// .f2-tooltip span:nth-child(1) {
// marg: 11px !important;
// }
// .f2-tooltip span:nth-child(2) {
// font-size: 13px !important;
// }
.sprite-icon { background-image: url(../images/sprite.png);background-size: 345px 205px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 345px 270px;}
.icon-bg { width: 345px; height: 180px; background-position: 0px 0px;} .icon-bg { width: 345px; height: 180px; background-position: 0px 0px;}
.icon-message { width: 14px; height: 13px; background-position: -24px -190px;}
.icon-huangguan { width: 14px; height: 15px; background-position: 0px -190px;}
\ No newline at end of file \ No newline at end of file
.icon-client { width: 26px; height: 26px; background-position: -37px -244px;}
.icon-crown { width: 12px; height: 9px; background-position: -229px -244px;}
.icon-customers { width: 40px; height: 44px; background-position: 0px -190px;}
.icon-equity { width: 40px; height: 44px; background-position: -50px -190px;}
.icon-huangguan { width: 14px; height: 15px; background-position: -181px -244px;}
.icon-liushi { width: 40px; height: 44px; background-position: -100px -190px;}
.icon-message { width: 14px; height: 13px; background-position: -205px -244px;}
.icon-production { width: 40px; height: 44px; background-position: -150px -190px;}
.icon-proportion { width: 26px; height: 26px; background-position: -73px -244px;}
.icon-Qy { width: 40px; height: 44px; background-position: -200px -190px;}
.icon-qycustomer { width: 26px; height: 26px; background-position: -109px -244px;}
.icon-rank { width: 27px; height: 26px; background-position: 0px -244px;}
.icon-speed { width: 26px; height: 26px; background-position: -145px -244px;}
.icon-totalCu { width: 40px; height: 44px; background-position: -250px -190px;}
.icon-wechat-customers { width: 40px; height: 44px; background-position: -300px -190px;}
\ No newline at end of file \ No newline at end of file

100 KB | W: | H:

171 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<div class="tab" v-if="data.length > 0">
<!-- 样式占位符-->
<div class="canvas-tab flex"> <div class="canvas-tab flex">
<template v-for="(i,index) in data"> <template v-for="(i, index) in data">
<div <div @click="click(index)" :class="['item', `${tabType.index == index ? 'active-' + i.location : 'unactive'}`]" :key="index"></div>
@click="click(index)"
:class="['item', 'text-center',`${tabIndex == index ? 'active':''}`]"
:key="index"
>{{i}}</div>
</template> </template>
</div> </div>
<div class="canvas-place-tab flex placeholder">
<template v-for="(i, index) in data">
<div @click="click(index)" :class="['item', 'text-center', `${tabType.index == index ? 'active' : ''}`]" :key="index + 'i'">{{ i.title }}</div>
</template>
</div>
<slot></slot>
</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
export default { export default {
name: 'CanvasTab', name: 'CanvasTab',
props: { watch: {
list: { tabIndex: {
type: Array, handler() {
default: () => { this.initData()
return []
}
}, },
index: { immediate: true
type: Number,
default: 0
}, },
activeColor: { outputData: {
type: String, handler() {
default: '#F6F6FF' this.initData()
}
}, },
watch: { deep: true
index(n) {
this.tabIndex = n
} }
}, },
computed: {
...mapState({
reportData: state => state.report.reportData,
tabIndex: state => state.report.tabIndex,
reportType: state => state.report.reportType,
tabType: state => state.report.tabType,
userInfo: state => state.report.userInfo,
outputData: state => state.report.outputData
})
},
data() { data() {
return { return {
tabIndex: this.index, data: []
data: this.list
} }
}, },
mounted() {}, mounted() {},
methods: { methods: {
click(tabIndex) { ...mapMutations({
this.tabIndex = tabIndex SET_TABTYPE_INDEX: 'report/SET_TABTYPE_INDEX'
this.$emit('change', tabIndex) }),
initData() {
let {
userInfo: { accountLevel },
reportType,
outputData
} = this
let text
if (reportType == 0) {
text = '本周'
} else {
let time = outputData.reportTimeStart.split('-')
text = time[1] + '月'
}
if (accountLevel !== 4 && this.tabIndex == 0) {
//集团客户周月报
if (reportType == 0) {
this.data = [
{ title: '企微客户占比', location: 'left' },
{ title: '新增企微客户数 ', location: 'right' }
]
} else {
this.data = [
{ title: '企微客户占比', location: 'left' },
{ title: '新增企微客户数 ', location: 'center' },
{ title: '新增客户趋势', location: 'right' }
]
}
} else if (accountLevel == 4 && this.tabIndex == 0) {
//门店客户周月报
if (reportType == 1) {
this.data = [
{ title: '新增客户趋势', location: 'left' },
{ title: '新增客户分布', location: 'right' }
]
} else {
this.data = []
}
} else if (accountLevel !== 4 && this.tabIndex == 1) {
//集团产值周月报
if (reportType == 0) {
this.data = [
{ title: `${text}门店产值`, location: 'left' },
{ title: '新增产值分布', location: 'right' }
]
} else {
this.data = [
{ title: `${text}门店产值`, location: 'left' },
{ title: '新增产值分布', location: 'center' },
{ title: '新增产值趋势', location: 'right' }
]
}
} else {
//门店产值月报
if (reportType == 1) {
this.data = [
{ title: '新增产值趋势', location: 'left' },
{ title: '新增产值分布', location: 'right' }
]
} else {
this.data = []
}
}
},
click(index) {
this.$emit('change', index)
} }
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.canvas-tab { .tab {
width: 100%; margin: 30px 0 80px 0;
height: 40px; height: auto;
box-shadow: 0px 3px 10px 0px rgba(223, 228, 234, 0.81);
border-radius: 4px;
position: relative;
background-color: #fff; background-color: #fff;
.canvas-tab {
width: 100%;
height: 50px;
box-sizing: border-box;
background-color: #dfe7f1;
.item {
width: 50%;
transition: all 0.5s;
font-size: 14px;
}
.active-left {
height: 0;
border-bottom: 50px solid #ffffff;
border-right: 10px solid transparent;
}
.active-right {
height: 0;
border-bottom: 50px solid #ffffff;
border-left: 10px solid transparent;
}
.active-center {
height: 0;
border-bottom: 50px solid #ffffff;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}
}
.canvas-place-tab {
width: 100%;
height: 50px;
box-sizing: border-box; box-sizing: border-box;
padding: 3px;
font-size: 12px; font-size: 12px;
box-shadow: 0px 3px 11px 0px rgba(166, 162, 217, 0.2); color: #333333;
border-radius: 5px; position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 9;
.item { .item {
color: #333333; color: #333333;
flex: 1; flex: 1;
height: 100%;
transition: all 0.5s; transition: all 0.5s;
font-size: 14px;
} }
.active { .active {
background: #ebf1f8;
border-radius: 4px;
font-size: 14px;
color: #3975c6; color: #3975c6;
height: 50px;
}
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="store-ranking-wrap">
<template v-if="staffDistributionVOList.length > 0">
<div class="store-rank-inline flex" v-for="i in staffDistributionVOList" :key="i.id">
<div class="customers-portrait">
<img :src="i.thumbAvatar" alt="" />
</div>
<div>
<div class="gray-text">{{ i.staffName }}</div>
<div class="text-message">占{{ (i.newlyQyRatio * 100).toFixed(0) }}%</div>
</div>
<div class="gray-text location">
新增
<span>{{ i.newlyQyCount }}</span>
位客户
</div>
</div>
</template>
<template v-else>
<Empty></Empty>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { mapState } from 'vuex'
export default {
name: 'CustomerRanking',
data() {
return {}
},
computed: {
...mapState({
tabIndex: state => state.report.tabIndex,
tabType: state => state.report.tabType,
userInfo: state => state.report.userInfo,
staffDistributionVOList: state => state.report.staffDistributionVOList
})
},
mounted() {},
methods: {}
}
</script>
<style lang='scss' scoped>
.store-ranking-wrap {
height: auto;
.store-rank-inline {
border-bottom: 1px solid #e8e8f2;
background-color: #fff;
height: 70px;
box-sizing: border-box;
&:last-child {
border-bottom: 1px solid #ffffff;
}
.customers-portrait {
width: 40px;
height: 40px;
margin: 0 15px 0 20px;
img {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.text-message {
margin-top: 2px;
}
.gray-text {
span {
font-size: 14px;
font-weight: 500;
color: #3975c6;
line-height: 15px;
margin: 0 7px;
width: 26px;
}
}
.location {
position: absolute;
right: 25px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<van-empty class="custom-image" :image="empty" :description="description" />
</template>
<script>
export default {
name: 'Empty',
data() {
return {
empty: require('../assets/images/empty.png')
}
},
props: {
description: {
type: String,
default: '暂无数据'
}
}
}
</script>
<style lang="scss" scoped>
.custom-image {
padding-top: 79px;
background-color: #fff;
}
.custom-image /deep/ .van-empty__image {
width: 88px;
height: 56px;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="group-layout-wrap">
<time-search></time-search>
<statistics></statistics>
<ranking></ranking>
<canvas-tab :list="tab" @change="change">
<tab-container ref="tabContainer" :tabType="tabType"></tab-container>
</canvas-tab>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'Group',
props: {
keyword: {
type: String,
default: ''
},
placeholder: {
type: String,
default: '请输入内容搜索'
}
},
data() {
return {
value: this.keyword
}
},
mounted() {},
methods: {
onSearch(e) {
this.$emit('search', e)
}
}
}
</script>
<style scoped lang='scss'>
.van-search {
padding: 9px 16px;
height: 50px;
background: #fff;
.van-search__content {
background-color: #fff;
border: 1px solid #cdd1d4;
border-radius: 16px;
}
.van-cell {
padding: 5px 16px 5px 0;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="ranking-wrap">
<template v-if="tabIndex == 1">
<template v-if="productionReportList&&productionReportList.length > 0">
<div class="rank-inline flex" v-for="(i, index) in productionReportList" :key="i.id">
<div :class="['rank-type', index == 0 ? 'rank-type-index' : '']">
{{ index + 1 }}
<template v-if="index == 0">
<div class="sprite-icon icon-huangguan"></div>
</template>
</div>
<div :class="['small-text', 'ranking-text', tabType.index == 1 ? 'rate' : '']">{{ i.merchantName }}</div>
<div class="small-text gray">¥{{ i.newProductionValue }}</div>
<tempalte v-if="tabType.index == 1 && tabIndex == 0">
<span class="ratio flex">
<van-icon name="down" size="10px" :class="`${index == 1 ? 'up' : ''}`" />
10%
</span>
</tempalte>
</div>
</template>
<template v-else>
<Empty></Empty>
</template>
</template>
<template v-else>
<template v-if="qyCustomerRatioMerchantTop&&qyCustomerRatioMerchantTop.length">
<div class="rank-inline flex" v-for="(c, index) in qyCustomerRatioMerchantTop" :key="c.id">
<div :class="['rank-type', index == 0 ? 'rank-type-index' : '']">
{{ index + 1 }}
<template v-if="index == 0">
<div class="sprite-icon icon-huangguan"></div>
</template>
</div>
<div :class="['small-text', 'ranking-text', tabType.index == 1 ? 'rate' : '']">{{ c.merchantName }}</div>
<div class="small-text gray">{{ tabType.index == 0 ? c.qyCustomerRatio * 100 + '%' : c.newlyQyCount }}</div>
<tempalte v-if="tabType.index == 1">
<span class="ratio flex">
<van-icon name="down" size="10px" :class="c.qyCustomerRatio > 0 ? 'up' : ''" />
{{ c.qyCustomerRatio * 100 }}%
</span>
</tempalte>
</div>
</template>
<template v-else>
<Empty></Empty>
</template>
</template>
</div>
</template>
<script>
import { mapState, mapGetters, mapActions } from 'vuex'
export default {
name: 'GroupRanking',
data() {
return {}
},
computed: {
...mapState({
reportData: state => state.report.reportData,
tabIndex: state => state.report.tabIndex,
tabType: state => state.report.tabType,
qyCustomerRatioMerchantTop: state => state.report.qyCustomerRatioMerchantTop, //企微客户占比
productionReportList: state => state.report.productionReportList
// qyTotalCountMerchantTop: state => state.report.productionReportList
})
},
mounted() {},
methods: {
click(tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
}
}
}
</script>
<style lang='scss' scoped>
.ranking-wrap {
height: auto;
background-color: #fff;
padding: 0 10px;
.rank-inline {
border-bottom: 1px solid #e8e8f2;
padding: 15px 0 19px 0;
.rank-type {
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #c9d7eb;
font-size: 12px;
font-weight: 500;
color: #333333;
display: flex;
align-items: center;
justify-content: center;
}
.rank-type-index {
background-color: #3975c6;
color: #fff;
position: relative;
.icon-huangguan {
position: absolute;
top: -5px;
right: -19px;
}
}
.ranking-text {
width: 196px;
word-wrap: break-word;
margin: 0 32px 0 8px;
height: auto;
}
.rate {
margin: 0 32px 0 8px !important;
width: 148px !important;
}
.ratio {
font-size: 12px;
color: #3975c6;
margin-left: 32px;
& .up {
transform: rotate(180deg);
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="ranking-wrap" v-if="fastData.length > 0">
<template v-for="item in fastData">
<div class="ranking-line flex" :key="item.icon">
<div :class="['sprite-icon', ' icon-' + item.icon]"></div>
<div class="small-text">
{{ item.text }}
<template v-if="tabIndex== 1">
<span>{{ item.info }}</span>
</template>
<template v-else>
<span>{{ item.value(reportData) }}</span>
<!-- <span>{{ item.value(reportData)*100 }}%</span> -->
</template>
</div>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
export default {
name: 'Ranking',
props: {
fastOrderSource: {
type: Number,
default: 0
}
},
data() {
return {
fastData: []
}
},
mounted() {},
computed: {
...mapState({
reportData: state => state.report.reportData,
tabIndex :state => state.report.tabIndex,
userInfo:state => state.report.userInfo,
})
},
methods: {
initFastData() {
let {userInfo:{accountLevel}} = this
this.fastData = []
if (this.tabIndex == 1) {
//增长速度最快业务1商城订单2直播订单3活动订单4会员套餐5精品升级6权益提单
let { fastOrderSource } = this.reportData
if (fastOrderSource) {
let text =
fastOrderSource == 1
? '商城订单'
: fastOrderSource == 2
? '直播订单'
: fastOrderSource == 3
? '活动订单'
: fastOrderSource == 4
? '会员套餐'
: fastOrderSource == 5
? '精品升级'
: '权益提单'
this.fastData.push({
text: '增长速度最快业务:',
info: text,
icon: 'rank'
})
}
console.log(this.fastData)
} else {
if (accountLevel !==4) {
this.fastData.push(
{
text: '企微客户占比最高的门店:',
value: obj => {
return obj.newlyQyFastestGrowthMerchant
},
icon: 'proportion'
},
{
text: '企微增长速度最快的门店:',
value: obj => {
return obj.newlyQyFastestGrowthMerchant
},
icon: 'speed'
},
{
text: '企微客户数最多的门店:',
value: obj => {
return obj.newlyQyMostMerchant
},
icon: 'client'
}
)
} else {
this.fastData.push({
text: '企业微信客户占比:',
value: obj => {
return obj.qyCustomerRatio
},
icon: 'qycustomer'
})
}
console.log(this.fastData)
}
},
click(tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
}
}
}
</script>
<style lang='scss'>
.ranking-wrap {
width: 345px;
height: auto;
background: #ffffff;
box-shadow: 0px 5px 8px 0px rgba(182, 188, 197, 0.15);
border-radius: 4px;
padding: 0 20px;
box-sizing: border-box;
.ranking-line {
height: 56px;
border-bottom: 1px solid rgba(57, 117, 198, 0.09);
&:last-child {
border-bottom: 1px solid #ffffff;
}
}
.sprite-icon {
margin-right: 10px;
}
.small-text {
color: #666666;
span {
color: #333333;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="statistics">
<div class="headline">{{ statisticsObj.title }}</div>
<div class="flex">
<template v-for="value in statisticsObj.cumulative">
<div class="text-half" :key="value.id">
<div class="small-text">{{ value.title }}</div>
<div class="num-text"><span v-if="value.type == 0">¥</span>{{ value.value(reportData) }}</div>
</div>
</template>
</div>
<div class="flex-between">
<van-swipe :loop="false" :width="167" :show-indicators="false">
<template v-for="add in statisticsObj.new">
<van-swipe-item class="container" :key="add.id">
<div class="text-message">{{ add.title }}</div>
<div class="flex-between">
<span class="add-count">{{ add.value(reportData) }}</span>
<template v-if="add.sequential(reportData)">
<div class="ratio text-message">
周环比
<span>
<van-icon name="down" size="10px" :class="add.up(reportData) == 1 ? 'up' : ''" />
{{ add.sequential(reportData) }}
</span>
</div>
</template>
</div>
<div class="flex">
<div :class="['sprite-icon', 'icon-' + add.icon]"></div>
<template v-if="add.list">
<div class="customer-info">
<span class="text-message mb">{{ add.list.customerTitle }}:{{ add.list.customerValue(reportData) }}</span>
<span class="text-message">{{ add.list.qyTitle }}:{{ add.list.qyValue(reportData) }}</span>
</div>
</template>
<template v-if="add.info">
<div class="customer-info">
<span class="text-message mb">发起申请客户数</span>
<div class="gray-text flex">
{{ add.info.value(reportData) }}
<div class="ratio text-message">
周环比
<label>
<van-icon name="down" size="10px" :class="`${index == 0 ? 'up' : ''}`" />
{{ add.info.sequential(reportData) }}
</label>
</div>
</div>
</div>
</template>
</div>
</van-swipe-item>
</template>
</van-swipe>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
export default {
name: 'Statistics',
data() {
return {
value: this.keyword
}
},
computed: {
...mapState({
reportData: state => state.report.reportData,
statisticsObj: state => state.report.statisticsObj
})
},
mounted() {},
methods: {}
}
</script>
<style scoped lang='scss'>
.statistics {
margin: 20px 0 30px 0;
.headline {
margin-bottom: 10px;
}
.headline::before {
content: '.';
width: 3px;
height: 15px;
background: #ffffff;
border-radius: 2px;
color: #ffffff;
margin-right: 5px;
box-sizing: border-box;
}
.text-half {
.small-text {
margin-bottom: 5px;
}
}
.flex-between {
width: 100%;
box-sizing: border-box;
}
.container {
width: 167px;
height: 106px;
background: #ffffff;
box-shadow: 0px 3px 8px 0px rgba(170, 180, 209, 0.2);
border-radius: 4px;
padding: 10px;
box-sizing: border-box;
margin-top: 10px;
margin-right: 10px;
.add-count {
height: 25px;
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 2px;
}
.ratio {
span {
padding: 0 1px;
width: auto;
height: 14px;
background: #d0def1;
border-radius: 3px;
height: 15px;
font-size: 11px;
font-weight: 500;
color: #3975c6;
line-height: 15px;
margin-left: 5px;
}
label {
font-weight: 500;
color: #3975c6;
line-height: 15px;
}
& .up {
transform: rotate(180deg);
}
}
.text-message {
display: inline-block;
}
.customer-info {
width: 65%;
.gray-text {
.text-message {
font-size: 10px;
}
.ratio {
margin-left: 2px;
}
}
}
}
}
.statistics /deep/ .van-swipe__track {
margin-right: 10px;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="store-ranking-wrap">
<template v-if="tabIndex == 0">
<div class="weekTitle headline">新增客户分布</div>
<van-swipe :loop="false" :width="140" :show-indicators="false">
<template v-for="(i, index) in staffDistributionVOList">
<van-swipe-item :key="i.id">
<template v-if="index == 0">
<div class="sprite-icon icon-crown"></div>
</template>
<div class="customers-portrait">
<img :src="i.thumbAvatar" alt="" />
<template v-if="index == 0">
<div class="sprite-icon icon-huangguan"></div>
</template>
</div>
<div class="gray-text">{{ i.staffName }}</div>
<div class="gray-text location">
新增
<span>{{ i.newlyQyCount }}</span>
位客户
</div>
<div class="rate">占{{ (i.newlyQyRatio * 100).toFixed(0) }}%</div>
</van-swipe-item>
</template>
</van-swipe>
</template>
<template v-if="tabIndex == 1">
<div class="weekTitle headline">新增产值分布</div>
<canvas class="canvas" id="pieChart" v-if="productionValueReportList.length>0"></canvas>
</template>
<template v-if="(tabIndex == 0 && staffDistributionVOList.length == 0) || (tabIndex == 1 && productionValueReportList.length == 0)">
<Empty></Empty>
</template>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import F2 from '@antv/f2/lib/index-all'
import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
export default {
name: 'StoresRanking',
data() {
return {
chart: null,
orderSource: {
1: '商城订单',
2: '直播订单',
3: '活动订单',
4: '门店套餐',
5: '精品升级',
6: '权益提单'
}
}
},
computed: {
...mapState({
reportData: state => state.report.reportData,
tabIndex: state => state.report.tabIndex,
reportType: state => state.report.reportType,
tabType: state => state.report.tabType,
userInfo: state => state.report.userInfo,
productionValueReportList: state => state.report.productionValueReportList,
staffDistributionVOList: state => state.report.staffDistributionVOList
})
},
watch: {
tabIndex: {
handler(n) {
let { userInfo } = this
this.$nextTick(() => {
this.initCanvas(userInfo.accountLevel)
})
},
deep: true
},
productionValueReportList: {
handler(n) {
let { userInfo } = this
this.$nextTick(() => {
this.initCanvas(userInfo.accountLevel)
})
},
deep: true
}
},
mounted() {
console.log(this.staffDistributionVOList)
let { userInfo } = this
if (userInfo) {
this.$nextTick(() => {
this.initCanvas(userInfo.accountLevel)
})
}
},
methods: {
initCanvas(type) {
//tabIndex 0 客户 1 产值
let { reportType, tabIndex } = this
if (type == 4 && tabIndex == 1 && reportType == 0) this.initPieChart()
},
initPieChart(id = 'pieChart') {
let { productionValueReportList, orderSource } = this
productionValueReportList.map(e => (e.count = 'count'))
console.log(productionValueReportList)
this.chart && this.chart.clear()
this.chart = null
this.chart = new F2.Chart({
id,
pixelRatio: window.devicePixelRatio,
padding: [40, 40, 40, 40]
})
this.chart.source(productionValueReportList)
this.chart.coord('polar', {
transposed: true,
radius: 0.9,
innerRadius: 0.6
})
this.chart.axis(false)
this.chart.legend(false)
this.chart.tooltip(false)
this.chart.guide().html({
position: ['50%', '50%'],
html: '<div style="text-align: center;width:150px;height: 50px;">\n <p style="font-size: 12px;color: #999;margin: 0" id="title"></p>\n <p style="font-size: 18px;color: #343434;margin: 0;font-weight: bold;" id="money"></p>\n </div>'
})
this.chart.interval().position('count*newProductionValue').adjust('stack').color('orderSource', ['#3975C6', '#43B899', '#FFC667', '#FF9DAA'])
this.chart.pieLabel({
sidePadding: 10,
activeShape: true,
label1(data) {
return {
text: `${orderSource[data.orderSource]}-占${data.newProductionValueRate}`,
fill: '#333'
}
},
label2(data) {
return {
text: `¥${data.newProductionValue}`,
fill: '#333',
fontSize: 12,
fontWeight: 'bold'
}
},
onClick(ev) {
const data = ev.data
if (data) {
console.log(data)
}
}
})
this.chart.render()
},
click(tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
}
}
}
</script>
<style lang='scss' scoped>
.store-ranking-wrap {
height: auto;
margin-bottom: 80px;
.van-swipe {
height: 180px;
.van-swipe-item {
height: 180px;
background-color: #ffffff;
margin-right: 10px;
flex-flow: column;
display: flex;
align-items: center;
padding: 20px 0 0 0;
box-sizing: border-box;
position: relative;
.icon-crown {
position: absolute;
top: 0;
left: 11px;
}
.customers-portrait {
width: 40px;
height: 40px;
position: relative;
img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.icon-huangguan {
position: absolute;
top: 0;
right: -7px;
}
}
.gray-text {
margin: 10px 0 0 0;
color: #999999;
span {
font-size: 14px;
font-weight: 500;
color: #3975c6;
line-height: 15px;
}
}
.rate {
width: 68px;
height: 24px;
background: #e4ebf2;
border-radius: 12px;
font-size: 12px;
font-weight: 400;
color: #333333;
line-height: 24px;
margin-top: 11px;
text-align: center;
}
}
}
.weekTitle {
margin: 30px 0 15px 0;
color: #333333;
line-height: 25px;
}
.weekTitle::before {
content: '.';
width: 3px;
height: 15px;
background: #3975c6;
border-radius: 2px;
color: #3975c6;
margin-right: 5px;
box-sizing: border-box;
}
}
.canvas {
width: 345px;
height: 195px;
background-color: #ffffff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<template
v-if="
(userInfo.accountLevel !== 4 && tabIndex == 0 && tabType.index == 0) ||
(userInfo.accountLevel !== 4 && tabIndex == 0 && tabType.index == 1) ||
(userInfo.accountLevel !== 4 && tabIndex == 1 && tabType.index == 0)
"
>
<group-ranking ref="groupRanking"></group-ranking>
</template>
<Chart ref="Chart"></Chart>
<template v-if="tabIndex == 0 && tabType.index == 1 && reportType == 1 && userInfo.accountLevel == 4">
<customer-ranking></customer-ranking>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { mapState, mapGetters, mapActions } from 'vuex'
export default {
name: 'TabContainer',
data() {
return {}
},
computed: {
...mapState({
tabIndex: state => state.report.tabIndex,
tabType: state => state.report.tabType,
userInfo: state => state.report.userInfo,
reportType:state => state.report.reportType,
})
},
mounted() {},
methods: {
click(tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
}
}
}
</script>
<style lang='scss'>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<div class="top flex">
<div class="report-name text-hide">
{{ userInfo.merchantName || 'XXXX商户名称-10月小结' }}
</div>
<template v-if="outputData.reportTimeStart && reportType == 0">
<div class="time small-text" @click="showDateSelect = true">
{{ new Date(outputData.reportTimeStart).format('yyyy.MM.dd') }}- {{ new Date(outputData.reportTimeEnd).format('yyyy.MM.dd') }}
<van-icon name="arrow-down" />
</div>
</template>
<template v-if="outputData.reportTimeStart && reportType == 1">
<div class="time small-text" @click="showDateSelect = true">
{{ outputData.reportTimeStart.slice(0,outputData.reportTimeStart.length-3) }}
<van-icon name="arrow-down" />
</div>
</template>
</div>
<van-popup v-model="showDateSelect" position="bottom">
<van-picker show-toolbar :title="reportType == 0 ? '选择周报' : '选择月报'" :columns="dateColumns" :default-index="dateColumns.length" @confirm="confirmDate" @cancel="showDateSelect = false" />
</van-popup>
</div>
</template>
<script>
import { mapState, mapActions, mapMutations } from 'vuex'
export default {
name: 'TimeSearch',
data() {
return {
showDateSelect: false,
dateColumns: []
}
},
computed: {
...mapState({
tabIndex: state => state.report.tabIndex,
reportData: state => state.report.reportData,
reportType: state => state.report.reportType,
outputData: state => state.report.outputData,
userInfo: state => state.report.userInfo
})
},
mounted() {
this.initDate()
},
methods: {
...mapActions({
getReport: 'report/getReport',
getCumerchantReport: 'report/getCumerchantReport',
getCugroupReport: 'report/getCugroupReport'
}),
...mapMutations({
SET_START_TIME: 'report/SET_START_TIME',
INIT_DATA: 'report/INIT_DATA',
SET_TABTYPE_INDEX:'report/SET_TABTYPE_INDEX'
}),
initDate() {
let { reportType } = this
let now = new Date()
let dateColumns = []
if (reportType == 0) {
let dateTime = now.getTime()
let day = now.getDay() || 7
let oneDayTime = 24 * 60 * 60 * 1000
for (let i = 24; i > 0; i--) {
let monday = new Date(dateTime - (day - 1 + i * 7) * oneDayTime).format('yyyy-MM-dd') // 获取周一
let sunday = new Date(dateTime + (7 - day - i * 7) * oneDayTime).format('yyyy-MM-dd') // 获取周日
dateColumns.push(`${monday}~${sunday}`)
}
this.dateColumns = dateColumns
let time = this.dateColumns[this.dateColumns.length - 1].split('~')
this.SET_START_TIME({
reportTimeStart: time[0],
reportTimeEnd: time[1]
})
} else {
let nowMonth = now.getMonth()
for (let i = nowMonth - 12; i <= nowMonth - 1; i++) {
dateColumns.push(new Date(new Date().setMonth(i)).format('yyyy-MM'))
}
this.dateColumns = dateColumns
this.SET_START_TIME({
reportTimeStart: this.dateColumns[this.dateColumns.length - 1]+'-01'
})
}
},
confirmDate(e) {
let {
reportType,
tabIndex,
userInfo: { accountLevel }
} = this
let time = ''
this.showLoading('加载中...')
if (reportType == 1) {
time = `${e}-01`
this.SET_START_TIME({
reportTimeStart: time
})
} else {
time = e.split('~')[0]
this.SET_START_TIME({
reportTimeStart: e.split('~')[0],
reportTimeEnd: e.split('~')[1]
})
}
if (tabIndex == 0) {
//客户
if (accountLevel == 4) {
//门店
this.getCumerchantReport({
merchantIdList: [this.userInfo.merchantId],
reportType: this.reportType,
startDate: time,
success: res => {
this.hideLoading()
this.INIT_DATA()
}
})
} else {
//集团
this.getCugroupReport({
reportType: this.reportType,
merchantIdList: [this.userInfo.merchantId],
startDate: time,
success: res => {
this.hideLoading()
this.INIT_DATA()
}
})
}
} else if (tabIndex == 1) {
//产值
this.getReport({
reportType: this.reportType,
reportTimeStart: time,
success: res => {
this.hideLoading()
this.INIT_DATA()
}
})
}
this.SET_TABTYPE_INDEX({ index: 0 })
this.showDateSelect = false
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang='scss'>
.top {
border-radius: 4px;
// position: fixed;
width: 345px;
height: 40px;
box-sizing: border-box;
background: #6191d1;
z-index: 9;
margin-top: 15px;
padding: 0 10px;
.report-name {
width: 50%;
height: 15px;
font-size: 14px;
font-weight: 500;
color: #ffffff;
line-height: 15px;
}
.time {
margin-left: auto;
}
}
</style>
...@@ -39,10 +39,11 @@ Vue.prototype.to = function (name, params) { ...@@ -39,10 +39,11 @@ Vue.prototype.to = function (name, params) {
Vue.config.productionTip = false Vue.config.productionTip = false
import VConsole from 'vconsole' import VConsole from 'vconsole'
// const vConsole = new VConsole() const vConsole = new VConsole()
const isMock = true const isMock = true
fetchConfig(!isMock).then(res => { fetchConfig(!isMock).then(res => {
console.log(res)
// 从配置服务器获取动态配置 // 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn // 设置 js中可以访问 $cdn
Vue.use(cfg) Vue.use(cfg)
......
...@@ -38,6 +38,7 @@ export default { ...@@ -38,6 +38,7 @@ export default {
this.initPieChart() this.initPieChart()
}, },
initLineChart(id = 'lineChart') { initLineChart(id = 'lineChart') {
console.log(this.$parent)
let { tabIndex } = this.$parent let { tabIndex } = this.$parent
this.lineChart && this.lineChart.clear() this.lineChart && this.lineChart.clear()
this.lineChart = null this.lineChart = null
......
...@@ -15,9 +15,8 @@ Object.keys(pages).map(parent => { ...@@ -15,9 +15,8 @@ Object.keys(pages).map(parent => {
const isIndex = parent == redirect && val.name == 'index' const isIndex = parent == redirect && val.name == 'index'
let childrenPath = `${parent}/${val.name}` let childrenPath = `${parent}/${val.name}`
let { meta } = val let { meta } = val
const path = isIndex ? const path =`/${val.name == 'index' ? parent : childrenPath}`
'/' :
`/${val.name == 'index' ? parent : childrenPath}`
const name = val.name == 'index' ? parent : childrenPath.replace('/', '.') const name = val.name == 'index' ? parent : childrenPath.replace('/', '.')
if (meta && meta.keepAlive) keepAlives.push(name) if (meta && meta.keepAlive) keepAlives.push(name)
let route = { let route = {
......
...@@ -2,13 +2,15 @@ import Vue from 'vue' ...@@ -2,13 +2,15 @@ import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import getters from './getters' import getters from './getters'
import app from './modules/app' import app from './modules/app'
import report from "./modules/report";
// import createPersistedState from "vuex-persistedstate" // import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { modules: {
app app,
report
}, },
getters getters
// plugins: [createPersistedState({ // plugins: [createPersistedState({
......
...@@ -162,6 +162,9 @@ const watchPageBack = () => { ...@@ -162,6 +162,9 @@ const watchPageBack = () => {
const centsToyuan = price => { const centsToyuan = price => {
return Number(Number(price / 100, 2).toFixed(2)) return Number(Number(price / 100, 2).toFixed(2))
} }
const getQuery = () => {
return window.vm.$route.query
}
const utils = { const utils = {
removeLocalStorage, removeLocalStorage,
...@@ -186,7 +189,8 @@ const utils = { ...@@ -186,7 +189,8 @@ const utils = {
throttle, throttle,
decimal, decimal,
dialog, dialog,
toTop toTop,
getQuery
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
......
<template>
<div class="layout">
<div class="top flex">
<div class="report-name text-hide">
{{ outputData.reportName || '' }}
</div>
<template v-if="outputData.reportTimeStart">
<div
class="time"
@click="showDateSelect = true"
>
{{ new Date(outputData.reportTimeStart).format('yyyy.MM.dd') }}- {{ new Date(outputData.reportTimeEnd).format('yyyy.MM.dd') }}
<van-icon name="arrow-down" />
</div>
</template>
</div>
<template v-if="tabIndex == 0">
<customer-statistics
:data="customerData"
:reportType="reportType"
/>
</template>
<template v-else>
<output-statistics
:data="outputData"
:reportType="reportType"
/>
</template>
<div class="bottom">
<tab
:list="['客户统计', '产值统计']"
@change="change"
:index="tabIndex"
></tab>
</div>
<van-popup
v-model="showDateSelect"
position="bottom"
>
<van-picker
show-toolbar
:title="reportType == 0 ? '选择周报' : '选择月报'"
:columns="dateColumns"
:default-index="dateColumns.length"
@confirm="confirmDate"
@cancel="showDateSelect = false"
/>
</van-popup>
</div>
</template>
<script>
import { reportApi } from '@/api'
export default {
name: '',
data() {
return {
tabIndex: 1,
reportType:0, //0 周 1 月
customerData: {},
outputData: {},
detail: {},
showDateSelect: false,
dateColumns: []
}
},
mounted() {
this.initDate()
this.getOutputReport()
},
methods: {
initDate() {
let { reportType } = this
let now = new Date()
let dateColumns = []
if (reportType == 0) {
let dateTime = now.getTime()
let day = now.getDay() || 7
let oneDayTime = 24 * 60 * 60 * 1000
for (let i = 24; i > 0; i--) {
let monday = new Date(dateTime - (day - 1 + i * 7) * oneDayTime).format('yyyy-MM-dd') // 获取周一
let sunday = new Date(dateTime + (7 - day - i * 7) * oneDayTime).format('yyyy-MM-dd') // 获取周日
dateColumns.push(`${monday}~${sunday}`)
}
this.dateColumns = dateColumns
} else {
let nowMonth = now.getMonth()
for (let i = nowMonth - 12; i <= nowMonth - 1; i++) {
dateColumns.push(new Date(new Date().setMonth(i)).format('yyyy-MM'))
}
this.dateColumns = dateColumns
}
},
change(e) {
this.tabIndex = e
},
getOutputReport(reportTimeStart = '') {
let userInfo = this.getLocalStorage('dj_scrm_userInfo')
let { reportType } = this
reportApi
.getReport({
reportType,
reportTimeStart
})
.then(({ code, data, message }) => {
this.hideLoading()
if (code == 0) {
if (data) {
if (data.newProductionValueSequential) data.newProductionValueSequential = Number(data.newProductionValueSequential.replace('%', ''))
if (data.newEquityBillLadingSequential) data.newEquityBillLadingSequential = Number(data.newEquityBillLadingSequential.replace('%', ''))
if (data.merchantProductionValueReportList) {
data.merchantProductionValueReportList.map(e => Number((e.newProductionValue = this.centsToyuan(e.newProductionValue))))
}
if (data.productionValueReportList) {
data.productionValueReportList.map(e => Number((e.newProductionValue = this.centsToyuan(e.newProductionValue))))
}
if (data.trendList) {
data.trendList.map(e => Number((e.orderMoneyTotalSum = this.centsToyuan(e.orderMoneyTotalSum))))
}
data.userInfo = userInfo
this.outputData = data
}
} else {
this.refreshPage(`产值统计:${message}`).then(() => {
this.getOutputReport(reportTimeStart)
})
}
})
},
confirmDate(e) {
let { reportType } = this
this.showLoading('加载中...')
if (reportType == 1) {
this.getOutputReport(`${e}-01`)
this.showDateSelect = false
} else {
let [start] = e.split('~')
this.getOutputReport(start)
this.showDateSelect = false
}
}
}
}
</script>
<style lang="scss" scoped>
.layout {
color: #333333;
font-size: 14px;
padding-bottom: 65px;
.top {
position: sticky;
height: 44px;
padding: 0 16px;
background: #ffffff;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05);
z-index: 9;
top: 0;
.report-name{
width: 50%;
}
.time {
margin-left: auto;
font-weight: 500;
font-size: 12px;
}
}
.bottom {
position: fixed;
bottom: 0;
left: 0;
background: #ffffff;
z-index: 2;
width: 100%;
}
}
</style>
...@@ -50,7 +50,7 @@ const spritesmithFunction = data => { ...@@ -50,7 +50,7 @@ const spritesmithFunction = data => {
} }
module.exports = { module.exports = {
publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router hash 模式使用 publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main-test/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router hash 模式使用 // publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router history模式使用 // publicPath: '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router history模式使用
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!