Files
ss-crm-manage-web/src/views/Clue/Order/Comp/OrderList.vue

367 lines
10 KiB
Vue
Raw Normal View History

2024-06-18 15:16:04 +08:00
<template>
<div>
<!-- 搜索工作栏 -->
<div>
2024-06-19 11:56:00 +08:00
<el-form
:model="searchForm"
ref="moreSearchRef"
inline
label-width="0"
style="display: inline"
>
2024-06-20 19:43:07 +08:00
<el-form-item style="margin-bottom: 10px">
<el-select
v-model="searchForm.signSchool"
placeholder="选择驾校"
filterable
clearable
@change="changeSchool"
>
<el-option
v-for="item in schoolOptions"
:key="item.schoolId"
:label="item.schoolName"
:value="item.schoolId"
/>
</el-select>
</el-form-item>
<el-form-item style="margin-bottom: 10px">
<el-select
v-model="searchForm.signPlace"
placeholder="选择场地"
filterable
clearable
:disabled="!searchForm.signSchool"
@change="changePlace"
>
<el-option
v-for="item in placeOptions"
:key="item.placeId"
:label="item.name"
:value="item.placeId"
/>
</el-select>
</el-form-item>
<el-form-item style="margin-bottom: 10px">
<el-select
v-model="searchForm.signClass"
:disabled="!searchForm.signPlace"
placeholder="选择班型"
filterable
clearable
>
<el-option
v-for="item in classOptions"
:key="item.typeId"
:label="item.typeName"
:value="item.typeId"
/>
</el-select>
</el-form-item>
2024-06-18 15:16:04 +08:00
</el-form>
2024-06-19 11:56:00 +08:00
<Search
v-if="!loading"
ref="searchRef"
:schema="allSchemas.searchSchema"
inlineBlock
labelWidth="0"
>
2024-06-18 15:16:04 +08:00
<template #actionMore>
<el-button @click="getTableList" v-hasPermi="['clue:order:search']"> 搜索 </el-button>
<el-button @click="resetQuery" v-hasPermi="['clue:order:reset']"> 重置 </el-button>
</template>
</Search>
</div>
<!-- 列表 -->
<SSTable
v-if="!loading"
2024-06-19 11:56:00 +08:00
class="mt-10px"
2024-06-18 15:16:04 +08:00
v-model:tableObject="tableObject"
:tableColumns="allSchemas.tableColumns"
@get-list="getTableList"
2024-06-24 23:28:56 +08:00
@get-checked-columns="getCheckedColumns"
2024-06-18 15:16:04 +08:00
>
<el-table-column
2024-06-24 23:28:56 +08:00
v-for="item in showColumns"
2024-06-18 15:16:04 +08:00
:key="item.field"
:prop="item.field"
:label="item.label"
min-width="120px"
2024-06-25 19:31:55 +08:00
>
<template #default="{ row }">
2024-08-09 11:47:56 +08:00
<div v-if="item.field == 'remark' || item.form?.component == 'Editor'">
<el-popover placement="top" width="500px" trigger="click" v-if="row[item.field]">
<template #reference>
<el-button type="primary" style="padding: 0" text>点击查看</el-button>
</template>
<div v-dompurify-html="row[item.field]"></div>
</el-popover>
</div>
2024-07-11 15:25:00 +08:00
<span v-else-if="item.form?.component == 'DatePicker'">
{{ formatDate(row[item.field]) }}
</span>
2024-09-26 17:36:29 +08:00
<div v-else-if="item.form?.component == 'UploadImg'">
<el-image
v-if="row[item.field]"
:src="row[item.field]"
preview-teleported
:lazy="true"
:preview-src-list="[row[item.field]]"
/>
<!-- <img v-if="row[item.field]" :src="row[item.field]" style="width: 100%; height: 100%" /> -->
</div>
2024-06-25 19:31:55 +08:00
<span v-else>{{ row[item.field] }}</span>
</template>
</el-table-column>
2024-09-20 11:21:05 +08:00
<el-table-column label="操作" width="170px" fixed="right">
2024-06-18 15:16:04 +08:00
<template #default="scope">
<el-button
type="primary"
class="mr-10px"
link
style="padding: 0; margin-left: 0"
v-hasPermi="['clue:order:detail']"
@click="handleDetail(scope.row)"
>
详情
</el-button>
<el-button
type="primary"
class="mr-10px"
link
style="padding: 0; margin-left: 0"
v-hasPermi="['clue:order:after-sale']"
@click="sellAfter(scope.row)"
>
售后
</el-button>
<el-button
type="primary"
class="mr-10px"
link
style="padding: 0; margin-left: 0"
2024-06-25 16:58:37 +08:00
v-if="scope.row.isPayoff == '未结清'"
2024-06-18 15:16:04 +08:00
v-hasPermi="['clue:order:return']"
@click="feeBack(scope.row)"
>
回款
</el-button>
2024-06-25 16:58:37 +08:00
<el-button
type="primary"
class="mr-10px"
link
style="padding: 0; margin-left: 0"
v-hasPermi="['clue:order:add-fee']"
@click="handleAddFee(scope.row)"
>
添加支出
</el-button>
2024-06-19 17:16:34 +08:00
<el-button
type="primary"
class="mr-10px"
link
2024-09-26 17:36:29 +08:00
:disabled="scope.row.isCommissioned != '未发放'"
2024-06-19 17:16:34 +08:00
style="padding: 0; margin-left: 0"
v-hasPermi="['clue:pool:enroll']"
@click="cancelDeal(scope.row)"
>
取消登记
</el-button>
2024-06-18 15:16:04 +08:00
</template>
</el-table-column>
</SSTable>
<!-- 详情 -->
<DialogOrder ref="orderDetailDialog" />
2024-06-19 00:31:40 +08:00
<DialogFeeback ref="feedbackDialog" />
<DialogAfterSale ref="afterSaleDialog" />
2024-06-25 16:58:37 +08:00
<DialogExtraFee ref="extraFeeDialog" />
2024-06-18 15:16:04 +08:00
</div>
</template>
<script setup name="ClueOrderList">
import { getSimpleFieldList } from '@/api/clue/orderField'
import * as SignApi from '@/api/clue/sign'
2025-09-17 11:56:09 +08:00
import { getAllUserListWithHire } from '@/api/system/user'
2024-06-18 15:16:04 +08:00
import { getPlaceList } from '@/api/school/place'
2024-07-09 17:29:42 +08:00
import { getClassTypeList } from '@/api/school/class'
2024-06-18 15:16:04 +08:00
import DialogOrder from './DialogOrder.vue'
2024-06-19 00:31:40 +08:00
import DialogFeeback from './DialogFeeback.vue'
import DialogAfterSale from './DialogAfterSale.vue'
2024-06-25 16:58:37 +08:00
import DialogExtraFee from './DialogExtraPay.vue'
2024-06-18 15:16:04 +08:00
import { removeNullField } from '@/utils'
2024-07-11 15:25:00 +08:00
import { formatDate } from '@/utils/formatTime'
2024-06-18 15:16:04 +08:00
2025-09-17 11:56:09 +08:00
// const userOptions = ref([])
2024-07-30 18:55:30 +08:00
const allUserOptions = ref([])
2024-07-05 15:29:18 +08:00
onMounted(() => {
getOptions()
})
2024-06-19 17:16:34 +08:00
const message = useMessage() // 消息弹窗
2024-06-18 15:16:04 +08:00
const allSchemas = ref({})
const orderDetailDialog = ref()
const searchRef = ref()
const schoolOptions = ref([])
const allPlaceOptions = ref([])
const searchForm = ref({
signSchool: undefined,
signPlace: undefined,
signClass: undefined,
signProduct: undefined
})
const tableObject = ref({
tableList: [],
loading: false,
total: 1,
pageSize: 20,
2024-06-29 20:26:05 +08:00
pageNo: 1
2024-06-18 15:16:04 +08:00
})
const placeOptions = computed(() => {
return allPlaceOptions.value.filter((it) => it.schoolId == searchForm.value.signSchool)
})
function resetQuery() {
searchForm.value = {
signSchool: undefined,
signPlace: undefined,
signClass: undefined,
signProduct: undefined
}
searchRef.value.reset()
2024-06-29 20:26:05 +08:00
tableObject.value.pageNo = 1
2024-06-18 15:16:04 +08:00
getTableList()
}
// 查询
async function getTableList() {
// 查询
tableObject.value.loading = true
try {
const queryParams = await searchRef.value.getFormModel()
const params = {
...queryParams,
...searchForm.value,
2024-06-29 20:26:05 +08:00
pageNo: tableObject.value.pageNo,
2025-08-30 17:05:48 +08:00
pageSize: tableObject.value.pageSize,
diyParams: {}
2024-06-18 15:16:04 +08:00
}
2024-09-26 17:36:29 +08:00
searchFieldList.value.map((it) => {
if (params[it.field]) {
params.diyParams[it.field] = params[it.field]
}
})
2024-06-18 15:16:04 +08:00
const data = await SignApi.getSignPage(removeNullField(params))
tableObject.value.tableList = data.list.map((it) => ({ ...it, ...it.diyParams }))
tableObject.value.total = data.total
} finally {
tableObject.value.loading = false
}
}
const loading = ref(true)
2024-09-26 17:36:29 +08:00
const searchFieldList = ref([])
2024-06-18 15:16:04 +08:00
async function getCurdSchemas() {
loading.value = true
try {
const data = await getSimpleFieldList()
2025-08-30 17:05:48 +08:00
searchFieldList.value = data.filter((it) => it.isCustom && it.isSearch)
2024-06-18 15:16:04 +08:00
data.forEach((elem) => {
2025-09-17 11:56:09 +08:00
// if (['createUser'].includes(elem.field)) {
// elem.search.options = userOptions.value
// } else
if (['convertPeople', 'receiver', 'createUser'].includes(elem.field)) {
2024-07-30 18:55:30 +08:00
elem.search.options = allUserOptions.value
2024-06-18 15:16:04 +08:00
}
})
allSchemas.value = useCrudSchemas(data).allSchemas
} finally {
loading.value = false
nextTick(() => {
getTableList()
})
}
}
2024-06-24 23:28:56 +08:00
const showColumns = ref([])
// 初始化表格
function getCheckedColumns(list) {
showColumns.value = list && list.length ? list : allSchemas.value.tableColumns
}
2024-06-18 15:16:04 +08:00
// 详情
function handleDetail(row) {
orderDetailDialog.value.open(row.clueId, row.signId)
}
2024-06-19 00:31:40 +08:00
const feedbackDialog = ref()
const afterSaleDialog = ref()
2024-06-18 15:16:04 +08:00
// 售后
2024-06-19 00:31:40 +08:00
function sellAfter(row) {
afterSaleDialog.value.open(row.signId)
}
// 回款
function feeBack(row) {
feedbackDialog.value.open(row.signId)
2024-06-18 15:16:04 +08:00
}
2024-06-25 16:58:37 +08:00
const extraFeeDialog = ref()
function handleAddFee(row) {
extraFeeDialog.value.open(row.signId)
}
2024-06-19 17:16:34 +08:00
// 取消登记
async function cancelDeal(row) {
try {
// 二次确认
await message.confirm('是否确认取消登记该线索?')
// 发起删除
await SignApi.cancelDeal(row.signId)
message.success('取消登记成功!')
// 刷新列表
await getTableList()
} catch (err) {
console.log(err)
}
}
2024-06-18 15:16:04 +08:00
function changeSchool() {
searchForm.value.signPlace = undefined
searchForm.value.signClass = undefined
}
function changePlace() {
searchForm.value.signClass = undefined
getClassTypeOptions()
}
const classOptions = ref([])
async function getClassTypeOptions() {
2024-07-09 17:29:42 +08:00
const data = await getClassTypeList({ placeId: searchForm.value.signPlace, status: 0 })
classOptions.value = data
2024-06-18 15:16:04 +08:00
}
2024-07-30 18:55:30 +08:00
async function getOptions() {
2024-06-20 19:43:07 +08:00
// 驾校
2026-04-01 14:08:41 +08:00
getPlaceList({ placeStatus: 0, schoolStatus: 0, isSearchSchool: true, hasAll: true }).then(
(data) => {
schoolOptions.value = data.schoolList
allPlaceOptions.value = data.placeList
}
)
2025-09-17 11:56:09 +08:00
// userOptions.value = await getUserOption()
allUserOptions.value = await getAllUserListWithHire()
2024-07-30 18:55:30 +08:00
getCurdSchemas()
2024-06-18 15:16:04 +08:00
}
</script>
<style lang="scss" scoped></style>