Files
dvcp_v2_webapp/project/fengdu/AppOutSource/AppMarkStatic/AppMarkStatic.vue

424 lines
10 KiB
Vue
Raw Normal View History

2024-06-24 10:31:49 +08:00
<template>
<div class="app-ark-static">
<ai-list>
<template #content>
<ai-title title="门店概况"></ai-title>
<div class="card_list">
<div class="card" v-for="(item,index) in cardList" :key="index">
<h2>{{ item.label }}</h2>
<p class="color1">{{ item.value || 0 }}</p>
</div>
</div>
<div class="flex-row">
<div class="left-row flex-col">
2024-06-27 10:47:18 +08:00
<ai-title :title="`${new Date().getMonth()}月五星门店(排名不分先后)`">
2024-06-24 10:31:49 +08:00
<template #rightBtn>
2024-06-27 10:47:18 +08:00
<ai-select
v-model="search.girdCode"
@change="(search.current = 1), getList()"
placeholder="请选择网格"
size="small"
:selectList="gridList">
</ai-select>
2024-06-24 10:31:49 +08:00
</template>
</ai-title>
2024-06-27 10:47:18 +08:00
<div class="table-wrap">
<ai-table :is-show-pagination="false"
:tableData="tableData"
style="height: 100%"
height="100%"
:col-configs="colConfigs"></ai-table>
</div>
2024-06-24 10:31:49 +08:00
</div>
<div class="right-row flex-col">
<ai-title title="网格五星门店数量排名"></ai-title>
2024-06-29 14:13:29 +08:00
<div class="bar-chart" v-show="chartList && chartList.length > 0" ref="chartRef"></div>
<div v-show="chartList && chartList.length === 0" class="no-data" style="width:386px;height:160px;"/>
2024-06-24 10:31:49 +08:00
</div>
</div>
<ai-title title="统计列表"></ai-title>
<ai-search-bar>
<template #left>
<ai-select
2024-06-27 10:47:18 +08:00
v-model="form.operatorType"
2024-06-28 10:38:07 +08:00
@change="(form.current = 1), getList2()"
2024-06-24 10:31:49 +08:00
placeholder="经营类型"
2024-06-27 10:47:18 +08:00
:selectList="$dict.getDict('operatorType')">
2024-06-24 10:31:49 +08:00
</ai-select>
<ai-select
2024-06-27 10:47:18 +08:00
v-model="form.girdCode"
2024-06-28 10:38:07 +08:00
@change="(form.current = 1), getList2()"
2024-06-24 10:31:49 +08:00
placeholder="所属网格"
2024-06-27 10:47:18 +08:00
:selectList="gridList">
2024-06-24 10:31:49 +08:00
</ai-select>
</template>
<template #right>
<el-input
2024-06-27 10:47:18 +08:00
v-model="form.shopName"
2024-06-24 10:31:49 +08:00
size="small"
2024-06-28 10:38:07 +08:00
v-throttle="() => {form.current = 1, getList2()}"
2024-06-24 10:31:49 +08:00
placeholder="请输入门店名称"
clearable
2024-06-28 10:38:07 +08:00
@clear="form.current = 1, form.shopName = '', getList2()"
2024-06-24 10:31:49 +08:00
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
2024-06-28 10:38:07 +08:00
:tableData="tableData1"
2024-06-24 10:31:49 +08:00
:col-configs="colConfigs1"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column
label="门店照片"
slot="pic"
align="left">
<template v-slot="{ row }">
2024-06-28 10:38:07 +08:00
<img class="shop-img" :src="row.fileUrl" v-if="row.fileUrl" alt="" v-viewer>
2024-06-29 13:53:59 +08:00
<img class="shop-img" src="./img/shop.png" v-else alt="" v-viewer>
2024-06-24 10:31:49 +08:00
</template>
</el-table-column>
<el-table-column label="门店评分" slot="mark" align="center">
<template v-slot="{row}">
2024-06-27 10:47:18 +08:00
<el-rate :value="row.storeScore" show-score text-color="#ff9900" disabled></el-rate>
2024-06-24 10:31:49 +08:00
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</div>
</template>
<script>
let chartInstance = null;
export default {
name: "AppMarkStatic",
label: '门店统计',
2024-06-27 10:47:18 +08:00
props: {
instance: Function,
dict: Object
},
2024-06-24 10:31:49 +08:00
data() {
return {
data: {},
2024-06-27 10:47:18 +08:00
form: {
current:1,
pages:10,
operatorType:'',
girdCode:'',
shopName:'',
},
search: {
girdCode:'',
fiveStartTime:new Date().getMonth().toString(),
storeLevel:'5',
pages:1000
},
2024-06-24 10:31:49 +08:00
cardList: [
{
label: '门店总数量',
2024-06-27 10:47:18 +08:00
value: 0
2024-06-24 10:31:49 +08:00
},
{
label: '总网格数',
2024-06-27 10:47:18 +08:00
value: 0
2024-06-24 10:31:49 +08:00
},
{
label: '总网格员',
2024-06-27 10:47:18 +08:00
value: 0
2024-06-24 10:31:49 +08:00
},
{
label: '五星门店',
2024-06-27 10:47:18 +08:00
value: 0
2024-06-24 10:31:49 +08:00
}
],
2024-06-27 10:47:18 +08:00
gridList:[],
2024-06-24 10:31:49 +08:00
tableData: [],
colConfigs: [
2024-06-27 10:47:18 +08:00
{prop: 'shopName', label: '门店名称', align: 'center'},
{prop: 'operatorType', label: '经营类型', align: 'center',render:(h,{row})=>{
return h('span',null,this.dict.getLabel('operatorType',row.operatorType))
}},
{prop: 'name', label: '经营者名称', align: 'center'},
2024-06-24 10:31:49 +08:00
],
total: 10,
colConfigs1: [
{type: "selection"},
2024-06-27 10:47:18 +08:00
{slot: 'pic', align: 'center'},
{prop: 'shopName', label: '门店名称', align: 'center'},
{prop: 'name', label: '经营者姓名', align: 'center'},
{prop: 'phone', label: '联系电话', align: 'center'},
{prop: 'createTime', label: '录入时间', align: 'center'},
{prop: 'girdName', label: '所属网格', align: 'center'},
{prop: 'address', label: '门店地址', align: 'center'},
{prop: 'operatorType', label: '经营类型', align: 'center',render:(h,{row})=>{
return h('span',null,this.dict.getLabel('operatorType',row.operatorType))
}},
{slot: 'mark', align: 'center'}
2024-06-24 10:31:49 +08:00
],
tableData1: [],
2024-06-27 10:47:18 +08:00
chartList:[]
2024-06-24 10:31:49 +08:00
}
},
2024-06-27 10:47:18 +08:00
mounted() {
this.$dict.load('operatorType').then(()=>{
this.girdList()
this.queryShopDetail()
this.getList()
2024-06-28 10:38:07 +08:00
this.getList2()
2024-06-27 10:47:18 +08:00
this.countByFiveStars()
})
},
2024-06-24 10:31:49 +08:00
methods: {
2024-06-27 10:47:18 +08:00
async countByFiveStars(){
try {
const {code, data:{records}} = await this.instance.post('/app/appShopStatistics/countByFiveStars',null,{
pages:1000
})
if (code === 0) {
this.chartList = records?.reverse() || []
2024-06-29 20:47:37 +08:00
this.$nextTick(()=>{
this.initChart()
})
2024-06-27 10:47:18 +08:00
}
} catch (e) {
console.log(e)
}
},
2024-06-24 10:31:49 +08:00
2024-06-27 10:47:18 +08:00
async girdList() {
try {
const {code, data:{records}} = await this.instance.post('/app/appShopStatistics/girdList',null,{
pages:1000
})
if (code === 0) {
this.gridList = records?.map(item=>{
return {
dictName:item.girdName,
dictValue:item.girdCode
}
})
}
} catch (e) {
console.log(e)
}
},
async queryShopDetail() {
try {
const {code, data} = await this.instance.post('/app/appShopStatistics/queryShopDetail')
if (code === 0) {
const list = ['shopCounts','girdCounts','girdPersons','fiveStarsShops']
list.forEach((item,index)=>{
this.cardList[index].value = data[item]
})
}
} catch (e) {
console.log(e)
}
2024-06-24 10:31:49 +08:00
},
2024-06-27 10:47:18 +08:00
// 五星门店列表查询
async getList() {
try {
const {code, data:{records}} = await this.instance.post('/app/appshoparchives/list',null,{
params:{
...this.search,
}
})
if (code === 0) {
this.tableData = records
}
} catch (e) {
console.log(e)
}
},
// 列表查询
async getList2() {
try {
const {code, data:{records,total}} = await this.instance.post('/app/appShopStatistics/list',null,{
params:{
...this.form,
}
})
if (code === 0) {
this.total = total
this.tableData1 = records
}
} catch (e) {
console.log(e)
}
},
2024-06-24 10:31:49 +08:00
resize() {
if (chartInstance) {
chartInstance.resize()
}
},
initChart() {
chartInstance = echarts.init(this.$refs.chartRef)
chartInstance.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
show: false
},
grid: {
top: '1%',
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'value',
boundaryGap: [0, 0.01]
},
yAxis: {
type: 'category',
2024-06-27 10:47:18 +08:00
data: this.chartList?.map(item=>item.girdName)
2024-06-24 10:31:49 +08:00
},
series: [
{
type: 'bar',
2024-06-27 10:47:18 +08:00
barWidth:'20%',
itemStyle: {
color: '#389FFF',
2024-06-24 10:31:49 +08:00
},
2024-06-27 10:47:18 +08:00
data: this.chartList?.map(item=>item.fiveStarsCount)
2024-06-24 10:31:49 +08:00
}
]
})
window.addEventListener('resize', this.resize)
}
},
beforeDestroy() {
if (chartInstance) {
chartInstance.dispose()
chartInstance = null
}
}
}
</script>
<style lang="scss" scoped>
.app-ark-static {
height: 100%;
background: #F3F6F9;
.card_list {
display: flex;
.card {
flex: 1;
height: 96px;
background: #F9F9F9;
border-radius: 2px;
margin-right: 20px;
padding: 16px 24px;
box-sizing: border-box;
h2 {
color: #888888;
font-weight: 600;
font-size: 16px;
}
p {
margin-top: 8px;
font-size: 24px;
font-weight: 600;
}
.color1 {
color: #2891FF;
}
.color2 {
color: #22AA99;
}
.color3 {
color: #F8B425;
}
}
.card:last-child {
margin-right: 0;
}
}
.flex-row {
width: 100%;
height: 400px;
display: flex;
justify-content: space-between;
gap: 20px;
margin-top: 10px;
.left-row {
height: 100%;
width: 50%;
2024-06-27 10:47:18 +08:00
display: flex;
2024-06-24 10:31:49 +08:00
}
.right-row {
width: 50%;
height: 100%;
display: flex;
}
.flex-col {
flex-direction: column;
}
2024-06-27 10:47:18 +08:00
.table-wrap{
flex: 1;
overflow: hidden;
}
2024-06-24 10:31:49 +08:00
}
.mt-10 {
margin-top: 20px;
}
.tooltip {
2024-06-24 10:34:13 +08:00
font-size: 16px;
2024-06-24 10:31:49 +08:00
color: #D9001B;
margin-right: 10px;
}
.h-full {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.bar-chart {
width: 100%;
flex: 1;
}
2024-06-28 10:38:07 +08:00
.shop-img{
width: 120px;
height: 120px;
}
2024-06-24 10:31:49 +08:00
}
</style>