门店管理,销售管理的代码框架开发
This commit is contained in:
596
src/views/video/index.vue
Normal file
596
src/views/video/index.vue
Normal file
@@ -0,0 +1,596 @@
|
||||
<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-input
|
||||
v-model="queryParams.videoName"
|
||||
placeholder="请输入视频名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<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.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.customerPhone"
|
||||
placeholder="请输入客户手机号"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="最小时长">
|
||||
<el-input
|
||||
v-model="queryParams.minDuration"
|
||||
placeholder="请输入最小时长"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 第三行 -->
|
||||
<el-form-item label="最大时长">
|
||||
<el-input
|
||||
v-model="queryParams.maxDuration"
|
||||
placeholder="请输入最大时长"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="录制时间">
|
||||
<el-date-picker
|
||||
v-model="queryParams.recordingTimeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 按钮区域 -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 数据表格区域 -->
|
||||
<el-card class="table-container" shadow="never">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="videoList"
|
||||
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="dealershipName" min-width="150" />
|
||||
<el-table-column label="视频名称" prop="videoName" min-width="200" />
|
||||
<el-table-column label="所属销售" prop="salesName" min-width="150" />
|
||||
<el-table-column label="客户姓名" prop="customerName" min-width="120" />
|
||||
<el-table-column label="客户手机号" prop="customerPhone" min-width="150" />
|
||||
<el-table-column label="操作" width="200" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleView(scope.row)">查看</el-button>
|
||||
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="text" @click="handleDelete(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-dialog
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
width="600px"
|
||||
@close="handleDialogClose"
|
||||
>
|
||||
<el-form ref="videoForm" :model="videoForm" :rules="videoRules" label-width="100px">
|
||||
<el-form-item label="视频名称" prop="videoName">
|
||||
<el-input v-model="videoForm.videoName" placeholder="请输入视频名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属门店" prop="dealershipId">
|
||||
<el-select v-model="videoForm.dealershipId" placeholder="请选择所属门店" style="width: 100%">
|
||||
<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="所属销售" prop="salesId">
|
||||
<el-select v-model="videoForm.salesId" placeholder="请选择所属销售" style="width: 100%">
|
||||
<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="客户姓名" prop="customerName">
|
||||
<el-input v-model="videoForm.customerName" placeholder="请输入客户姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户手机号" prop="customerPhone">
|
||||
<el-input v-model="videoForm.customerPhone" placeholder="请输入客户手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频时长" prop="duration">
|
||||
<el-input v-model="videoForm.duration" placeholder="请输入视频时长(分钟)" type="number" />
|
||||
</el-form-item>
|
||||
<el-form-item label="录制时间" prop="recordingTime">
|
||||
<el-date-picker
|
||||
v-model="videoForm.recordingTime"
|
||||
type="datetime"
|
||||
placeholder="请选择录制时间"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频描述" prop="description">
|
||||
<el-input
|
||||
v-model="videoForm.description"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入视频描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 视频详情对话框 -->
|
||||
<el-dialog
|
||||
title="视频详情"
|
||||
:visible.sync="detailVisible"
|
||||
width="800px"
|
||||
>
|
||||
<div v-if="currentVideo" class="video-detail">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>视频名称:</label>
|
||||
<span>{{ currentVideo.videoName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>所属门店:</label>
|
||||
<span>{{ currentVideo.dealershipName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>所属销售:</label>
|
||||
<span>{{ currentVideo.salesName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>客户姓名:</label>
|
||||
<span>{{ currentVideo.customerName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>客户手机号:</label>
|
||||
<span>{{ currentVideo.customerPhone }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>视频时长:</label>
|
||||
<span>{{ currentVideo.duration }} 分钟</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>录制时间:</label>
|
||||
<span>{{ currentVideo.recordingTime }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="detail-item">
|
||||
<label>创建时间:</label>
|
||||
<span>{{ currentVideo.createTime }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="currentVideo.description" :gutter="20">
|
||||
<el-col :span="24">
|
||||
<div class="detail-item">
|
||||
<label>视频描述:</label>
|
||||
<span>{{ currentVideo.description }}</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 {
|
||||
getVideoList,
|
||||
addVideo,
|
||||
updateVideo,
|
||||
deleteVideo
|
||||
} from '@/api/video'
|
||||
|
||||
export default {
|
||||
name: 'Video',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
videoList: [],
|
||||
total: 0,
|
||||
selectedIds: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
isEdit: false,
|
||||
detailVisible: false,
|
||||
currentVideo: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
videoName: '',
|
||||
dealershipId: '',
|
||||
salesId: '',
|
||||
customerName: '',
|
||||
customerPhone: '',
|
||||
minDuration: '',
|
||||
maxDuration: '',
|
||||
recordingTimeRange: []
|
||||
},
|
||||
// 视频表单
|
||||
videoForm: {
|
||||
id: null,
|
||||
videoName: '',
|
||||
dealershipId: '',
|
||||
salesId: '',
|
||||
customerName: '',
|
||||
customerPhone: '',
|
||||
duration: '',
|
||||
recordingTime: '',
|
||||
description: ''
|
||||
},
|
||||
// 表单验证规则
|
||||
videoRules: {
|
||||
videoName: [
|
||||
{ required: true, message: '请输入视频名称', trigger: 'blur' }
|
||||
],
|
||||
dealershipId: [
|
||||
{ required: true, message: '请选择所属门店', trigger: 'change' }
|
||||
],
|
||||
salesId: [
|
||||
{ required: true, message: '请选择所属销售', trigger: 'change' }
|
||||
],
|
||||
customerName: [
|
||||
{ required: true, message: '请输入客户姓名', trigger: 'blur' }
|
||||
],
|
||||
customerPhone: [
|
||||
{ required: true, message: '请输入客户手机号', trigger: 'blur' }
|
||||
],
|
||||
duration: [
|
||||
{ required: true, message: '请输入视频时长', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
// 门店选项
|
||||
dealershipOptions: [
|
||||
{ value: '1', label: '销售演示-上汽' },
|
||||
{ value: '2', label: 'DCC演示' },
|
||||
{ value: '3', label: '销售演示-奔驰' },
|
||||
{ value: '4', 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.recordingTimeRange && params.recordingTimeRange.length === 2) {
|
||||
params.recordingTimeStart = params.recordingTimeRange[0]
|
||||
params.recordingTimeEnd = params.recordingTimeRange[1]
|
||||
}
|
||||
delete params.recordingTimeRange
|
||||
|
||||
// 移除空值
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] === '' || params[key] === null || params[key] === undefined) {
|
||||
delete params[key]
|
||||
}
|
||||
})
|
||||
|
||||
getVideoList(params).then(response => {
|
||||
console.log('API响应:', response)
|
||||
if (response.code === 20000) {
|
||||
this.videoList = 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.videoList = [
|
||||
{
|
||||
id: '1',
|
||||
videoName: '销售演示视频_001',
|
||||
dealershipName: '销售演示-上汽',
|
||||
salesName: '销冠【普通】',
|
||||
customerName: '张先生',
|
||||
customerPhone: '13800138000',
|
||||
duration: 15,
|
||||
recordingTime: '2025-08-08 10:30:15',
|
||||
createTime: '2025-08-08 10:30:15',
|
||||
description: '销售演示视频,展示产品特点'
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
videoName: '客户咨询视频_002',
|
||||
dealershipName: 'DCC演示',
|
||||
salesName: '粤语销售',
|
||||
customerName: '李女士',
|
||||
customerPhone: '13900139000',
|
||||
duration: 25,
|
||||
recordingTime: '2025-08-08 11:20:30',
|
||||
createTime: '2025-08-08 11:20:30',
|
||||
description: '客户咨询产品详情'
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
videoName: '产品介绍视频_003',
|
||||
dealershipName: '销售演示-奔驰',
|
||||
salesName: '上海销售',
|
||||
customerName: '王先生',
|
||||
customerPhone: '13700137000',
|
||||
duration: 18,
|
||||
recordingTime: '2025-08-08 14:15:45',
|
||||
createTime: '2025-08-08 14:15:45',
|
||||
description: '奔驰产品详细介绍'
|
||||
}
|
||||
]
|
||||
this.total = this.videoList.length
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.current = 1
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 重置查询
|
||||
resetQuery() {
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.queryParams = {
|
||||
current: 1,
|
||||
size: 10,
|
||||
videoName: '',
|
||||
dealershipId: '',
|
||||
salesId: '',
|
||||
customerName: '',
|
||||
customerPhone: '',
|
||||
minDuration: '',
|
||||
maxDuration: '',
|
||||
recordingTimeRange: []
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 选择变化
|
||||
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()
|
||||
},
|
||||
|
||||
// 查看视频详情
|
||||
handleView(row) {
|
||||
this.currentVideo = row
|
||||
this.detailVisible = true
|
||||
},
|
||||
|
||||
// 添加视频
|
||||
handleAdd() {
|
||||
this.dialogTitle = '添加视频'
|
||||
this.isEdit = false
|
||||
this.videoForm = {
|
||||
id: null,
|
||||
videoName: '',
|
||||
dealershipId: '',
|
||||
salesId: '',
|
||||
customerName: '',
|
||||
customerPhone: '',
|
||||
duration: '',
|
||||
recordingTime: '',
|
||||
description: ''
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
|
||||
// 编辑视频
|
||||
handleEdit(row) {
|
||||
this.dialogTitle = '编辑视频'
|
||||
this.isEdit = true
|
||||
this.videoForm = { ...row }
|
||||
this.dialogVisible = true
|
||||
},
|
||||
|
||||
// 删除视频
|
||||
handleDelete(row) {
|
||||
this.$confirm('确认删除该视频?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteVideo(row.id).then(response => {
|
||||
if (response.code === 20000) {
|
||||
this.$message.success('删除成功')
|
||||
this.getList()
|
||||
} else {
|
||||
this.$message.error(response.message || '删除失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.success('删除成功')
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 提交表单
|
||||
handleSubmit() {
|
||||
this.$refs.videoForm.validate(valid => {
|
||||
if (valid) {
|
||||
const submitFunc = this.isEdit ? updateVideo : addVideo
|
||||
submitFunc(this.videoForm).then(response => {
|
||||
if (response.code === 20000) {
|
||||
this.$message.success(this.isEdit ? '更新成功' : '添加成功')
|
||||
this.dialogVisible = false
|
||||
this.getList()
|
||||
} else {
|
||||
this.$message.error(response.message || (this.isEdit ? '更新失败' : '添加失败'))
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.success(this.isEdit ? '更新成功' : '添加成功')
|
||||
this.dialogVisible = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 对话框关闭
|
||||
handleDialogClose() {
|
||||
this.$refs.videoForm.resetFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.filter-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.video-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