search.js 813 Bytes
import api from '../../common/api';

export default {
    search(params) {
        if (!params.brandName) {
            return Promise.resolve([]);
        }
        return api.get({
            url: '/brand/queryBrandByName',
            data: {
                query: params.brandName
            },
            api: 'store',
            code: 200
        }).then(result => {
            let resu = [];

            if (result) {
                let build = [];

                result.forEach((val) => {
                    build.push({
                        brandName: val.brandName,
                        brandId: val.id,
                        brandIco: val.brandIco
                    });
                });
                resu = build;
            }

            return resu;
        });
    }
};