import { fetchShopTypeList, changeShopSetting, addShopType, getShopType, updateShopType, deleteShopType, fetchShopList, fetchShopTypeSelect, addShop, getShop, updateShop, shelfShop, obtainedShop } from '@/api/shopType'

const transaction = {
  namespaced: true,
  state: {
  },

  mutations: {
  },

  actions: {
    // 获取收费组列表
    FetchShopTypeList({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        fetchShopTypeList(listQuery).then(response => {
          const data = response.data
          resolve(data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ChangeShopSetting({ commit }, shopSettingValue) {
      return new Promise((resolve, reject) => {
        changeShopSetting(shopSettingValue).then(response => {
          const data = response.data
          resolve(data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddShopType({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        addShopType(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddShop({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        addShop(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetShopType({ commit }, id) {
      return new Promise((resolve, reject) => {
        getShopType(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetShop({ commit }, id) {
      return new Promise((resolve, reject) => {
        getShop(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdateShopType({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        updateShopType(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdateShop({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        updateShop(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    DeleteShopType({ commit }, ids) {
      return new Promise((resolve, reject) => {
        deleteShopType(ids).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ShelfShop({ commit }, ids) {
      return new Promise((resolve, reject) => {
        shelfShop(ids).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ObtainedShop({ commit }, ids) {
      return new Promise((resolve, reject) => {
        obtainedShop(ids).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    FetchShopList({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        fetchShopList(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    FetchShopTypeSelect({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        fetchShopTypeSelect(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default transaction
