250108
This commit is contained in:
+12
-12
@@ -1,6 +1,6 @@
|
||||
import request from '@/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import {MODULES_API_URL} from '@/config/setting';
|
||||
import {THINK_API_URL} from '@/config/setting';
|
||||
import type {Cart, CartParam, CartVo} from "@/api/shop/cart/model";
|
||||
import type {Merchant} from "@/api/shop/merchant/model";
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {Merchant} from "@/api/shop/merchant/model";
|
||||
*/
|
||||
export async function pageCart(params: CartParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Cart>>>(
|
||||
MODULES_API_URL + '/shop/cart/page',
|
||||
THINK_API_URL + '/shop/cart/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export async function pageCart(params: CartParam) {
|
||||
*/
|
||||
export async function listCart(params?: CartParam) {
|
||||
const res = await request.get<ApiResult<CartVo>>(
|
||||
MODULES_API_URL + '/shop/cart',
|
||||
THINK_API_URL + '/shop/cart',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export async function listCart(params?: CartParam) {
|
||||
*/
|
||||
export async function addCart(data: Cart) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart',
|
||||
THINK_API_URL + '/shop/cart',
|
||||
data
|
||||
);
|
||||
console.log(res)
|
||||
@@ -56,7 +56,7 @@ export async function addCart(data: Cart) {
|
||||
*/
|
||||
export async function updateCart(data: Cart) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart',
|
||||
THINK_API_URL + '/shop/cart',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -70,7 +70,7 @@ export async function updateCart(data: Cart) {
|
||||
*/
|
||||
export async function removeCart(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/' + id
|
||||
THINK_API_URL + '/shop/cart/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeCart(id?: number) {
|
||||
// 按店铺ID更新选中
|
||||
export async function updateCartByMerchantId(id?: number) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/updateCartByMerchantId/' + id
|
||||
THINK_API_URL + '/shop/cart/updateCartByMerchantId/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -93,7 +93,7 @@ export async function updateCartByMerchantId(id?: number) {
|
||||
// 全选操作
|
||||
export async function onSelectAll(yes: Boolean) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/onSelectAll/' + yes
|
||||
THINK_API_URL + '/shop/cart/onSelectAll/' + yes
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
@@ -105,7 +105,7 @@ export async function onSelectAll(yes: Boolean) {
|
||||
* 批量修改
|
||||
*/
|
||||
export async function updateBatchCart(data: Cart[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(MODULES_API_URL + '/shop/cart/batch', data);
|
||||
const res = await request.put<ApiResult<unknown>>(THINK_API_URL + '/shop/cart/batch', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ export async function updateBatchCart(data: Cart[]) {
|
||||
*/
|
||||
export async function removeBatchCart(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/cart/batch',
|
||||
THINK_API_URL + '/shop/cart/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -131,7 +131,7 @@ export async function removeBatchCart(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getCart(id: number) {
|
||||
const res = await request.get<ApiResult<Cart>>(
|
||||
MODULES_API_URL + '/shop/cart/' + id
|
||||
THINK_API_URL + '/shop/cart/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
@@ -144,7 +144,7 @@ export async function getCart(id: number) {
|
||||
*/
|
||||
export async function myCart(params: CartParam) {
|
||||
const res = await request.get<ApiResult<Merchant[]>>(
|
||||
MODULES_API_URL + '/shop/cart/myCart',
|
||||
THINK_API_URL + '/shop/cart/myCart',
|
||||
{
|
||||
params
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user