|
|
|
@ -3,6 +3,11 @@ |
|
|
|
<view class="main_box"> |
|
|
|
<!--自定义导航栏--> |
|
|
|
<view class="navbar_section"> |
|
|
|
<view class="title">市场数据统计</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 顶部筛选 --> |
|
|
|
<view class="filter-section"> |
|
|
|
<view class="filter-item"> |
|
|
|
<view class="label">统计时间:</view> |
|
|
|
<picker mode="date" fields="month" :value="currentDate" @change="dateChange"> |
|
|
|
@ -11,7 +16,6 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 市场人员资源量统计 --> |
|
|
|
<view class="table-section"> |
|
|
|
<view class="table-title">市场人员资源量统计</view> |
|
|
|
@ -39,14 +43,14 @@ |
|
|
|
<view class="table-container"> |
|
|
|
<view class="table-header"> |
|
|
|
<view class="th th-channel" style="width: 100px;">渠道</view> |
|
|
|
<view class="th" v-for="(school, index) in schoolList" :key="index">{{school.name}}</view> |
|
|
|
<view class="th" v-for="(school, index) in schoolList" :key="index">{{school.campus_name}}</view> |
|
|
|
<view class="th th-total">渠道合计</view> |
|
|
|
</view> |
|
|
|
<view class="table-body"> |
|
|
|
<view class="table-row" v-for="(channel, index) in channelSchoolData" :key="index"> |
|
|
|
<view class="table-row" v-for="(channel, index) in channelList" :key="index"> |
|
|
|
<view class="td td-channel" style="width: 100px;">{{channel.name}}</view> |
|
|
|
<view class="td" v-for="(school, sIndex) in schoolList" :key="sIndex"> |
|
|
|
{{channel.schools[school.id] || 0}} |
|
|
|
{{channel[school.id] || 0}} |
|
|
|
</view> |
|
|
|
<view class="td td-total">{{channel.total}}</view> |
|
|
|
</view> |
|
|
|
@ -60,133 +64,43 @@ |
|
|
|
<view class="table-container"> |
|
|
|
<view class="table-header"> |
|
|
|
<view class="th th-channel" style="width: 100px;">渠道</view> |
|
|
|
<view class="th" v-for="(staff, index) in marketStaffList" :key="index">市场{{staff.name}}</view> |
|
|
|
<view class="th" v-for="(staff, index) in staffData" :key="index">市场{{staff.name}}</view> |
|
|
|
<view class="th th-total">资源合计</view> |
|
|
|
</view> |
|
|
|
<view class="table-body"> |
|
|
|
<view class="table-row" v-for="(channel, index) in channelStaffData" :key="index"> |
|
|
|
<view class="table-row" v-for="(channel, index) in channelList" :key="index"> |
|
|
|
<view class="td td-channel" style="width: 100px;">{{channel.name}}</view> |
|
|
|
<view class="td" v-for="(staff, sIndex) in marketStaffList" :key="sIndex"> |
|
|
|
{{channel.staffs[staff.id] || 0}} |
|
|
|
<view class="td" v-for="(staff, sIndex) in staffData" :key="sIndex"> |
|
|
|
{{staff['channel'][channel.value] || 0}} |
|
|
|
</view> |
|
|
|
<view class="td td-total">{{channel.total}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 底部导航--> |
|
|
|
<AQTabber /> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import apiRoute from '@/api/apiRoute.js'; |
|
|
|
import AQTabber from "@/components/AQ/AQTabber.vue" |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
AQTabber, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
currentDate: this.formatDate(new Date()), |
|
|
|
currentMonth: new Date().getMonth() + 1, |
|
|
|
// 市场人员资源量统计 |
|
|
|
staffData: [{ |
|
|
|
name: 'A', |
|
|
|
weekCount: 0, |
|
|
|
monthCount: 0, |
|
|
|
yearCount: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'B', |
|
|
|
weekCount: 0, |
|
|
|
monthCount: 0, |
|
|
|
yearCount: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'C', |
|
|
|
weekCount: 0, |
|
|
|
monthCount: 0, |
|
|
|
yearCount: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'D', |
|
|
|
weekCount: 0, |
|
|
|
monthCount: 0, |
|
|
|
yearCount: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'E', |
|
|
|
weekCount: 0, |
|
|
|
monthCount: 0, |
|
|
|
yearCount: 0 |
|
|
|
} |
|
|
|
], |
|
|
|
staffData: [], |
|
|
|
// 校区列表 |
|
|
|
schoolList: [{ |
|
|
|
id: 1, |
|
|
|
name: '校区1' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 2, |
|
|
|
name: '校区2' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 3, |
|
|
|
name: '校区3' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 4, |
|
|
|
name: '校区4' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 5, |
|
|
|
name: '校区5' |
|
|
|
} |
|
|
|
], |
|
|
|
schoolList: [], |
|
|
|
// 渠道列表 |
|
|
|
channelList: [{ |
|
|
|
id: 1, |
|
|
|
name: '地推' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 2, |
|
|
|
name: '转介绍' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 3, |
|
|
|
name: '美团/大众' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 4, |
|
|
|
name: '抖音' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 5, |
|
|
|
name: '小红书' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 6, |
|
|
|
name: '其他' |
|
|
|
} |
|
|
|
], |
|
|
|
channelList: [], |
|
|
|
// 市场人员列表 |
|
|
|
marketStaffList: [{ |
|
|
|
id: 'A', |
|
|
|
name: 'A' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'B', |
|
|
|
name: 'B' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'C', |
|
|
|
name: 'C' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'D', |
|
|
|
name: 'D' |
|
|
|
} |
|
|
|
marketStaffList: [ |
|
|
|
{ id: 'A', name: 'A' }, |
|
|
|
{ id: 'B', name: 'B' }, |
|
|
|
{ id: 'C', name: 'C' }, |
|
|
|
{ id: 'D', name: 'D' } |
|
|
|
], |
|
|
|
// 校区渠道数据 |
|
|
|
channelSchoolData: [], |
|
|
|
@ -214,28 +128,23 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
// 初始化数据 |
|
|
|
initData() { |
|
|
|
async initData() { |
|
|
|
// 模拟获取数据,实际项目中应该调用API |
|
|
|
this.getStaffStatistics(); |
|
|
|
this.getChannelSchoolStatistics(); |
|
|
|
this.getChannelStaffStatistics(); |
|
|
|
await this.getStaffStatistics(); |
|
|
|
// await this.getChannelSchoolStatistics(); |
|
|
|
// this.getChannelStaffStatistics(); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取人员资源量统计 |
|
|
|
getStaffStatistics() { |
|
|
|
async getStaffStatistics() { |
|
|
|
// 模拟数据,实际项目中应该调用API |
|
|
|
// 示例:apiRoute.getStaffStatistics({date: this.currentDate}).then(res => {}) |
|
|
|
let res = await apiRoute.getStaffStatistics({date: this.currentDate}) |
|
|
|
|
|
|
|
console.log(res.data.staffData,"================"); |
|
|
|
this.staffData = res.data.staffData |
|
|
|
this.schoolList = res.data.schoolList |
|
|
|
this.channelList = res.data.channelList |
|
|
|
|
|
|
|
// 模拟随机数据 |
|
|
|
this.staffData = this.staffData.map(staff => { |
|
|
|
const monthCount = Math.floor(Math.random() * 100); |
|
|
|
return { |
|
|
|
...staff, |
|
|
|
weekCount: Math.floor(Math.random() * 30), |
|
|
|
monthCount: monthCount, |
|
|
|
yearCount: monthCount + Math.floor(Math.random() * 200) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取校区渠道统计 |
|
|
|
@ -382,30 +291,24 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.th-person, |
|
|
|
.td-person { |
|
|
|
.th-person, .td-person { |
|
|
|
min-width: 80rpx; |
|
|
|
flex: 0.8; |
|
|
|
} |
|
|
|
|
|
|
|
.th-week, |
|
|
|
.td-week, |
|
|
|
.th-month, |
|
|
|
.td-month, |
|
|
|
.th-year, |
|
|
|
.td-year { |
|
|
|
.th-week, .td-week, |
|
|
|
.th-month, .td-month, |
|
|
|
.th-year, .td-year { |
|
|
|
flex: 1; |
|
|
|
} |
|
|
|
|
|
|
|
.th-channel, |
|
|
|
.td-channel { |
|
|
|
.th-channel, .td-channel { |
|
|
|
flex: 1.2; |
|
|
|
text-align: left; |
|
|
|
padding-left: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.th-total, |
|
|
|
.td-total { |
|
|
|
.th-total, .td-total { |
|
|
|
flex: 1.2; |
|
|
|
font-weight: bold; |
|
|
|
} |
|
|
|
|