import request from '@/utils/request'

export function getTplList() {
  return request({
    url: 'tpl.detail',
    method: 'post'
  })
}

/**
 * 营销接口
 */
export function getMarketList(params = {}) {
  return request({
    url: 'routine.marketlist',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getMarketInfo(id) {
  return request({
    url: 'routine.marketinfo',
    method: 'post',
    data: {
      id,
    }
  })
}
export function getMarketAdList(params = {}) {
  return request({
    url: 'routine.marketadlist',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function marketAdEdit(params = {}) {
  return request({
    url: 'routine.marketadedit',
    method: 'post',
    data: params
  })
}
export function marketAdPublish(params = {}) {
  return request({
    url: 'routine.marketadpublish',
    method: 'post',
    data: params
  })
}
export function marketRented(params = {}) {
  return request({
    url: 'routine.marketrented',
    method: 'post',
    data: params
  })
}
export function marketCrmList(params = {}) {
  return request({
    url: 'routine.marketlistinglist',
    method: 'post',
    data: params
  })
}
export function marketCrmNew(params = {}) {
  return request({
    url: 'routine.marketlistingnew',
    method: 'post',
    data: params
  })
}
export function marketCrmEdit(params = {}) {
  return request({
    url: 'routine.marketlistingedit',
    method: 'post',
    data: params
  })
}

/**
 * 申请接口
 */
export function applicationInquireCredit(params = {}) {
  return request({
    url: 'routine.applicationinviteCredit',
    method: 'post',
    data: params
  })
}
export function applicationEdit(params = {}) {
  return request({
    url: 'routine.applicationedit',
    method: 'post',
    data: params
  })
}
export function applicationFile(params = {}) {
  return request({
    url: 'routine.applicationfile',
    method: 'post',
    data: params
  })
}
export function getApplicationList(params = {}) {
  return request({
    url: 'routine.applicationlist',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getApplicationInfo(id) {
  return request({
    url: 'routine.applicationinfo',
    method: 'post',
    data: {
      id
    }
  })
}
export function getApplicationDetail(applicationId) {
  return request({
    url: 'routine.applicationdetail',
    method: 'post',
    data: {
      applicationId
    }
  })
}

/**
 * 验屋接口
 */
export function getInspectionList(params = {}) {
  return request({
    url: 'routine.inspectionlist',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getInspectionInfo(id) {
  return request({
    url: 'routine.inspectioninfo',
    method: 'post',
    data: {
      id,
    }
  })
}
export function inspectionBook(params = {}) {
  return request({
    url: 'routine.inspectionbook',
    method: 'post',
    data: params
  })
}
export function inspectionFinish(params = {}) {
  return request({
    url: 'routine.inspectionfinish',
    method: 'post',
    data: params
  })
}

/**
 * 维修接口
 */
export function repairNew(params) {
  return request({
    url: 'repair.new',
    method: 'post',
    data: params
  })
}
export function getRepairList(params = {}) {
  return request({
    url: 'repair.repairlist',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getRepairInfo(id) {
  return request({
    url: 'routine.repairinfo',
    method: 'post',
    data: {
      id,
    }
  })
}
export function repairDetail(repairId) {
  return request({
    url: 'repair.repairdetail',
    method: 'post',
    data: {
      repairId
    }
  })
}
export function repairAskQuote(params) {
  return request({
    url: 'repair.repairaskquote',
    method: 'post',
    data: params
  })
}
export function repairChoiceTechnician(params) {
  return request({
    url: 'repair.repairchoicetechnician',
    method: 'post',
    data: params
  })
}
export function repairModifyDate(params) {
  return request({
    url: 'repair.repairModifyDate',
    method: 'post',
    data: params
  })
}
export function repairCancelChoice(params) {
  return request({
    url: 'repair.repaircancelchoice',
    method: 'post',
    data: params
  })
}
export function repairMgFinished(params) {
  return request({
    url: 'repair.repairmgfinished',
    method: 'post',
    data: params
  })
}
export function repairArchive(params) {
  return request({
    url: 'repair.repairarchive',
    method: 'post',
    data: params
  })
}

/**
 * 付款接口
 */
export function getPaymentList(params = {}) {
  return request({
    url: 'routine.paymentlist',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getPaymentInfo(id) {
  return request({
    url: 'routine.paymentinfo',
    method: 'post',
    data: {
      id,
    }
  })
}

/**
 * 通知接口
 */
export function routineNotification(params = {}) {
  return request({
    url: 'routine.notification',
    method: 'post',
    data: {
      ...params,
    }
  })
}


/**
 * 房产接口
 */
export function getPropertyList(params = {}) {
  return request({
    url: 'property.list',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getPropertyDetail(propertyId) {
  return request({
    url: 'property.detail',
    method: 'post',
    data: {
      propertyId
    }
  })
}
export function updateProperty(params = {}) {
  return request({
    url: 'property.new',
    method: 'post',
    data: params
  })
}
export function searchByAddress(params = {}) {
  return request({
    url: 'property.searchbyaddress',
    method: 'post',
    data: params
  })
}

/**
 * 租客接口
 */
 export function getTenantList(params = {}) {
  return request({
    url: 'tenant.list',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getTenantDetail(tenantId) {
  return request({
    url: 'tenant.detail',
    method: 'post',
    data: {
      tenantId
    }
  })
}
export function updateTenant(params = {}) {
  return request({
    url: 'tenant.new',
    method: 'post',
    data: params
  })
}
export function applyTenant(params = {}) {
  return request({
    url: 'tenant.application',
    method: 'post',
    data: params
  })
}

/**
 * 房东接口
 */
 export function getLandlordList(params = {}) {
  return request({
    url: 'landlord.list',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getLandlordDetail(landlordId) {
  return request({
    url: 'landlord.detail',
    method: 'post',
    data: {
      landlordId
    }
  })
}
export function updateLandlord(params = {}) {
  return request({
    url: 'landlord.new',
    method: 'post',
    data: params
  })
}

/**
 * 技工接口
 */
 export function getTechnicianList(params = {}) {
  return request({
    url: 'technician.list',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getTechnicianDetail(technicianId) {
  return request({
    url: 'technician.detail',
    method: 'post',
    data: {
      technicianId
    }
  })
}
export function updateTechnician(params = {}) {
  return request({
    url: 'technician.new',
    method: 'post',
    data: params
  })
}

/**
 * 会计接口
 */
 export function getAccountList(params = {}) {
  return request({
    url: 'account.list',
    method: 'post',
    data: {
      from: 0,
      size: 10,
      ...params,
    }
  })
}
export function getAccountDetail(params = {}) {
  return request({
    url: 'account.detail',
    method: 'post',
    data: params
  })
}
export function createTransaction(params = {}) {
  return request({
    url: 'account.new',
    method: 'post',
    data: params
  })
}
export function deleteTransaction(params = {}) {
  return request({
    url: 'account.deltransaction',
    method: 'post',
    data: params
  })
}
export function confirmTransaction(params = {}) {
  return request({
    url: 'account.done',
    method: 'post',
    data: params
  })
}
/*
export function addAccountFile(params = {}) {
  return request({
    url: 'account.addfile',
    method: 'post',
    data: params
  })
}
*/

/**
 * 配置接口
 */
export function UserEdit(params) {
  return request({
    url: 'user.edit',
    method: 'post',
    data: params
  })
}
export function UserInfo(params){
  return request({
    url: 'user.info',
    method: 'post',
    data: params
  })
}


/**
 * 增加评价
 */
export  function addPropertyNote(PropertyId, content){
  return request({
    url: 'property.addnote',
    method: 'post',
    data: {
      PropertyId,
      content
    }
  })
}
export function addTenantNote(tenantId, content) {
  return request({
    url: 'tenant.addnote',
    method: 'post',
    data: {
      tenantId,
      content
    }
  })
}
export function addLandlordNote(landlordId, content) {
  return request({
    url: 'landlord.addnote',
    method: 'post',
    data: {
      landlordId,
      content
    }
  })
}
export  function addTechnicianNote(technicianId, content){
  return request({
    url: 'technician.addnote',
    method: 'post',
    data: {
      technicianId,
      content
    }
  })
}


/**
 * 删除评论
 */
export function delPropertyNote(PropertyId, ids) {
  return request({
    url: 'property.delnote',
    method: 'post',
    data: {
      PropertyId,
      ids
    }
  })
}
export function delTenantNote(tenantId, ids) {
  return request({
    url: 'tenant.delnote',
    method: 'post',
    data: {
      tenantId,
      ids
    }
  })
}
export function delLandlordNote(landlordId, ids) {
  return request({
    url: 'landlord.delnote',
    method: 'post',
    data: {
      landlordId,
      ids
    }
  })
}
export function delTechnicianNote(technicianId, ids) {
  return request({
    url: 'technician.delnote',
    method: 'post',
    data: {
      technicianId,
      ids
    }
  })
}


/**
 * 增加文件
 */
export function addPropertyFile(propertyId, files){
  return request({
    url: 'property.addfile',
    method: 'post',
    data: {
      propertyId,
      files
    }
  })
}
export function addTenantFile(tenantId, files) {
  return request({
    url: 'tenant.addfile',
    method: 'post',
    data: {
      tenantId,
      files
    }
  })
}
export function addLandlordFile(landlordId, files) {
  return request({
    url: 'landlord.addfile',
    method: 'post',
    data: {landlordId, files}
  })
}
export function addTechnicianFile(technicianId, files) {
  return request({
    url: 'technician.addfile',
    method: 'post',
    data: {technicianId, files}
  })
}

/**
 * 删除文件
 */
export function delPropertyFile(id, titleSli){
  return request({
    url: 'property.delfile',
    method: 'post',
    data: {
      id,
      titleSli
    }
  })
}
export function delTenantFile(id, titleSli) {
  return request({
    url: 'tenant.delfile',
    method: 'post',
    data: {
      id,
      titleSli
    }
  })
}
export function delLandlordFile(id, titleSli) {
  return request({
    url: 'landlord.delfile',
    method: 'post',
    data: {id, titleSli}
  })
}
export function delTechnicianFile(id, titleSli) {
  return request({
    url: 'technician.delfile',
    method: 'post',
    data: {id, titleSli}
  })
}


/**
 * 独立页面接口
 */
 export  function directApplication(params){
  return request({
    url: 'direct.application',
    method: 'post',
    data: params
  })
}
export  function directTechniciannew(params){
  return request({
    url: 'direct.techniciannew',
    method: 'post',
    data: params
  })
}
export  function directRepairNew(params){
  return request({
    url: 'direct.repairNew',
    method: 'post',
    data: params
  })
}
export  function directRepairTechnicianFinished(params){
  return request({
    url: 'direct.repairTechnicianFinished',
    method: 'post',
    data: params
  })
}
export  function directRepairDetailBySecret(reqSecret){
  return request({
    url: 'direct.repairDetailBySecret',
    method: 'post',
    data: {
      reqSecret
    }
  })
}

export function tenantLeaseNew(params){
  return request({
    url: 'tenant.leasenew',
    method: 'post',
    data: params
  })
}

