import request from "../utils/request.js";
import Method from "./Method.js";

const merchant = {
    sendSms: async (mobile, type) => {
        return request({
            url: '/index/login/sendSms',
            method: Method.POST,
            data: {
                mobile,
                type
            },
        });
    },
    register: async (data) => {
        return request({
            url: '/index/login/register',
            method: Method.POST,
            data: data,
        });
    },
    login: async (data) => {
        return request({
            url: '/index/login/login',
            method: Method.POST,
            data: data,
        });
    },
    getMenu: async (data) => {
        return request({
            url: '/index/business/getMenu',
            method: Method.POST,
            data: data,
        });
    },
    getPlatformList: async () => {
        return request({
            url: '/index/task/getPlatformList',
            method: Method.POST,
        });
    },
    getMaterialType: async (data) => {
        return request({
            url: '/index/task/getMaterialType',
            method: Method.POST,
            data: data,
        });
    },
    getProvince: async () => {
        return request({
            url: '/index/task/getProvince',
            method: Method.POST,
        });
    },
    getSettlementAfter: async () => {
        return request({
            url: '/index/task/getSettlementAfter',
            method: Method.POST,
        });
    },
    getChooseContent: async (data) => {
        return request({
            url: '/index/task/getChooseContent',
            method: Method.POST,
            data: data
        });
    },
    getNumberOfReleases: async () => {
        return Promise.resolve({
            data: [
                {
                    id: 1,
                    name: '一次'
                },
                {
                    id: 2,
                    name: '两次'
                },
                {
                    id: 3,
                    name: '三次'
                },
                {
                    id: 4,
                    name: '四次'
                },
                {
                    id: 5,
                    name: '五次'
                },
            ]
        })
    },
    getPublicationDuration: async () => {
        return Promise.resolve({
            data: [
                {
                    id: 5,
                    name: '5分钟'
                },
                {
                    id: 10,
                    name: '10分钟'
                },
                {
                    id: 20,
                    name: '20分钟'
                },
                {
                    id: 30,
                    name: '30分钟'
                },
            ]
        })
    },
    createTask: async (data) => {
        return request({
            url: '/index/task/createTask',
            method: Method.POST,
            data: data,
        });
    },
    getTaskPlatformList: async (data) => {
        return request({
            url: '/index/task/getPlatformList',
            method: Method.POST,
            data: data
        });
    },
    getTaskStatusList: async (data) => {
        return request({
            url: '/index/task/getStatusList',
            method: Method.POST,
            data: data
        });
    },
    getTaskList: async (data) => {
        return request({
            url: '/index/task/getTaskList',
            method: Method.POST,
            data: data
        });
    },
    addWithdrawal: async (data) => {
        return request({
            url: '/index/business/addWithdrawal',
            method: Method.POST,
            data: data
        });
    },
    getWithdrawalList: async (data) => {
        return request({
            url: '/index/business/getWithdrawalList',
            method: Method.POST,
            data: data
        });
    },
    getBusinessInfo: async (data) => {
        return request({
            url: '/index/business/getInfo',
            method: Method.POST,
            data: data
        });
    },
    rechargeOrderQR: async (data) => {
        return request({
            url: '/index/business/rechargeOrder',
            method: Method.POST,
            data: data
        });
    },
    saveNickname: async (data) => {
        return request({
            url: '/index/business/saveNickname',
            method: Method.POST,
            data: data
        });
    },
    saveMobile: async (data) => {
        return request({
            url: '/index/business/saveMobile',
            method: Method.POST,
            data: data
        });
    },
    saveWechat: async (data) => {
        return request({
            url: '/index/business/saveWechat',
            method: Method.POST,
            data: data
        });
    },
    savePassword: async (data) => {
        return request({
            url: '/index/business/savePassword',
            method: Method.POST,
            data: data
        });
    },
    saveAvatar: async (data) => {
        return request({
            url: '/index/business/saveAvatar',
            method: Method.POST,
            data: data
        });
    },
    getTaskChildrenList: async (data) => {
        return request({
            url: '/index/task/getTaskChildrenList',
            method: Method.POST,
            data: data
        });
    },
    getMaterialList: async (id) => {
        return request({
            url: '/index/task/getMaterialList',
            method: Method.POST,
            data: {id}
        });
    },
    addMaterial: async (data) => {
        return request({
            url: '/index/task/addMaterial',
            method: Method.POST,
            data: data
        });
    },
    delMaterial: async (id) => {
        return request({
            url: '/index/task/delMaterial',
            method: Method.POST,
            data: {id}
        });
    },
    addChildrenComment: async (data) => {
        return request({
            url: '/index/task/addChildrenComment',
            method: Method.POST,
            data: data
        });
    },
    getChildrenComment: async (id) => {
        return request({
            url: '/index/task/getChildrenComment',
            method: Method.POST,
            data: {id}
        });
    },
    delChildrenComment: async (id) => {
        return request({
            url: '/index/task/delChildrenComment',
            method: Method.POST,
            data: {id}
        });
    },
    editChildrenMaterial: async (data) => {
        return request({
            url: '/index/task/editChildrenMaterial',
            method: Method.POST,
            data: data
        });
    },
    editChildrenMaterimal: async (data) => {
        return request({
            url: '/index/task/editChildrenMaterimal',
            method: Method.POST,
            data: data
        });
    },
    startTask: async (data) => {
        return request({
            url: '/index/task/startTask',
            method: Method.POST,
            data: data
        });
    },
    moneyToTask: async (id) => {
        return request({
            url: '/index/task/moneyToTask',
            method: Method.POST,
            data: {id}
        });
    },
    stopTask: async (id) => {
        return request({
            url: '/index/task/stopTask',
            method: Method.POST,
            data: {id}
        });
    },
    endTask: async (id) => {
        return request({
            url: '/index/task/endTask',
            method: Method.POST,
            data: {id}
        });
    },
    getSettlementBefore: async (data) => {
        return request({
            url: '/index/task/getSettlementBefore',
            method: Method.POST,
            data: data
        });
    },
    getTaskInfo: async (id) => {
        return request({
            url: '/index/task/getTaskInfo',
            method: Method.POST,
            data: {id}
        });
    },
    editTask: async (data) => {
        return request({
            url: '/index/task/editTask',
            method: Method.POST,
            data: data
        });
    }
}

export default merchant;
