开通新人特权

This commit is contained in:
zhonghua.li
2026-05-16 11:31:41 +08:00
parent 928887b389
commit efae19532e
2 changed files with 136 additions and 0 deletions

View File

@@ -48,3 +48,19 @@ export function parseLbPurchaseApplyFromOrderInfo(data) {
timeout: 120000 timeout: 120000
}) })
} }
/** 按申请日期区间与租户同步 hxrd 用户 VIP可能较慢依赖外部管理端 */
export function syncHxrAdminUserVip(params) {
return request({
url: '/lbPurchaseApply/syncHxrAdminUserVip',
method: 'get',
params: {
applyDateStart: params.applyDateStart,
applyDateEnd: params.applyDateEnd,
tenantId: params.tenantId,
max_order: params.maxOrder
},
timeout: 120000,
skipResponseNormalize: true
})
}

View File

@@ -45,6 +45,9 @@
<el-button type="warning" icon="el-icon-view" :loading="privilegeLoading" @click="handleViewPrivilege"> <el-button type="warning" icon="el-icon-view" :loading="privilegeLoading" @click="handleViewPrivilege">
查看特权 查看特权
</el-button> </el-button>
<el-button type="success" icon="el-icon-present" style="margin-left: 12px" @click="openNewcomerVipDialog">
开通新人特权
</el-button>
</el-card> </el-card>
<el-card class="table-container" shadow="never"> <el-card class="table-container" shadow="never">
@@ -52,6 +55,7 @@
<el-table-column label="申请人" prop="applyUser" min-width="120" /> <el-table-column label="申请人" prop="applyUser" min-width="120" />
<el-table-column label="申请电话" prop="applyPhone" min-width="130" /> <el-table-column label="申请电话" prop="applyPhone" min-width="130" />
<el-table-column label="同事姓名" prop="colleagueName" min-width="120" /> <el-table-column label="同事姓名" prop="colleagueName" min-width="120" />
<el-table-column label="同事电话" prop="colleaguePhone" min-width="130" show-overflow-tooltip />
<el-table-column label="组长姓名" prop="teamLeader" min-width="120" /> <el-table-column label="组长姓名" prop="teamLeader" min-width="120" />
<el-table-column label="申请日期" prop="applyDate" min-width="120" /> <el-table-column label="申请日期" prop="applyDate" min-width="120" />
<el-table-column label="创建时间" prop="createTime" min-width="170"> <el-table-column label="创建时间" prop="createTime" min-width="170">
@@ -184,6 +188,47 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
title="开通新人特权"
:visible.sync="newcomerVipDialogVisible"
width="520px"
@close="resetNewcomerVipDialog"
>
<el-form label-width="120px">
<el-form-item label="申请日期" required>
<el-date-picker
v-model="newcomerVipApplyDateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="max_order" required>
<el-input-number
v-model="newcomerVipMaxOrder"
:min="1"
:max="999999"
:step="1"
controls-position="right"
style="width: 100%"
placeholder="最大订单数"
/>
</el-form-item>
<el-form-item label="租户ID">
<el-input :value="newcomerVipTenantIdDisplay" disabled placeholder="未获取到租户ID" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="newcomerVipDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="newcomerVipSubmitLoading" @click="handleConfirmNewcomerVip">
确认
</el-button>
</div>
</el-dialog>
<el-dialog title="特权推荐人列表" :visible.sync="privilegeDialogVisible" width="760px" @close="resetPrivilegeDialog"> <el-dialog title="特权推荐人列表" :visible.sync="privilegeDialogVisible" width="760px" @close="resetPrivilegeDialog">
<el-table v-loading="privilegeLoading" :data="privilegeList" style="width: 100%"> <el-table v-loading="privilegeLoading" :data="privilegeList" style="width: 100%">
<el-table-column type="index" label="#" width="60" /> <el-table-column type="index" label="#" width="60" />
@@ -209,6 +254,7 @@ import {
getLbPurchaseApplyList, getLbPurchaseApplyList,
needPrivilegeRecommenders, needPrivilegeRecommenders,
parseLbPurchaseApplyFromOrderInfo, parseLbPurchaseApplyFromOrderInfo,
syncHxrAdminUserVip,
updateLbPurchaseApply updateLbPurchaseApply
} from '@/api/lb-purchase-apply' } from '@/api/lb-purchase-apply'
import { getBusinessHeaders } from '@/utils/business-headers' import { getBusinessHeaders } from '@/utils/business-headers'
@@ -218,6 +264,11 @@ export default {
data() { data() {
const today = this.getCurrentDate() const today = this.getCurrentDate()
return { return {
newcomerVipDialogVisible: false,
newcomerVipSubmitLoading: false,
newcomerVipApplyDateRange: [today, today],
newcomerVipMaxOrder: null,
newcomerVipTenantIdDisplay: '',
loading: false, loading: false,
submitLoading: false, submitLoading: false,
parseAiLoading: false, parseAiLoading: false,
@@ -562,6 +613,75 @@ export default {
resetPrivilegeDialog() { resetPrivilegeDialog() {
this.privilegeList = [] this.privilegeList = []
}, },
openNewcomerVipDialog() {
const today = this.getCurrentDate()
this.newcomerVipTenantIdDisplay = this.getTenantIdFromBusinessHeaders()
if (
Array.isArray(this.privilegeDateRange) &&
this.privilegeDateRange.length === 2 &&
this.privilegeDateRange[0] &&
this.privilegeDateRange[1]
) {
this.newcomerVipApplyDateRange = [...this.privilegeDateRange]
} else {
this.newcomerVipApplyDateRange = [today, today]
}
if (this.newcomerVipMaxOrder == null || this.newcomerVipMaxOrder === '') {
this.newcomerVipMaxOrder = 1
}
this.newcomerVipDialogVisible = true
},
resetNewcomerVipDialog() {
const today = this.getCurrentDate()
this.newcomerVipApplyDateRange = [today, today]
this.newcomerVipMaxOrder = null
this.newcomerVipTenantIdDisplay = ''
this.newcomerVipSubmitLoading = false
},
handleConfirmNewcomerVip() {
const tenantId = this.getTenantIdFromBusinessHeaders()
if (!tenantId) {
this.$message.error('未获取到租户ID请先登录或配置业务请求头中的租户')
return
}
this.newcomerVipTenantIdDisplay = tenantId
if (!Array.isArray(this.newcomerVipApplyDateRange) || this.newcomerVipApplyDateRange.length !== 2) {
this.$message.warning('请选择申请开始日期与结束日期')
return
}
const [applyDateStart, applyDateEnd] = this.newcomerVipApplyDateRange
if (!applyDateStart || !applyDateEnd) {
this.$message.warning('请选择申请开始日期与结束日期')
return
}
const maxOrder = this.newcomerVipMaxOrder
if (maxOrder == null || maxOrder === '' || Number(maxOrder) < 1) {
this.$message.warning('请输入有效的 max_order正整数')
return
}
this.newcomerVipSubmitLoading = true
syncHxrAdminUserVip({
applyDateStart,
applyDateEnd,
tenantId,
maxOrder: Number(maxOrder)
})
.then((res) => {
const ok = res && (res.success === true || res.code === 200 || res.code === 20000)
if (ok) {
this.$message.success((res && res.message) || '同步成功')
this.newcomerVipDialogVisible = false
} else {
this.$message.error((res && (res.message || res.msg)) || '同步失败')
}
})
.catch(() => {
// 错误提示由 @/utils/request 响应拦截器统一展示
})
.finally(() => {
this.newcomerVipSubmitLoading = false
})
},
formatDateTime(dateTime) { formatDateTime(dateTime) {
if (!dateTime) return '-' if (!dateTime) return '-'
const date = new Date(String(dateTime).replace('T', ' ')) const date = new Date(String(dateTime).replace('T', ' '))