 'use strict'

const Method = require('./method.js').Method;
var network = require("../utils/network.js");
const baseUrl = require('./index.js').config;
var app = getApp();

//获取订单可用优惠劵
const takeCoupon = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.PUT,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//储值支付
const takePayoff = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.POST,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//储值梯度
const takeGradient = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//支付成功
const takeSuccesss = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.POST,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//发送验证码
const takeCode = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//获取优惠劵列表
const takeCouponlist = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//获取会员信息
const takeMessage = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//获取储值并支付
const takeStorepay = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.POST,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//提交生日
const takeBirthday = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.PUT,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//获得惊喜红包
const takeLucky = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//获得历史账单
const takeWallet = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//获得积分商品
const takePointproduct = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//兑换积分商品
const takeExchange = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.PUT,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//会员积分
const takeLog= (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//查看积分规则
const takePointsrule = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//查看储值协议
const takeAgreement = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//查看开屏红包
const takeWelcome = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//单个领取
const takeCollectone = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.PUT,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
//不再提醒
const takeNotremind = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.PUT,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
// 查询储值开关
const takeRechargeallow = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
// 查询储值开关
const takeRechargestatus = (url, urldata, data, message, success, fail) => {
  network.requestLoadingmember(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
// 优惠券兑换码
const takeRedeemCode = (url, urldata, data, message, success, fail) => {
  network.requestLoading(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
// 平台优惠券
const takePlatformCoupon = (url, urldata, data, message, success, fail) => {
  network.requestLoading(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
// 查询协议分类
const takeExplanation = (url, urldata, data, message, success, fail) => {
  network.requestLoadingno(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
// 查询协议说明的详情
const takeExplanationDetail = (url, urldata, data, message, success, fail) => {
  network.requestLoadingno(url, urldata, {
    ...data,
  },
    Method.GET,
    message,
    function (res) {
      typeof success == "function" && success(res)
    },
    function (ex) {
      // 失败执行的方法
      typeof fail == "function" && fail(ex)
    })
}
module.exports = {
  takeCoupon: takeCoupon,
  takePayoff: takePayoff,
  takeGradient:takeGradient,
  takeSuccesss: takeSuccesss,
  takeCode: takeCode,
  takeCouponlist: takeCouponlist,
  takeMessage: takeMessage,
  takeStorepay: takeStorepay,
  takeBirthday: takeBirthday,
  takeLucky: takeLucky,
  takeWallet: takeWallet,
  takePointproduct: takePointproduct,
  takeExchange: takeExchange,
  takeLog: takeLog,
  takePointsrule: takePointsrule,
  takeAgreement: takeAgreement,
  takeWelcome: takeWelcome,
  takeCollectone: takeCollectone,
  takeNotremind: takeNotremind,
  takeRechargeallow: takeRechargeallow,
  takeRechargestatus: takeRechargestatus,
  takeExplanation: takeExplanation,
  takeExplanationDetail: takeExplanationDetail,
  takeRedeemCode: takeRedeemCode,
  takePlatformCoupon: takePlatformCoupon
}