import request from '@/utils/request'
import Qs from 'qs'

export function listMember(query) {
    return request({
        url: '/memberCoupon/list',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}

export function createPackage(data) {
    return request({
        url: '/memberCoupon/create',
        method: 'post',
        data
    })
}

//删除单个兑换码
export function deleteData(query) {
    return request({
        url: '/memberCoupon/delete',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}

//删除同批次的退换码
export function deleteBatchNo(query) {
    return request({
        url: '/memberCoupon/deleteBatchNo',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}

//导出
export function exportData(query) {
    return request({
        url: '/memberCoupon/export',
        method: 'post',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        },
        responseType: 'blob',
    })
}


export function createMemberCard(data) {
    return request({
        url: '/memberCoupon/createMemberCard',
        method: 'post',
        data
    })
}
export function batchNoAssigned(query) {
    return request({
        url: '/memberCoupon/batchNoAssigned',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
export function memberCardExport(query) {
    return request({
        url: '/memberCoupon/memberCardExport',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        },
        responseType: 'blob',
    })
}

export function useExplain(query) {
    return request({
        url: '/memberCoupon/useExplain',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}