75 lines
2.0 KiB
TypeScript
75 lines
2.0 KiB
TypeScript
/**
|
||
* 代理扫码分销注册相关 API(公开,无需登录)
|
||
*/
|
||
|
||
import { BaseService } from '../BaseService'
|
||
import type { BaseResponse } from '@/types/api'
|
||
|
||
/**
|
||
* 发送短信验证码请求参数
|
||
*/
|
||
export interface SendCodeParams {
|
||
phone: string // 手机号
|
||
scene: 'bind_phone' // 业务场景
|
||
}
|
||
|
||
/**
|
||
* 发送短信验证码响应
|
||
*/
|
||
export interface SendCodeResponse {
|
||
cooldown_seconds: number // 冷却秒数,用于倒计时
|
||
}
|
||
|
||
/**
|
||
* 代理扫码注册请求参数
|
||
*/
|
||
export interface AgentDistributionRegistrationParams {
|
||
distribution_code: string // 分销码
|
||
phone: string // 手机号
|
||
code: string // 短信验证码
|
||
password: string // 密码
|
||
shop_name: string // 店铺名称
|
||
shop_code: string // 店铺编号
|
||
username: string // 用户名
|
||
contact_name?: string // 联系人(选填)
|
||
province?: string // 省(选填)
|
||
city?: string // 市(选填)
|
||
district?: string // 区县(选填)
|
||
address?: string // 详细地址(选填)
|
||
}
|
||
|
||
/**
|
||
* 代理扫码注册响应
|
||
*/
|
||
export interface AgentDistributionRegistrationResponse {
|
||
id: number // 注册记录ID
|
||
status: number // 状态(0 待审批)
|
||
status_name: string // 状态名称
|
||
}
|
||
|
||
export class AgentDistributionService extends BaseService {
|
||
/**
|
||
* 发送短信验证码
|
||
* POST /api/c/v1/auth/send-code(公开,不带 Token)
|
||
*/
|
||
static sendCode(params: SendCodeParams): Promise<BaseResponse<SendCodeResponse>> {
|
||
return this.post<BaseResponse<SendCodeResponse>>('/api/c/v1/auth/send-code', params, {
|
||
requestOptions: { withToken: false }
|
||
})
|
||
}
|
||
|
||
/**
|
||
* 代理扫码注册
|
||
* POST /api/c/v1/agent-distribution-registrations(公开,不带 Token)
|
||
*/
|
||
static registerAgent(
|
||
params: AgentDistributionRegistrationParams
|
||
): Promise<BaseResponse<AgentDistributionRegistrationResponse>> {
|
||
return this.post<BaseResponse<AgentDistributionRegistrationResponse>>(
|
||
'/api/c/v1/agent-distribution-registrations',
|
||
params,
|
||
{ requestOptions: { withToken: false } }
|
||
)
|
||
}
|
||
}
|