开通同事特权

This commit is contained in:
zhonghua.li
2026-05-16 20:30:51 +08:00
parent efae19532e
commit baddbb9369
3 changed files with 128 additions and 0 deletions

View File

@@ -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
})
}

View File

@@ -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 => {

View File

@@ -48,6 +48,9 @@
<el-button type="success" icon="el-icon-present" style="margin-left: 12px" @click="openNewcomerVipDialog">
开通新人特权
</el-button>
<el-button type="success" icon="el-icon-present" style="margin-left: 12px" @click="openColleagueVipDialog">
开通同事特权
</el-button>
</el-card>
<el-card class="table-container" shadow="never">
@@ -229,6 +232,45 @@
</div>
</el-dialog>
<el-dialog
title="开通同事特权"
:visible.sync="colleagueVipDialogVisible"
width="520px"
@close="resetColleagueVipDialog"
>
<el-form label-width="120px">
<el-form-item label="申请开始日期" required>
<el-date-picker
v-model="colleagueVipApplyDateStart"
type="date"
value-format="yyyy-MM-dd"
clearable
placeholder="请选择开始日期"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="申请结束日期" required>
<el-date-picker
v-model="colleagueVipApplyDateEnd"
type="date"
value-format="yyyy-MM-dd"
clearable
placeholder="请选择结束日期"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="租户ID" required>
<el-input v-model="colleagueVipTenantId" clearable placeholder="请输入租户ID" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="colleagueVipDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="colleagueVipSubmitLoading" @click="handleConfirmColleagueVip">
确定
</el-button>
</div>
</el-dialog>
<el-dialog title="特权推荐人列表" :visible.sync="privilegeDialogVisible" width="760px" @close="resetPrivilegeDialog">
<el-table v-loading="privilegeLoading" :data="privilegeList" style="width: 100%">
<el-table-column type="index" label="#" width="60" />
@@ -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) {