Merge remote-tracking branch 'yudao/dev' into dev
commit
783f6283ca
@ -0,0 +1,68 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface BusinessStatusTypeVO {
|
||||
id: number
|
||||
name: string
|
||||
deptIds: number[]
|
||||
statuses?: {
|
||||
id: number
|
||||
name: string
|
||||
percent: number
|
||||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_STATUSES = [
|
||||
{
|
||||
endStatus: 1,
|
||||
key: '结束',
|
||||
name: '赢单',
|
||||
percent: 100
|
||||
},
|
||||
{
|
||||
endStatus: 2,
|
||||
key: '结束',
|
||||
name: '输单',
|
||||
percent: 0
|
||||
},
|
||||
{
|
||||
endStatus: 3,
|
||||
key: '结束',
|
||||
name: '无效',
|
||||
percent: 0
|
||||
}
|
||||
]
|
||||
|
||||
// 查询商机状态组列表
|
||||
export const getBusinessStatusPage = async (params: any) => {
|
||||
return await request.get({ url: `/crm/business-status/page`, params })
|
||||
}
|
||||
|
||||
// 新增商机状态组
|
||||
export const createBusinessStatus = async (data: BusinessStatusTypeVO) => {
|
||||
return await request.post({ url: `/crm/business-status/create`, data })
|
||||
}
|
||||
|
||||
// 修改商机状态组
|
||||
export const updateBusinessStatus = async (data: BusinessStatusTypeVO) => {
|
||||
return await request.put({ url: `/crm/business-status/update`, data })
|
||||
}
|
||||
|
||||
// 查询商机状态类型详情
|
||||
export const getBusinessStatus = async (id: number) => {
|
||||
return await request.get({ url: `/crm/business-status/get?id=` + id })
|
||||
}
|
||||
|
||||
// 删除商机状态
|
||||
export const deleteBusinessStatus = async (id: number) => {
|
||||
return await request.delete({ url: `/crm/business-status/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 获得商机状态组列表
|
||||
export const getBusinessStatusTypeSimpleList = async () => {
|
||||
return await request.get({ url: `/crm/business-status/type-simple-list` })
|
||||
}
|
||||
|
||||
// 获得商机阶段列表
|
||||
export const getBusinessStatusSimpleList = async (typeId: number) => {
|
||||
return await request.get({ url: `/crm/business-status/status-simple-list`, params: { typeId } })
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface BusinessStatusTypeVO {
|
||||
id: number
|
||||
name: string
|
||||
deptIds: number[]
|
||||
status: boolean
|
||||
}
|
||||
|
||||
// 查询商机状态类型列表
|
||||
export const getBusinessStatusTypePage = async (params) => {
|
||||
return await request.get({ url: `/crm/business-status-type/page`, params })
|
||||
}
|
||||
|
||||
// 查询商机状态类型详情
|
||||
export const getBusinessStatusType = async (id: number) => {
|
||||
return await request.get({ url: `/crm/business-status-type/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增商机状态类型
|
||||
export const createBusinessStatusType = async (data: BusinessStatusTypeVO) => {
|
||||
return await request.post({ url: `/crm/business-status-type/create`, data })
|
||||
}
|
||||
|
||||
// 修改商机状态类型
|
||||
export const updateBusinessStatusType = async (data: BusinessStatusTypeVO) => {
|
||||
return await request.put({ url: `/crm/business-status-type/update`, data })
|
||||
}
|
||||
|
||||
// 删除商机状态类型
|
||||
export const deleteBusinessStatusType = async (id: number) => {
|
||||
return await request.delete({ url: `/crm/business-status-type/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出商机状态类型 Excel
|
||||
export const exportBusinessStatusType = async (params) => {
|
||||
return await request.download({ url: `/crm/business-status-type/export-excel`, params })
|
||||
}
|
||||
|
||||
// 获取商机状态类型信息列表
|
||||
export const getBusinessStatusTypeList = async () => {
|
||||
return await request.get({ url: `/crm/business-status-type/get-simple-list` })
|
||||
}
|
||||
|
||||
// 根据类型ID获取商机状态信息列表
|
||||
export const getBusinessStatusListByTypeId = async (typeId: number) => {
|
||||
return await request.get({ url: `/crm/business-status-type/get-status-list?typeId=` + typeId })
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ContractConfigVO {
|
||||
notifyEnabled?: boolean
|
||||
notifyDays?: number
|
||||
}
|
||||
|
||||
// 获取合同配置
|
||||
export const getContractConfig = async () => {
|
||||
return await request.get({ url: `/crm/contract-config/get` })
|
||||
}
|
||||
|
||||
// 更新合同配置
|
||||
export const saveContractConfig = async (data: ContractConfigVO) => {
|
||||
return await request.put({ url: `/crm/contract-config/save`, data })
|
||||
}
|
||||
@ -1,66 +1,66 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface BiRankRespVO {
|
||||
export interface StatisticsRankRespVO {
|
||||
count: number
|
||||
nickname: string
|
||||
deptName: string
|
||||
}
|
||||
|
||||
// 排行 API
|
||||
export const RankApi = {
|
||||
export const StatisticsRankApi = {
|
||||
// 获得合同排行榜
|
||||
getContractPriceRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-contract-price-rank',
|
||||
url: '/crm/statistics-rank/get-contract-price-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 获得回款排行榜
|
||||
getReceivablePriceRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-receivable-price-rank',
|
||||
url: '/crm/statistics-rank/get-receivable-price-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 签约合同排行
|
||||
getContractCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-contract-count-rank',
|
||||
url: '/crm/statistics-rank/get-contract-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 产品销量排行
|
||||
getProductSalesRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-product-sales-rank',
|
||||
url: '/crm/statistics-rank/get-product-sales-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 新增客户数排行
|
||||
getCustomerCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-customer-count-rank',
|
||||
url: '/crm/statistics-rank/get-customer-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 新增联系人数排行
|
||||
getContactsCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-contacts-count-rank',
|
||||
url: '/crm/statistics-rank/get-contacts-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 跟进次数排行
|
||||
getFollowCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-follow-count-rank',
|
||||
url: '/crm/statistics-rank/get-follow-count-rank',
|
||||
params
|
||||
})
|
||||
},
|
||||
// 跟进客户数排行
|
||||
getFollowCustomerCountRank: (params: any) => {
|
||||
return request.get({
|
||||
url: '/crm/bi-rank/get-follow-customer-count-rank',
|
||||
url: '/crm/statistics-rank/get-follow-customer-count-rank',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
v-loading="formLoading"
|
||||
label-width="0px"
|
||||
:inline-message="true"
|
||||
:disabled="disabled"
|
||||
>
|
||||
<el-table :data="formData" class="-mt-10px">
|
||||
<el-table-column label="序号" type="index" align="center" width="60" />
|
||||
<el-table-column label="产品名称" min-width="180">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productId`" :rules="formRules.productId" class="mb-0px!">
|
||||
<el-select
|
||||
v-model="row.productId"
|
||||
clearable
|
||||
filterable
|
||||
@change="onChangeProduct($event, row)"
|
||||
placeholder="请选择产品"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in productList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
<el-input disabled v-model="row.productNo" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_UNIT" :value="row.productUnit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格(元)" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
<el-input disabled v-model="row.productPrice" :formatter="erpPriceInputFormatter" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价(元)" fixed="right" min-width="140">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.businessPrice`" class="mb-0px!">
|
||||
<el-input-number
|
||||
v-model="row.businessPrice"
|
||||
controls-position="right"
|
||||
:min="0.001"
|
||||
:precision="2"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="count" fixed="right" min-width="120">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.count`" :rules="formRules.count" class="mb-0px!">
|
||||
<el-input-number
|
||||
v-model="row.count"
|
||||
controls-position="right"
|
||||
:min="0.001"
|
||||
:precision="3"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合计" prop="totalPrice" fixed="right" min-width="140">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.totalPrice`" class="mb-0px!">
|
||||
<el-input disabled v-model="row.totalPrice" :formatter="erpPriceInputFormatter" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3" v-if="!disabled">
|
||||
<el-button @click="handleAdd" round>+ 添加产品</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ProductApi from '@/api/crm/product'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
const props = defineProps<{
|
||||
products: undefined
|
||||
disabled: false
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
const formRules = reactive({
|
||||
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
||||
businessPrice: [{ required: true, message: '合同价格不能为空', trigger: 'blur' }],
|
||||
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref([]) // 表单 Ref
|
||||
const productList = ref<ProductApi.ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 初始化设置产品项 */
|
||||
watch(
|
||||
() => props.products,
|
||||
async (val) => {
|
||||
formData.value = val
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 监听合同产品变化,计算合同产品总价 */
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
// 循环处理
|
||||
val.forEach((item) => {
|
||||
if (item.businessPrice != null && item.count != null) {
|
||||
item.totalPrice = erpPriceMultiply(item.businessPrice, item.count)
|
||||
} else {
|
||||
item.totalPrice = undefined
|
||||
}
|
||||
})
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
const row = {
|
||||
id: undefined,
|
||||
productId: undefined,
|
||||
productUnit: undefined, // 产品单位
|
||||
productNo: undefined, // 产品条码
|
||||
productPrice: undefined, // 产品价格
|
||||
businessPrice: undefined,
|
||||
count: 1
|
||||
}
|
||||
formData.value.push(row)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (index: number) => {
|
||||
formData.value.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 处理产品变更 */
|
||||
const onChangeProduct = (productId, row) => {
|
||||
const product = productList.value.find((item) => item.id === productId)
|
||||
if (product) {
|
||||
row.productUnit = product.unit
|
||||
row.productNo = product.no
|
||||
row.productPrice = product.price
|
||||
row.businessPrice = product.price
|
||||
}
|
||||
}
|
||||
|
||||
/** 表单校验 */
|
||||
const validate = () => {
|
||||
return formRef.value.validate()
|
||||
}
|
||||
defineExpose({ validate })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
productList.value = await ProductApi.getProductSimpleList()
|
||||
})
|
||||
</script>
|
||||
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item name="basicInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">基本信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="4">
|
||||
<el-descriptions-item label="商机姓名">{{ business.name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客户名称">{{ business.customerName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商机金额(元)">
|
||||
{{ erpPriceInputFormatter(business.totalPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预计成交日期">
|
||||
{{ formatDate(business.dealTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="下次联系时间">
|
||||
{{ formatDate(business.contactNextTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商机状态组">
|
||||
{{ business.statusTypeName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商机阶段">{{ business.statusName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ business.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="systemInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">系统信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="4">
|
||||
<el-descriptions-item label="负责人">{{ business.ownerUserName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="最后跟进时间">
|
||||
{{ formatDate(business.contactLastTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label=""> </el-descriptions-item>
|
||||
<el-descriptions-item label=""> </el-descriptions-item>
|
||||
<el-descriptions-item label="创建人">{{ business.creatorName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(business.createTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(business.updateTime) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { erpPriceInputFormatter } from '@/utils'
|
||||
|
||||
const { business } = defineProps<{
|
||||
business: BusinessApi.BusinessVO
|
||||
}>()
|
||||
|
||||
// 展示的折叠面板
|
||||
const activeNames = ref(['basicInfo', 'systemInfo'])
|
||||
</script>
|
||||
@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
v-loading="formLoading"
|
||||
label-width="0px"
|
||||
:inline-message="true"
|
||||
:disabled="disabled"
|
||||
>
|
||||
<el-table :data="formData" class="-mt-10px">
|
||||
<el-table-column label="序号" type="index" align="center" width="60" />
|
||||
<el-table-column label="产品名称" min-width="180">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productId`" :rules="formRules.productId" class="mb-0px!">
|
||||
<el-select
|
||||
v-model="row.productId"
|
||||
clearable
|
||||
filterable
|
||||
@change="onChangeProduct($event, row)"
|
||||
placeholder="请选择产品"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in productList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
<el-input disabled v-model="row.productNo" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_UNIT" :value="row.productUnit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格(元)" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
<el-input disabled v-model="row.productPrice" :formatter="erpPriceInputFormatter" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价(元)" fixed="right" min-width="140">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.contractPrice`" class="mb-0px!">
|
||||
<el-input-number
|
||||
v-model="row.contractPrice"
|
||||
controls-position="right"
|
||||
:min="0.001"
|
||||
:precision="2"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="count" fixed="right" min-width="120">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.count`" :rules="formRules.count" class="mb-0px!">
|
||||
<el-input-number
|
||||
v-model="row.count"
|
||||
controls-position="right"
|
||||
:min="0.001"
|
||||
:precision="3"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合计" prop="totalPrice" fixed="right" min-width="140">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.totalPrice`" class="mb-0px!">
|
||||
<el-input disabled v-model="row.totalPrice" :formatter="erpPriceInputFormatter" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3" v-if="!disabled">
|
||||
<el-button @click="handleAdd" round>+ 添加产品</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ProductApi from '@/api/crm/product'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
const props = defineProps<{
|
||||
products: undefined
|
||||
disabled: false
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
const formRules = reactive({
|
||||
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
||||
contractPrice: [{ required: true, message: '合同价格不能为空', trigger: 'blur' }],
|
||||
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref([]) // 表单 Ref
|
||||
const productList = ref<ProductApi.ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 初始化设置产品项 */
|
||||
watch(
|
||||
() => props.products,
|
||||
async (val) => {
|
||||
formData.value = val
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 监听合同产品变化,计算合同产品总价 */
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
// 循环处理
|
||||
val.forEach((item) => {
|
||||
if (item.contractPrice != null && item.count != null) {
|
||||
item.totalPrice = erpPriceMultiply(item.contractPrice, item.count)
|
||||
} else {
|
||||
item.totalPrice = undefined
|
||||
}
|
||||
})
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
const row = {
|
||||
id: undefined,
|
||||
productId: undefined,
|
||||
productUnit: undefined, // 产品单位
|
||||
productNo: undefined, // 产品条码
|
||||
productPrice: undefined, // 产品价格
|
||||
contractPrice: undefined,
|
||||
count: 1
|
||||
}
|
||||
formData.value.push(row)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (index: number) => {
|
||||
formData.value.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 处理产品变更 */
|
||||
const onChangeProduct = (productId, row) => {
|
||||
const product = productList.value.find((item) => item.id === productId)
|
||||
if (product) {
|
||||
row.productUnit = product.unit
|
||||
row.productNo = product.no
|
||||
row.productPrice = product.price
|
||||
row.contractPrice = product.price
|
||||
}
|
||||
}
|
||||
|
||||
/** 表单校验 */
|
||||
const validate = () => {
|
||||
return formRef.value.validate()
|
||||
}
|
||||
defineExpose({ validate })
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
productList.value = await ProductApi.getProductSimpleList()
|
||||
})
|
||||
</script>
|
||||
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="160px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-card shadow="never">
|
||||
<!-- 操作 -->
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<CardTitle title="合同配置设置" />
|
||||
<el-button type="primary" @click="onSubmit" v-hasPermi="['crm:contract-config:update']">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 表单 -->
|
||||
<el-form-item label="提前提醒设置" prop="notifyEnabled">
|
||||
<el-radio-group
|
||||
v-model="formData.notifyEnabled"
|
||||
@change="changeNotifyEnable"
|
||||
class="ml-4"
|
||||
>
|
||||
<el-radio :label="false" size="large">不提醒</el-radio>
|
||||
<el-radio :label="true" size="large">提醒</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div v-if="formData.notifyEnabled">
|
||||
<el-form-item>
|
||||
提前 <el-input-number class="mx-2" v-model="formData.notifyDays" /> 天提醒
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ContractConfigApi from '@/api/crm/contract/config'
|
||||
import { CardTitle } from '@/components/Card'
|
||||
|
||||
defineOptions({ name: 'CrmContractConfig' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const formLoading = ref(false)
|
||||
const formData = ref({
|
||||
notifyEnabled: false,
|
||||
notifyDays: undefined
|
||||
})
|
||||
const formRules = reactive({})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 获取配置 */
|
||||
const getConfig = async () => {
|
||||
try {
|
||||
formLoading.value = true
|
||||
const data = await ContractConfigApi.getContractConfig()
|
||||
if (data === null) {
|
||||
return
|
||||
}
|
||||
formData.value = data
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交配置 */
|
||||
const onSubmit = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as ContractConfigApi.ContractConfigVO
|
||||
await ContractConfigApi.saveContractConfig(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
await getConfig()
|
||||
formLoading.value = false
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 更改提前提醒设置 */
|
||||
const changeNotifyEnable = () => {
|
||||
if (!formData.value.notifyEnabled) {
|
||||
formData.value.notifyDays = undefined
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getConfig()
|
||||
})
|
||||
</script>
|
||||
@ -1,71 +0,0 @@
|
||||
<template>
|
||||
<el-table :data="list" :show-overflow-tooltip="true" :stripe="true" height="200">
|
||||
<el-table-column align="center" label="商机名称" prop="name" />
|
||||
<el-table-column align="center" label="客户名称" prop="customerName" />
|
||||
<el-table-column align="center" label="商机金额" prop="price" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="预计成交日期"
|
||||
prop="dealTime"
|
||||
width="120px"
|
||||
/>
|
||||
<el-table-column align="center" label="商机状态类型" prop="statusTypeName" width="120" />
|
||||
<el-table-column align="center" label="商机状态" prop="statusName" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="更新时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
|
||||
<el-table-column align="center" label="备注" prop="remark" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="130">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
|
||||
defineOptions({ name: 'BusinessList' })
|
||||
const props = withDefaults(defineProps<{ businessIds: number[] }>(), {
|
||||
businessIds: () => []
|
||||
})
|
||||
const list = ref<BusinessApi.BusinessVO[]>([] as BusinessApi.BusinessVO[])
|
||||
watch(
|
||||
() => props.businessIds,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
list.value = BusinessApi.getBusinessListByIds(unref(val)) as unknown as BusinessApi.BusinessVO[]
|
||||
}
|
||||
)
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:businessIds', businessIds: number[]): void
|
||||
}>()
|
||||
const handleDelete = (id: number) => {
|
||||
const index = list.value.findIndex((item) => item.id === id)
|
||||
if (index !== -1) {
|
||||
list.value.splice(index, 1)
|
||||
}
|
||||
emits(
|
||||
'update:businessIds',
|
||||
list.value.map((item) => item.id)
|
||||
)
|
||||
}
|
||||
</script>
|
||||
@ -1,97 +0,0 @@
|
||||
<template>
|
||||
<el-table :data="list" :show-overflow-tooltip="true" :stripe="true" height="200">
|
||||
<el-table-column align="center" fixed="left" label="姓名" prop="name" width="140" />
|
||||
<el-table-column align="center" fixed="left" label="客户名称" prop="customerName" width="120" />
|
||||
<el-table-column align="center" label="手机" prop="mobile" width="120" />
|
||||
<el-table-column align="center" label="电话" prop="telephone" width="120" />
|
||||
<el-table-column align="center" label="邮箱" prop="email" width="120" />
|
||||
<el-table-column align="center" label="职位" prop="post" width="120" />
|
||||
<el-table-column align="center" label="地址" prop="detailAddress" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="下次联系时间"
|
||||
prop="contactNextTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="关键决策人" prop="master" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="直属上级" prop="parentName" width="140" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="最后跟进时间"
|
||||
prop="contactLastTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="性别" prop="sex">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="负责人" prop="ownerUserName" width="120" />
|
||||
<el-table-column align="center" label="创建人" prop="creatorName" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="更新时间"
|
||||
prop="updateTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column align="center" label="备注" prop="remark" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="130">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
|
||||
defineOptions({ name: 'ContactList' })
|
||||
const props = withDefaults(defineProps<{ contactIds: number[] }>(), {
|
||||
contactIds: () => []
|
||||
})
|
||||
const list = ref<ContactApi.ContactVO[]>([] as ContactApi.ContactVO[])
|
||||
const getContactList = async () => {
|
||||
list.value = (await ContactApi.getContactListByIds(
|
||||
unref(props.contactIds)
|
||||
)) as unknown as ContactApi.ContactVO[]
|
||||
}
|
||||
watch(
|
||||
() => props.contactIds,
|
||||
(val) => {
|
||||
if (!val || val.length === 0) {
|
||||
return
|
||||
}
|
||||
getContactList()
|
||||
}
|
||||
)
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:contactIds', contactIds: number[]): void
|
||||
}>()
|
||||
const handleDelete = (id: number) => {
|
||||
const index = list.value.findIndex((item) => item.id === id)
|
||||
if (index !== -1) {
|
||||
list.value.splice(index, 1)
|
||||
}
|
||||
emits(
|
||||
'update:contactIds',
|
||||
list.value.map((item) => item.id)
|
||||
)
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<el-table :data="formData" :show-overflow-tooltip="true" :stripe="true" height="120">
|
||||
<el-table-column label="商机名称" fixed="left" align="center" prop="name" />
|
||||
<el-table-column
|
||||
label="商机金额"
|
||||
align="center"
|
||||
prop="totalPrice"
|
||||
:formatter="erpPriceTableColumnFormatter"
|
||||
/>
|
||||
<el-table-column label="客户名称" align="center" prop="customerName" />
|
||||
<el-table-column label="商机组" align="center" prop="statusTypeName" />
|
||||
<el-table-column label="商机阶段" align="center" prop="statusName" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="80">
|
||||
<template #default="{ $index }">
|
||||
<el-button link type="danger" @click="handleDelete($index)"> 移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { erpPriceTableColumnFormatter } from '@/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
businesses: undefined
|
||||
}>()
|
||||
const formData = ref([])
|
||||
|
||||
/** 初始化商机列表 */
|
||||
watch(
|
||||
() => props.businesses,
|
||||
async (val) => {
|
||||
formData.value = val
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (index: number) => {
|
||||
formData.value.splice(index, 1)
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<el-table :data="contacts" :show-overflow-tooltip="true" :stripe="true" height="150">
|
||||
<el-table-column label="姓名" fixed="left" align="center" prop="name">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
|
||||
{{ scope.row.name }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="手机号" align="center" prop="mobile" />
|
||||
<el-table-column label="职位" align="center" prop="post" />
|
||||
<el-table-column label="直属上级" align="center" prop="parentName" />
|
||||
<el-table-column label="是否关键决策人" align="center" prop="master" min-width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="130">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
const props = defineProps<{
|
||||
contacts: undefined
|
||||
}>()
|
||||
const formData = ref([])
|
||||
|
||||
/** 初始化联系人列表 */
|
||||
watch(
|
||||
() => props.contacts,
|
||||
async (val) => {
|
||||
formData.value = val
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (index: number) => {
|
||||
formData.value.splice(index, 1)
|
||||
}
|
||||
</script>
|
||||
@ -1,6 +0,0 @@
|
||||
import BusinessList from './BusinessList.vue'
|
||||
import BusinessTableSelect from './BusinessTableSelect.vue'
|
||||
import ContactList from './ContactList.vue'
|
||||
import ContactTableSelect from './ContactTableSelect.vue'
|
||||
|
||||
export { BusinessList, BusinessTableSelect, ContactList, ContactTableSelect }
|
||||
@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item name="basicInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">基本信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="4">
|
||||
<el-descriptions-item label="回款编号">{{ receivable.no }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客户名称">
|
||||
{{ receivable.customerName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同编号">
|
||||
{{ receivable.contract?.no }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回款日期">
|
||||
{{ formatDate(receivable.returnTime, 'YYYY-MM-DD') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回款金额">
|
||||
{{ erpPriceInputFormatter(receivable.price) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回款方式">
|
||||
<dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="receivable.returnType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ receivable.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="systemInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">系统信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="4">
|
||||
<el-descriptions-item label="负责人">
|
||||
{{ receivable.ownerUserName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建人">
|
||||
{{ receivable.creatorName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(receivable.createTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(receivable.updateTime) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ReceivableApi from '@/api/crm/receivable'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { erpPriceInputFormatter } from '@/utils'
|
||||
|
||||
const { receivable } = defineProps<{
|
||||
receivable: ReceivableApi.ReceivableVO
|
||||
}>()
|
||||
|
||||
// 展示的折叠面板
|
||||
const activeNames = ref(['basicInfo', 'systemInfo'])
|
||||
</script>
|
||||
@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item name="basicInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">基本信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="4">
|
||||
<el-descriptions-item label="期数">{{ receivablePlan.period }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客户名称">
|
||||
{{ receivablePlan.customerName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同编号">
|
||||
{{ receivablePlan.contractNo }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="计划回款金额">
|
||||
{{ erpPriceInputFormatter(receivablePlan.price) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="计划回款日期">
|
||||
{{ formatDate(receivablePlan.returnTime, 'YYYY-MM-DD') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="计划回款方式">
|
||||
<dict-tag
|
||||
:type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE"
|
||||
:value="receivablePlan.returnType"
|
||||
/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="提前几天提醒">
|
||||
{{ receivablePlan.remindDays }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ receivablePlan.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="实际回款金额">
|
||||
<el-text v-if="receivablePlan.receivable">
|
||||
{{ erpPriceInputFormatter(receivablePlan.receivable.price) }}
|
||||
</el-text>
|
||||
<el-text v-else>{{ erpPriceInputFormatter(0) }}</el-text>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="未回款金额">
|
||||
<el-text v-if="receivablePlan.receivable">
|
||||
{{ erpPriceInputFormatter(receivablePlan.price - receivablePlan.receivable.price) }}
|
||||
</el-text>
|
||||
<el-text v-else>{{ erpPriceInputFormatter(receivablePlan.price) }}</el-text>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实际回款日期">
|
||||
{{ formatDate(receivablePlan.receivable?.returnTime, 'YYYY-MM-DD') }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="systemInfo">
|
||||
<template #title>
|
||||
<span class="text-base font-bold">系统信息</span>
|
||||
</template>
|
||||
<el-descriptions :column="4">
|
||||
<el-descriptions-item label="负责人">
|
||||
{{ receivablePlan.ownerUserName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建人">
|
||||
{{ receivablePlan.creatorName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(receivablePlan.createTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(receivablePlan.updateTime) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { erpPriceInputFormatter } from '@/utils'
|
||||
|
||||
const { receivablePlan } = defineProps<{
|
||||
receivablePlan: ReceivablePlanApi.ReceivablePlanVO
|
||||
}>()
|
||||
|
||||
// 展示的折叠面板
|
||||
const activeNames = ref(['basicInfo', 'systemInfo'])
|
||||
</script>
|
||||
Loading…
Reference in New Issue