diff --git a/src/api/mall/product/spu.ts b/src/api/mall/product/spu.ts index 2ad9bc60..6c476b8c 100644 --- a/src/api/mall/product/spu.ts +++ b/src/api/mall/product/spu.ts @@ -20,8 +20,8 @@ export interface Sku { stock?: number // 库存 weight?: number // 商品重量,单位:kg 千克 volume?: number // 商品体积,单位:m^3 平米 - subCommissionFirstPrice?: number | string // 一级分销的佣金 - subCommissionSecondPrice?: number | string // 二级分销的佣金 + firstBrokerageRecord?: number | string // 一级分销的佣金 + secondBrokerageRecord?: number | string // 二级分销的佣金 salesCount?: number // 商品销量 } diff --git a/src/api/mall/trade/brokerage/record/index.ts b/src/api/mall/trade/brokerage/record/index.ts new file mode 100644 index 00000000..7df9a225 --- /dev/null +++ b/src/api/mall/trade/brokerage/record/index.ts @@ -0,0 +1,11 @@ +import request from '@/config/axios' + +// 查询佣金记录列表 +export const getBrokerageRecordPage = async (params: any) => { + return await request.get({ url: `/trade/brokerage-record/page`, params }) +} + +// 查询佣金记录详情 +export const getBrokerageRecord = async (id: number) => { + return await request.get({ url: `/trade/brokerage-record/get?id=` + id }) +} diff --git a/src/api/mall/trade/brokerage/user/index.ts b/src/api/mall/trade/brokerage/user/index.ts new file mode 100644 index 00000000..1fed3bfa --- /dev/null +++ b/src/api/mall/trade/brokerage/user/index.ts @@ -0,0 +1,39 @@ +import request from '@/config/axios' + +export interface BrokerageUserVO { + id: number + bindUserId: number + bindUserTime: Date + brokerageEnabled: boolean + brokerageTime: Date + price: number + frozenPrice: number + + nickname: string + avatar: string +} + +// 查询分销用户列表 +export const getBrokerageUserPage = async (params: any) => { + return await request.get({ url: `/trade/brokerage-user/page`, params }) +} + +// 查询分销用户详情 +export const getBrokerageUser = async (id: number) => { + return await request.get({ url: `/trade/brokerage-user/get?id=` + id }) +} + +// 修改推广员 +export const updateBindUser = async (data: any) => { + return await request.put({ url: `/trade/brokerage-user/update-bind-user`, data }) +} + +// 清除推广员 +export const clearBindUser = async (data: any) => { + return await request.put({ url: `/trade/brokerage-user/clear-bind-user`, data }) +} + +// 修改推广资格 +export const updateBrokerageEnabled = async (data: any) => { + return await request.put({ url: `/trade/brokerage-user/update-brokerage-enable`, data }) +} diff --git a/src/api/mall/trade/brokerage/withdraw/index.ts b/src/api/mall/trade/brokerage/withdraw/index.ts new file mode 100644 index 00000000..c93286a9 --- /dev/null +++ b/src/api/mall/trade/brokerage/withdraw/index.ts @@ -0,0 +1,39 @@ +import request from '@/config/axios' + +export interface BrokerageWithdrawVO { + id: number + userId: number + price: number + feePrice: number + totalPrice: number + type: number + name: string + accountNo: string + bankName: string + bankAddress: string + accountQrCodeUrl: string + status: number + auditReason: string + auditTime: Date + remark: string +} + +// 查询佣金提现列表 +export const getBrokerageWithdrawPage = async (params: any) => { + return await request.get({ url: `/trade/brokerage-withdraw/page`, params }) +} + +// 查询佣金提现详情 +export const getBrokerageWithdraw = async (id: number) => { + return await request.get({ url: `/trade/brokerage-withdraw/get?id=` + id }) +} + +// 佣金提现 - 通过申请 +export const approveBrokerageWithdraw = async (id: number) => { + return await request.put({ url: `/trade/brokerage-withdraw/approve?id=` + id }) +} + +// 审核佣金提现 - 驳回申请 +export const rejectBrokerageWithdraw = async (data: BrokerageWithdrawVO) => { + return await request.put({ url: `/trade/brokerage-withdraw/reject`, data }) +} diff --git a/src/api/mall/trade/config/index.ts b/src/api/mall/trade/config/index.ts new file mode 100644 index 00000000..3a1771d8 --- /dev/null +++ b/src/api/mall/trade/config/index.ts @@ -0,0 +1,24 @@ +import request from '@/config/axios' + +export interface ConfigVO { + brokerageEnabled: boolean + brokerageEnabledCondition: number + brokerageBindMode: number + brokeragePostUrls: string + brokerageFirstPercent: number + brokerageSecondPercent: number + brokerageWithdrawMinPrice: number + brokerageBankNames: string + brokerageFrozenDays: number + brokerageWithdrawType: string +} + +// 查询交易中心配置详情 +export const getTradeConfig = async () => { + return await request.get({ url: `/trade/config/get` }) +} + +// 保存交易中心配置 +export const saveTradeConfig = async (data: ConfigVO) => { + return await request.put({ url: `/trade/config/save`, data }) +} diff --git a/src/api/mall/trade/order/index.ts b/src/api/mall/trade/order/index.ts index d4a22944..80669c57 100644 --- a/src/api/mall/trade/order/index.ts +++ b/src/api/mall/trade/order/index.ts @@ -51,12 +51,13 @@ export interface OrderVO { avatar?: string } // 订单操作日志 - orderLog: orderLog[] + logs?: OrderLogRespVO[] } -export interface orderLog { +export interface OrderLogRespVO { content?: string createTime?: Date + userType?: number } export interface OrderItemRespVO { diff --git a/src/api/member/experience-record/index.ts b/src/api/member/experience-record/index.ts new file mode 100644 index 00000000..6d40a48d --- /dev/null +++ b/src/api/member/experience-record/index.ts @@ -0,0 +1,22 @@ +import request from '@/config/axios' + +export interface ExperienceRecordVO { + id: number + userId: number + bizId: string + bizType: number + title: string + description: string + experience: number + totalExperience: number +} + +// 查询会员经验记录列表 +export const getExperienceRecordPage = async (params) => { + return await request.get({ url: `/member/experience-record/page`, params }) +} + +// 查询会员经验记录详情 +export const getExperienceRecord = async (id: number) => { + return await request.get({ url: `/member/experience-record/get?id=` + id }) +} diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 8d783635..6f3ded5c 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -272,3 +272,89 @@ export const PromotionDiscountTypeEnum = { name: '折扣' } } + +/** + * 分销关系绑定模式枚举 + */ +export const BrokerageBindModeEnum = { + ANYTIME: { + mode: 0, + name: '没有推广人' + }, + REGISTER: { + mode: 1, + name: '新用户' + } +} +/** + * 分佣模式枚举 + */ +export const BrokerageEnabledConditionEnum = { + ALL: { + condition: 0, + name: '人人分销' + }, + ADMIN: { + condition: 1, + name: '指定分销' + } +} +/** + * 佣金记录业务类型枚举 + */ +export const BrokerageRecordBizTypeEnum = { + ORDER: { + type: 1, + name: '获得推广佣金' + }, + WITHDRAW: { + type: 2, + name: '提现申请' + } +} +/** + * 佣金提现状态枚举 + */ +export const BrokerageWithdrawStatusEnum = { + AUDITING: { + status: 0, + name: '审核中' + }, + AUDIT_SUCCESS: { + status: 10, + name: '审核通过' + }, + AUDIT_FAIL: { + status: 20, + name: '审核不通过' + }, + WITHDRAW_SUCCESS: { + status: 11, + name: '提现成功' + }, + WITHDRAW_FAIL: { + status: 21, + name: '提现失败' + } +} +/** + * 佣金提现类型枚举 + */ +export const BrokerageWithdrawTypeEnum = { + WALLET: { + type: 1, + name: '钱包' + }, + BANK: { + type: 2, + name: '银行卡' + }, + WECHAT: { + type: 3, + name: '微信' + }, + ALIPAY: { + type: 4, + name: '支付宝' + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 6b163628..aa948594 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -60,13 +60,19 @@ export const getBoolDictOptions = (dictType: string) => { return dictOption } -export const getDictObj = (dictType: string, value: any) => { +/** + * 获取指定字典类型的指定值对应的字典对象 + * @param dictType 字典类型 + * @param value 字典值 + * @return DictDataType 字典对象 + */ +export const getDictObj = (dictType: string, value: any): DictDataType | undefined => { const dictOptions: DictDataType[] = getDictOptions(dictType) - dictOptions.forEach((dict: DictDataType) => { - if (dict.value === value.toString()) { + for (const dict of dictOptions) { + if (dict.value === value + '') { return dict } - }) + } } /** @@ -74,12 +80,13 @@ export const getDictObj = (dictType: string, value: any) => { * * @param dictType 字典类型 * @param value 字典数据的值 + * @return 字典名称 */ -export const getDictLabel = (dictType: string, value: any) => { +export const getDictLabel = (dictType: string, value: any): string => { const dictOptions: DictDataType[] = getDictOptions(dictType) const dictLabel = ref('') dictOptions.forEach((dict: DictDataType) => { - if (dict.value === value) { + if (dict.value === value + '') { dictLabel.value = dict.label } }) @@ -131,7 +138,7 @@ export enum DICT_TYPE { BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type', // ========== PAY 模块 ========== - PAY_CHANNEL_CODE = 'pay_channel_code_type', // 支付渠道编码类型 + PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型 PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态 PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态 PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态 @@ -143,6 +150,7 @@ export enum DICT_TYPE { // ========== MALL - 会员模块 ========== MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', // 积分的业务类型 + MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型 // ========== MALL - 商品模块 ========== PRODUCT_UNIT = 'product_unit', // 商品单位 @@ -157,6 +165,13 @@ export enum DICT_TYPE { TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态 TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态 TRADE_DELIVERY_TYPE = 'trade_delivery_type', // 配送方式 + BROKERAGE_ENABLED_CONDITION = 'brokerage_enabled_condition', // 分佣模式 + BROKERAGE_BIND_MODE = 'brokerage_bind_mode', // 分销关系绑定模式 + BROKERAGE_BANK_NAME = 'brokerage_bank_name', // 佣金提现银行 + BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金提现类型 + BROKERAGE_RECORD_BIZ_TYPE = 'brokerage_record_biz_type', // 佣金业务类型 + BROKERAGE_RECORD_STATUS = 'brokerage_record_status', // 佣金状态 + BROKERAGE_WITHDRAW_STATUS = 'brokerage_withdraw_status', // 佣金提现状态 // ========== MALL - 营销模块 ========== PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型 diff --git a/src/utils/formatter.ts b/src/utils/formatter.ts new file mode 100644 index 00000000..7c6e39ff --- /dev/null +++ b/src/utils/formatter.ts @@ -0,0 +1,12 @@ +import { fenToYuan } from '@/utils' +import { TableColumnCtx } from 'element-plus' + +// 格式化金额【分转元】 +export const fenToYuanFormat = ( + row: any, + column: TableColumnCtx, + cellValue: any, + index: number +) => { + return `¥${fenToYuan(cellValue)}` +} diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 49742f00..a4eb0b92 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -230,6 +230,7 @@ const getCookie = () => { } } } +const loading = ref() // ElLoading.service 返回的实例 // 登录 const handleLogin = async (params) => { loginLoading.value = true @@ -244,7 +245,7 @@ const handleLogin = async (params) => { if (!res) { return } - ElLoading.service({ + loading.value = ElLoading.service({ lock: true, text: '正在加载系统中...', background: 'rgba(0, 0, 0, 0.7)' @@ -264,13 +265,9 @@ const handleLogin = async (params) => { } else { push({ path: redirect.value || permissionStore.addRouters[0].path }) } - } catch { - loginLoading.value = false } finally { - setTimeout(() => { - const loadingInstance = ElLoading.service() - loadingInstance.close() - }, 400) + loginLoading.value = false + loading.value.close() } } diff --git a/src/views/infra/server/index.vue b/src/views/infra/server/index.vue index 06c35d97..b9a157a5 100644 --- a/src/views/infra/server/index.vue +++ b/src/views/infra/server/index.vue @@ -16,6 +16,9 @@ const src = ref(import.meta.env.VITE_BASE_URL + '/admin/applications') /** 初始化 */ onMounted(async () => { try { + // 友情提示:如果访问出现 404 问题: + // 1)boot 参考 https://doc.iocoder.cn/server-monitor/ 解决; + // 2)cloud 参考 https://cloud.iocoder.cn/server-monitor/ 解决 const data = await ConfigApi.getConfigKey('url.spring-boot-admin') if (data && data.length > 0) { src.value = data diff --git a/src/views/mall/product/spu/components/SkuList.vue b/src/views/mall/product/spu/components/SkuList.vue index f64e4a98..7a4605c6 100644 --- a/src/views/mall/product/spu/components/SkuList.vue +++ b/src/views/mall/product/spu/components/SkuList.vue @@ -80,7 +80,7 @@