35 lines
1016 B
TypeScript
35 lines
1016 B
TypeScript
import { get, post } from '@/utils/request.ts';
|
|
|
|
// 商品分类类型
|
|
export enum GoodsCategoryType {
|
|
Vip = 'Vip',
|
|
PremiumPackage = 'PremiumPackage',
|
|
}
|
|
|
|
// 商品信息接口
|
|
export interface GoodsItem {
|
|
goodsName: string; // 商品名称
|
|
originalPrice: number; // 原价
|
|
referencePrice: number; // 参考价格(月均价)
|
|
goodsPrice: number; // 实际价格
|
|
discountAmount: number | null; // 折扣金额
|
|
goodsCategory: string; // 商品分类
|
|
remark: string | null; // 备注(标签)
|
|
discountDescription: string | null; // 折扣描述
|
|
}
|
|
|
|
// 获取商品列表
|
|
export function getGoodsList(categoryType: GoodsCategoryType) {
|
|
return get<GoodsItem[]>(`/pay/GoodsList?GoodsCategoryType=${categoryType}`).json();
|
|
}
|
|
|
|
// 创建订单并发起支付
|
|
export function createOrder(params: any) {
|
|
return post<any>(`/pay/Order`, params).json();
|
|
}
|
|
|
|
// 查询订单状态
|
|
export function getOrderStatus(OutTradeNo: any) {
|
|
return get<any>(`/pay/OrderStatus?OutTradeNo=${OutTradeNo}`).json();
|
|
}
|