You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/common/api/wx.js

56 lines
1.4 KiB

3 years ago
/*
* @Author: ch
* @Date: 2022-04-28 16:30:54
* @LastEditors: ch
3 years ago
* @LastEditTime: 2022-05-17 20:07:26
3 years ago
* @Description: file content
*/
import {ToAsyncAwait, MsbRequest, MsbRequestTk} from '@/common/utils';
const BASE_URL = '/mall/trade';
3 years ago
// 第三方鉴权服务
const AUTH_URL = '/third';
const APPID = 'wxd2015f0c56defa02';
3 years ago
3 years ago
/**
* 获取授权页面地址
* @param {*} data
*/
export const ApiGetAuthUrl = (params) =>
3 years ago
ToAsyncAwait(MsbRequest.get(`${AUTH_URL}/wx/mp/getAuthorizationUrl/${APPID}`, params));
3 years ago
/**
* 获取openId
* @param {*} data
*/
export const ApiGetOpenId = ({code}) =>
3 years ago
ToAsyncAwait(MsbRequest.get(`${AUTH_URL}/wx/mp/getOpenId/${APPID}`, { code }));
/**
* 微信OPENID绑定用户
* @param {*} data
*/
export const ApiPostThirdInfo = (data) =>
3 years ago
ToAsyncAwait(MsbRequestTk.post(`${AUTH_URL}/third/saveThirdInfo`, {...data, appId:APPID}));
3 years ago
/**
3 years ago
* 微信h5支付获取支付URL
3 years ago
* @param {*} data
*/
3 years ago
export const ApiPostWxH5Pay = (data) =>
ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/pay/wxPay/h5`, data));
/**
* 微信JSAPI支付获取支付参数
* @param {*} data
*/
export const ApiPostWxJsApiPay = (data) =>
3 years ago
ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/pay/wxPay/jsapi`, data));
/**
* 微信APP支付
* @param {*} data
*/
export const ApiPostWxAppPay = (data) =>
ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/pay/wxPay/app`, data));