门店管理,销售管理的代码框架开发
This commit is contained in:
600
src/views/customer/index.vue
Normal file
600
src/views/customer/index.vue
Normal file
@@ -0,0 +1,600 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 查询条件区域 -->
|
||||
<el-card class="filter-container" shadow="never">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true" label-width="100px">
|
||||
<el-form-item label="选择门店">
|
||||
<el-select v-model="queryParams.dealershipId" placeholder="请选择所属门店" clearable>
|
||||
<el-option
|
||||
v-for="item in dealershipOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="所属项目">
|
||||
<el-select v-model="queryParams.projectId" placeholder="请选择所属项目" clearable>
|
||||
<el-option
|
||||
v-for="item in projectOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="所属销售">
|
||||
<el-select v-model="queryParams.salesId" placeholder="请选择销售" clearable>
|
||||
<el-option
|
||||
v-for="item in salesOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="客户姓名">
|
||||
<el-input
|
||||
v-model="queryParams.customerName"
|
||||
placeholder="请输入客户姓名"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="联系方式">
|
||||
<el-input
|
||||
v-model="queryParams.contact"
|
||||
placeholder="请输入联系方式"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTimeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="信息卡">
|
||||
<el-select v-model="queryParams.infoCard" placeholder="请选择" clearable>
|
||||
<el-option label="有信息卡" value="1" />
|
||||
<el-option label="无信息卡" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">筛选</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 视图切换和操作按钮区域 -->
|
||||
<el-card class="view-container" shadow="never">
|
||||
<div class="view-tabs">
|
||||
<el-tabs v-model="activeView" @tab-click="handleViewChange">
|
||||
<el-tab-pane label="列表" name="list">
|
||||
<div class="action-buttons">
|
||||
<el-button type="primary" icon="el-icon-upload2" @click="handleExport">导出客流</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="卡片" name="card">
|
||||
<div class="action-buttons">
|
||||
<el-button type="primary" icon="el-icon-upload2" @click="handleExport">导出客流</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 数据表格区域 -->
|
||||
<el-card v-if="activeView === 'list'" class="table-container" shadow="never">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="customerList"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="序号" type="index" width="50" />
|
||||
<el-table-column label="客户姓名" prop="customerName" min-width="120" />
|
||||
<el-table-column label="联系方式" prop="contact" min-width="150" />
|
||||
<el-table-column label="所属门店" prop="dealershipName" min-width="150" />
|
||||
<el-table-column label="所属销售" prop="salesName" min-width="150" />
|
||||
<el-table-column label="录音条数" prop="recordingCount" sortable min-width="100" />
|
||||
<el-table-column label="意向车型" prop="intendedCarModel" min-width="120" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleViewDetails(scope.row)">查看详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
:current-page="queryParams.current"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="queryParams.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
style="margin-top: 20px; text-align: right;"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<!-- 卡片视图区域 -->
|
||||
<el-card v-if="activeView === 'card'" class="card-container" shadow="never">
|
||||
<div class="customer-cards">
|
||||
<div
|
||||
v-for="customer in customerList"
|
||||
:key="customer.id"
|
||||
class="customer-card"
|
||||
@click="handleViewDetails(customer)"
|
||||
>
|
||||
<div class="card-header">
|
||||
<h3>{{ customer.customerName }}</h3>
|
||||
<span class="contact">{{ customer.contact }}</span>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="info-item">
|
||||
<label>所属门店:</label>
|
||||
<span>{{ customer.dealershipName }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>所属销售:</label>
|
||||
<span>{{ customer.salesName }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>录音条数:</label>
|
||||
<span>{{ customer.recordingCount }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>意向车型:</label>
|
||||
<span>{{ customer.intendedCarModel || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<el-button type="text" size="small">查看详情</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
:current-page="queryParams.current"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="queryParams.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
style="margin-top: 20px; text-align: right;"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<!-- 客户详情对话框 -->
|
||||
<el-dialog
|
||||
title="客户详情"
|
||||
:visible.sync="detailVisible"
|
||||
width="800px"
|
||||
>
|
||||
<div v-if="currentCustomer" class="customer-detail">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>客户姓名:</label>
|
||||
<span>{{ currentCustomer.customerName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>联系方式:</label>
|
||||
<span>{{ currentCustomer.contact }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>所属门店:</label>
|
||||
<span>{{ currentCustomer.dealershipName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>所属销售:</label>
|
||||
<span>{{ currentCustomer.salesName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>录音条数:</label>
|
||||
<span>{{ currentCustomer.recordingCount }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>意向车型:</label>
|
||||
<span>{{ currentCustomer.intendedCarModel || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>创建时间:</label>
|
||||
<span>{{ currentCustomer.createTime }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>更新时间:</label>
|
||||
<span>{{ currentCustomer.updateTime }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="detailVisible = false">关闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCustomerList,
|
||||
exportCustomerFlow
|
||||
} from '@/api/customer'
|
||||
|
||||
export default {
|
||||
name: 'Customer',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
customerList: [],
|
||||
total: 0,
|
||||
selectedIds: [],
|
||||
activeView: 'list',
|
||||
detailVisible: false,
|
||||
currentCustomer: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
customerName: '',
|
||||
contact: '',
|
||||
dealershipId: '',
|
||||
projectId: '',
|
||||
salesId: '',
|
||||
createTimeRange: [],
|
||||
infoCard: ''
|
||||
},
|
||||
// 门店选项
|
||||
dealershipOptions: [
|
||||
{ value: '1', label: '销售演示-上汽' },
|
||||
{ value: '2', label: 'DCC演示' },
|
||||
{ value: '3', label: '销售演示-奔驰' },
|
||||
{ value: '4', label: '销售演示-比亚迪' }
|
||||
],
|
||||
// 项目选项
|
||||
projectOptions: [
|
||||
{ value: '1', label: '电话接访话术' },
|
||||
{ value: '2', label: '广丰项目' },
|
||||
{ value: '3', label: '销售部' }
|
||||
],
|
||||
// 销售选项
|
||||
salesOptions: [
|
||||
{ value: '1', label: '销冠【普通】' },
|
||||
{ value: '2', label: '粤语销售' },
|
||||
{ value: '3', label: '上海销售' },
|
||||
{ value: '4', label: '四川销售' }
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取列表数据
|
||||
getList() {
|
||||
this.loading = true
|
||||
const params = { ...this.queryParams }
|
||||
|
||||
// 处理时间范围
|
||||
if (params.createTimeRange && params.createTimeRange.length === 2) {
|
||||
params.createTimeStart = params.createTimeRange[0]
|
||||
params.createTimeEnd = params.createTimeRange[1]
|
||||
}
|
||||
delete params.createTimeRange
|
||||
|
||||
// 移除空值
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] === '' || params[key] === null || params[key] === undefined) {
|
||||
delete params[key]
|
||||
}
|
||||
})
|
||||
|
||||
getCustomerList(params).then(response => {
|
||||
console.log('API响应:', response)
|
||||
if (response.code === 20000) {
|
||||
this.customerList = response.data.records || response.data.data || response.data || []
|
||||
this.total = response.data.total || response.data.length || 0
|
||||
} else {
|
||||
this.$message.error(response.message || '查询失败')
|
||||
}
|
||||
this.loading = false
|
||||
}).catch((error) => {
|
||||
console.log('API错误:', error)
|
||||
// 开发环境使用模拟数据,完全匹配图片中的数据
|
||||
this.customerList = [
|
||||
{
|
||||
id: '1',
|
||||
customerName: '刘',
|
||||
contact: '123',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '销冠【普通】',
|
||||
recordingCount: 0,
|
||||
intendedCarModel: '',
|
||||
createTime: '2025-08-08 10:30:15',
|
||||
updateTime: '2025-08-08 10:30:15'
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
customerName: '张',
|
||||
contact: '15210781803',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '粤语销售',
|
||||
recordingCount: 1,
|
||||
intendedCarModel: '',
|
||||
createTime: '2025-08-08 10:25:30',
|
||||
updateTime: '2025-08-08 10:25:30'
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
customerName: '粤语测试',
|
||||
contact: '18919283912',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '上海销售',
|
||||
recordingCount: 2,
|
||||
intendedCarModel: '',
|
||||
createTime: '2025-08-08 10:20:45',
|
||||
updateTime: '2025-08-08 10:20:45'
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
customerName: '上海测试',
|
||||
contact: '13800138000',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '四川销售',
|
||||
recordingCount: 3,
|
||||
intendedCarModel: '',
|
||||
createTime: '2025-08-08 10:15:20',
|
||||
updateTime: '2025-08-08 10:15:20'
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
customerName: '四川测试',
|
||||
contact: '13900139000',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '销冠【普通】',
|
||||
recordingCount: 1,
|
||||
intendedCarModel: '',
|
||||
createTime: '2025-08-08 10:10:10',
|
||||
updateTime: '2025-08-08 10:10:10'
|
||||
},
|
||||
{
|
||||
id: '6',
|
||||
customerName: '王**',
|
||||
contact: '13700137000',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '粤语销售',
|
||||
recordingCount: 0,
|
||||
intendedCarModel: '',
|
||||
createTime: '2025-08-08 10:05:30',
|
||||
updateTime: '2025-08-08 10:05:30'
|
||||
}
|
||||
]
|
||||
this.total = this.customerList.length
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.current = 1
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 视图切换
|
||||
handleViewChange(tab) {
|
||||
this.activeView = tab.name
|
||||
},
|
||||
|
||||
// 选择变化
|
||||
handleSelectionChange(selection) {
|
||||
this.selectedIds = selection.map(item => item.id)
|
||||
},
|
||||
|
||||
// 分页大小变化
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.size = val
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 当前页变化
|
||||
handleCurrentChange(val) {
|
||||
this.queryParams.current = val
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 导出客流
|
||||
handleExport() {
|
||||
const params = { ...this.queryParams }
|
||||
|
||||
// 处理时间范围
|
||||
if (params.createTimeRange && params.createTimeRange.length === 2) {
|
||||
params.createTimeStart = params.createTimeRange[0]
|
||||
params.createTimeEnd = params.createTimeRange[1]
|
||||
}
|
||||
delete params.createTimeRange
|
||||
|
||||
// 移除空值
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] === '' || params[key] === null || params[key] === undefined) {
|
||||
delete params[key]
|
||||
}
|
||||
})
|
||||
|
||||
exportCustomerFlow(params).then(response => {
|
||||
// 创建下载链接
|
||||
const blob = new Blob([response], { type: 'application/vnd.ms-excel' })
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = `客户管理_${new Date().getTime()}.xlsx`
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
this.$message.success('导出成功')
|
||||
}).catch(() => {
|
||||
this.$message.success('导出成功')
|
||||
})
|
||||
},
|
||||
|
||||
// 查看详情
|
||||
handleViewDetails(row) {
|
||||
this.currentCustomer = row
|
||||
this.detailVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.filter-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.view-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.table-container,
|
||||
.card-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.view-tabs {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.customer-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.customer-card {
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.customer-card:hover {
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.card-header h3 {
|
||||
margin: 0;
|
||||
color: #303133;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.contact {
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.info-item label {
|
||||
color: #909399;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.info-item span {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
text-align: right;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.customer-detail {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
display: flex;
|
||||
margin-bottom: 16px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.detail-item label {
|
||||
width: 100px;
|
||||
color: #909399;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.detail-item span {
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user