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>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!