list.js 1.81 KB
import api from '../../common/api';

export default {
    getList() {
        return api.get({
            url: '/brand/list',
            api: 'store',
            code: 200
        }).then(result => {
            let resu = {
                brandList: [],
                letters: []
            };

            if (result) {
                let build = [];
                let brandArr = Object.keys(result);

                brandArr.forEach((val) => {
                    build.push({
                        letter: val,
                        brand: result[val]
                    });
                });
                resu.brandList = build;
                resu.letters = brandArr;
            }

            return resu;
        });
    },
    getTabList() {
        return api.get({
            url: '/brand/category',
            api: 'store',
            code: 200
        }).then(result => {
            let resu = [];

            if (result) {
                resu = result;
            }

            return resu;
        });
    },
    getcateList(category) {
        return api.get({
            url: '/brand/newList',
            api: 'store',
            code: 200,
            data: {
                category: category.category
            }
        }).then(result => {
            let resu = {
                brandList: [],
                letters: []
            };

            if (result) {
                let build = [];
                let brandArr = Object.keys(result);

                brandArr.forEach((val) => {
                    build.push({
                        letter: val,
                        brand: result[val]
                    });
                });
                resu.brandList = build;
                resu.letters = brandArr;
            }

            return resu;
        });
    },
};