"use strict";
const common_vendor = require("../common/vendor.js");
const config_http = require("./http.js");
const login = (data) => {
  return config_http.request({
    url: "/app/user/login",
    method: "get",
    data
  });
};
const getMyIndexInfo = (data) => {
  return config_http.request({
    url: "/app/user/userInfo",
    method: "get",
    data
  });
};
const withdrawDeposit = (orderNo) => {
  common_vendor.index.__f__("log", "at config/user.js:23", "调用提现API，订单号：", orderNo);
  return config_http.request({
    url: `/app/withdraw/add/${orderNo}`,
    method: "get",
    hideLoading: true
  });
};
const getOrderList = (data) => {
  return config_http.request({
    url: "/app/order/list",
    method: "get",
    data,
    hideLoading: true
  });
};
const checkOrdersByStatus = (deviceNo, statuses) => {
  const statusQuery = statuses.join(",");
  return config_http.request({
    url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`,
    method: "get",
    hideLoading: true,
    // 隐藏加载提示，避免干扰用户
    ignoreEmptyError: true
    // 添加标记，表示即使返回空数据也不视为错误
  });
};
const getDeviceInfo = (deviceNo) => {
  return config_http.request({
    url: `/app/device/${deviceNo}`,
    method: "get"
  });
};
const queryById = (id) => {
  common_vendor.index.__f__("log", "at config/user.js:81", `查询订单详情, orderId: ${id}`);
  return config_http.request({
    url: `/app/order/${id}`,
    method: "get",
    hideLoading: true
  });
};
const cancelOrder = (data) => {
  return config_http.request({
    url: `/device/order/clear/${data.orderId}`,
    method: "get",
    data
  });
};
const rentPowerBank = (deviceNo, phone) => {
  return config_http.request({
    url: "/app/device/rentPowerBank",
    method: "post",
    data: {
      deviceNo,
      phone
    }
  });
};
const confirmPaymentAndRent = (orderId) => {
  common_vendor.index.__f__("log", "at config/user.js:123", `确认支付并弹出风扇, orderId: ${orderId}`);
  return config_http.request({
    url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
    method: "GET"
  });
};
const getOrderByOrderNo = (orderNo) => {
  return config_http.request({
    url: `/app/order/byOrderNo/${orderNo}`,
    method: "get",
    hideLoading: true
  });
};
const getOrderByOrderNoScore = (orderNo) => {
  common_vendor.index.__f__("log", "at config/user.js:160", "通过订单号获取支付分订单信息", orderNo);
  return config_http.request({
    url: `/app/wx-payment/score/create/${orderNo}`,
    method: "get",
    hideLoading: true
  });
};
const getOrderByOrderNoScorePayStatus = (orderNo) => {
  common_vendor.index.__f__("log", "at config/user.js:169", "通过订单号获取支付分订单状态", orderNo);
  return config_http.request({
    url: `/app/wx-payment/score/status/${orderNo}`,
    method: "get",
    hideLoading: true
  });
};
const updateOrderPackage = (data) => {
  common_vendor.index.__f__("log", "at config/user.js:179", "更新订单套餐信息：", data);
  return config_http.request({
    url: "/app/device/updateOrderPackage",
    method: "post",
    data
  });
};
const updateUserBalance = (orderId) => {
  return config_http.request({
    url: `/app/user/updateBalance/${orderId}`,
    method: "post",
    hideLoading: true
  });
};
exports.cancelOrder = cancelOrder;
exports.checkOrdersByStatus = checkOrdersByStatus;
exports.confirmPaymentAndRent = confirmPaymentAndRent;
exports.getDeviceInfo = getDeviceInfo;
exports.getMyIndexInfo = getMyIndexInfo;
exports.getOrderByOrderNo = getOrderByOrderNo;
exports.getOrderByOrderNoScore = getOrderByOrderNoScore;
exports.getOrderByOrderNoScorePayStatus = getOrderByOrderNoScorePayStatus;
exports.getOrderList = getOrderList;
exports.login = login;
exports.queryById = queryById;
exports.rentPowerBank = rentPowerBank;
exports.updateOrderPackage = updateOrderPackage;
exports.updateUserBalance = updateUserBalance;
exports.withdrawDeposit = withdrawDeposit;
//# sourceMappingURL=../../.sourcemap/mp-weixin/config/user.js.map
