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

299 lines
8.5 KiB
Vue
Raw Normal View History

2024-06-18 15:16:04 +08:00
<template>
<div>
<el-form :model="searchForm" label-width="0" inline>
<el-form-item>
2024-06-19 00:31:40 +08:00
<el-input v-model="searchForm.signId" placeholder="成交单号" clearable />
2024-06-18 15:16:04 +08:00
</el-form-item>
<el-form-item>
2024-06-19 00:31:40 +08:00
<el-input v-model="searchForm.name" placeholder="线索名称" clearable />
2024-06-18 15:16:04 +08:00
</el-form-item>
<el-form-item>
2024-08-06 22:04:21 +08:00
<el-select v-model="searchForm.state" placeholder="审核状态" clearable style="width: 120px">
2024-06-19 00:31:40 +08:00
<el-option label="待审核" :value="1" />
<el-option label="已撤销" :value="2" />
<el-option label="已通过" :value="3" />
<el-option label="已驳回" :value="4" />
</el-select>
</el-form-item>
<el-form-item>
2024-08-06 22:04:21 +08:00
<el-select
v-model="searchForm.signUser"
placeholder="登记人"
clearable
filterable
style="width: 120px"
>
2024-06-18 15:16:04 +08:00
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="searchForm.dealDate"
type="daterange"
2024-06-19 11:56:00 +08:00
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
2024-06-18 15:16:04 +08:00
range-separator="-"
2024-07-11 15:25:00 +08:00
start-placeholder="成交日期"
end-placeholder="成交日期"
2024-08-06 22:04:21 +08:00
style="width: 240px"
2024-06-18 15:16:04 +08:00
/>
</el-form-item>
<el-form-item>
2024-08-06 22:04:21 +08:00
<el-select
v-model="searchForm.applyUser"
placeholder="申请人"
clearable
filterable
style="width: 120px"
>
2024-06-18 15:16:04 +08:00
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-date-picker
2024-06-19 00:31:40 +08:00
v-model="searchForm.applyTime"
2024-06-18 15:16:04 +08:00
type="daterange"
2024-06-19 11:56:00 +08:00
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
2024-06-18 15:16:04 +08:00
range-separator="-"
start-placeholder="申请日期"
end-placeholder="申请日期"
2024-08-06 22:04:21 +08:00
style="width: 240px"
2024-06-18 15:16:04 +08:00
/>
</el-form-item>
<el-form-item>
2024-08-06 22:04:21 +08:00
<el-date-picker
v-model="searchForm.checkTime"
type="daterange"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
range-separator="-"
start-placeholder="审核日期"
end-placeholder="审核日期"
style="width: 240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleSearch" v-hasPermi="['clue:order:after-sale-search']">
查询
</el-button>
<el-button @click="handleReset" v-hasPermi="['clue:order:after-sale-reset']">
重置
</el-button>
<el-button @click="batchAudit" v-hasPermi="['clue:order:after-sale-batch-audit']">
批量审核
</el-button>
2024-06-18 15:16:04 +08:00
</el-form-item>
</el-form>
2024-06-19 15:04:20 +08:00
<el-table
v-loading="loading"
:data="tableList"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" :selectable="(row) => row.state == 1" />
2024-06-19 00:31:40 +08:00
<el-table-column prop="signId" label="成交单号" min-width="150px" />
<el-table-column prop="name" label="线索名称" min-width="200px" />
<el-table-column prop="phone" label="联系方式" min-width="150px" />
<el-table-column prop="reason" label="售后原因" min-width="150px" />
<el-table-column prop="refundAmount" label="退款金额" min-width="90px" />
2024-08-05 18:18:32 +08:00
<el-table-column prop="percentageDeductAmount" label="提成扣款" min-width="90px" />
<el-table-column prop="isCompanyReceipts" label="是否公司收款" min-width="120px" />
2024-06-19 00:31:40 +08:00
<el-table-column prop="isReturns" label="是否退货" min-width="90px" />
<el-table-column prop="solution" label="解决方案" min-width="150px" />
<el-table-column prop="signUserName" label="登记人" min-width="90px" />
2024-07-11 15:25:00 +08:00
<el-table-column
prop="dealDate"
label="成交日期"
min-width="120px"
:formatter="dateFormatter"
/>
2024-06-19 00:31:40 +08:00
<el-table-column prop="applyUserName" label="申请人" min-width="90px" />
2024-07-11 15:25:00 +08:00
<el-table-column
prop="applyTime"
label="申请时间"
min-width="120px"
:formatter="dateFormatter"
/>
2024-08-06 22:04:21 +08:00
<el-table-column prop="checkUser" label="审核人" min-width="90" />
<el-table-column
prop="checkTime"
label="审核时间"
min-width="120px"
:formatter="dateFormatter"
/>
2024-06-19 00:31:40 +08:00
<el-table-column prop="stateName" label="审核状态" fixed="right" min-width="90px" />
2024-06-18 15:16:04 +08:00
<el-table-column label="操作" width="150px" fixed="right">
<template #default="{ row }">
2024-08-06 22:04:21 +08:00
<el-button
type="primary"
style="padding: 0"
text
v-hasPermi="['clue:order:after-sale-detail']"
@click="handleDetail(row.id)"
>
2024-06-18 15:16:04 +08:00
详情
</el-button>
2024-06-19 00:31:40 +08:00
<el-button
type="primary"
style="padding: 0"
text
v-if="row.state == 1 && currentUserId == row.applyUser"
v-hasPermi="['clue:order:after-sale']"
@click="handleCancel(row.id)"
>
2024-06-18 15:16:04 +08:00
撤销
</el-button>
2024-06-19 00:31:40 +08:00
<el-button
type="primary"
style="padding: 0"
text
v-if="row.state == 1"
v-hasPermi="['clue:order:after-sale-audit']"
2024-06-19 11:56:00 +08:00
@click="handleAudit(row)"
2024-06-19 00:31:40 +08:00
>
2024-06-18 15:16:04 +08:00
审核
</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
v-model:limit="searchForm.pageSize"
v-model:page="searchForm.pageNo"
:total="total"
@pagination="getList"
/>
2024-06-19 11:56:00 +08:00
<DialogAfterSaleAudit ref="afterSaleAuditDialog" @success="getList" />
2024-06-19 15:04:20 +08:00
<DialogAfterSaleDetail ref="afterSaleDetailDialog" />
<DialogBatchAudit ref="batchAuditDialog" @success="getList" />
2024-06-18 15:16:04 +08:00
</div>
</template>
<script setup name="AfterSales">
2024-06-19 00:31:40 +08:00
import * as AfterSaleApi from '@/api/clue/afterSale'
import { getSimpleUserList as getUserOption } from '@/api/system/user'
import { useUserStore } from '@/store/modules/user'
2024-06-19 11:56:00 +08:00
import DialogAfterSaleAudit from './DialogAfterSaleAudit.vue'
2024-06-19 15:04:20 +08:00
import DialogAfterSaleDetail from './DialogAfterSaleDetail.vue'
import DialogBatchAudit from './DialogBatchAudit.vue'
2024-06-19 11:56:00 +08:00
2024-07-24 11:24:07 +08:00
import { removeNullField } from '@/utils'
2024-07-11 15:25:00 +08:00
import { dateFormatter } from '@/utils/formatTime'
2024-06-19 11:56:00 +08:00
const afterSaleAuditDialog = ref()
2024-06-19 00:31:40 +08:00
const userStore = useUserStore()
const message = useMessage() // 消息弹窗
const currentUserId = userStore.getUser.id
2024-06-18 15:16:04 +08:00
const searchForm = ref({
signId: undefined,
name: undefined,
dealDate: [],
2024-06-19 00:31:40 +08:00
state: undefined,
2024-06-18 15:16:04 +08:00
dealUser: undefined,
createDate: [],
createUser: undefined,
2024-08-06 22:04:21 +08:00
checkTime: [],
2024-06-18 15:16:04 +08:00
pageNo: 1,
pageSize: 20
})
const userOptions = ref([])
const tableList = ref([])
const total = ref(0)
function handleSearch() {
searchForm.value.pageNo = 1
getList()
}
function handleReset() {
searchForm.value = {
signId: undefined,
name: undefined,
2024-06-19 00:31:40 +08:00
state: undefined,
2024-06-18 15:16:04 +08:00
dealDate: [],
dealUser: undefined,
createDate: [],
createUser: undefined,
2024-08-06 22:04:21 +08:00
checkTime: [],
2024-06-18 15:16:04 +08:00
pageNo: 1,
pageSize: 20
}
}
2024-06-19 00:31:40 +08:00
const loading = ref(false)
async function getList() {
loading.value = true
try {
2024-07-24 11:24:07 +08:00
const data = await AfterSaleApi.getAfterSalePage(removeNullField(searchForm.value))
2024-06-19 00:31:40 +08:00
tableList.value = data.list
total.value = data.total
} finally {
loading.value = false
}
2024-06-18 15:16:04 +08:00
}
2024-06-19 15:04:20 +08:00
const batchIds = ref([])
function handleSelectionChange(val) {
2024-06-19 17:16:34 +08:00
batchIds.value = val.map((it) => it.id)
2024-06-19 15:04:20 +08:00
}
const batchAuditDialog = ref()
function batchAudit() {
if (batchIds.value.length) {
batchAuditDialog.value.open('aftersale', batchIds.value)
} else {
message.info('请选择表格中需要审核的数据')
}
2024-06-18 15:16:04 +08:00
}
2024-06-19 15:04:20 +08:00
const afterSaleDetailDialog = ref()
2024-06-18 15:16:04 +08:00
function handleDetail(id) {
2024-06-19 15:04:20 +08:00
afterSaleDetailDialog.value.open(id)
2024-06-18 15:16:04 +08:00
}
2024-06-19 00:31:40 +08:00
async function handleCancel(id) {
try {
// 删除的二次确认
await message.confirm('是否确认撤销申请?')
// 发起删除
await AfterSaleApi.cancelApplyAfterSale({ id })
message.success('撤销成功!')
// 刷新列表
await getList()
} catch (err) {
console.log(err)
}
2024-06-18 15:16:04 +08:00
}
2024-06-19 11:56:00 +08:00
function handleAudit(row) {
afterSaleAuditDialog.value.open(row)
2024-06-18 15:16:04 +08:00
}
2024-06-19 00:31:40 +08:00
function getOptions() {
getUserOption().then((data) => {
userOptions.value = data
})
}
2024-06-18 15:16:04 +08:00
onMounted(() => {
2024-06-19 00:31:40 +08:00
getOptions()
2024-06-18 15:16:04 +08:00
handleSearch()
})
</script>
<style lang="scss" scoped></style>