/**
 * 这是与购物有关的业务逻辑的服务
 */
export default class ProductService {
    constructor(AjaxService) {
        Object.assign(this, { AjaxService })
        this.name = 'ProductService'
    }
    /**
     * @description 获取楼层数据
     */
    QueryProductFloor(data = {}) {
        return this.AjaxService.get({
            url: '/product/floor',
            data,
            isLoading: false,
        })
    }
    /**
     * @description 获取楼层商品详情
     * @param:name 商品名称关键词
     * @param:pageNum 页码
     * @param:pageSize 条数
     */
    QueryProductList(data = {}) {
        return this.AjaxService.get({
            url: '/product/floor/detail',
            data,
            isLoading: false,
        })
    }
    /**
     * @description 获取商品列表
     * @param:name 商品名称关键词
     * @param:pageNum 页码
     * @param:pageSize 条数
     */
    GetProductList(data = {}) {
        return this.AjaxService.get({
            url: '/product/list',
            data,
            isLoading: false,
        })
    }
    /**
     * @商品详情-查询商品详情
     * @param:userId 用户ID(未登录传0或者'')
     * @param:productIds 商品ID
     */
    QueryProductDetils(data = {}) {
        return this.AjaxService.get({
            url: '/product/details',
            data,
            isLoading: false,
        })
    }
    /**
     * @加入购物车
     * @param:userId 用户ID(必填)
     * @param:productId 用户ID(必填)
     * @param:productCount 商品数量(必填)
     */
    shoppingAddCart(data = {}) {
        return this.AjaxService.post({
            url: '/shopping/add/cart',
            data,
            isLoading: false
        })
    }
    /**
     * @再次购买----一键加入购物车
     * @param:orderId 用户ID(必填)
     */
    ShoppingAgainCart(data = {}) {
        return this.AjaxService.get({
            url: '/shopping/addCart',
            data,
            isLoading: false
        })
    }

    /**
     * @购物车列表
     * @param:userId 用户ID(必填)
     */
    QueryShoppingCartList(data = {}) {
        return this.AjaxService.get({
            url: '/shopping/info',
            data,
            isLoading: false
        })
    }
    /**
     * @查询购物车数量
     * @param:userId 用户ID(必填)
     */
    QueryShoppingQuantity(data = {}) {
        return this.AjaxService.get({
            url: '/shopping/quantity',
            data,
            isLoading: false
        })
    }
    /**
     * @更新购物车商品增减
     * @param:cartId 购物车ID
     * @param:productCount 商品数量ID(必填)
     */
    ShoppingCartUpdate(data = {}) {
        return this.AjaxService.post({
            url: '/shopping/update',
            data,
            isLoading: false
        })
    }
    /**
     * @删除购物车商品
     * @param:cartIds 购物车ID(用','号拼接)
     */
    ShoppingCartDelete(data = {}) {
        return this.AjaxService.post({
            url: '/shopping/delete',
            data,
            isLoading: false
        })
    }
    /* 查询搜索历史记录 */
    GetProductSearchHistory(data = {}) {
        return this.AjaxService.get({
            url: '/product/search/history',
            data,
            isLoading: false,
        })
    }
    /* 清除搜索历史记录 */
    GetDeleteProductSearchHistory(data = {}) {
        return this.AjaxService.get({
            url: '/product/delete/history',
            data,
            isLoading: false,
        })
    }
    /* 搜索商品列表 */
    GetProductSearchList(data = {}) {
        return this.AjaxService.get({
            url: '/search/query/product',
            data,
            isLoading: true,
        })
    }
    /* 活动专区 */
    GetProductActivityAreaList(data = {}) {
        return this.AjaxService.get({
            url: '/product/activityArea',
            data,
            isLoading: false,
        })
    }
    /* 活动详情 */
    GetProductActivityDetails(data = {}) {
        return this.AjaxService.get({
            url: '/product/activity/details',
            data,
            isLoading: false,
        })
    }
}
