项目初始化

This commit is contained in:
jerry
2025-01-21 01:46:34 +08:00
parent 364021b042
commit 48153e7761
962 changed files with 172070 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
import request from '@/sheep/request';
const ImConversationApi = {
// 获得会话列表
getMemberConversationPage: (params) => {
return request({
url: '/im/member-conversation/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
getRandomMemberConversation: () => {
return request({
url: '/im/member-conversation/getRandom',
method: 'GET',
custom: {
auth: true,
showLoading: false,
},
});
},
// 创建会话
createMemberConversation: (data) => {
return request({
url: '/im/member-conversation/create',
method: 'POST',
data,
custom: {
auth: true,
showLoading: false,
},
});
},
// 删除会话
deleteMemberConversation: (id) => {
return request({
url: '/im/member-conversation/delete',
method: 'DELETE',
params: {
id
},
custom: {
auth: true,
showLoading: false,
},
});
},
// 拉黑
slashedMemberConversation: (id) => {
return request({
url: '/im/member-conversation/slashed',
method: 'DELETE',
params: {
id
},
custom: {
auth: true,
showLoading: false,
},
});
},
// 置顶会话
pinnedMemberConversation: (data) => {
return request({
url: '/im/member-conversation/pinned',
method: 'PUT',
data,
custom: {
auth: true,
showLoading: false,
},
});
},
};
export default ImConversationApi;

View File

@@ -0,0 +1,44 @@
import request from '@/sheep/request';
const ImMessageApi = {
// 获得消息列表
getMemberMessagePage: (params) => {
return request({
url: '/im/member-message/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
// 更新消息已读
updateReadStatus: (messageId) => {
return request({
url: '/im/member-message/update-read-status',
method: 'POST',
params: { messageId },
custom: {
auth: true,
showLoading: false,
},
});
},
// 发送消息
sendImMessage: (data) => {
return request({
url: '/im/member-message/send',
method: 'POST',
data,
custom: {
auth: true,
showLoading: false,
showSuccess: false,
successMsg: '保存成功'
},
});
},
};
export default ImMessageApi;

45
sheep/api/infra/file.js Normal file
View File

@@ -0,0 +1,45 @@
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
const FileApi = {
// 上传文件
uploadFile: (file) => {
// TODO 芋艿:访问令牌的接入;
const token = uni.getStorageSync('token');
uni.showLoading({
title: '上传中',
});
return new Promise((resolve, reject) => {
uni.uploadFile({
url: baseUrl + apiPath + '/infra/file/upload',
filePath: file,
name: 'file',
header: {
// Accept: 'text/json',
Accept: '*/*',
'tenant-id': tenantId,
// Authorization: 'Bearer test247',
},
success: (uploadFileRes) => {
let result = JSON.parse(uploadFileRes.data);
if (result.error === 1) {
uni.showToast({
icon: 'none',
title: result.msg,
});
} else {
return resolve(result);
}
},
fail: (error) => {
console.log('上传失败:', error);
return resolve(false);
},
complete: () => {
uni.hideLoading();
},
});
});
},
};
export default FileApi;

View File

@@ -0,0 +1,53 @@
import request from '@/sheep/request';
const AddressApi = {
// 获得用户收件地址列表
getAddressList: () => {
return request({
url: '/member/address/list',
method: 'GET'
});
},
// 创建用户收件地址
createAddress: (data) => {
return request({
url: '/member/address/create',
method: 'POST',
data,
custom: {
showSuccess: true,
successMsg: '保存成功'
},
});
},
// 更新用户收件地址
updateAddress: (data) => {
return request({
url: '/member/address/update',
method: 'PUT',
data,
custom: {
showSuccess: true,
successMsg: '更新成功'
},
});
},
// 获得用户收件地址
getAddress: (id) => {
return request({
url: '/member/address/get',
method: 'GET',
params: { id }
});
},
// 删除用户收件地址
deleteAddress: (id) => {
return request({
url: '/member/address/delete',
method: 'DELETE',
params: { id }
});
},
};
export default AddressApi;

132
sheep/api/member/auth.js Normal file
View File

@@ -0,0 +1,132 @@
import request from '@/sheep/request';
const AuthUtil = {
// 使用手机 + 密码登录
login: (data) => {
return request({
url: '/member/auth/login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登录中',
successMsg: '登录成功',
},
});
},
// 使用手机 + 验证码登录
smsLogin: (data) => {
return request({
url: '/member/auth/sms-login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登录中',
successMsg: '登录成功',
},
});
},
// 发送手机验证码
sendSmsCode: (mobile, scene) => {
return request({
url: '/member/auth/send-sms-code',
method: 'POST',
data: {
mobile,
scene,
},
custom: {
loadingMsg: '发送中',
showSuccess: true,
successMsg: '发送成功',
},
});
},
// 登出系统
logout: () => {
return request({
url: '/member/auth/logout',
method: 'POST',
});
},
// 刷新令牌
refreshToken: (refreshToken) => {
return request({
url: '/member/auth/refresh-token',
method: 'POST',
params: {
refreshToken
},
custom: {
loading: false, // 不用加载中
showError: false, // 不展示错误提示
},
});
},
// 社交授权的跳转
socialAuthRedirect: (type, redirectUri) => {
return request({
url: '/member/auth/social-auth-redirect',
method: 'GET',
params: {
type,
redirectUri,
},
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
});
},
// 社交快捷登录
socialLogin: (type, code, state) => {
return request({
url: '/member/auth/social-login',
method: 'POST',
data: {
type,
code,
state,
},
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
});
},
// 微信小程序的一键登录
weixinMiniAppLogin: (phoneCode, loginCode, state) => {
return request({
url: '/member/auth/weixin-mini-app-login',
method: 'POST',
data: {
phoneCode,
loginCode,
state
},
custom: {
showSuccess: true,
loadingMsg: '登陆中',
successMsg: '登录成功',
},
});
},
// 创建微信 JS SDK 初始化所需的签名
createWeixinMpJsapiSignature: (url) => {
return request({
url: '/member/auth/create-weixin-jsapi-signature',
method: 'POST',
params: {
url
},
custom: {
showError: false,
showLoading: false,
},
})
},
//
};
export default AuthUtil;

19
sheep/api/member/point.js Normal file
View File

@@ -0,0 +1,19 @@
import request from '@/sheep/request';
const PointApi = {
// 获得用户积分记录分页
getPointRecordPage: (params) => {
if (params.addStatus === undefined) {
delete params.addStatus
}
const queryString = Object.keys(params)
.map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&');
return request({
url: `/member/point/record/page?${queryString}`,
method: 'GET',
});
}
};
export default PointApi;

View File

@@ -0,0 +1,37 @@
import request from '@/sheep/request';
const SignInApi = {
// 获得签到规则列表
getSignInConfigList: () => {
return request({
url: '/member/sign-in/config/list',
method: 'GET',
});
},
// 获得个人签到统计
getSignInRecordSummary: () => {
return request({
url: '/member/sign-in/record/get-summary',
method: 'GET',
});
},
// 签到
createSignInRecord: () => {
return request({
url: '/member/sign-in/record/create',
method: 'POST',
});
},
// 获得签到记录分页
getSignRecordPage: (params) => {
const queryString = Object.keys(params)
.map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&');
return request({
url: `/member/sign-in/record/page?${queryString}`,
method: 'GET',
});
},
};
export default SignInApi;

View File

@@ -0,0 +1,76 @@
import request from '@/sheep/request';
const SocialApi = {
// 获得社交用户
getSocialUser: (type) => {
return request({
url: '/member/social-user/get',
method: 'GET',
params: {
type
},
custom: {
showLoading: false,
},
});
},
// 社交绑定
socialBind: (type, code, state) => {
return request({
url: '/member/social-user/bind',
method: 'POST',
data: {
type,
code,
state
},
custom: {
custom: {
showSuccess: true,
loadingMsg: '绑定中',
successMsg: '绑定成功',
},
},
});
},
// 社交绑定
socialUnbind: (type, openid) => {
return request({
url: '/member/social-user/unbind',
method: 'DELETE',
data: {
type,
openid
},
custom: {
showLoading: false,
loadingMsg: '解除绑定',
successMsg: '解绑成功',
},
});
},
// 获取订阅消息模板列表
getSubscribeTemplateList: () =>
request({
url: '/member/social-user/get-subscribe-template-list',
method: 'GET',
custom: {
showError: false,
showLoading: false,
},
}),
// 获取微信小程序码
getWxaQrcode: async (path, query) => {
return await request({
url: '/member/social-user/wxa-qrcode',
method: 'POST',
data: {
scene: query,
path,
checkPath: false, // TODO 开发环境暂不检查 path 是否存在
},
});
},
};
export default SocialApi;

166
sheep/api/member/user.js Normal file
View File

@@ -0,0 +1,166 @@
import request from '@/sheep/request';
const UserApi = {
// 获取会员列表
getUserPage: (params) => {
return request({
url: '/member/user/page',
method: 'GET',
params,
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得基本信息
getUserInfo: () => {
return request({
url: '/member/user/get',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
// 获得榜单信息
getWeekTopList: () => {
return request({
url: '/member/user/getWeekTopList',
method: 'GET',
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得首页信息
getHomeData: () => {
return request({
url: '/member/user/getHomeData',
method: 'GET',
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得基本信息
getUserInfoById: (id) => {
return request({
url: '/member/user/getByUserId',
method: 'GET',
params: { id },
custom: {
showLoading: false,
auth: false,
},
});
},
// 交换名片
getQrcodeByUserId: (id) => {
return request({
url: '/member/user/getQrcodeByUserId',
method: 'GET',
params: { id },
custom: {
showLoading: false,
auth: true,
},
});
},
// 判断是否关注公众号
getQrcode: () => {
return request({
url: '/mp/user/getQrcode',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
// 修改基本信息
updateUser: (data) => {
return request({
url: '/member/user/update',
method: 'PUT',
data,
custom: {
auth: true,
showSuccess: true,
successMsg: '更新成功'
},
});
},
// 首页置顶
slashed: () => {
return request({
url: '/member/user/slashed',
method: 'PUT',
custom: {
auth: true,
showSuccess: true,
successMsg: '置顶成功'
},
});
},
// 修改用户手机
updateUserMobile: (data) => {
return request({
url: '/member/user/update-mobile',
method: 'PUT',
data,
custom: {
loadingMsg: '验证中',
showSuccess: true,
successMsg: '修改成功'
},
});
},
// 基于微信小程序的授权码,修改用户手机
updateUserMobileByWeixin: (code) => {
return request({
url: '/member/user/update-mobile-by-weixin',
method: 'PUT',
data: {
code
},
custom: {
showSuccess: true,
loadingMsg: '获取中',
successMsg: '修改成功'
},
});
},
// 修改密码
updateUserPassword: (data) => {
return request({
url: '/member/user/update-password',
method: 'PUT',
data,
custom: {
loadingMsg: '验证中',
showSuccess: true,
successMsg: '修改成功'
},
});
},
// 重置密码
resetUserPassword: (data) => {
return request({
url: '/member/user/reset-password',
method: 'PUT',
data,
custom: {
loadingMsg: '验证中',
showSuccess: true,
successMsg: '修改成功'
}
});
},
};
export default UserApi;

View File

@@ -0,0 +1,21 @@
import request from '@/sheep/request';
// TODO 芋艿:小程序直播还不支持
export default {
//小程序直播
mplive: {
getRoomList: (ids) =>
request({
url: 'app/mplive/getRoomList',
method: 'GET',
params: {
ids: ids.join(','),
}
}),
getMpLink: () =>
request({
url: 'app/mplive/getMpLink',
method: 'GET'
}),
},
};

View File

@@ -0,0 +1,10 @@
const files = import.meta.glob('./*.js', { eager: true });
let api = {};
Object.keys(files).forEach((key) => {
api = {
...api,
[key.replace(/(.*\/)*([^.]+).*/gi, '$2')]: files[key].default,
};
});
export default api;

View File

@@ -0,0 +1,18 @@
import request from '@/sheep/request';
export default {
// 苹果相关
apple: {
// 第三方登录
login: (data) =>
request({
url: 'third/apple/login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
}),
},
};

14
sheep/api/pay/channel.js Normal file
View File

@@ -0,0 +1,14 @@
import request from '@/sheep/request';
const PayChannelApi = {
// 获得指定应用的开启的支付渠道编码列表
getEnableChannelCodeList: (appId) => {
return request({
url: '/pay/channel/get-enable-code-list',
method: 'GET',
params: { appId }
});
},
};
export default PayChannelApi;

22
sheep/api/pay/order.js Normal file
View File

@@ -0,0 +1,22 @@
import request from '@/sheep/request';
const PayOrderApi = {
// 获得支付订单
getOrder: (id) => {
return request({
url: '/pay/order/get',
method: 'GET',
params: { id }
});
},
// 提交支付订单
submitOrder: (data) => {
return request({
url: '/pay/order/submit',
method: 'POST',
data
});
}
};
export default PayOrderApi;

37
sheep/api/pay/point.js Normal file
View File

@@ -0,0 +1,37 @@
import request from '@/sheep/request';
const PayPointApi = {
// 获得钱包充值套餐列表
getPointRechargePackageList: () => {
return request({
url: '/pay/point-recharge-package/list',
method: 'GET',
custom: {
showError: false,
showLoading: false,
},
});
},
// 创建钱包充值记录(发起充值)
createPointRecharge: (data) => {
return request({
url: '/pay/point-recharge/create',
method: 'POST',
data,
});
},
// 获得钱包充值记录分页
getPointRechargePage: (params) => {
return request({
url: '/pay/point-recharge/page',
method: 'GET',
params,
custom: {
showError: false,
showLoading: false,
},
});
},
};
export default PayPointApi;

68
sheep/api/pay/wallet.js Normal file
View File

@@ -0,0 +1,68 @@
import request from '@/sheep/request';
const PayWalletApi = {
// 获取钱包
getPayWallet() {
return request({
url: '/pay/wallet/get',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
// 获得钱包流水分页
getWalletTransactionPage: (params) => {
const queryString = Object.keys(params)
.map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&');
return request({
url: `/pay/wallet-transaction/page?${queryString}`,
method: 'GET',
});
},
// 获得钱包流水统计
getWalletTransactionSummary: (params) => {
const queryString = `createTime=${params.createTime[0]}&createTime=${params.createTime[1]}`;
return request({
url: `/pay/wallet-transaction/get-summary?${queryString}`,
// url: `/pay/wallet-transaction/get-summary`,
method: 'GET',
// params: params
});
},
// 获得钱包充值套餐列表
getWalletRechargePackageList: () => {
return request({
url: '/pay/wallet-recharge-package/list',
method: 'GET',
custom: {
showError: false,
showLoading: false,
},
});
},
// 创建钱包充值记录(发起充值)
createWalletRecharge: (data) => {
return request({
url: '/pay/wallet-recharge/create',
method: 'POST',
data,
});
},
// 获得钱包充值记录分页
getWalletRechargePage: (params) => {
return request({
url: '/pay/wallet-recharge/page',
method: 'GET',
params,
custom: {
showError: false,
showLoading: false,
},
});
},
};
export default PayWalletApi;

View File

@@ -0,0 +1,21 @@
import request from '@/sheep/request';
const CategoryApi = {
// 查询分类列表
getCategoryList: () => {
return request({
url: '/product/category/list',
method: 'GET',
});
},
// 查询分类列表,指定编号
getCategoryListByIds: (ids) => {
return request({
url: '/product/category/list-by-ids',
method: 'GET',
params: { ids },
});
},
};
export default CategoryApi;

View File

@@ -0,0 +1,22 @@
import request from '@/sheep/request';
const CommentApi = {
// 获得商品评价分页
getCommentPage: (spuId, pageNo, pageSize, type) => {
return request({
url: '/product/comment/page',
method: 'GET',
params: {
spuId,
pageNo,
pageSize,
type,
},
custom: {
showLoading: false,
showError: false,
},
});
},
};
export default CommentApi;

View File

@@ -0,0 +1,54 @@
import request from '@/sheep/request';
const FavoriteApi = {
// 获得商品收藏分页
getFavoritePage: (data) => {
return request({
url: '/product/favorite/page',
method: 'GET',
params: data,
});
},
// 检查是否收藏过商品
isFavoriteExists: (spuId) => {
return request({
url: '/product/favorite/exits',
method: 'GET',
params: {
spuId,
},
});
},
// 添加商品收藏
createFavorite: (spuId) => {
return request({
url: '/product/favorite/create',
method: 'POST',
data: {
spuId,
},
custom: {
auth: true,
showSuccess: true,
successMsg: '收藏成功',
},
});
},
// 取消商品收藏
deleteFavorite: (spuId) => {
return request({
url: '/product/favorite/delete',
method: 'DELETE',
data: {
spuId,
},
custom: {
auth: true,
showSuccess: true,
successMsg: '取消成功',
},
});
},
};
export default FavoriteApi;

View File

@@ -0,0 +1,39 @@
import request from '@/sheep/request';
const SpuHistoryApi = {
// 删除商品浏览记录
deleteBrowseHistory: (spuIds) => {
return request({
url: '/product/browse-history/delete',
method: 'DELETE',
data: { spuIds },
custom: {
showSuccess: true,
successMsg: '删除成功',
},
});
},
// 清空商品浏览记录
cleanBrowseHistory: () => {
return request({
url: '/product/browse-history/clean',
method: 'DELETE',
custom: {
showSuccess: true,
successMsg: '清空成功',
},
});
},
// 获得商品浏览记录分页
getBrowseHistoryPage: (data) => {
return request({
url: '/product/browse-history/page',
method: 'GET',
data,
custom: {
showLoading: false
},
});
},
};
export default SpuHistoryApi;

41
sheep/api/product/spu.js Normal file
View File

@@ -0,0 +1,41 @@
import request from '@/sheep/request';
const SpuApi = {
// 获得商品 SPU 列表
getSpuListByIds: (ids) => {
return request({
url: '/product/spu/list-by-ids',
method: 'GET',
params: { ids },
custom: {
showLoading: false,
showError: false,
},
});
},
// 获得商品 SPU 分页
getSpuPage: (params) => {
return request({
url: '/product/spu/page',
method: 'GET',
params,
custom: {
showLoading: false,
showError: false,
},
});
},
// 查询商品
getSpuDetail: (id) => {
return request({
url: '/product/spu/get-detail',
method: 'GET',
params: { id },
custom: {
showLoading: false,
showError: false,
},
});
},
};
export default SpuApi;

View File

@@ -0,0 +1,16 @@
import request from '@/sheep/request';
const ActivityApi = {
// 获得单个商品,近期参与的每个活动
getActivityListBySpuId: (spuId) => {
return request({
url: '/promotion/activity/list-by-spu-id',
method: 'GET',
params: {
spuId,
},
});
},
};
export default ActivityApi;

View File

@@ -0,0 +1,12 @@
import request from '@/sheep/request';
export default {
// 获得文章详情
getArticle: (id, title) => {
return request({
url: '/promotion/article/get',
method: 'GET',
params: { id, title }
});
}
}

View File

@@ -0,0 +1,68 @@
import request from '@/sheep/request';
// 拼团 API
const CombinationApi = {
// 获得拼团活动分页
getCombinationActivityPage: (params) => {
return request({
url: '/promotion/combination-activity/page',
method: 'GET',
params,
});
},
// 获得拼团活动明细
getCombinationActivity: (id) => {
return request({
url: '/promotion/combination-activity/get-detail',
method: 'GET',
params: {
id,
},
});
},
// 获得最近 n 条拼团记录(团长发起的)
getHeadCombinationRecordList: (activityId, status, count) => {
return request({
url: '/promotion/combination-record/get-head-list',
method: 'GET',
params: {
activityId,
status,
count,
},
});
},
// 获得我的拼团记录分页
getCombinationRecordPage: (params) => {
return request({
url: "/promotion/combination-record/page",
method: 'GET',
params
});
},
// 获得拼团记录明细
getCombinationRecordDetail: (id) => {
return request({
url: '/promotion/combination-record/get-detail',
method: 'GET',
params: {
id,
},
});
},
// 获得拼团记录的概要信息
getCombinationRecordSummary: () => {
return request({
url: '/promotion/combination-record/get-summary',
method: 'GET',
});
},
};
export default CombinationApi;

View File

@@ -0,0 +1,101 @@
import request from '@/sheep/request';
const CouponApi = {
// 获得优惠劵模板列表
getCouponTemplateListByIds: (ids) => {
return request({
url: '/promotion/coupon-template/list-by-ids',
method: 'GET',
params: { ids },
custom: {
showLoading: false, // 不展示 Loading避免领取优惠劵时不成功提示
showError: false,
},
});
},
// 获得优惠劵模版列表
getCouponTemplateList: (spuId, productScope, count) => {
return request({
url: '/promotion/coupon-template/list',
method: 'GET',
params: { spuId, productScope, count },
});
},
// 获得优惠劵模版分页
getCouponTemplatePage: (params) => {
return request({
url: '/promotion/coupon-template/page',
method: 'GET',
params,
});
},
// 获得优惠劵模版
getCouponTemplate: (id) => {
return request({
url: '/promotion/coupon-template/get',
method: 'GET',
params: { id },
});
},
// 我的优惠劵列表
getCouponPage: (params) => {
return request({
url: '/promotion/coupon/page',
method: 'GET',
params,
});
},
// 领取优惠券
takeCoupon: (templateId) => {
return request({
url: '/promotion/coupon/take',
method: 'POST',
data: { templateId },
custom: {
auth: true,
showLoading: true,
loadingMsg: '领取中',
showSuccess: true,
successMsg: '领取成功',
},
});
},
// 获得优惠劵
getCoupon: (id) => {
return request({
url: '/promotion/coupon/get',
method: 'GET',
params: { id },
});
},
// 获得未使用的优惠劵数量
getUnusedCouponCount: () => {
return request({
url: '/promotion/coupon/get-unused-count',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
// 获得匹配指定商品的优惠劵列表
getMatchCouponList: (price, spuIds, skuIds, categoryIds) => {
return request({
url: '/promotion/coupon/match-list',
method: 'GET',
params: {
price,
spuIds: spuIds.join(','),
skuIds: skuIds.join(','),
categoryIds: categoryIds.join(','),
},
custom: {
showError: false,
showLoading: false, // 避免影响 settlementOrder 结算的结果
},
});
}
};
export default CouponApi;

View File

@@ -0,0 +1,38 @@
import request from '@/sheep/request';
const DiyApi = {
getUsedDiyTemplate: () => {
return request({
url: '/promotion/diy-template/used',
method: 'GET',
custom: {
showError: false,
showLoading: false,
},
});
},
getDiyTemplate: (id) => {
return request({
url: '/promotion/diy-template/get',
method: 'GET',
params: {
id
},
custom: {
showError: false,
showLoading: false,
},
});
},
getDiyPage: (id) => {
return request({
url: '/promotion/diy-page/get',
method: 'GET',
params: {
id
}
});
},
};
export default DiyApi;

View File

@@ -0,0 +1,31 @@
import request from '@/sheep/request';
const KeFuApi = {
sendKefuMessage: (data) => {
return request({
url: '/promotion/kefu-message/send',
method: 'POST',
data,
custom: {
auth: true,
showLoading: true,
loadingMsg: '发送中',
showSuccess: true,
successMsg: '发送成功',
},
});
},
getKefuMessagePage: (params) => {
return request({
url: '/promotion/kefu-message/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
};
export default KeFuApi;

View File

@@ -0,0 +1,14 @@
import request from '@/sheep/request';
const RewardActivityApi = {
// 获得满减送活动
getRewardActivity: (id) => {
return request({
url: '/promotion/reward-activity/get',
method: 'GET',
params: { id },
});
}
};
export default RewardActivityApi;

View File

@@ -0,0 +1,33 @@
import request from "@/sheep/request";
const SeckillApi = {
// 获得秒杀时间段列表
getSeckillConfigList: () => {
return request({ url: 'promotion/seckill-config/list', method: 'GET' });
},
// 获得当前秒杀活动
getNowSeckillActivity: () => {
return request({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
},
// 获得秒杀活动分页
getSeckillActivityPage: (params) => {
return request({ url: 'promotion/seckill-activity/page', method: 'GET', params });
},
/**
* 获得秒杀活动明细
* @param {number} id 秒杀活动编号
* @return {*}
*/
getSeckillActivity: (id) => {
return request({
url: 'promotion/seckill-activity/get-detail',
method: 'GET',
params: { id }
});
}
}
export default SeckillApi;

13
sheep/api/system/area.js Normal file
View File

@@ -0,0 +1,13 @@
import request from '@/sheep/request';
const AreaApi = {
// 获得地区树
getAreaTree: () => {
return request({
url: '/system/area/tree',
method: 'GET'
});
},
};
export default AreaApi;

16
sheep/api/system/dict.js Normal file
View File

@@ -0,0 +1,16 @@
import request from '@/sheep/request';
const DictApi = {
// 根据字典类型查询字典数据信息
getDictDataListByType: (type) => {
return request({
url: `/system/dict-data/type`,
method: 'GET',
params: {
type,
},
});
},
};
export default DictApi;

View File

@@ -0,0 +1,63 @@
import request from '@/sheep/request';
const AfterSaleApi = {
// 获得售后分页
getAfterSalePage: (params) => {
return request({
url: `/trade/after-sale/page`,
method: 'GET',
params,
custom: {
showLoading: false,
},
});
},
// 创建售后
createAfterSale: (data) => {
return request({
url: `/trade/after-sale/create`,
method: 'POST',
data,
});
},
// 获得售后
getAfterSale: (id) => {
return request({
url: `/trade/after-sale/get`,
method: 'GET',
params: {
id,
},
});
},
// 取消售后
cancelAfterSale: (id) => {
return request({
url: `/trade/after-sale/cancel`,
method: 'DELETE',
params: {
id,
},
});
},
// 获得售后日志列表
getAfterSaleLogList: (afterSaleId) => {
return request({
url: `/trade/after-sale-log/list`,
method: 'GET',
params: {
afterSaleId,
},
});
},
// 退回货物
deliveryAfterSale: (data) => {
return request({
url: `/trade/after-sale/delivery`,
method: 'PUT',
data,
});
}
};
export default AfterSaleApi;

View File

@@ -0,0 +1,93 @@
import request from '@/sheep/request';
const BrokerageApi = {
// 绑定分销用户
bindBrokerageUser: (data)=>{
return request({
url: '/trade/brokerage-user/bind',
method: 'PUT',
data
});
},
// 获得个人分销信息
getBrokerageUser: () => {
return request({
url: '/trade/brokerage-user/get',
method: 'GET'
});
},
// 获得个人分销统计
getBrokerageUserSummary: () => {
return request({
url: '/trade/brokerage-user/get-summary',
method: 'GET',
});
},
// 获得分销记录分页
getBrokerageRecordPage: params => {
if (params.status === undefined) {
delete params.status
}
const queryString = Object.keys(params)
.map(key => encodeURIComponent(key) + '=' + params[key])
.join('&');
return request({
url: `/trade/brokerage-record/page?${queryString}`,
method: 'GET',
});
},
// 创建分销提现
createBrokerageWithdraw: data => {
return request({
url: '/trade/brokerage-withdraw/create',
method: 'POST',
data,
});
},
// 获得商品的分销金额
getProductBrokeragePrice: spuId => {
return request({
url: '/trade/brokerage-record/get-product-brokerage-price',
method: 'GET',
params: { spuId }
});
},
// 获得分销用户排行(基于佣金)
getRankByPrice: params => {
const queryString = `times=${params.times[0]}&times=${params.times[1]}`;
return request({
url: `/trade/brokerage-user/get-rank-by-price?${queryString}`,
method: 'GET',
});
},
// 获得分销用户排行分页(基于佣金)
getBrokerageUserChildSummaryPageByPrice: params => {
const queryString = Object.keys(params)
.map(key => encodeURIComponent(key) + '=' + params[key])
.join('&');
return request({
url: `/trade/brokerage-user/rank-page-by-price?${queryString}`,
method: 'GET',
});
},
// 获得分销用户排行分页(基于用户量)
getBrokerageUserRankPageByUserCount: params => {
const queryString = Object.keys(params)
.map(key => encodeURIComponent(key) + '=' + params[key])
.join('&');
return request({
url: `/trade/brokerage-user/rank-page-by-user-count?${queryString}`,
method: 'GET',
});
},
// 获得下级分销统计分页
getBrokerageUserChildSummaryPage: params => {
return request({
url: '/trade/brokerage-user/child-summary-page',
method: 'GET',
params,
})
}
}
export default BrokerageApi

50
sheep/api/trade/cart.js Normal file
View File

@@ -0,0 +1,50 @@
import request from '@/sheep/request';
const CartApi = {
addCart: (data) => {
return request({
url: '/trade/cart/add',
method: 'POST',
data: data,
custom: {
showSuccess: true,
successMsg: '已添加到购物车~',
}
});
},
updateCartCount: (data) => {
return request({
url: '/trade/cart/update-count',
method: 'PUT',
data: data
});
},
updateCartSelected: (data) => {
return request({
url: '/trade/cart/update-selected',
method: 'PUT',
data: data
});
},
deleteCart: (ids) => {
return request({
url: '/trade/cart/delete',
method: 'DELETE',
params: {
ids
}
});
},
getCartList: () => {
return request({
url: '/trade/cart/list',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
};
export default CartApi;

20
sheep/api/trade/config.js Normal file
View File

@@ -0,0 +1,20 @@
import request from '@/sheep/request';
const TradeConfigApi = {
// 获得交易配置
getTradeConfig: (userId) => {
return request({
url: `/trade/config/get`,
params: {
userId,
},
custom: {
auth: false,
showLoading: false,
},
method: 'GET',
});
},
};
export default TradeConfigApi;

View File

@@ -0,0 +1,31 @@
import request from '@/sheep/request';
const DeliveryApi = {
// 获得快递公司列表
getDeliveryExpressList: () => {
return request({
url: `/trade/delivery/express/list`,
method: 'get',
});
},
// 获得自提门店列表
getDeliveryPickUpStoreList: (params) => {
return request({
url: `/trade/delivery/pick-up-store/list`,
method: 'GET',
params,
});
},
// 获得自提门店
getDeliveryPickUpStore: (id) => {
return request({
url: `/trade/delivery/pick-up-store/get`,
method: 'GET',
params: {
id,
},
});
},
};
export default DeliveryApi;

247
sheep/api/trade/order.js Normal file
View File

@@ -0,0 +1,247 @@
import request from '@/sheep/request';
import { isEmpty } from '@/sheep/helper/utils';
const OrderApi = {
// 计算订单信息
settlementOrder: (data) => {
const data2 = {
...data,
};
// 移除多余字段
if (!(data.couponId > 0)) {
delete data2.couponId;
}
if (!(data.addressId > 0)) {
delete data2.addressId;
}
if (!(data.pickUpStoreId > 0)) {
delete data2.pickUpStoreId;
}
if (isEmpty(data.receiverName)) {
delete data2.receiverName;
}
if (isEmpty(data.receiverMobile)) {
delete data2.receiverMobile;
}
if (!(data.combinationActivityId > 0)) {
delete data2.combinationActivityId;
}
if (!(data.combinationHeadId > 0)) {
delete data2.combinationHeadId;
}
if (!(data.seckillActivityId > 0)) {
delete data2.seckillActivityId;
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items;
for (let i = 0; i < data.items.length; i++) {
data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
if (data.items[i].cartId) {
data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
}
}
const queryString = Object.keys(data2)
.map((key) => key + '=' + data2[key])
.join('&');
return request({
url: `/trade/order/settlement?${queryString}`,
method: 'GET',
custom: {
showError: true,
showLoading: true,
},
});
},
clerkOrder: (data) => {
const data2 = {
...data,
};
// 移除多余字段
if (!(data.couponId > 0)) {
delete data2.couponId;
}
if (!(data.addressId > 0)) {
delete data2.addressId;
}
if (!(data.pickUpStoreId > 0)) {
delete data2.pickUpStoreId;
}
if (isEmpty(data.receiverName)) {
delete data2.receiverName;
}
if (isEmpty(data.receiverMobile)) {
delete data2.receiverMobile;
}
if (!(data.combinationActivityId > 0)) {
delete data2.combinationActivityId;
}
if (!(data.combinationHeadId > 0)) {
delete data2.combinationHeadId;
}
if (!(data.seckillActivityId > 0)) {
delete data2.seckillActivityId;
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items;
for (let i = 0; i < data.items.length; i++) {
data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
if (data.items[i].cartId) {
data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
}
}
const queryString = Object.keys(data2)
.map((key) => key + '=' + data2[key])
.join('&');
return request({
url: `/trade/order/clerkOrder?${queryString}`,
method: 'GET',
custom: {
showError: true,
showLoading: true,
},
});
},
// 创建订单
createOrder: (data) => {
return request({
url: `/trade/order/create`,
method: 'POST',
data,
});
},
// 创建陪玩订单
createWorkerOrder: (data) => {
return request({
url: `/trade/order/createWorkerOrder`,
method: 'POST',
data,
});
},
// 获得订单
getOrder: (id) => {
return request({
url: `/trade/order/get-detail`,
method: 'GET',
params: {
id,
},
custom: {
showLoading: false,
},
});
},
// 订单列表
getOrderPage: (params) => {
return request({
url: '/trade/order/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
// 订单列表
getWorkerOrderPage: (params) => {
return request({
url: '/trade/order/worker/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
// 订单列表
getBlindOrderPage: (params) => {
return request({
url: '/trade/order/blind/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
// 确认收货
receiveOrder: (id) => {
return request({
url: `/trade/order/receive`,
method: 'PUT',
params: {
id,
},
});
},
// 确认接单
deliveryOrder: (id) => {
return request({
url: `/trade/order/delivery`,
method: 'PUT',
data: {
id: id,
logisticsId: 0
},
});
},
// 取消订单
cancelOrder: (id) => {
return request({
url: `/trade/order/cancel`,
method: 'DELETE',
params: {
id,
},
});
},
// 删除订单
deleteOrder: (id) => {
return request({
url: `/trade/order/delete`,
method: 'DELETE',
params: {
id,
},
});
},
// 获得交易订单的物流轨迹
getOrderExpressTrackList: (id) => {
return request({
url: `/trade/order/get-express-track-list`,
method: 'GET',
params: {
id,
},
});
},
// 获得交易订单数量
getOrderCount: () => {
return request({
url: '/trade/order/get-count',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
// 创建单个评论
createOrderItemComment: (data) => {
return request({
url: `/trade/order/item/create-comment`,
method: 'POST',
data,
custom: {
showSuccess: true,
successMsg: '评价成功'
},
});
},
};
export default OrderApi;

195
sheep/api/worker/clerk.js Normal file
View File

@@ -0,0 +1,195 @@
import request from '@/sheep/request';
const ClerkApi = {
// 创建店员申请
createClerkApply: (data) => {
return request({
url: '/worker/clerk-apply/create',
method: 'POST',
data,
custom: {
showSuccess: true,
successMsg: '提交成功'
},
});
},
// 更新店员申请
updateClerkApply: (data) => {
return request({
url: '/worker/clerk-apply/update',
method: 'PUT',
data,
custom: {
showSuccess: true,
successMsg: '提交成功'
},
});
},
// 更新店员在线状态
updateOnlineStatus: (data) => {
return request({
url: '/worker/clerk-apply/updateOnlineStatus',
method: 'PUT',
data,
custom: {
showSuccess: true,
successMsg: '提交成功'
},
});
},
// 获得店员申请
getClerkApply: (id) => {
return request({
url: '/worker/clerk-apply/get',
method: 'GET',
params: { id },
custom: {
auth: true,
showLoading: false,
},
});
},
// 获得店员等级
getClerkLevel: (id) => {
return request({
url: '/worker/clerk-apply/getClerkLevel',
method: 'GET',
params: { id },
custom: {
auth: true,
showLoading: false,
},
});
},
// 获得店员申请
getClerk: (params) => {
return request({
url: '/worker/clerk/get',
method: 'GET',
params,
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得店员盲盒
getClerkBlind: () => {
return request({
url: '/worker/clerk/getClerkBlind',
method: 'GET',
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得商品分类列表
getCategoryListByParentId: (parentId) => {
return request({
url: '/worker/category/getCategoryListByParentId',
method: 'GET',
params: { parentId },
custom: {
auth: false,
showLoading: false,
},
});
},
// 保存技能管理
saveGoodsList: (data) => {
return request({
url: '/worker/clerk-apply/save',
method: 'PUT',
data,
custom: {
showSuccess: true,
successMsg: '保存成功'
},
});
},
// 获得店员列表
getClerkPage: (params) => {
return request({
url: '/worker/clerk/page',
method: 'GET',
params,
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得店员关注列表
getClerkFansPage: (params) => {
return request({
url: '/worker/clerk-fans/page',
method: 'GET',
params,
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得首页信息
getHomeData: () => {
return request({
url: '/worker/clerk/getHomeData',
method: 'GET',
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得首页信息
getClerkList: () => {
return request({
url: '/worker/clerk/getClerkList',
method: 'GET',
custom: {
auth: true,
showLoading: false,
},
});
},
// 获得榜单信息
getWeekTopList: () => {
return request({
url: '/worker/clerk/getWeekTopList',
method: 'GET',
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得店员申请列表
getClerkApplyPage: (params) => {
return request({
url: '/worker/clerk-apply/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
// 获得商品列表
getGoodsList: (id) => {
return request({
url: '/worker/clerk-apply/list',
method: 'GET',
params: { id },
custom: {
auth: true,
showLoading: false,
},
});
},
};
export default ClerkApi;

View File

@@ -0,0 +1,60 @@
import request from '@/sheep/request';
const RewardApi = {
// 获得礼物列表
getGiftList: () => {
return request({
url: '/worker/gift/getList',
method: 'GET',
custom: {
auth: true,
showLoading: false,
},
});
},
// 获得打赏礼物列表
getRewardGiftList: (params) => {
return request({
url: '/worker/reward/getGiftList',
method: 'GET',
params: params,
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得礼物列表
getTopList: () => {
return request({
url: '/worker/reward/getTopList',
method: 'GET',
custom: {
auth: false,
showLoading: false,
},
});
},
// 创建打赏订单
createRewardOrder: (data) => {
return request({
url: `/worker/reward/createOrder`,
method: 'POST',
data,
});
},
// 获得打赏分页
getRewardPage: (params) => {
return request({
url: '/worker/reward/page',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
};
export default RewardApi;

100
sheep/api/worker/trend.js Normal file
View File

@@ -0,0 +1,100 @@
import request from '@/sheep/request';
const TrendApi = {
// 发布动态
createTrend: (data) => {
return request({
url: '/worker/trend/create',
method: 'POST',
data,
custom: {
auth: true,
showSuccess: true,
successMsg: '发布成功,请等待管理员审核'
},
});
},
// 动态点赞
createTrendLike: (data) => {
return request({
url: '/worker/trend-like/create',
method: 'POST',
data,
custom: {
auth: true,
showSuccess: false,
showLoading: false,
successMsg: '点赞成功'
},
});
},
// 删除动态
deleteTrendLike: (id) => {
return request({
url: '/worker/trend/delete',
method: 'DELETE',
params: {
id,
},
custom: {
auth: true,
showSuccess: true,
showLoading: false,
successMsg: '删除成功'
},
});
},
// 获得动态详情
getTrend: (id) => {
return request({
url: '/worker/trend/get',
method: 'GET',
params: { id },
custom: {
auth: false,
showLoading: false,
},
});
},
// 店员关注
createClerkFans: (data) => {
return request({
url: '/worker/clerk-fans/create',
method: 'POST',
data,
custom: {
auth: true,
showSuccess: false,
showLoading: false,
successMsg: '关注成功'
},
});
},
// 获得动态分页
getTrendPage: (params) => {
return request({
url: '/worker/trend/page',
method: 'GET',
params,
custom: {
auth: false,
showLoading: false,
},
});
},
// 获得动态分页
getMyTrendPage: (params) => {
return request({
url: '/worker/trend/myPage',
method: 'GET',
params,
custom: {
auth: true,
showLoading: false,
},
});
},
};
export default TrendApi;