goods.js 3.04 KB
import { http } from '@/main'

const url = 'rop-scrm-shopmall/router'
const getGoodsListApi = params => {
    params.method = 'scrm.api.shopmall.goods.configuration.page'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}

const updateGoodsStatusApi = params => {
    params.method = 'scrm.api.shopmall.goods.configuration.upgrade.update.status'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}

const delGoodsApi = params => {
    params.method = 'scrm.api.shopmall.goods.configuration.upgrade.delete'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}


const getCarlifeGoodsApi = params => {
    params.method = 'scrm.api.shopmall.goods.smartcarlife.page'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}


const addGoodsApi = params => {
    params.method = 'scrm.api.shopmall.goods.configuration.upgrade.add.or.update'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}


const getGoodsDetail = params => {
    params.method = 'scrm.api.shopmall.goods.configuration.detail'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}


const getMerchantListApi = params => {
    params.method = 'scrm.api.shopmall.goods.smartcarlife.detail'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}


const getBrowseListApi = params => {
    params.method = 'scrm.api.shopmall.discover.goods.browse.records'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}

const getVisitorListApi = params => {
    params.method = 'scrm.api.shopmall.discover.goods.visitor.records'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}

const getSharedListApi = params => {
    params.method = 'scrm.api.shopmall.discover.goods.shared.records'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}

const exportBrowseApi = (params, TYPE = 1) => {
    //TYPE 1 浏览 2 访客 3 分享
    params.method = {
      1: 'scrm.api.shopmall.discover.goods.browse.records.export',
      2: 'scrm.api.shopmall.discover.goods.visitor.records.export',
      3: 'scrm.api.shopmall.discover.goods.shared.records.export'
    }[TYPE]
    return http({
      url,
      method: 'POST',
      data: params,
      sign: true
    })
  }

const exportGoodsApi = params => {
    params.method = 'scrm.api.shopmall.goods.configuration.export'
    return http({
        url,
        method: 'post',
        data: params,
        sign: true
    })
}
  
export default {
    getGoodsListApi,
    updateGoodsStatusApi,
    delGoodsApi,
    getCarlifeGoodsApi,
    addGoodsApi,
    getGoodsDetail,
    getMerchantListApi,
    getBrowseListApi,
    getVisitorListApi,
    getSharedListApi,
    exportBrowseApi,
    exportGoodsApi
}