/**
 * 这是与购物有关的业务逻辑的服务
 */
export default class ProductService {
	constructor(AjaxService) {
		Object.assign(this, { AjaxService })
		this.name = 'ProductService'
	}
	/**
	 * @商城首页-常用商品列表
	 * @param:userId 用户ID(未登录传0或者'')，
	 * @param:preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100)，，
	 * @param:pageNum 页码
	 * @param:pageSize 每页条数
	 */
	queryProductPreferred (data = {}) {
		return this.AjaxService.get({ url:'/product/preferred', data, isLoading: false })
	}
	
	/**
	 * @商品列表-查询商品价格
	 * @param:userId 用户ID(未登录传0或者'')
	 * @param:productID 商品ID','符号拼接
	 */
	querySearchProductPrice (data = {}) {
		return this.AjaxService.get({ url:'/product/listPrice', data, isLoading: false })
	}
	
	/**
	 * @查询凑单商品页初始化
	 * @param:promotionsId 促销ID
	 */
	queryProductPromotionInfo (data = {}) {
		return this.AjaxService.get({ url:'/product/promotion/info', data, isLoading: false })
	}
	/**
	 * @查询凑单商品列表
	 * @param:promotionsId 促销ID
	 * @param:pageSize 查询条数
	 * @param:pageNum 查询页数
	 */
	queryProductPromotionList (data = {}) {
		return this.AjaxService.get({ url:'/product/promotion/products', data, isLoading: true })
	}
	
	/**
	 * @商品详情-查询商品详情
	 * @param:userId 用户ID(未登录传0或者'')
	 * @param:productIds 商品ID
	 */
	queryProductDetils (data = {}) {
		return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
	}
	/**
	 * @商品详情-相关推荐
	 * @param:productIds 商品ID
	 */
	queryProductDetilsRelevant (data = {}) {
		return this.AjaxService.get({ url:'/product/detail/recommend', data, isLoading: false })
	}
	
	/**
	 * @加入购物车
	 * @param:userId 用户ID(必填)
	 * @param:productID 用户ID(必填)
	 * @param:productCount 商品数量(必填)
	 */
	shoppingAddCart (data = {}) {
		return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
	}
	
	/**
	 * @购物车列表
	 * @param:userId 用户ID(必填)
	 */
	QueryShoppingCartList (data = {}) {
		return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
	}
	
	/**
	 * @更新购物车商品增减
	 * @param:userId 用户ID(必填)
	 * @param:productID 商品ID(必填)
	 * @param:productCount 商品数量ID(必填)
	 */
	shoppingCartUpdate (data = {}) {
		return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
	}
	/**
	 * @删除购物车商品
	 * @param:userId 用户ID(必填)
	 * @param:productIDs 商品ID(用','号拼接)
	 */
	shoppingCartDelete (data = {}) {
		return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
	}
	/* 二级列表 */
	GetPageTopic (data = {}) {
		return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
	}
	/* 二级列表banner */
	GetPageTopicBanner (data = {}) {
		return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
	}
	/* 活动专题列表 */
	GetPromotionsrList (data = {}) {
		return this.AjaxService.get({ url:'/promotions/list', data, isLoading: true })
	}
	/* 搜索项目仪器列表 */
	GetSearchEquipmentList (data = {}) {
		return this.AjaxService.get({ url:'/search/query/equipment', data, isLoading: true })
	}
	/* 项目仪器详情 */
	GetEquipmentDetails (data = {}) {
		return this.AjaxService.get({ url:'/equipment/recommend', data, isLoading: true })
	}
	/* 查询搜索历史记录 */
	GetProductSearchHistory (data = {}) {
		return this.AjaxService.get({ url:'/product/searchHistory', data, isLoading: false })
	}
	/* 添加搜索历史记录 */
	GetAddProductSearchHistory (data = {}) {
		return this.AjaxService.get({ url:'/product/history/add', data, isLoading: true })
	}
	/* 清除搜索历史记录 */
	GetDeleteProductSearchHistory (data = {}) {
		return this.AjaxService.get({ url:'/product/searchHistory/delete', data, isLoading: false })
	}
	/* 搜索商品列表 */
	GetProductSearchList (data = {}) {
		return this.AjaxService.get({ url:'/search/query/product', data, isLoading: true })
	}
	/* 获取商品评价 */
	GetProductEvaluate (data = {}) {
		return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
	}
	/* 获取再次购买商品列表 */
	GetRepeatBuyAgainProductList (data = {}) {
		return this.AjaxService.get({ url:'/repeat/buyAgain', data, isLoading: true })
	}
	/* 新商品搜索查询商品阶梯价格 */
	GetSearchProductLadderPrice (data = {}) {
		return this.AjaxService.get({ url:'/product/ladderPrice', data, isLoading: false })
	}
	/* 获取分类导航 */
	GetProductClassify (data = {}) {
		return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
	}
	/* 获取小程序三个模块商品列表 */
	GetProductPreferred (data = {}) {
		return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
	}
	/* 发票信息回显 */
	GetPersonalCenterFindInvoice (data = {}) {
		return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
	}
	/* 发票信息保存 */
	GetPersonalCenterInvoice (data = {}) {
		return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
	}
}
