import {getComplaint,getLetterOfComplaintInfo,addComplaint,upComplaint,
  getLetterType,checkMeasure,downloadFile,delLetterOfComplaint} from '@/api/complaint'

const state = {

}

const mutations = {

}

const actions = {
  //1.投诉管理 start ---------------------------------------->
  //获取投诉举报列表
  getComplaint({commit},data) {
    return new Promise((resolve, reject) => {
      getComplaint(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //查看举报信息
  getLetterOfComplaintInfo({commit},data) {
    return new Promise((resolve, reject) => {
      getLetterOfComplaintInfo(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //添加投诉举报信息
  addComplaint({commit},data) {
    return new Promise((resolve, reject) => {
      addComplaint(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //修改投诉举报
  upComplaint({commit},data) {
    return new Promise((resolve, reject) => {
      upComplaint(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //获取状态
  getLetterType({commit},data) {
    return new Promise((resolve, reject) => {
      getLetterType(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //获取受理状态
  checkMeasure({commit},data) {
    return new Promise((resolve, reject) => {
      checkMeasure(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //下载文件
  downloadFile({commit},data) {
    return new Promise((resolve, reject) => {
      downloadFile(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //删除投诉举报
  delLetterOfComplaint({commit},data) {
    return new Promise((resolve, reject) => {
      delLetterOfComplaint(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  }
  //投诉管理 end ---------------------------------------->
}


export default {
  namespaced: true,
  state,
  mutations,
  actions
}
