全局:清理多余的 request2.js

This commit is contained in:
YunaiV
2024-01-20 10:07:11 +08:00
parent ce389efdae
commit 492d84073d
35 changed files with 123 additions and 964 deletions
-48
View File
@@ -1,48 +0,0 @@
import request from '@/sheep/request';
export default {
myGroupon: (params) =>
request({
url: 'activity/groupon/myGroupons',
method: 'GET',
params,
}),
getGrouponList: (params) =>
request({
url: 'activity/groupon',
method: 'GET',
params,
}),
grouponDetail: (id) =>
request({
url: 'activity/groupon/' + id,
method: 'GET',
}),
activity: (id) =>
request({
url: 'activity/activity/' + id,
method: 'GET',
}),
getSummary: () =>
request({
url: '/app-api/member/sign-in/record/get-summary',
method: 'GET',
}),
getBargainRecordSummary: () =>
request({
url: '/app-api/promotion/bargain-record/get-summary',
method: 'GET',
}),
getBargainActivityPage: () =>
request({
url: '/app-api/promotion/bargain-activity/page',
method: 'GET',
}),
getBargainActivityDetail: (params) =>
request({
url: '/app-api/promotion/bargain-activity/get-detail',
method: 'GET',
params
}),
};
-42
View File
@@ -1,42 +0,0 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
list: (data) =>
request2({
url: 'trade/cart/list',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
}),
append: (data) =>
request({
url: 'cart',
method: 'POST',
custom: {
showSuccess: true,
successMsg: '已添加到购物车~',
},
data: {
...data,
type: 'inc',
},
}),
// 删除购物车
delete: (ids) =>
request2({
url: 'trade/cart/delete?ids=' + ids,
method: 'DELETE',
}),
update: (data) =>
request2({
url: 'trade/cart/update-count',
method: 'PUT',
data: {
...data,
type: 'cover',
},
}),
};
-10
View File
@@ -1,10 +0,0 @@
import request2 from '@/sheep/request2';
export default {
list: (params) =>
request2({
url: 'product/category/list',
method: 'GET',
params,
}),
};
-29
View File
@@ -1,29 +0,0 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 我的拼团
list: (params) =>
request({
url: 'coupon',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
detail: (id, user_coupon_id) =>
request({
url: 'coupon/' + id,
method: 'GET',
params: {
user_coupon_id,
},
}),
get: (id) =>
request({
url: 'coupon/get/' + id,
method: 'POST',
}),
};
-58
View File
@@ -1,58 +0,0 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 商品详情
detail: (id, params = {}) =>
request2({
url: 'product/spu/get-detail?id=' + id,
method: 'GET',
params,
custom: {
showLoading: false,
showError: false,
},
}),
// 商品列表
list: (params) =>
request2({
url: 'product/spu/page',
method: 'GET',
params,
custom: {
showLoading: false,
showError: false,
},
}),
// 商品查询
ids: (params = {}) =>
request({
url: 'goods/goods/ids',
method: 'GET',
params,
custom: {
showLoading: false,
showError: false,
},
}),
// 商品查询
activity: (params = {}) =>
request({
url: 'goods/goods/activity',
method: 'GET',
params,
custom: {
showLoading: false,
showError: false,
},
}),
activityList: (params = {}) =>
request({
url: 'goods/goods/activityList',
method: 'GET',
params,
}),
};
@@ -1,12 +1,7 @@
import request from '@/sheep/request';
// TODO 芋艿:小程序直播还不支持
export default {
// 自定义页面
page: (id) =>
request({
url: 'page/' + id,
method: 'GET',
}),
//小程序直播
mplive: {
getRoomList: (ids) =>
@@ -1,5 +1,6 @@
import request from '@/sheep/request';
// TODO 芋艿:暂不支持 socket 聊天
export default {
// 获取聊天token
unifiedToken: () =>
@@ -7,7 +7,4 @@ Object.keys(files).forEach((key) => {
};
});
// TODO 芋艿:直接在 useModal 引入 AuthUtil 会报错,所以采用这用这方式先
api.AuthUtil = import.meta.globEager('./member/auth.js')['./member/auth.js'].default;
export default api;
+44
View File
@@ -0,0 +1,44 @@
import request from '@/sheep/request';
import { baseUrl, apiPath } from '@/sheep/config';
export default {
// 微信相关
wechat: {
// 小程序订阅消息
subscribeTemplate: (params) =>
request({
url: 'third/wechat/subscribeTemplate',
method: 'GET',
params: {
platform: 'miniProgram',
},
custom: {
showError: false,
showLoading: false,
},
}),
// 获取微信小程序码
getWxacode: (path) =>
`${baseUrl}${apiPath}third/wechat/wxacode?platform=miniProgram&payload=${encodeURIComponent(
JSON.stringify({
path,
}),
)}`,
},
// 苹果相关
apple: {
// 第三方登录
login: (data) =>
request({
url: 'third/apple/login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
}),
},
};
-186
View File
@@ -1,186 +0,0 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 订单详情
detail: (id, params) =>
request2({
url: 'trade/order/get-detail?id=' + id,
method: 'GET',
params,
}),
// detail: (id, params) =>
// request({
// url: 'order/order/' + id,
// method: 'GET',
// params,
// }),
// 获取支付结果
payResult: (id) =>
request({
url: 'order/order/' + id,
method: 'GET',
custom: {
showLoading: false,
},
}),
itemDetail: (id, itemId) =>
request({
url: 'order/order/itemDetail/' + id + '/' + itemId,
method: 'GET',
custom: {
showLoading: false,
},
}),
// 订单列表
list: (params) =>
request2({
url: 'trade/order/page',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
// list: (params) =>
// request({
// url: 'order/order',
// method: 'GET',
// params,
// custom: {
// showLoading: false,
// },
// }),
// 计算订单信息
calc: (data) => {
const data2 = {
...data,
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items
for (let i = 0; i < data.items.length; i++) {
// data2['items[' + i + '' + '].skuId'] = data.items[i].skuId + '';
// data2['items[' + i + '' + '].count'] = data.items[i].count + '';
// data2['items[' + i + '' + '].cartId'] = data.items[i].cartId + '';
data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + '';
data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + '';
data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
}
console.log(data2, '对比数据')
return request2({
url: 'trade/order/settlement',
method: 'GET',
// data,
params: data2
})
},
// calc: (data) =>
// request({
// url: 'order/order/calc',
// method: 'POST',
// data,
// }),
// 创建订单
create: (data) =>
request({
url: 'order/order/create',
method: 'POST',
data,
}),
//订单可用优惠券
coupons: (data) =>
request({
url: 'order/order/coupons',
method: 'POST',
data,
}),
// 确认收货
confirm: (id) =>
request({
url: 'order/order/confirm/' + id,
method: 'PUT',
}),
// 评价订单
comment: (data) =>
request2({
url: 'trade/order/item/create-comment',
method: 'POST',
data,
}),
// comment: (id, data) =>
// request({
// url: 'order/order/comment/' + id,
// method: 'POST',
// data,
// }),
// 申请退款
applyRefund: (id) =>
request({
url: 'order/order/applyRefund/' + id,
method: 'PUT',
}),
// 取消订单
cancel: (id) =>
request({
url: 'order/order/cancel/' + id,
method: 'PUT',
}),
// 删除订单
delete: (id) =>
request({
url: 'order/order/' + id,
method: 'DELETE',
}),
// 售后
aftersale: {
// 申请售后
apply: (data) =>
request({
url: 'order/aftersale',
method: 'POST',
data,
}),
list: (params) =>
request2({
url: 'trade/after-sale/page',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
// list: (params) =>
// request({
// url: 'order/aftersale',
// method: 'GET',
// params,
// custom: {
// showLoading: false,
// },
// }),
//取消售后
cancel: (id) =>
request({
url: 'order/aftersale/cancel/' + id,
method: 'PUT',
}),
//删除售后单
delete: (id) =>
request({
url: 'order/aftersale/' + id,
method: 'DELETE',
}),
// 售后详情
detail: (id) =>
request2({
url: 'trade/after-sale/get?id=' + id,
method: 'GET',
}),
},
//订单包裹
express: (id, orderId) =>
request({
url: 'order/express/' + id + `${orderId ? '/' + orderId : ''}`,
method: 'GET',
}),
};
+2 -2
View File
@@ -1,9 +1,9 @@
import request2 from '@/sheep/request2';
import request from '@/sheep/request';
const ActivityApi = {
// 获得单个商品,近期参与的每个活动
getActivityListBySpuId: (spuId) => {
return request2({
return request({
url: '/app-api/promotion/activity/list-by-spu-id',
method: 'GET',
params: {
+28
View File
@@ -0,0 +1,28 @@
import request from '@/sheep/request';
const BargainApi = {
// 获得砍价记录的概要信息
getBargainRecordSummary: () => {
return request({
url: '/app-api/promotion/bargain-record/get-summary',
method: 'GET',
});
},
// 获得砍价活动分页
getBargainActivityPage: () => {
return request({
url: '/app-api/promotion/bargain-activity/page',
method: 'GET',
});
},
// 获得砍价活动详情
getBargainActivityDetail(params) {
return request({
url: '/app-api/promotion/bargain-activity/get-detail',
method: 'GET',
params,
});
},
};
export default BargainApi;
+5 -5
View File
@@ -1,19 +1,19 @@
import request2 from "@/sheep/request2";
import request from "@/sheep/request";
const SeckillApi = {
// 获得秒杀时间段列表
getSeckillConfigList: () => {
return request2({ url: 'promotion/seckill-config/list', method: 'GET' });
return request({ url: 'promotion/seckill-config/list', method: 'GET' });
},
// 获得当前秒杀活动
getNowSeckillActivity: () => {
return request2({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
return request({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
},
// 获得秒杀活动分页
getSeckillActivityPage: (params) => {
return request2({ url: 'promotion/seckill-activity/page', method: 'GET', params });
return request({ url: 'promotion/seckill-activity/page', method: 'GET', params });
},
/**
@@ -22,7 +22,7 @@ const SeckillApi = {
* @return {*}
*/
getSeckillActivity: (id) => {
return request2({
return request({
url: 'promotion/seckill-activity/get-detail',
method: 'GET',
params: { id }
-103
View File
@@ -1,103 +0,0 @@
import request from '@/sheep/request';
import { baseUrl, apiPath } from '@/sheep/config';
export default {
// 微信相关
wechat: {
// 第三方登录
login: (data) =>
request({
url: 'third/wechat/login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
}),
// 绑定微信
bind: (data) =>
request({
url: 'third/wechat/bind',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '绑定中',
},
}),
// 公众号授权
oauthLogin: (data) =>
request({
url: 'third/wechat/oauthLogin',
method: 'GET',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
}),
// 获取小程序sessionKey(后端不会给前端返回真实的sessionKey)
getSessionId: (data) =>
request({
url: 'third/wechat/getSessionId',
method: 'POST',
data,
custom: {
showLoading: false,
},
}),
// 微信小程序 绑定一键获取的手机号
bindUserPhoneNumber: (data) =>
request({
url: 'third/wechat/bindUserPhoneNumber',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '获取中',
},
}),
// 小程序订阅消息
subscribeTemplate: (params) =>
request({
url: 'third/wechat/subscribeTemplate',
method: 'GET',
params: {
platform: 'miniProgram',
},
custom: {
showError: false,
showLoading: false,
},
}),
// 获取微信小程序码
getWxacode: (path) =>
`${baseUrl}${apiPath}third/wechat/wxacode?platform=miniProgram&payload=${encodeURIComponent(
JSON.stringify({
path,
}),
)}`,
},
// 苹果相关
apple: {
// 第三方登录
login: (data) =>
request({
url: 'third/apple/login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
}),
},
};
-23
View File
@@ -1,23 +0,0 @@
import request from '@/sheep/request';
export default {
order: (id) =>
request({
url: 'trade/order/' + id,
method: 'GET',
custom: {
showLoading: false,
},
}),
orderLog: (params) =>
request({
url: 'trade/order',
method: 'GET',
params,
custom: {
showLoading: false,
},
}),
};
+11
View File
@@ -1,6 +1,17 @@
import request from '@/sheep/request';
const AfterSaleApi = {
// 获得售后分页
getAfterSalePage: (params) => {
return request({
url: `/app-api/trade/after-sale/page`,
method: 'GET',
params,
custom: {
showLoading: false,
},
});
},
// 创建售后
createAfterSale: (data) => {
return request({
-168
View File
@@ -1,168 +0,0 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
import $platform from '@/sheep/platform';
export default {
// 添加分享记录
addShareLog: (data) =>
request({
url: 'share/add',
method: 'POST',
data,
custom: {
showError: false,
},
}),
share: {
list: (params) =>
request({
url: 'share/list',
method: 'GET',
params,
}),
},
address: {
default: () =>
request2({
url: 'member/address/get-default',
method: 'GET',
custom: {
showError: false,
},
}),
list: () =>
request2({
url: 'member/address/list',
method: 'GET',
custom: {},
}),
create: (data) =>
request2({
url: 'member/address/create',
method: 'POST',
data,
custom: {
showSuccess: true,
},
}),
update: (data) =>
request2({
url: 'member/address/update',
method: 'PUT',
data,
custom: {
showSuccess: true,
},
}),
detail: (id) =>
request2({
url: 'member/address/get?id=' + id,
method: 'GET',
}),
delete: (id) =>
request2({
url: 'member/address/delete?id=' + id,
method: 'DELETE',
}),
},
favorite: {
list: (params) =>
request2({
url: 'product/favorite/page',
method: 'GET',
params,
}),
do: (id) =>
request({
url: 'user/goodsLog/favorite',
method: 'POST',
data: {
goods_id: id,
},
custom: {
showSuccess: true,
auth: true,
},
}),
// 取消收藏
cancel: (id) =>
request2({
url: 'product/favorite/delete-list',
method: 'DELETE',
data: {
spuIds: id.split(',').map(item => item * 1),
// spuIds: id.split(',').join(','),
},
custom: {
showSuccess: true,
auth: true,
},
}),
// cancel: (id) =>
// request({
// url: 'user/goodsLog/favorite',
// method: 'POST',
// data: {
// goods_ids: id,
// },
// custom: {
// showSuccess: true,
// auth: true,
// },
// }),
},
view: {
list: (params) =>
request({
url: 'user/goodsLog/views',
method: 'GET',
params,
custom: {},
}),
delete: (data) =>
request({
url: 'user/goodsLog/viewDel',
method: 'DELETE',
data,
custom: {
showSuccess: true,
},
}),
},
wallet: {
log: (params) =>
request2({
// url: 'member/point/record/page',
url: 'pay/wallet-transaction/page',
method: 'GET',
params,
custom: {},
}),
},
account: {
info: (params) =>
request({
url: 'user/account',
method: 'GET',
params,
custom: {
showError: false,
auth: true,
},
}),
save: (data) =>
request({
url: 'user/account',
method: 'POST',
data,
custom: {
showSuccess: true,
auth: true,
},
}),
}
};