// 引入 request 文件
import request from "@/common/api/request.js";
import { prveUrl } from "./config.js";

export const pay = (data) => {
  let platformType = "";
  let payType = "";
  // #ifdef APP-PLUS
  platformType = "APP";
  // #endif
  // #ifdef H5
  platformType = "H5";
  // #endif
  // #ifdef MP-WEIXIN
  platformType = "WX";
  platformType = "wechat";
  payType = "WECHAT";
  // #endif
  // #ifdef MP-ALIPAY
  platformType = "alipay";
  payType = "ALIPAY";
  // #endif


  return request({
    url: prveUrl + "/user/distribution/pay",
    method: "post",
    data: { platformType, payType, ...data },
  });
};

export const centerUser = (data) => {
  return request({
    url: prveUrl + "/user/distribution/centerUser",
    method: "post",
    data: data,
  });
};
export const activates = (data) => {
  return request({
    url: prveUrl + "/user/distribution/centerUser/activates",
    method: "get",
    data: data,
  });
};
export const unActivates = (data) => {
  return request({
    url: prveUrl + "/user/distribution/centerUser/unActivates",
    method: "get",
    data: data,
  });
};
export const centerConfig = (data) => {
  return request({
    url: prveUrl + "/user/distribution/centerConfig",
    method: "get",
    data: data,
  });
};


// 绑定邀请用户
export const bindInviteUser = (data) => {
  return request({
    url: prveUrl + "/user/distribution/bindInviteUser",
    method: "post",
    data: data,
  });
};

export const childUser = (data) => {
  return request({
    url: prveUrl + "/user/distribution/childUser",
    method: "get",
    data: data,
  });
};
export const inviteUser = (data) => {
  return request({
    url: prveUrl + "/user/distribution/inviteUser",
    method: "get",
    data: data,
  });
};

// 提现
export const withdraw = (data) => {
  return request({
    url: prveUrl + "/user/distribution/withdraw",
    method: "post",
    data: data,
  });
};

// 提现详情
export const withdrawDetail = (data) => {
  return request({
    url: prveUrl + "/user/distribution/withdraw/detail",
    method: "get",
    data: data,
  });
};
//提现记录
export const withdrawFlow = (data) => {
  return request({
    url: prveUrl + "/user/distribution/withdraw/flow",
    method: "get",
    data: data,
  });
};

// 实名认证
export const realNameAuth = (data) => {
  return request({
    url: prveUrl + "/user/distribution/realNameAuth",
    method: "post",
    data: data,
  });
};


// 收益明细
export const getIncomeDetails = (data) => {
  return request({
    url: prveUrl + "/user/distribution/distributionFlow",
    method: "get",
    data: data,
  });
};

// 获取邀请码
export const getInviteCode = (data) => {
  return request({
    url: prveUrl + "/user/distribution/getInviteCode",
    method: "get",
    data: data,
  });
};
export const autoGetInviteCode = (data) => {
  return request({
    url: prveUrl + "/user/distribution/autoGetInviteCode",
    method: "get",
    data: data,
  });
};



// 获取配置
export const getConfig = (data) => {
  return request({
    url: prveUrl + "/user/distribution/getConfig",
    method: "get",
    data: data,
  });
};


// 分销员中心-无感-绑定邀请人
export const autoBindInviteUser = (data) => {
  return request({
    url: prveUrl + "/user/distribution/autoBindInviteUser",
    method: "post",
    data: data,
  });
};

// 全民股东界面-进入过标识
export const distributionEditIn = (data) => {
  return request({
    url: prveUrl + "/user/distribution/editIn",
    method: "get",
    data: data,
  });
};