docs: 更新优惠券相关文档- 新增优惠券API集成文档
- 新增优惠券卡片对齐修复文档 - 新增优惠券状态显示调试文档 - 新增优惠券组件警告修复文档- 更新用ShopInfo Hook字段迁移文档 - 更新Arguments关键字修复文档
This commit is contained in:
@@ -99,6 +99,34 @@ export interface CmsWebsite {
|
||||
search?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface AppInfo {
|
||||
appId?: number;
|
||||
appName?: string;
|
||||
description?: string;
|
||||
keywords?: string;
|
||||
appCode?: string;
|
||||
mpQrCode?: string;
|
||||
title?: string;
|
||||
logo?: string;
|
||||
icon?: string;
|
||||
domain?: string;
|
||||
running?: number;
|
||||
version?: number;
|
||||
expirationTime?: string;
|
||||
expired?: boolean;
|
||||
expiredDays?: number;
|
||||
soon?: number;
|
||||
statusIcon?: string;
|
||||
statusText?: string;
|
||||
config?: Object;
|
||||
serverTime?: Object;
|
||||
topNavs?: CmsNavigation[];
|
||||
bottomNavs?: CmsNavigation[];
|
||||
setting?: Object;
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 网站信息记录表搜索条件
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import request from '@/utils/request-legacy';
|
||||
import type { ApiResult } from '@/api/index';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type {
|
||||
LoginParam,
|
||||
LoginResult,
|
||||
@@ -70,71 +70,3 @@ export async function sendSmsCaptcha(data: LoginParam) {
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
export async function getOpenId(data: any){
|
||||
const res = request.post<ApiResult<LoginResult>>(
|
||||
SERVER_API_URL + '/wx-login/getOpenId',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
export async function loginByOpenId(data:any){
|
||||
const res = request.post<ApiResult<LoginResult>>(
|
||||
SERVER_API_URL + '/wx-login/loginByOpenId',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
export async function remoteLogin(data: LoginParam) {
|
||||
const res = await request.post<ApiResult<LoginResult>>(
|
||||
'https://open.gxwebsoft.com/api/login',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
// setToken(res.data.data?.access_token, data.remember);
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业微信登录链接
|
||||
*/
|
||||
export async function getWxWorkQrConnect(data: any) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/wx-work',
|
||||
data
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
export async function loginMpWxMobile(data: {
|
||||
refereeId: number;
|
||||
gradeId: number;
|
||||
code: any;
|
||||
sceneType: string;
|
||||
comments: string;
|
||||
encryptedData: any;
|
||||
tenantId: string;
|
||||
iv: any;
|
||||
notVerifyPhone: boolean
|
||||
}) {
|
||||
const res = request.post<ApiResult<unknown>>(SERVER_API_URL + '/wx-login/loginByMpWxPhone', data);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
@@ -99,3 +99,42 @@ export async function getShopUserCoupon(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的可用优惠券
|
||||
*/
|
||||
export async function getMyAvailableCoupons() {
|
||||
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
|
||||
'/shop/shop-user-coupon/my/available'
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的已使用优惠券
|
||||
*/
|
||||
export async function getMyUsedCoupons() {
|
||||
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
|
||||
'/shop/shop-user-coupon/my/used'
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的已过期优惠券
|
||||
*/
|
||||
export async function getMyExpiredCoupons() {
|
||||
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
|
||||
'/shop/shop-user-coupon/my/expired'
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
@@ -32,8 +32,16 @@ export interface ShopUserCoupon {
|
||||
endTime?: string;
|
||||
// 使用状态(0未使用 1已使用 2已过期)
|
||||
status?: number;
|
||||
// 状态文本描述
|
||||
statusText?: string;
|
||||
// 是否过期, 0否, 1是
|
||||
isExpire?: number;
|
||||
// 是否即将过期(后端计算)
|
||||
isExpiringSoon?: boolean;
|
||||
// 剩余天数(后端计算)
|
||||
daysRemaining?: number;
|
||||
// 剩余小时数(后端计算)
|
||||
hoursRemaining?: number;
|
||||
// 使用时间
|
||||
useTime?: string;
|
||||
// 使用订单ID
|
||||
@@ -63,5 +71,13 @@ export interface ShopUserCouponParam extends PageParam {
|
||||
isExpire?: number;
|
||||
sortBy?: string;
|
||||
sortOrder?: string;
|
||||
// 仅查询有效的优惠券
|
||||
validOnly?: boolean;
|
||||
// 仅查询已过期的优惠券
|
||||
expired?: boolean;
|
||||
// 查询即将过期的优惠券
|
||||
expiringSoon?: boolean;
|
||||
// 当前时间(用于测试)
|
||||
currentTime?: string;
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { UserCoupon, UserCouponParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询用户优惠券
|
||||
*/
|
||||
export async function pageUserCoupon(params: UserCouponParam) {
|
||||
const res = await request.get<ApiResult<PageResult<UserCoupon>>>(
|
||||
'/sys/user-coupon/page',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户优惠券列表
|
||||
*/
|
||||
export async function listUserCoupon(params?: UserCouponParam) {
|
||||
const res = await request.get<ApiResult<UserCoupon[]>>(
|
||||
'/sys/user-coupon',
|
||||
params
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户优惠券统计
|
||||
*/
|
||||
export async function getUserCouponCount(userId: number) {
|
||||
const res = await request.get<ApiResult<{
|
||||
total: number;
|
||||
unused: number;
|
||||
used: number;
|
||||
expired: number;
|
||||
}>>(
|
||||
'/sys/user-coupon/count',
|
||||
{ userId }
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询用户优惠券
|
||||
*/
|
||||
export async function getUserCoupon(id: number) {
|
||||
const res = await request.get<ApiResult<UserCoupon>>(
|
||||
'/sys/user-coupon/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用优惠券
|
||||
*/
|
||||
export async function useCoupon(couponId: number, orderId: number) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/sys/user-coupon/use',
|
||||
{ couponId, orderId }
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 用户优惠券
|
||||
*/
|
||||
export interface UserCoupon {
|
||||
// 优惠券ID
|
||||
couponId?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 优惠券名称
|
||||
name?: string;
|
||||
// 优惠券类型 1-满减券 2-折扣券 3-免费券
|
||||
type?: number;
|
||||
// 优惠券金额/折扣
|
||||
value?: string;
|
||||
// 使用门槛金额
|
||||
minAmount?: string;
|
||||
// 有效期开始时间
|
||||
startTime?: string;
|
||||
// 有效期结束时间
|
||||
endTime?: string;
|
||||
// 使用状态 0-未使用 1-已使用 2-已过期
|
||||
status?: number;
|
||||
// 使用时间
|
||||
useTime?: string;
|
||||
// 关联订单ID
|
||||
orderId?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 更新时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户优惠券搜索条件
|
||||
*/
|
||||
export interface UserCouponParam extends PageParam {
|
||||
userId?: number;
|
||||
type?: number;
|
||||
status?: number;
|
||||
name?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user