shopmallApi.js 5.63 KB
import api from "./request";
const path = "scrm.api.shopmall.weapp.";
const couponpath = "scrm.api.coupon.";
const wechatPath = "scrm.api.wechat.";
module.exports = {
  /** 分页查询商城专区的商品信息 */
  getGoodsList(data) {
    return api.post({
      method: `scrm.api.shopmall.zoneInfo.weapp.goodsPage`,
      pageNum: 1,
      pageSize: 999,
      ...data,
    });
  },
  /** 根据商品ID获取商品 */
  getGoodsDetail(id) {
    return api.post(
      {
        method: `${path}goods.getById`,
        id,
        viewAmount: true,
      },
      true
    );
  },
  /** 添加购物车 */
  addShoppingcart(data) {
    return api.post({
      method: `${path}shoppingcart.add`,
      ...data,
    });
  },
  /** 购物车删除商品 */
  delShoppingcart(id) {
    return api.post({
      method: `${path}shoppingcart.delete`,
      id,
    });
  },
  /** 分页获取购物车 */
  getShoppingcartList() {
    return api.post({
      method: `${path}shoppingcart.list`,
    });
  },
  /** 购物车商品变更(比如修改数量) */
  updateShoppingcart(data) {
    return api.post({
      method: `${path}shoppingcart.update`,
      ...data,
    });
  },
  /**购物车结算 */
  settlementShoppingcart(data) {
    return api.post({
      method: `${path}shoppingcart.settlement`,
      ...data,
    });
  },
  /**根据规格值组合获取规格组合库存及零售价 */
  getGoodsSpecificationExtra(data) {
    return api.post({
      method: `${path}goods.getGoodsSpecificationExtra`,
      ...data,
    });
  },
  /** 创建订单(立即购买) */
  createOrder(data) {
    return api.post({
      method: `${path}order.create`,
      ...data,
    });
  },
  /**创建支付订单(去付款) */
  payOrder(data) {
    return api.post({
      method: `${path}order.createPay`,
      ...data,
    });
  },
  /** 确认收货 */
  confirmReceipt(orderCode) {
    return api.post({
      method: `${path}order.confirmReceipt`,
      orderCode,
    });
  },
  /**订单详情  */
  getOrderDetail(orderCode) {
    return api.post({
      method: `${path}order.detail`,
      orderCode,
    });
  },
  /** 申请售后 */
  afterSale(data) {
    return api.post(
      {
        method: `${path}orderRefund.apply`,
        ...data,
      },
      true
    );
  },
  /**活动详情 */
  getActivityDetail(id) {
    return api.post(
      {
        method: `${path}activity.detail`,
        id,
      },
      true
    );
  },
  /** 直播活动详情 */
  getLiveActivityDetail(data) {
    return api.post(
      {
        method: `${path}live.activity.detail`,
        ...data,
      },
      true
    );
  },
  /**获取订单的售后详情 */
  getOrderRefundDetail(orderCode) {
    return api.post({
      method: `${path}orderRefund.detail`,
      orderCode,
    });
  },
  /** 为售后添加退货快递信息 */
  addDelivery(data) {
    return api.post({
      method: `${path}orderRefund.addDelivery`,
      ...data,
    });
  },
  /** 获取商品关联优惠券列表 */
  getGoodscouponList(id) {
    return api.post(
      {
        method: `${path}goods.user.coupons.get`,
        ...id,
      },
      true
    );
  },
  /** 领取商品详情优惠券 */
  getCoupon(data) {
    return api.post(
      {
        method: `${couponpath}customer.receive`,
        ...data,
      },
      true
    );
  },
  /** 领取确认订单最大优惠券 */
  getMaxCoupon(orderGoods) {
    return api.post(
      {
        method: `${path}order.coupons.get`,
        orderGoods,
      },
      true
    );
  },
  /**更换优惠券*/
  updateCoupon(orderGoods) {
    return api.post(
      {
        method: `${path}order.coupons.change`,
        orderGoods,
      },
      true
    );
  },

  //立即评价
  addComment(data) {
    return api.post(
      {
        method: `${path}orderGoodsComment.saveByOrder`,
        ...data,
      },
      true
    );
  },
  //评论列表
  getCommentList(data) {
    return api.post(
      {
        method: `${path}orderGoodsComment.page`,
        ...data,
      },
      true
    );
  },
  //获取订单的评论详情
  getOrderCommentDetails(orderCode) {
    return api.post(
      {
        method: `${path}orderGoodsComment.customerOrderGoodsComment`,
        orderCode,
      },
      true
    );
  },
  //取消付款
  cancelPay(orderCode) {
    return api.post(
      {
        method: `${path}order.cancelPay`,
        orderCode,
      },
      true
    );
  },
  //申请售后待审核的订单取消售后
  cancelOrder(orderCode) {
    return api.post(
      {
        method: `${path}orderRefund.cancel`,
        orderCode,
      },
      true
    );
  },
  /** 直播活动详情id */
  getLiveActivityId(id) {
    return api.post(
      {
        method: `${wechatPath}get.scene.by.id`,
        ...id,
      },
      true
    );
  },
  /** 获取活动分享链接 */
  getActivitylink(id) {
    return api.post(
      {
        method: `scrm.api.shopmall.activity.get.shared`,
        id,
      },
      true
    );
  },
  /** 获取商品分享链接 */
  getGoodslink(id) {
    return api.post(
      {
        method: `scrm.api.shopmall.goods.get.shared`,
        id,
      },
      true
    );
  },
  // scrm.api.shopmall.weapp.
  requestSubscribeMessage() {
    return api.post(
      {
        method: `scrm.api.shopmall.weapp.order.listSubscribeMsgTemplateIds`,
      },
      true
    );
  },
  /** 小程序端根据优惠券id查询可使用商品列表(分页) */
  getCouponGoodsPage(data) {
    // let merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id')
    // if (merchantId) data.merchantId = merchantId
    data.pageSize = 8;
    return api.post({
      method: "scrm.app.shopmall.coupon.goods.page",
      ...data,
    });
  },
};