restapi.js 2.95 KB
const restapi = require('../../../utils/restapi.js');

module.exports = {

  /** 获取主页数据*/
  getIndexModules: function (merchantId, success, fail) {
    restapi.req('/web-dj-weapp/home/getIndexModules', { merchantId: merchantId }, {}, 'GET', 'json', 'text', success, fail);
  },

  /** 领取活动优惠券*/
  receiveActivityCoupon: function (activityCouponId, activityId, success, fail) {
    restapi.req('/web-dj-weapp/coupon/receive', { activityCouponId: activityCouponId, activityId: activityId }, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  },

  /** 查看活动详情*/
  getActivityDetail: function (data, success, fail) {
    restapi.req('/web-dj-weapp/popularActivity/detail', JSON.stringify(data), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail);
  },

  /** 查看精品交付礼包详情*/
  getGoodsDetail: function (data, success, fail) {
    restapi.req('/web-dj-weapp/boutiquedelivery/goods/getDetailByGoodsCode', data, {}, 'GET', 'json', 'text', success, fail);
  },
  
  generateActivityOrder: function (activityOrderRequestVO, success, fail) {
    restapi.req('/web-dj-weapp/popularActivity/generateActivityOrder', JSON.stringify(activityOrderRequestVO), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail);

  },
  
  /**
   * 获取门店信息
   */
  getMerchantById(merchantId, success) {
    restapi.req('/web-dj-weapp/personal/merchant', { merchantId: merchantId }, {}, 'GET', 'json', 'text', success);
  },
 
 
  /**
   * 获取小程序应用信息
   * merchantId:商户号
   */
  getAppInfo: function (merchantId, success, fail) {
    restapi.req('/web-dj-weapp/appinfo/get', { merchantId: merchantId }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 创建记录
  */
  createLogRecord: function (obj, success, fail) {
    restapi.req('/web-dj-weapp/myactivity/createLogRecord', JSON.stringify(obj), { 'content-type': 'application/json' }, 'POST', 'json', 'text', success, fail);
  },
  /**
   * 根据活动id查找正在进行的拼团
   */
  getGroupsByActivityId: function (activityId, success, fail){
    restapi.req('/web-dj-weapp/popularActivity/getGroupsByActivityId', { activityId: activityId }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 根据团队编码查找拼团记录
   */
  getGroupsByGroupCode: function (groupCode, success, fail){
    restapi.req('/web-dj-weapp/popularActivity/getGroupsByGroupCode', { groupCode: groupCode }, {}, 'GET', 'json', 'text', success, fail);
  },
  /**
   * 根据条件查找拼团(团长)信息:groupCode:团队编码,account_id:用户账号,activity_id:活动id
   */
  getGroupInfoDetail: function (record , success, fail) {
    restapi.req('/web-dj-weapp/popularActivity/getGroupInfoDetail', record, { 'content-type': 'application/x-www-form-urlencoded' }, 'POST', 'json', 'text', success, fail);
  }
}