import request from "@/utils/request.js"; /** * 获取产品详情 * @param int id * */ export function getProductDetail(id, type, zoneId, seckillId) { return request.get('product/detail/' + id + '?type=' + type + (zoneId ? ('&zoneId=' + zoneId) : '') + (seckillId ? ('&timerId=' + seckillId) : ''), {}, { noAuth: true }); } export function addProductView(id) { return request.get('product/view/' + id, {}, { noAuth: true }); } /** * 产品分享二维码 推广员 * @param int id */ // #ifndef MP export function getProductCode(id) { return request.get('product/code/' + id, {}); } // #endif // #ifdef MP export function getProductCode(id) { return request.get('product/code/' + id, { user_type: 'routine' }); } // #endif /** * 添加收藏 * @param int id * @param string category product=普通产品,product_seckill=秒杀产品 */ export function collectAdd(id, category) { return request.post('collect/add', { id: id, 'category': category === undefined ? 'product' : category }); } /** * 取消收藏产品 * @param int id */ export function collectDel(proId) { return request.post(`collect/cancel/${proId}`); } /** * 删除收藏产品 * @param string id */ export function collectDelete(ids) { return request.post(`collect/delete`, ids); } /** * 购车添加 * */ export function postCartAdd(data) { return request.post('cart/save', data, {}); } /** * 批量购车添加 * */ export function batchPostCartAdd(data) { return request.post('cart/batchSave', data, {}); } /** * 获取分类列表 * */ export function getCategoryList() { return request.get('category', {}, { noAuth: true }); } /** * 获取产品列表 * @param object data */ export function getProductslist(data) { return request.get('products', data, { noAuth: true }); } /** * 获取推荐产品 * */ export function getProductHot(page, limit) { return request.get("product/hot", { page: page === undefined ? 1 : page, limit: limit === undefined ? 4 : limit }, { noAuth: true }); } /** * 批量收藏 * * @param object id 产品编号 join(',') 切割成字符串 * @param string category */ export function collectAll(id, category) { return request.post('collect/all', { id: id, category: category === undefined ? 'product' : category }); } /** * 首页产品的轮播图和产品信息 * @param int type * */ export function getGroomList(type, data) { return request.get('index/product/' + type, data, { noAuth: true }); } /** * 获取收藏列表 * @param object data */ export function getCollectUserList(data) { return request.get('collect/user', data) } /** * 获取产品评论 * @param int id * @param object data * */ export function getReplyList(id, data) { return request.get('reply/list/' + id, data, { noAuth: true }) } /** * 产品评价数量和好评度 * @param int id */ export function getReplyConfig(id) { return request.get('reply/config/' + id, {}, { noAuth: true }); } /** * 获取搜索关键字获取 * */ export function getSearchKeyword() { return request.get('search/keyword', {}, { noAuth: true }); } /** * 门店列表 * @returns {*} */ export function storeListApi(data) { return request.post("store/list", data, {}, 1); } /** * 优品推荐 * @param object data */ export function getProductGood() { return request.get('product/good', {}, { noAuth: true }); } /** * 详情页产品评论 * @param int id * @param object data * */ export function getReplyProduct(id) { return request.get('reply/product/' + id, {}, { noAuth: true }) } export function getStoreZoneAndCouponList(data) { return request.get('getStoreZoneAndCouponList', data, { noAuth: true }); } export function getLast10Order(data) { return request.get('getLast10Order', data, { noAuth: true }); } export function getZoneDetail(id, data) { return request.get('store/zone/detail/' + id, data, { noAuth: true }); } export function getZoneGoodList(id, data) { return request.get('store/zone/product/list/' + id, data, { noAuth: true }); } /** * 专区促销预估 * @param {number} zoneId - 专区ID * @param {number} applyNum - 专区商品总件数 * @param {number} zoneTotalFee - 专区应付总额 */ export function getZonePromotionPreview(zoneId, applyNum, zoneTotalFee) { return request.get('store/zone/promotion/preview', { zoneId: zoneId, applyNum: applyNum, zoneTotalFee: zoneTotalFee }, { noAuth: true }); } // 检查是否已经签到 export function checkSign(data) { return request.get('store/zone/check/sign', data, { noAuth: true }); } // 渠道活动 - 验证销售码是否正确 export function signInSales(data) { return request.get('channel/activity/signInSales', data, { noAuth: true }); } export function getBeanRate(data) { return request.get('order/exchangeCareBean', data, { noAuth: true }); } export function collectShare(data) { return request.post("collect/share?productId=" + data.productId, {}, { noAuth: true }); } export function getZoneCouponList(id, data) { return request.get('coupons/zone/' + id, data, { noAuth: true }); } export function getStoreZoneAndCouponPopupList(data) { return request.get('getStoreZoneAndCouponPopupList', data, { noAuth: true }); } export function getProductCouponList(data) { return request.get('coupons/product', data, { noAuth: true }); } // 小程序专区优惠券列表 export function getZoneCoupon(id) { return request.get('zone/coupon/list/' + id, {}, { noAuth: true }); } // 查询当前用户指定优惠券可用数量 export function getZoneCouponCount(data) { return request.get('zone/coupon/user/count', data, { noAuth: true }); } // 查当前用户即将到期的优惠券 export function getExpiringCoupon() { return request.get('coupon/expiring', {}, { noAuth: true }); } // 小程序悦养豆兑换优惠券 export function couponExchange(data) { return request.post('zone/coupon/exchange', data); } // 当前用户悦养豆消耗记录 export function getConsumeRecord(data) { return request.get('care/bean/consume/record/list', data, { noAuth: true }); } // 访问专区并执行券包判断 export function couponPackVisit(data) { return request.post('coupon-pack/visit', data); } // 生成好友券分享链接 export function couponPackSharelink(data) { return request.post('coupon-pack/share-link?activityId=' + data.activityId, {}); } // 授权后恢复未授权访问 export function couponPackPendingVisitProcess(data) { return request.post('coupon-pack/pending-visit/process', data); } // 未授权访问暂存 export function couponPackPendingVisit(data) { return request.post('coupon-pack/pending-visit', data); } // 查询当前用户券包状态 export function getCounponPackStatus(zoneId) { return request.get('coupon-pack/status?zoneId=' + zoneId, {}, { noAuth: true }); }