Explorar o código

!387 feat: CRM/backlog 提醒数量
Merge pull request !387 from dhb52/crm-msg

芋道源码 hai 1 ano
pai
achega
c804ec5e7a

+ 34 - 10
src/api/crm/backlog/index.ts

@@ -1,17 +1,41 @@
 import request from '@/config/axios'
 
-import { type CustomerVO } from '../customer'
-import { type ClueVO } from '../clue'
+// 1. 获得今日需联系客户数量
+export const getTodayCustomerCount = async () => {
+  return await request.get({ url: '/crm/customer/today-customer-count' })
+}
+
+// 2. 获得分配给我的线索数量
+export const getFollowLeadsCount = async () => {
+  return await request.get({ url: '/crm/clue/follow-leads-count' })
+}
+
+// 3. 获得分配给我的客户数量
+export const getFollowCustomerCount = async () => {
+  return await request.get({ url: '/crm/customer/follow-customer-count' })
+}
 
-// 查询客户列表
-// TODO @芋艿:看看是不是后续融合到 getCustomerPage 里;
-export const getTodayCustomerPage = async (params) => {
-  return await request.get({ url: `/crm/backlog/today-customer-page`, params })
+// 4. 获得待进入公海的客户数量
+export const getPutInPoolCustomerRemindCount = async () => {
+  return await request.get({ url: '/crm/customer/put-in-pool-remind-count' })
 }
 
-// 查询线索列表
-export const getFollowLeadsPage = async (params) => {
-  return await request.get({ url: `/crm/backlog/page`, params })
+// 5. 获得待审核合同数量
+export const getCheckContractCount = async () => {
+  return await request.get({ url: '/crm/contract/check-contract-count' })
 }
 
-export { type CustomerVO, type ClueVO }
+// 6. 获得待审核回款数量
+export const getCheckReceivablesCount = async () => {
+  return await request.get({ url: '/crm/receivable/check-receivables-count' })
+}
+
+// 7. 获得待回款提醒数量
+export const getRemindReceivablePlanCount = async () => {
+  return await request.get({ url: '/crm/receivable-plan/remind-receivable-plan-count' })
+}
+
+// 8. 获得即将到期的合同数量
+export const getEndContractCount = async () => {
+  return await request.get({ url: '/crm/contract/end-contract-count' })
+}

+ 37 - 26
src/views/crm/backlog/index.vue

@@ -28,6 +28,7 @@
 </template>
 
 <script lang="ts" setup>
+import * as BacklogApi from '@/api/crm/backlog'
 import CheckContract from './tables/CheckContract.vue'
 import CheckReceivables from './tables/CheckReceivables.vue'
 import EndContract from './tables/EndContract.vue'
@@ -38,54 +39,56 @@ import RemindReceivables from './tables/RemindReceivables.vue'
 import TodayCustomer from './tables/TodayCustomer.vue'
 
 const leftType = ref('todayCustomer')
+
+const todayCustomerCountRef = ref(0)
+const followLeadsCountRef = ref(0)
+const followCustomerCountRef = ref(0)
+const putInPoolCustomerRemindCountRef = ref(0)
+const checkContractCountRef = ref(0)
+const checkReceivablesCountRef = ref(0)
+const remindReceivablesCountRef = ref(0)
+const endContractCountRef = ref(0)
+
 const leftSides = ref([
   {
     name: '今日需联系客户',
     infoType: 'todayCustomer',
-    msgCount: 1,
-    tips: '下次跟进时间为今日的客户'
+    msgCount: todayCustomerCountRef
   },
   {
     name: '分配给我的线索',
     infoType: 'followLeads',
-    msgCount: 0,
-    tips: '转移之后未跟进的线索'
+    msgCount: followLeadsCountRef
   },
   {
     name: '分配给我的客户',
     infoType: 'followCustomer',
-    msgCount: 0,
-    tips: '转移、领取、分配之后未跟进的客户,默认显示自己负责的客户'
+    msgCount: followCustomerCountRef
   },
   {
     name: '待进入公海的客户',
     infoType: 'putInPoolRemind',
-    msgCount: 0,
-    tips: ''
+    msgCount: putInPoolCustomerRemindCountRef
   },
   {
     name: '待审核合同',
     infoType: 'checkContract',
-    msgCount: 0,
-    tips: ''
+    msgCount: checkContractCountRef
   },
   {
     name: '待审核回款',
     infoType: 'checkReceivables',
-    msgCount: 0,
-    tips: ''
+    msgCount: checkReceivablesCountRef
   },
   {
     name: '待回款提醒',
     infoType: 'remindReceivables',
-    msgCount: 4,
-    tips: ''
+    msgCount: remindReceivablesCountRef
   },
   {
     name: '即将到期的合同',
     infoType: 'endContract',
-    msgCount: 20,
-    tips: '根据“合同到期时间”及设置的“提前提醒天数”提醒'
+    msgCount: endContractCountRef
   }
 ])
 
@@ -93,8 +96,20 @@ const leftSides = ref([
 const sideClick = (item: any) => {
   leftType.value = item.infoType
 }
-// TODO @dhb52: 侧边栏样式,在黑暗模式下,颜色会不对。是不是可以读取主题色哈;
+
+/** 加载时读取待办数量 */
+onMounted(async () => {
+  BacklogApi.getTodayCustomerCount().then(count => todayCustomerCountRef.value = count)
+  BacklogApi.getFollowLeadsCount().then(count => followLeadsCountRef.value = count)
+  BacklogApi.getFollowCustomerCount().then(count => followCustomerCountRef.value = count)
+  BacklogApi.getPutInPoolCustomerRemindCount().then(count => putInPoolCustomerRemindCountRef.value = count)
+  BacklogApi.getCheckContractCount().then(count => checkContractCountRef.value = count)
+  BacklogApi.getCheckReceivablesCount().then(count => checkReceivablesCountRef.value = count)
+  BacklogApi.getRemindReceivablePlanCount().then(count => remindReceivablesCountRef.value = count)
+  BacklogApi.getEndContractCount().then(count => endContractCountRef.value = count)
+})
 </script>
+
 <style lang="scss" scoped>
 .side-item-list {
   top: 0;
@@ -102,8 +117,8 @@ const sideClick = (item: any) => {
   left: 0;
   z-index: 1;
   font-size: 14px;
-  background-color: white;
-  border: 1px solid #e6e6e6;
+  background-color: var(--el-bg-color);
+  border: 1px solid var(--el-border-color);
   border-radius: 5px;
 
   .side-item {
@@ -112,21 +127,17 @@ const sideClick = (item: any) => {
     padding: 0 20px;
     line-height: 50px;
     cursor: pointer;
-
-    i {
-      color: #999;
-    }
   }
 }
 
 .side-item-default {
-  color: #333;
+  color: var(--el-text-color-primary);
   border-right: 2px solid transparent;
 }
 
 .side-item-select {
-  color: #409eff;
-  background-color: #ecf5ff;
+  color: var(--el-color-primary);
+  background-color: var(--el-color-primary-light-9);
   border-right: 2px solid var(--el-color-primary);
 }
 

+ 0 - 65
src/views/crm/backlog/tables/RemindReceivables.vue

@@ -68,26 +68,6 @@
         :formatter="dateFormatter"
         width="180px"
       />
-      <el-table-column label="操作" align="center" width="130px">
-        <template #default="scope">
-          <el-button
-            link
-            type="primary"
-            @click="openForm('update', scope.row.id)"
-            v-hasPermi="['crm:receivable-plan:update']"
-          >
-            编辑
-          </el-button>
-          <el-button
-            link
-            type="danger"
-            @click="handleDelete(scope.row.id)"
-            v-hasPermi="['crm:receivable-plan:delete']"
-          >
-            删除
-          </el-button>
-        </template>
-      </el-table-column>
     </el-table>
     <!-- 分页 -->
     <Pagination
@@ -102,16 +82,12 @@
 <script setup lang="ts" name="RemindReceivables">
 import { DICT_TYPE } from '@/utils/dict'
 import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
-import download from '@/utils/download'
 import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
 import * as UserApi from '@/api/system/user'
 import { RECEIVABLE_REMIND_TYPE } from './common'
 
 defineOptions({ name: 'ReceivablePlan' })
 
-const message = useMessage() // 消息弹窗
-const { t } = useI18n() // 国际化
-
 const loading = ref(true) // 列表的加载中
 const total = ref(0) // 列表的总页数
 const list = ref([]) // 列表的数据
@@ -122,7 +98,6 @@ const queryParams = reactive({
   remindType: 1
 })
 const queryFormRef = ref() // 搜索的表单
-const exportLoading = ref(false) // 导出的加载中
 
 /** 查询列表 */
 const getList = async () => {
@@ -142,46 +117,6 @@ const handleQuery = () => {
   getList()
 }
 
-/** 重置按钮操作 */
-const resetQuery = () => {
-  queryFormRef.value.resetFields()
-  handleQuery()
-}
-
-/** 添加/修改操作 */
-const formRef = ref()
-const openForm = (type: string, id?: number) => {
-  formRef.value.open(type, id)
-}
-
-/** 删除按钮操作 */
-const handleDelete = async (id: number) => {
-  try {
-    // 删除的二次确认
-    await message.delConfirm()
-    // 发起删除
-    await ReceivablePlanApi.deleteReceivablePlan(id)
-    message.success(t('common.delSuccess'))
-    // 刷新列表
-    await getList()
-  } catch {}
-}
-
-/** 导出按钮操作 */
-const handleExport = async () => {
-  try {
-    // 导出的二次确认
-    await message.exportConfirm()
-    // 发起导出
-    exportLoading.value = true
-    const data = await ReceivablePlanApi.exportReceivablePlan(queryParams)
-    download.excel(data, '回款计划.xls')
-  } catch {
-  } finally {
-    exportLoading.value = false
-  }
-}
-
 /** 初始化 **/
 onMounted(async () => {
   await getList()

+ 4 - 3
src/views/crm/backlog/tables/TodayCustomer.vue

@@ -119,7 +119,7 @@
 </template>
 
 <script lang="ts" setup name="TodayCustomer">
-import * as BacklogApi from '@/api/crm/backlog'
+import * as CustomerApi from '@/api/crm/customer'
 import { DICT_TYPE } from '@/utils/dict'
 import { dateFormatter } from '@/utils/formatTime'
 import { CONTACT_STATUS, SCENE_TYPES } from './common'
@@ -135,7 +135,8 @@ const queryParams = ref({
   pageNo: 1,
   pageSize: 10,
   contactStatus: 1,
-  sceneType: 1
+  sceneType: 1,
+  pool: null // 是否公海数据
 })
 const queryFormRef = ref() // 搜索的表单
 
@@ -143,7 +144,7 @@ const queryFormRef = ref() // 搜索的表单
 const getList = async () => {
   loading.value = true
   try {
-    const data = await BacklogApi.getTodayCustomerPage(queryParams.value)
+    const data = await CustomerApi.getCustomerPage(queryParams.value)
     list.value = data.list
     total.value = data.total
   } finally {