Commit c226e8c7 by 姜鹏凯

裂变详情

1 parent 206c3c39
...@@ -6,13 +6,57 @@ ...@@ -6,13 +6,57 @@
<search-title :showMore="true" @search="getLineData"></search-title> <search-title :showMore="true" @search="getLineData"></search-title>
<chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line> <chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line>
</div> </div>
<div class="g-card">
<div class="g-card-title">数据报表</div>
<div style="display: flex; justify-content: space-between;">
<search-title :showMore="true" @search="getTableFn"></search-title>
<el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column label="日期" align="center" min-width="100" prop="dateTime" show-overflow-tooltip />
<el-table-column
label="完成任务老客总数"
align="center"
prop="completeTaskOldCustomerNum"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="裂变新客总数"
align="center"
prop="fissionCustomerNum"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日完成任务老客数"
align="center"
prop="tdCompleteTaskOldCustomerNum"
min-width="120"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日裂变新客数"
align="center"
prop="tdFissionCustomerNum"
min-width="120"
show-overflow-tooltip
></el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getTableChangeSize()"
/>
</div>
</div> </div>
</template> </template>
<script> <script>
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
import ChartLine from '@/components/ChartLine.vue' import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '@/components/SearchTitle.vue' import SearchTitle from '@/components/SearchTitle.vue'
import { getTotal, getLineData } from '../taskGroup/api' import { getTotal, getLineData, getTableData, getTableExport } from '../taskGroup/api'
export default { export default {
name: 'fission-statistics', name: 'fission-statistics',
components: { components: {
...@@ -27,12 +71,17 @@ ...@@ -27,12 +71,17 @@
}, },
watch: { watch: {
fissionType(val) { fissionType(val) {
if (val == 1) {
this.legend = ['完成任务老客数', '裂变新客数']
} else {
this.legend = ['完成任务客户数', '裂变新客数']
}
this.$forceUpdate() this.$forceUpdate()
} }
}, },
data() { data() {
return { return {
legend: ['访问总数(pv)', '访问总人数(uv)', '小程序打开数'], legend: ['完成任务老客数', '裂变新客数'],
xdata: [], xdata: [],
series: [], series: [],
cardData: [ cardData: [
...@@ -69,7 +118,18 @@ ...@@ -69,7 +118,18 @@
} }
], ],
value: [], value: [],
id: '' id: '',
exportLoading: false,
tableList: [],
loading: false,
total: 0,
query: {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: ''
},
tableSearch: {}
} }
}, },
methods: { methods: {
...@@ -87,12 +147,64 @@ ...@@ -87,12 +147,64 @@
}, },
getLineData(data) { getLineData(data) {
this.$forceUpdate() this.$forceUpdate()
data.promotionId = this.id data.id = this.id
getLineData(data).then(({ data }) => { getLineData(data).then(({ data }) => {
this.xdata = data.xAxis let arr1 = []
this.series = [data.yAxis.pv, data.yAxis.uv, data.yAxis.open] let arr2 = []
let arr3 = []
data.forEach((dd) => {
arr1.push(dd.date)
arr2.push(dd.completeTaskOldCustomerNum)
arr3.push(dd.fissionCustomerNum)
})
this.xdata = arr1
this.series = [arr2, arr3]
this.$forceUpdate() this.$forceUpdate()
}) })
},
exportFn() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.exportLoading = true
return getTableExport(Object.assign({}, this.tableSearch))
})
.then((res) => {
if (res) {
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '数据明细-' + dateFormat(new Date()) + '.xlsx' // 重命名文件
link.click()
URL.revokeObjectURL(url)
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.exportLoading = false
})
},
getTableChangeSize() {
this.loading = true
getTableData(Object.assign({}, this.query)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
},
getTableFn(data) {
this.tableSearch = data
this.loading = true
this.query.id = this.id
this.query.beginTime = data.beginTime
this.query.endTime = data.endTime
this.getTableChangeSize()
} }
}, },
created() { created() {
......
...@@ -58,3 +58,28 @@ export function getTotal(id) { ...@@ -58,3 +58,28 @@ export function getTotal(id) {
url: wecom + '/findWeFissionTab/' + id url: wecom + '/findWeFissionTab/' + id
}) })
} }
// 统计 折线图
export function getLineData(data) {
return request({
url: wecom + '/findWeFissionTrend',
params: data
})
}
// 统计 表格
export function getTableData(data) {
return request({
url: wecom + '/findWeFissionDataReport',
params: data
})
}
// 统计 导出
export function getTableExport(data) {
return request({
url: wecom + '/exportWeFissionDataReport',
params: data,
responseType: 'blob'
})
}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<el-button <el-button
v-if="form.fassionState == 1" v-if="form.fassionState == 1"
type="primary" type="primary"
@click="$router.push({ path: './add', query: { id: id } })" @click="$router.push({ path: './add', query: { id: $route.query.id } })"
> >
编辑 编辑
</el-button> </el-button>
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
<div class="g-card"> <div class="g-card">
<div class="g-card-title">数据趋势</div> <div class="g-card-title">数据趋势</div>
<search-title :showMore="true" @search="getLineData"></search-title> <search-title :showMore="true" @search="getLineData"></search-title>
<div style="display: flex; justify-content: space-between"> <div style="display: flex; justify-content: space-between;">
<chart-line <chart-line
style="height: 300px; width: 48%" style="height: 300px; width: 48%;"
:legend="legendRedOne" :legend="legendRedOne"
:xData="xdataOne" :xData="xdataOne"
:series="seriesOne" :series="seriesOne"
></chart-line> ></chart-line>
<chart-line <chart-line
style="height: 300px; width: 48%" style="height: 300px; width: 48%;"
:legend="legendRedTwo" :legend="legendRedTwo"
:xData="xdata" :xData="xdata"
:series="series" :series="series"
...@@ -22,21 +22,13 @@ ...@@ -22,21 +22,13 @@
</div> </div>
<div class="g-card"> <div class="g-card">
<div class="g-card-title">数据报表</div> <div class="g-card-title">数据报表</div>
<div style="display: flex; justify-content: space-between"> <div style="display: flex; justify-content: space-between;">
<search-title :showMore="true" @search="getTableFn"></search-title> <search-title :showMore="true" @search="getTableFn"></search-title>
<el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading" <el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
>导出Excel</el-button
>
</div> </div>
<el-table v-loading="loading" :data="tableList" style="width: 100%"> <el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column <el-table-column label="日期" align="center" min-width="100" prop="dateTime" show-overflow-tooltip />
label="日期"
align="center"
min-width="100"
prop="dateTime"
show-overflow-tooltip
/>
<el-table-column <el-table-column
:label="true ? '红包领取总数' : '卡券领取总数'" :label="true ? '红包领取总数' : '卡券领取总数'"
align="center" align="center"
...@@ -76,24 +68,24 @@ ...@@ -76,24 +68,24 @@
</div> </div>
</template> </template>
<script> <script>
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
import ChartBar from '@/components/ChartBar.vue' import ChartBar from '@/components/ChartBar.vue'
import ChartLine from '@/components/ChartLine.vue' import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '../components/SearchTitle.vue' import SearchTitle from '../components/SearchTitle.vue'
import { import {
getTotalData, getTotalData,
getRedTableData, getRedTableData,
getMoneyLineData, getMoneyLineData,
getNumLineData, getNumLineData,
getRedTableExport, getRedTableExport
} from '@/api/drainageCode/pullNews' } from '@/api/drainageCode/pullNews'
export default { export default {
name: 'identity-code-statistics', name: 'identity-code-statistics',
components: { components: {
SearchTitle, SearchTitle,
ChartLine, ChartLine,
ChartBar, ChartBar
}, },
data() { data() {
return { return {
...@@ -112,58 +104,58 @@ export default { ...@@ -112,58 +104,58 @@ export default {
{ {
title: '红包领取总数', title: '红包领取总数',
tips: '当前活码新客累计领取红包的总个数', tips: '当前活码新客累计领取红包的总个数',
value: 0, value: 0
}, },
{ {
title: '红包领取总金额(元)', title: '红包领取总金额(元)',
tips: '当前活码新客累计领取红包的总金额', tips: '当前活码新客累计领取红包的总金额',
value: 0, value: 0
}, },
{ {
title: '今日红包领取数', title: '今日红包领取数',
tips: '当前活码今日新客领取红包的总个数', tips: '当前活码今日新客领取红包的总个数',
value: 0, value: 0,
title1: '较昨日', title1: '较昨日',
value1: 0, value1: 0
}, },
{ {
title: '今日红包领取金额(元)', title: '今日红包领取金额(元)',
tips: '当前活码今日新客领取红包的总金额', tips: '当前活码今日新客领取红包的总金额',
value: 0, value: 0,
title1: '较昨日', title1: '较昨日',
value1: 0, value1: 0
}, }
], ],
cardDataCard: [ cardDataCard: [
{ {
title: '卡券领取总数', title: '卡券领取总数',
tips: '当前活码新客累计领取卡券的总个数', tips: '当前活码新客累计领取卡券的总个数',
value: 0, value: 0
}, },
{ {
title: '卡券领取总面额(元)', title: '卡券领取总面额(元)',
tips: '当前活码新客累计领取卡券的总面额', tips: '当前活码新客累计领取卡券的总面额',
value: 0, value: 0
}, },
{ {
title: '今日卡券领取数', title: '今日卡券领取数',
tips: '当前活码今日新客领取卡券的总个数', tips: '当前活码今日新客领取卡券的总个数',
value: 0, value: 0,
title1: '较昨日', title1: '较昨日',
value1: 0, value1: 0
}, },
{ {
title: '今日红包领取面额(元)', title: '今日红包领取面额(元)',
tips: '当前活码今日新客领取卡券的总面额', tips: '当前活码今日新客领取卡券的总面额',
value: 0, value: 0,
title1: '较昨日', title1: '较昨日',
value1: 0, value1: 0
}, }
], ],
total: 0, total: 0,
query: { query: {
pageSize: 10, pageSize: 10,
pageNum: 1, pageNum: 1
}, },
tableList: [], tableList: [],
loading: false, loading: false,
...@@ -172,14 +164,14 @@ export default { ...@@ -172,14 +164,14 @@ export default {
value: [], value: [],
tableSearch: {}, tableSearch: {},
addWeUserState: null, addWeUserState: null,
id: '', id: ''
} }
}, },
props: { props: {
form: { form: {
type: Object, type: Object,
default: {}, default: {}
}, }
}, },
methods: { methods: {
...@@ -187,7 +179,7 @@ export default { ...@@ -187,7 +179,7 @@ export default {
this.$confirm('确认导出吗?', '提示', { this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}) })
.then(() => { .then(() => {
this.exportLoading = true this.exportLoading = true
...@@ -258,13 +250,13 @@ export default { ...@@ -258,13 +250,13 @@ export default {
this.query.beginTime = data.beginTime this.query.beginTime = data.beginTime
this.query.endTime = data.endTime this.query.endTime = data.endTime
this.getTableChangeSize() this.getTableChangeSize()
}, }
}, },
created() { created() {
this.addWeUserState = this.$route.query.addWeUserState this.addWeUserState = this.$route.query.addWeUserState
this.id = this.$route.query.groupId this.id = this.$route.query.groupId
this.getTabTotalFn() this.getTabTotalFn()
}, }
} }
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!