123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- import { httpDelete, httpGet, httpPost, httpPut } from '../../utils/http'
- import {
- ResPageData,
- Designer,
- AgentTask,
- ReportInfo,
- FollowUp,
- DesignerBasicInfo,
- DesignerEvent,
- DesignerFamilyInfo,
- AgentPoint,
- DesignerAward,
- DesignerPointsStatistics,
- PointsOrder,
- DesignerOrderSaleOther,
- BrowseRecordCountRes, BrowseRecord,
- } from '@designer-hub/app/src/core/libs/models'
- import dayjs from 'dayjs'
- /**
- * 通过ID获取用户信息
- */
- export const getUserInfoById = (id: string | number) =>
- httpGet<
- Partial<{
- mobile: string
- status: string
- nickname: string
- avatar: string
- name: string
- sex: string
- areaId: number
- areaName: string
- birthday: string
- mark: string
- tagIds: string
- levelId: number
- groupId: number
- id: number
- registerIp: string
- loginIp: string
- loginDate: string
- createTime: string
- point: number
- totalPoint: number
- tagNames: string
- levelName: string
- groupName: string
- experience: number
- }>
- >('/app-api/member/user/getByUserId', { id })
- /**
- * 获取设计师信息
- */
- // export const getDesignerInfo = (userId: number) =>
- // httpGet<Designer>('/app-api/member/designer/getDesignerInfo', { userId })
- /**
- * 获取设计师基本信息
- */
- export const getDesignerBasicInfo = (userId: number) =>
- httpGet<DesignerBasicInfo>('/app-api/member/stylist-basic-info/get', { userId })
- /**
- * 更新设计师基本信息
- */
- export const updateDesignerBasicInfo = (data: Partial<DesignerBasicInfo>) =>
- httpPut('/app-api/member/stylist-basic-info/update', data)
- /**
- * 获取设计师家庭信息
- */
- export const getDesignerFamilyInfo = (query = {}) =>
- httpGet<ResPageData<DesignerFamilyInfo>>('/app-api/member/stylist-family/list', query)
- /**
- * 保存设计师家庭信息
- */
- export const saveDesignerFamilyInfo = (data: Partial<DesignerFamilyInfo>) =>
- httpPost('/app-api/member/stylist-family/save', data)
- /**
- * 获取设计师额外事件
- */
- export const getDesignerExtraEvents = (query = {}) =>
- httpGet<ResPageData<DesignerEvent>>('/app-api/member/stylist-extra-events/pageInfo', query)
- /**
- * /app-api/member/stylist-extra-events/getStudyAndActivity 获取设计师学习和活动
- */
- export const getDesignerActivity = (query = {}) =>
- httpGet<{
- [key in 'study' | 'activity' | 'extraEventsQuantity']:
- | { type: number; quantity: number }[]
- | number
- }>('/app-api/member/stylist-extra-events/getStudyAndActivity', query)
- /**
- * 设计师列表
- */
- export const getDesigners = (query = {}) =>
- httpGet<ResPageData<Designer>>('/app-api/member/app-broker/pageStylist', query)
- /**
- * 任务列表
- */
- export const getTasks = (query = {}) =>
- httpGet<ResPageData<AgentTask>>('/app-api/member/task/page', query)
- /**
- * 关系报备
- */
- export const getReportInfoPage = (query = {}) =>
- httpGet<ResPageData<ReportInfo>>('/app-api/member/report-info/page', query)
- /**
- * 删除关系报备
- */
- export const deleteReportInfo = (id: number) =>
- httpDelete(`/app-api/member/report-info/delete`, { id })
- /**
- * 创建设计师跟进
- */
- export const createFollowUp = (data: Partial<FollowUp>) =>
- httpPost('/app-api/member/stylist-follow-up/create', data)
- /**
- * 获取设计师跟进列表
- */
- export const getFollowUpPage = (query = {}) =>
- httpGet<ResPageData<FollowUp & { followTypeName: string; brokerName: string }>>(
- '/app-api/member/app-broker/pageFollowUp',
- query,
- )
- /**
- * 更新设计师跟进
- */
- export const updateFollowUp = (data: Partial<FollowUp>) =>
- httpPut('/app-api/member/stylist-follow-up/update', data)
- /**
- * /app-api/member/user-auth-info/focus 重点跟进或取消
- */
- export const focusOrCancel = (data: { brokerId: number; userId: number }) =>
- httpPost('/app-api/member/user-auth-info/focus', data)
- /**
- * /app-api/member/task/points_flow 积分流水
- */
- export const getPointsFlow = (query = {}) =>
- httpGet<ResPageData<AgentPoint>>('/app-api/member/task/points_flow', query)
- /**
- * /app-api/member/points-details/pageAllByYear/2024?pageNo=1&pageSize=10&stylistId=287&year=2024 设计师积分详情
- */
- export const getPointsDetails = (query: { year?: string } = {}) =>
- httpGet<
- ResPageData<{
- id: number
- pointsType: string
- typeName: string
- pointsCategory: string
- categoryName: string
- sourceId: number
- name: string
- pointsStauts: string
- points: number
- orderMoney: string
- materialsId: number
- materialsBrand: string
- stylistId: number
- brokerId: number
- stylistName: string
- brokerName: string
- generateTime: string
- verifyTime: string
- completeTime: string
- turnDownTime: string
- cancelTime: string
- cancelReason: string
- turnDownReason: string
- remark: string
- couponId: number
- orderNo: string
- createTime: string
- }>
- >(`/app-api/member/points-details/pageAllByYear/${query.year}`, query)
- /**
- * 设计师奖品列表
- */
- export const getAwards = (query = {}) =>
- httpGet<DesignerAward[]>('/app-api/member/stylist-awards/list', query)
- /**
- * 创建设计师奖品
- */
- export const createAward = (data: Partial<DesignerAward>) =>
- httpPost('/app-api/member/stylist-awards/create', data)
- /**
- * 删除设计师奖品
- */
- export const deleteAward = (id: number) =>
- httpDelete('/app-api/member/stylist-awards/delete', { id })
- /**
- * 获取设计师销售订单
- */
- export const getSalesOrders = (query = {}) =>
- httpGet<
- ResPageData<{
- id: number
- materials: string
- materialsBrand: string
- projectName: string
- customerName: string
- customerPhone: string
- orderMoney: number
- createTime: number
- }>
- >('/app-api/member/stylist-other-sales/pageByDate', query)
- /**
- * 获取设计师积分统计
- */
- export const getPointsCount = (query = {}) =>
- httpGet<DesignerPointsStatistics>('/app-api/member/points-details/getPointsCount', query)
- /**
- * 设计师积分订单
- */
- export const getPointsOrders = (query = {}) =>
- httpGet<ResPageData<PointsOrder>>('/app-api/member/points-order/pageDitch', query)
- /**
- * 获取设计师销售订单统计
- */
- export const getSalesOrdersCount = (query = {}) =>
- httpGet<{
- /**
- * 今年订单成交数量
- */
- orderCountYear: number
- /**
- * 今年成交金额
- */
- salesAmountYtd: number
- /**
- * 类型订单成交数量
- */
- orderCount: number
- /**
- * 累计成交金额
- */
- salesAmount: number
- /**
- * 其他订单数量
- */
- otherSale: number
- }>('/app-api/member/stylist-other-sales/get', query)
- /**
- * 其他销售列表
- */
- export const getOtherSalesPage = (query = {}) =>
- httpGet<ResPageData<DesignerOrderSaleOther>>(
- '/app-api/member/stylist-other-sales/OtherSalesPage',
- query,
- )
- /**
- * /app-api/member/stylist-other-sales/save 创建其他销售
- */
- export const saveOtherSales = (data: Partial<DesignerOrderSaleOther>) =>
- httpPost('/app-api/member/stylist-other-sales/save', data)
- /**
- * 删除其他销售
- */
- export const deleteOtherSales = (id: number) =>
- httpDelete('/app-api/member/stylist-other-sales/delete', { id })
- /**
- * 更新其他销售
- */
- export const updateOtherSales = (data: Partial<DesignerOrderSaleOther>) =>
- httpPost('/app-api/member/stylist-other-sales/update', data)
- /**
- * 创建设计师活动
- */
- export const createDesignerEvent = (query: Partial<DesignerEvent>) =>
- httpPost('/app-api/member/stylist-extra-events/create', query)
- /**
- * 删除设计师活动
- */
- export const deleteDesignerEvent = (id: number) =>
- httpDelete('/app-api/member/stylist-extra-events/delete', { id })
- /**
- * 获取设计师活动
- */
- export const getDesignerEvents = (query = {}) =>
- httpGet<ResPageData<DesignerEvent>>('/app-api/member/stylist-extra-events/pageInfo', query)
- /**
- * 更新设计师活动
- */
- export const updateDesignerEvent = (query: Partial<DesignerEvent>) =>
- httpPost('/app-api/member/stylist-extra-events/update', query)
- /**
- * 获取设计师浏览记录统计
- */
- export const getBrowseRecordCount = (stylistId: number) =>
- httpGet<BrowseRecordCountRes>(
- `/app-api/member/browse-record/browseRecordCount?stylistId=${stylistId}`,
- )
- /**
- * /app-api/member/browse-record/page 浏览记录
- * @param query
- */
- export const getBrowseRecords = (query = {}) =>
- httpGet<ResPageData<BrowseRecord>>('/app-api/member/browse-record/page', query)
- export const getSalesOrdersCounts = (query = {}) =>
- getSalesOrdersCount(query).then((res) => ({
- ...res,
- data: [
- { label: '今年成交订单数', value: res.data.orderCountYear ?? 0, userId: '' },
- { label: '今年成交金额', value: res.data.salesAmountYtd ?? 0 },
- { label: '累计成交订单数', value: res.data.orderCount ?? 0 },
- { label: '累计成交金额', value: res.data.salesAmount ?? 0 },
- { label: '其他销售信息', value: `${res.data.otherSale ?? 0}条` },
- ],
- }))
- /**
- * 获取设计师积分统计数组
- */
- export const getPointsCounts = (query = {}) =>
- getPointsCount(query).then((res) => ({
- ...res,
- data: [
- {
- userId: '',
- title: '当前剩余积分',
- value: res.data.points ?? 0,
- subTitle: '最近',
- subValue: dayjs(res.data.pointsTime).format('YY/MM/DD'),
- },
- {
- userId: '',
- title: '累计获得积分',
- value: res.data.gainPoints ?? 0,
- subTitle: '本年',
- subValue: res.data.gainPointsYear ?? 0,
- },
- {
- userId: '',
- title: '累计消耗积分',
- value: res.data.usePoints ?? 0,
- subTitle: '本年',
- subValue: res.data.usePointsYear ?? 0,
- },
- {
- userId: '',
- title: '累计跟进次数',
- value: res.data.followUpCount ?? 0,
- subTitle: '本年',
- subValue: res.data.followUpYearCount ?? 0,
- },
- {
- userId: '',
- title: '累计消耗次数',
- value: res.data.usageCount ?? 0,
- subTitle: '本年',
- subValue: res.data.usageYearCount ?? 0,
- },
- {
- userId: '',
- title: '累计获得次数',
- value: res.data.obtainedCount ?? 0,
- subTitle: '本年',
- subValue: res.data.obtainedYearCount ?? 0,
- },
- ],
- }))
- export const getDesignerActivities = (query = {}) =>
- getDesignerActivity(query).then((res) => ({
- ...res,
- data: [
- ...(res.data.study as any[]).map((it) => ({
- type: '',
- label: it.type,
- value: it.quantity + '次',
- path: '',
- })),
- { type: 'line', label: '', value: '' },
- ...(res.data.study as any[]).map((it) => ({
- type: '',
- label: it.type,
- value: it.quantity + '次',
- path: '',
- })),
- {
- type: '',
- label: '其他活动',
- value: res.data.extraEventsQuantity + '次',
- path: '/pages/agent/designer/archives/index',
- },
- ],
- }))
|