对接接口
This commit is contained in:
145
src/api/user.ts
145
src/api/user.ts
@ -8,139 +8,34 @@ import type { IUserResult } from '@/api/types/user'
|
||||
* 获取用户个人信息
|
||||
*/
|
||||
export function getUserInfo() {
|
||||
return http.Post<IUserResult>('/api/user/info')
|
||||
return http.Post<IUserResult>('/storeapi/user/info')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取优惠券列表
|
||||
*/
|
||||
export function getUserCoupons() {
|
||||
return http.Post('/api/UserCoupon/UserCoupinList')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户地址
|
||||
*/
|
||||
export function getUserAddress() {
|
||||
return http.Post('/api/user/addressList')
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户添加地址
|
||||
*/
|
||||
export interface IAddUserAddressParams {
|
||||
id: number
|
||||
contact: string
|
||||
telephone: string
|
||||
province: string
|
||||
province_id?: number
|
||||
city: string
|
||||
city_id?: number
|
||||
district: string
|
||||
district_id?: number
|
||||
address: string
|
||||
is_default: number
|
||||
}
|
||||
|
||||
export function addUserAddress(data: IAddUserAddressParams) {
|
||||
return http.Post<IUserAddressListResult>('/api/user/addAddress', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户地址
|
||||
*/
|
||||
export interface IEditUserAddressParams extends IAddUserAddressParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function editUserAddress(data: IAddUserAddressParams) {
|
||||
return http.Post('/api/user/editAddress', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户地址
|
||||
*/
|
||||
export interface IDeleteUserAddressParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function deleteUserAddress(data: IDeleteUserAddressParams) {
|
||||
return http.Post('/api/user/delAddress', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地址详情
|
||||
*/
|
||||
|
||||
export interface IUserAddressDetailsParams extends IDeleteUserAddressParams {}
|
||||
export function userAddressDetails(data: IUserAddressDetailsParams) {
|
||||
return http.Post<IUserAddressDetailsResult>('/api/user/addressDetails', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠券列表(从订单页获取)
|
||||
*/
|
||||
export interface IGetCouponsParams {
|
||||
id: number
|
||||
numbers: number
|
||||
type_id: number
|
||||
}
|
||||
|
||||
export function getCoupons(data: IGetCouponsParams) {
|
||||
return http.Post<IUserCouponListResult>('/api/UserCoupon/UserCoupinList', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠券列表(从个人中心点击进去)
|
||||
*/
|
||||
export interface IGetMyCouponsParams {
|
||||
status: number
|
||||
type_id: number
|
||||
}
|
||||
export function getMyCoupons(data: IGetMyCouponsParams) {
|
||||
return http.Post('/api/UserCoupon/orderCoupinList', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心优惠券
|
||||
*/
|
||||
export function getMyCoupon() {
|
||||
return http.Post<IUserCouponListResult>('/api/UserCoupon/coupinList')
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取个人中心优惠券
|
||||
*/
|
||||
export interface IClaimMyCouponParams {
|
||||
id: number
|
||||
}
|
||||
|
||||
export function claimMyCoupon(data: IClaimMyCouponParams) {
|
||||
return http.Post('/api/UserCoupon/receiveCoupon', data)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 金额使用记录
|
||||
*/
|
||||
export interface IGetUserMoneyLogParams {
|
||||
page: number
|
||||
size: number
|
||||
month: string
|
||||
}
|
||||
|
||||
export function getUserMoneyLog(data: IGetUserMoneyLogParams) {
|
||||
return http.Post<IOrderListResult>('/api/user/moneyLogList', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
export interface IUpdateUserInfoParams {
|
||||
field: string,
|
||||
value: string | number
|
||||
nickname?: string
|
||||
avatar?: string
|
||||
mobile?: number
|
||||
band_mobile?: string
|
||||
password?: string
|
||||
}
|
||||
|
||||
export function updateUserInfo(data: IUpdateUserInfoParams) {
|
||||
return http.Post('/api/user/setInfo', data)
|
||||
console.log("🚀 ~ updateUserInfo ~ data:", data)
|
||||
return http.Post('/storeapi/user/updateUser', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
export interface IGetVerificationCodeParams {
|
||||
mobile: string
|
||||
scene: number
|
||||
}
|
||||
|
||||
export function getVerificationCode(data: IGetVerificationCodeParams) {
|
||||
return http.Post('/storeapi/sms/sendCode', data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user