莳松crm管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ss-crm-manage-web/src/views/Clue/Order/Comp/Reback.vue

392 lines
11 KiB

1 year ago
<template>
<div>
<el-form :model="searchForm" label-width="0" inline>
<el-form-item>
1 year ago
<el-input v-model="searchForm.signId" placeholder="成交单号" clearable />
1 year ago
</el-form-item>
<el-form-item>
1 year ago
<el-input v-model="searchForm.name" placeholder="线索名称" clearable />
1 year ago
</el-form-item>
<el-form-item>
1 year ago
<el-select v-model="searchForm.state" placeholder="审核状态" clearable>
<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>
11 months ago
<el-form-item v-if="appStore.getAppInfo?.instanceType == 1">
<el-select v-model="searchForm.receiver" placeholder="接待人" clearable filterable>
<el-option
11 months ago
v-for="item in allUserOptions"
11 months ago
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item v-else-if="appStore.getAppInfo?.instanceType == 2">
<el-select v-model="searchForm.convertPeople" placeholder="转化人" clearable filterable>
<el-option
11 months ago
v-for="item in allUserOptions"
11 months ago
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
1 year ago
<el-form-item>
<el-select v-model="searchForm.signUser" placeholder="登记人" clearable filterable>
1 year ago
<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"
1 year ago
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
1 year ago
range-separator="-"
12 months ago
start-placeholder="成交日期"
end-placeholder="成交日期"
1 year ago
/>
</el-form-item>
<el-form-item>
1 year ago
<el-select v-model="searchForm.applyUser" placeholder="申请人" clearable filterable>
1 year ago
<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
1 year ago
v-model="searchForm.applyTime"
1 year ago
type="daterange"
1 year ago
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
1 year ago
range-separator="-"
start-placeholder="申请日期"
end-placeholder="申请日期"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
<el-button @click="batchAudit">批量审核</el-button>
</el-form-item>
</el-form>
1 year ago
<el-table
v-loading="loading"
:data="tableList"
border
11 months ago
show-summary
:summary-method="getSummaries"
1 year ago
@selection-change="handleSelectionChange"
>
11 months ago
<el-table-column type="selection" width="60" :selectable="(row) => row.state == 1" />
<el-table-column prop="signId" label="成交单号" min-width="180px" />
11 months ago
<el-table-column prop="name" label="线索名称" width="150px" />
<el-table-column prop="phone" label="联系方式" width="120px" />companyProfit
<el-table-column prop="money" label="回款金额" min-width="120px">
<template #default="{ row }">
<el-input-number
v-if="row.edit"
v-model="row.money"
size="small"
:min="0"
:controls="false"
style="width: 100%"
/>
<div v-else>{{ row.money }}</div>
</template>
</el-table-column>
<el-table-column
11 months ago
v-if="appStore.getAppInfo?.instanceType == 1"
11 months ago
prop="companyProfit"
label="公司利润"
min-width="120px"
>
<template #default="{ row }">
<el-input-number
v-if="row.edit"
v-model="row.companyProfit"
size="small"
:min="0"
:controls="false"
style="width: 100%"
/>
<div v-else>{{ row.companyProfit }}</div>
</template>
</el-table-column>
<el-table-column
11 months ago
v-if="appStore.getAppInfo?.instanceType == 1"
11 months ago
prop="personProfit"
label="员工利润"
min-width="120px"
>
<template #default="{ row }">
<el-input-number
v-if="row.edit"
v-model="row.personProfit"
size="small"
:min="0"
:controls="false"
style="width: 100%"
/>
<div v-else>{{ row.personProfit }}</div>
</template>
</el-table-column>
<el-table-column prop="signPrice" label="成交价" min-width="90" />
1 year ago
<el-table-column prop="isPayoff" label="是否结清" min-width="90" />
11 months ago
<el-table-column
v-if="appStore.getAppInfo?.instanceType == 1"
prop="receiverName"
label="接待人"
min-width="90"
/>
<el-table-column
v-else-if="appStore.getAppInfo?.instanceType == 2"
prop="convertPeopleName"
label="转化人"
min-width="90"
/>
1 year ago
<el-table-column prop="signUserName" label="登记人" min-width="90" />
12 months ago
<el-table-column
prop="dealDate"
label="成交日期"
min-width="120px"
:formatter="dateFormatter"
/>
1 year ago
<el-table-column prop="applyUserName" label="申请人" min-width="90" />
12 months ago
<el-table-column
prop="applyTime"
label="申请时间"
min-width="120px"
:formatter="dateFormatter"
/>
1 year ago
<el-table-column prop="stateName" label="审核状态" fixed="right" min-width="90" />
11 months ago
<el-table-column label="操作" width="220px" fixed="right">
1 year ago
<template #default="{ row }">
11 months ago
<el-button type="primary" style="padding: 0" text @click="handleDetail(row)">
1 year ago
详情
</el-button>
<el-button
type="primary"
style="padding: 0"
text
v-if="row.state == 1 && currentUserId == row.applyUser"
v-hasPermi="['clue:order:return']"
@click="handleCancel(row.id)"
1 year ago
>
1 year ago
撤销
</el-button>
11 months ago
<el-button
type="primary"
style="padding: 0"
text
v-if="row.state == 1"
11 months ago
v-hasPermi="['clue:order:update-return-money']"
11 months ago
@click="handleUpdate(row)"
>
<span>{{ row.edit ? '保存' : '修改金额' }}</span>
</el-button>
1 year ago
<el-button
type="primary"
style="padding: 0"
text
v-if="row.state == 1"
v-hasPermi="['clue:order:return-audit']"
1 year ago
@click="handleAudit(row)"
1 year ago
>
1 year ago
审核
</el-button>
1 year ago
</template>
</el-table-column>
</el-table>
<Pagination
v-model:limit="searchForm.pageSize"
v-model:page="searchForm.pageNo"
:total="total"
@pagination="getList"
/>
1 year ago
<DialogFeebackAudit ref="feebackDialog" @success="getList" />
1 year ago
<DialogFeebackDetail ref="feebackDetailDialog" />
<DialogBatchAudit ref="batchAuditDialog" @success="getList" />
1 year ago
</div>
</template>
<script setup name="Reback">
1 year ago
import * as FeebackApi from '@/api/clue/payment'
11 months ago
import { getSimpleUserList as getUserOption, getAllUserList } from '@/api/system/user'
1 year ago
import { useUserStore } from '@/store/modules/user'
1 year ago
import DialogFeebackAudit from './DialogFeebackAudit.vue'
1 year ago
import DialogFeebackDetail from './DialogFeebackDetail.vue'
import DialogBatchAudit from './DialogBatchAudit.vue'
1 year ago
11 months ago
import { removeNullField } from '@/utils'
11 months ago
import { useAppStore } from '@/store/modules/app'
12 months ago
import { dateFormatter } from '@/utils/formatTime'
1 year ago
const userStore = useUserStore()
const message = useMessage() // 消息弹窗
11 months ago
const appStore = useAppStore()
1 year ago
1 year ago
const feebackDialog = ref()
1 year ago
const currentUserId = userStore.getUser.id
1 year ago
const searchForm = ref({
signId: undefined,
name: undefined,
1 year ago
state: undefined,
1 year ago
dealDate: [],
1 year ago
signUser: undefined,
applyTime: [],
applyUser: undefined,
1 year ago
pageNo: 1,
pageSize: 20
})
const userOptions = ref([])
11 months ago
const allUserOptions = ref([])
1 year ago
const tableList = ref([])
const total = ref(0)
function handleSearch() {
searchForm.value.pageNo = 1
getList()
}
function handleReset() {
searchForm.value = {
signId: undefined,
11 months ago
receiver: undefined,
convertPeople: undefined,
1 year ago
name: undefined,
dealDate: [],
1 year ago
state: undefined,
signUser: undefined,
applyTime: [],
applyUser: undefined,
1 year ago
pageNo: 1,
pageSize: 20
}
}
11 months ago
const totalInfo = ref({})
1 year ago
const loading = ref(false)
async function getList() {
loading.value = true
try {
11 months ago
const data = await FeebackApi.getPaymentPage(removeNullField(searchForm.value))
1 year ago
tableList.value = data.list
total.value = data.total
11 months ago
totalInfo.value = data.totalData
1 year ago
} finally {
loading.value = false
}
1 year ago
}
1 year ago
const batchIds = ref([])
function handleSelectionChange(val) {
1 year ago
batchIds.value = val.map((it) => it.id)
1 year ago
}
const batchAuditDialog = ref()
1 year ago
function batchAudit() {
1 year ago
if (batchIds.value.length) {
batchAuditDialog.value.open('aftersale', batchIds.value)
} else {
message.info('请选择表格中需要审核的数据')
}
1 year ago
}
1 year ago
const feebackDetailDialog = ref()
11 months ago
function handleDetail(row) {
feebackDetailDialog.value.open(row)
1 year ago
}
1 year ago
async function handleCancel(id) {
try {
// 删除的二次确认
await message.confirm('是否确认撤销申请?')
// 发起删除
await FeebackApi.cancelApplyPayment({ id })
message.success('撤销成功!')
// 刷新列表
await getList()
} catch (err) {
console.log(err)
}
1 year ago
}
1 year ago
function handleAudit(row) {
feebackDialog.value.open(row)
1 year ago
}
1 year ago
function getOptions() {
getUserOption().then((data) => {
userOptions.value = data
})
11 months ago
getAllUserList().then((data) => {
allUserOptions.value = data
})
}
function getSummaries(param) {
const { columns } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
} else if (column.property == 'money') {
11 months ago
sums[index] = totalInfo.value.totalMoney
} else if (column.property == 'personProfit') {
sums[index] = totalInfo.value.totalPersonProfit
} else if (column.property == 'companyProfit') {
sums[index] = totalInfo.value.totalPersonProfit
} else if (column.property == 'signPrice') {
sums[index] = totalInfo.value.totalSignPrice
11 months ago
} else {
sums[index] = ''
}
})
return sums
1 year ago
}
11 months ago
async function handleUpdate(row) {
if (row.edit) {
// 删除的二次确认
await message.confirm('是否确认修改回款金额?')
// 保存
FeebackApi.updateApplyPayment({ id: row.id, money: row.money })
.then(() => {
message.success('修改成功')
})
.finally(() => {
row.edit = false
})
} else {
row.edit = true
}
}
1 year ago
onMounted(() => {
1 year ago
getOptions()
1 year ago
handleSearch()
})
</script>
<style lang="scss" scoped></style>