forked from gxwebsoft/mp-10550
优化下单流程
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { ShopOrder, ShopOrderParam } from './model';
|
||||
import type { ShopOrder, ShopOrderParam, OrderCreateRequest } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询订单
|
||||
@@ -100,6 +100,33 @@ export async function getShopOrder(id: number) {
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付返回数据
|
||||
*/
|
||||
export interface WxPayResult {
|
||||
prepayId: string;
|
||||
orderNo: string;
|
||||
timeStamp: string;
|
||||
nonceStr: string;
|
||||
package: string;
|
||||
signType: string;
|
||||
paySign: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*/
|
||||
export async function createOrder(data: OrderCreateRequest) {
|
||||
const res = await request.post<ApiResult<WxPayResult>>(
|
||||
'/shop/shop-order/create',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user