import request from '@/config/axios'
import ExpressForm from '@/views/mall/trade/delivery/express/ExpressForm.vue'

export interface UserVO {
  id: number
  avatar: string | undefined
  birthday: number | undefined
  createTime: number | undefined
  loginDate: number | undefined
  loginIp: string
  mark: string
  mobile: string
  name: string | undefined
  nickname: string | undefined
  registerIp: string
  sex: number
  status: number
  areaId: number | undefined
  areaName: string | undefined
  levelName: string | null
  point: number | undefined | null
  totalPoint: number | undefined | null
  experience: number | null | undefined
}

// 查询消费者列表
export const getUserPage = async (params) => {
  return await request.get({ url: `/member/user/page`, params })
}
// 查询消费者列表
export const getMemberUserPage = async (params) => {
  return await request.get({ url: `/distri/duser/memberUserPage`, params })
}
// 查询消费者详情
export const getMemberUser = async (id: number) => {
  return await request.get({ url: `/distri/share-path/getMemberUser?id=` + id })
}
export const getUser = async (id: number) => {
  return await request.get({ url: `/member/user/get?id=` + id })
}
// 查询消费者地址
export const getUserAddress = async (id: number,addressType:number) => {
  return await request.get({ url: `/member/address/list?userId=` + id + `&addressType=` + addressType })
}
// 查询消费者身价
export const getUserLevel = async (params) => {
  return await request.get({ url: `/distri/social-status-change-log/page`,params})
}
// 查询消费者佣金
export const getUserPoints = async (params) => {
  return await request.get({ url: `/distri/pt-profit-log/page`,params})
}
// 查询消费者签到记录
export const getUserSignLog = async (params) => {
  return await request.get({ url: `/distri/social-status-change-log/getUserSignLog`,params})
}
// 修改消费者
export const updateUser = async (data: UserVO) => {
  return await request.put({ url: `/member/user/update`, data })
}

// 修改消费者等级
export const updateUserLevel = async (data: any) => {
  return await request.put({ url: `/member/user/update-level`, data })
}

// 修改消费者佣金
export const updateUserPoint = async (data: any) => {
  return await request.put({ url: `/member/user/update-point`, data })
}

// 修改消费者余额
export const updateUserBalance = async (data: any) => {
  return await request.put({ url: `/member/user/update-balance`, data })
}

// 根据用户名查询用户列表（模糊查询）
export const getUserListByUsername = async (params) => {
  return await request.get({ url: `/member/user/getUsersByUserName`, params })
}

// 查询平台消费分来源
export const getUserConsumption=  async (params: any) => {
  return await request.get({ url: `/distri/consumption-change-log/page`, params })
}