import request from "../utils/request";

/**
 * 已兑换的商品列表
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
 */
export const getMySkuList = () => request.get("/weapp/mySkuList");

/**
 * 去实体店取兑换的商品
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
 */
export const useMySku = (data) => request.post("/weapp/use/mySku", data);

/**
 * 上传小票的历史记录
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=77a8d929-dbed-4219-83b2-10da4e7b4bfd)
 */
export const getMyPhotoList = () => request.get("/weapp/score/photo/list");

/**
 * 积分兑换商品
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
 */
export const exchangeScore = (data) =>
  request.post("/weapp/score/exchange", data);

/**
 * 积分兑换商城
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=32732123-c89b-487a-b8d4-f15c4b2d3f59)
 */
export const getScoreList = () => request.get("/weapp/score/list");

/**
 * 自助积分
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
 */
export const uploadPhoto = (data) =>
  request.post("/weapp/score/photo/upload", data);

/**
 * 店铺列表页
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=992f53fb-051f-48cc-b2d4-31d18b45ba35)
 */
export const getShopList = (price_type) =>
  request.get(
    `/weapp/shops/list${price_type ? "?price_type=" + price_type : ""}`
  );

/**
 * 店铺详情页
 *
 * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=589cd780-4901-46e6-8a91-f0681300359b)
 */
export const getShopDetail = (id) => request.get(`/weapp/shops/${id}`);
