- 新增地址类型定义,增强前端地址数据结构 - 新增地址编辑页面,支持地址智能识别和定位选点功能 - 地址编辑支持省市区选择及默认地址设置 - 新增地址列表页面,支持地址展示、删除、编辑和选择功能 - 实现售后申请页面,支持选择售后类型和退款原因 - 售后申请支持商品选择、退款金额计算和凭证上传 - 新增售后详情页面,支持售后状态展示及申请取消 - 优化页面加载和用户交互体验,增加错误提示和权限处理
167 lines
3.9 KiB
TypeScript
167 lines
3.9 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { ShopInvoiceTitle, ShopInvoiceTitleParam, ShopInvoiceRecord, ShopInvoiceRecordParam, InvoiceApplyRequest } from './model';
|
|
|
|
/**
|
|
* 分页查询发票抬头
|
|
*/
|
|
export async function pageShopInvoiceTitle(params: ShopInvoiceTitleParam) {
|
|
const res = await request.get<ApiResult<PageResult<ShopInvoiceTitle>>>(
|
|
'/shop/shop-invoice-title/page',
|
|
params
|
|
);
|
|
if (res.code === 0) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 查询发票抬头列表
|
|
*/
|
|
export async function listShopInvoiceTitle(params?: ShopInvoiceTitleParam) {
|
|
const res = await request.get<ApiResult<ShopInvoiceTitle[]>>(
|
|
'/shop/shop-invoice-title',
|
|
params
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 添加发票抬头
|
|
*/
|
|
export async function addShopInvoiceTitle(data: ShopInvoiceTitle) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/shop/shop-invoice-title',
|
|
data
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 修改发票抬头
|
|
*/
|
|
export async function updateShopInvoiceTitle(data: ShopInvoiceTitle) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/shop/shop-invoice-title',
|
|
data
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 删除发票抬头
|
|
*/
|
|
export async function removeShopInvoiceTitle(id?: number) {
|
|
const res = await request.del<ApiResult<unknown>>(
|
|
'/shop/shop-invoice-title/' + id
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询发票抬头
|
|
*/
|
|
export async function getShopInvoiceTitle(id: number) {
|
|
const res = await request.get<ApiResult<ShopInvoiceTitle>>(
|
|
'/shop/shop-invoice-title/' + id
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 设置默认发票抬头
|
|
*/
|
|
export async function setDefaultInvoiceTitle(id: number) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/shop/shop-invoice-title/set-default/' + id
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 分页查询发票记录
|
|
*/
|
|
export async function pageShopInvoiceRecord(params: ShopInvoiceRecordParam) {
|
|
const res = await request.get<ApiResult<PageResult<ShopInvoiceRecord>>>(
|
|
'/shop/shop-invoice-record/page',
|
|
params
|
|
);
|
|
if (res.code === 0) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 查询发票记录列表
|
|
*/
|
|
export async function listShopInvoiceRecord(params?: ShopInvoiceRecordParam) {
|
|
const res = await request.get<ApiResult<ShopInvoiceRecord[]>>(
|
|
'/shop/shop-invoice-record',
|
|
params
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 申请发票
|
|
*/
|
|
export async function applyInvoice(data: InvoiceApplyRequest) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/shop/shop-invoice-record/apply',
|
|
data
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询发票记录
|
|
*/
|
|
export async function getShopInvoiceRecord(id: number) {
|
|
const res = await request.get<ApiResult<ShopInvoiceRecord>>(
|
|
'/shop/shop-invoice-record/' + id
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 获取用户可开票订单列表
|
|
*/
|
|
export async function listInvoiceableOrders() {
|
|
const res = await request.get<ApiResult<ShopInvoiceRecord[]>>(
|
|
'/shop/shop-invoice-record/invoiceable-orders'
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|