diff --git a/src/api/lb-purchase-apply.js b/src/api/lb-purchase-apply.js index 79b3104..368542f 100644 --- a/src/api/lb-purchase-apply.js +++ b/src/api/lb-purchase-apply.js @@ -64,3 +64,18 @@ export function syncHxrAdminUserVip(params) { skipResponseNormalize: true }) } + +/** 按申请日期区间与租户同步同事 hxrd 用户 VIP(可能较慢,依赖外部管理端) */ +export function syncHxrAdminColleagueVip(params) { + return request({ + url: '/lbPurchaseApply/syncHxrAdminColleagueVip', + method: 'get', + params: { + applyDateStart: params.applyDateStart, + applyDateEnd: params.applyDateEnd, + tenantId: params.tenantId + }, + timeout: 120000, + skipResponseNormalize: true + }) +} diff --git a/src/utils/request.js b/src/utils/request.js index 4765480..060babb 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -78,6 +78,12 @@ service.interceptors.request.use( config.headers[key] = safe } }) + if (config.tenantId) { + const tenantHeader = coerceBusinessHeaderValueForXHR('X-Tenant-Id', config.tenantId) + if (tenantHeader !== '') { + config.headers['X-Tenant-Id'] = tenantHeader + } + } return config }, error => { diff --git a/src/views/lb-business/purchase-apply/index.vue b/src/views/lb-business/purchase-apply/index.vue index f29927d..7fd8418 100644 --- a/src/views/lb-business/purchase-apply/index.vue +++ b/src/views/lb-business/purchase-apply/index.vue @@ -48,6 +48,9 @@ 开通新人特权 + + 开通同事特权 + @@ -229,6 +232,45 @@ + + + + + + + + + + + + + + + @@ -254,6 +296,7 @@ import { getLbPurchaseApplyList, needPrivilegeRecommenders, parseLbPurchaseApplyFromOrderInfo, + syncHxrAdminColleagueVip, syncHxrAdminUserVip, updateLbPurchaseApply } from '@/api/lb-purchase-apply' @@ -269,6 +312,11 @@ export default { newcomerVipApplyDateRange: [today, today], newcomerVipMaxOrder: null, newcomerVipTenantIdDisplay: '', + colleagueVipDialogVisible: false, + colleagueVipSubmitLoading: false, + colleagueVipApplyDateStart: today, + colleagueVipApplyDateEnd: today, + colleagueVipTenantId: '', loading: false, submitLoading: false, parseAiLoading: false, @@ -638,6 +686,65 @@ export default { this.newcomerVipTenantIdDisplay = '' this.newcomerVipSubmitLoading = false }, + openColleagueVipDialog() { + const today = this.getCurrentDate() + const tenantId = this.getTenantIdFromBusinessHeaders() + if ( + Array.isArray(this.privilegeDateRange) && + this.privilegeDateRange.length === 2 && + this.privilegeDateRange[0] && + this.privilegeDateRange[1] + ) { + this.colleagueVipApplyDateStart = this.privilegeDateRange[0] + this.colleagueVipApplyDateEnd = this.privilegeDateRange[1] + } else { + this.colleagueVipApplyDateStart = today + this.colleagueVipApplyDateEnd = today + } + this.colleagueVipTenantId = tenantId + this.colleagueVipDialogVisible = true + }, + resetColleagueVipDialog() { + const today = this.getCurrentDate() + this.colleagueVipApplyDateStart = today + this.colleagueVipApplyDateEnd = today + this.colleagueVipTenantId = '' + this.colleagueVipSubmitLoading = false + }, + handleConfirmColleagueVip() { + const applyDateStart = this.colleagueVipApplyDateStart + const applyDateEnd = this.colleagueVipApplyDateEnd + const tenantId = (this.colleagueVipTenantId || '').trim() + if (!applyDateStart || !applyDateEnd) { + this.$message.warning('请选择申请开始日期与结束日期') + return + } + if (!tenantId) { + this.$message.warning('请输入租户ID') + return + } + this.colleagueVipSubmitLoading = true + syncHxrAdminColleagueVip({ + applyDateStart, + applyDateEnd, + tenantId + }) + .then((res) => { + const ok = res && (res.success === true || res.code === 200 || res.code === 20000) + if (ok) { + this.$message.success((res && res.message) || '同步成功') + this.colleagueVipDialogVisible = false + } else { + this.$message.error((res && (res.message || res.msg)) || '同步失败') + } + }) + .catch(() => { + // 错误提示由 @/utils/request 响应拦截器统一展示 + }) + .finally(() => { + this.colleagueVipSubmitLoading = false + }) + }, handleConfirmNewcomerVip() { const tenantId = this.getTenantIdFromBusinessHeaders() if (!tenantId) {