import req from "@/service/http";

// 产品列表
export const list = param => {
  return req.get("product/list", param);
};

// 获取产品H5链接
export const getLink = () => {
  return req.get("third/bainian/insurance_url", {
    params: {
      goBackUrl: `${window.location.origin}/payWaiting?third=1`
    }
  });
};

// 产品详情
// export const detail = param => {
//   return req.get("product/detail", param);
// };

// 产品算价
export const trail = param => {
  return req.post("product/price/trial", param);
};

// 下单流程
export const placeOrder = {
  // 创建保单订单
  create: params => {
    return req.post("policy_order", params);
  },
  // 获取订单支付信息
  pay: params => {
    return req.post("pay/go", params);
  },
  // 轮询支付结果
  polling: params => {
    return req.get("pay/result", {
      params
    });
  }
};
