Refactor code structure and remove redundant changes
This commit is contained in:
96
api/pay/index.ts
Normal file
96
api/pay/index.ts
Normal file
@ -0,0 +1,96 @@
|
||||
import { get, post } from '@/utils/axios'
|
||||
import { AppPayWalletPackageRespVO, PayOrderSubmitReqVO, PayOrderRespVO, PageResultAppPayWalletRechargeRespVO } from './types'
|
||||
|
||||
/**
|
||||
* 获得VIP列表
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export const listVip = () => {
|
||||
return get<IResponse<AppPayWalletPackageRespVO[]>>({
|
||||
url: '/prod-api/app-api/pay/wallet-recharge-package/list-vip',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交支付订单
|
||||
*/
|
||||
export const submitPayOrder = (data: PayOrderSubmitReqVO) => {
|
||||
return post<
|
||||
IResponse<{
|
||||
displayContent: string
|
||||
displayMode: string
|
||||
orderId: number
|
||||
status: number
|
||||
}>
|
||||
>({
|
||||
url: '/prod-api/app-api/pay/order/submit',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建示例订单
|
||||
*/
|
||||
export const createOrder = (params: { spuId: number }) => {
|
||||
return post<IResponse<string>>({
|
||||
url: '/prod-api/app-api/pay/demo-order/create',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得钱包充值套餐列表
|
||||
*/
|
||||
export const listWalletRechargePackage = () => {
|
||||
return get<IResponse<AppPayWalletPackageRespVO[]>>({
|
||||
url: '/prod-api/app-api/pay/wallet-recharge-package/list',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付状态
|
||||
*/
|
||||
export const getPayStatus = (params: { id: number }) => {
|
||||
return get<IResponse<PayOrderRespVO>>({
|
||||
url: '/prod-api/app-api/pay/order/get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获取token
|
||||
*/
|
||||
export const getTokenByCode = (params: { type: number; code: string; state: string }) => {
|
||||
return post<IResponse<string>>({
|
||||
url: '/prod-api/app-api/member/social-user/bind',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 社交快捷登录,使用 code 授权码
|
||||
*/
|
||||
export const socialLoginByCode = (params: { type: number; code: string; state: string }) => {
|
||||
return post<
|
||||
IResponse<{
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
userId: string
|
||||
expiresTime: number
|
||||
openid: string
|
||||
}>
|
||||
>({
|
||||
url: '/prod-api/app-api/member/auth/social-login',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得钱包充值记录分页
|
||||
*/
|
||||
export const getWalletRechargeRecordPage = (params: { pageNo: number; pageSize: number }) => {
|
||||
return get<IResponse<PageResultAppPayWalletRechargeRespVO>>({
|
||||
url: '/prod-api/app-api/pay/wallet-transaction/page',
|
||||
params,
|
||||
})
|
||||
}
|
||||
63
api/pay/types.ts
Normal file
63
api/pay/types.ts
Normal file
@ -0,0 +1,63 @@
|
||||
export interface AppPayWalletPackageRespVO {
|
||||
id: number
|
||||
name: string
|
||||
payPrice: number
|
||||
bonusPrice: number
|
||||
type: number
|
||||
brokerageRate: number
|
||||
profile: string
|
||||
remark: string
|
||||
btnloading: boolean
|
||||
qrCodeUrl: string
|
||||
level: number
|
||||
}
|
||||
|
||||
export interface PayOrderSubmitReqVO {
|
||||
id: number
|
||||
memberId: string
|
||||
channelCode: string
|
||||
channelExtras?: any
|
||||
displayMode?: string
|
||||
returnUrl?: string
|
||||
}
|
||||
|
||||
export interface PayOrderRespVO {
|
||||
appId: number
|
||||
channelId: number
|
||||
channelCode: string
|
||||
merchantOrderId: string
|
||||
subject: string
|
||||
body: string
|
||||
notifyUrl: string
|
||||
price: number
|
||||
channelFeeRate: number
|
||||
channelFeePrice: number
|
||||
status: number
|
||||
userIp: string
|
||||
expireTime: string
|
||||
successTime: string
|
||||
extensionId: number
|
||||
no: string
|
||||
refundPrice: number
|
||||
channelUserId: string
|
||||
channelOrderNo: string
|
||||
id: number
|
||||
createTime: string
|
||||
}
|
||||
|
||||
export interface PageResultAppPayWalletRechargeRespVO {
|
||||
list: AppPayWalletRechargeRespVO[]
|
||||
total: number
|
||||
}
|
||||
export interface AppPayWalletRechargeRespVO {
|
||||
id: number
|
||||
totalPrice: number
|
||||
payPrice: number
|
||||
bonusPrice: number
|
||||
payChannelCode: string
|
||||
payChannelName: string
|
||||
payOrderId: number
|
||||
payOrderChannelOrderNo: string
|
||||
payTime: string
|
||||
refundStatus: number
|
||||
}
|
||||
Reference in New Issue
Block a user