-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 清空
+
+
+
+
+
+ 新增
+
+ 同步用户
+
+
+ 清理优惠卷
+
+
+
+
+
+
+
+
+
+
+ {{ formatSellBuyCount(scope.row) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatDateTime(scope.row.joinTime) }}
+
+
+
+
+ {{ formatStatusLabel(scope.row.status) }}
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
-
-
-
+
+
+
+ 基本信息
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 资产与等级
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VIP 与交易
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 登录与时间
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+ 清空
+
+
+
+
+
+
+ 修正状态
+
+ 将按 member_info 全部用户批量修改「是否可寄卖 / 用户状态」
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatMemberLevel(scope.row.userLevel) }}
+
+
+
+
+ {{ formatMemberStatus(scope.row.status) }}
+
+
+
+
+ {{ formatAuditStatus(scope.row.auditStatus) }}
+
+
+
+
+ {{ formatYesNo(scope.row.canConsign) }}
+
+
+
+
+ {{ formatYesNo(scope.row.isPriorityBuy) }}
+
+
+
+
+
+
+ {{ formatDateTime(scope.row.updateTime) }}
+
+
+
+
+ 修正状态
+
+
+
+
+
-
-
- 查询
- 清空
-
-
-
+
-
- 新增
-
- 同步用户
-
-
- 清理优惠卷
-
-
-
-
-
-
-
-
-
-
- {{ formatSellBuyCount(scope.row) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ formatDateTime(scope.row.joinTime) }}
-
-
-
-
- {{ formatStatusLabel(scope.row.status) }}
-
-
-
-
- 编辑
- 删除
-
-
-
-
-
-
-
-
-
- 基本信息
-
-
-
-
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 资产与等级
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- VIP 与交易
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
- 登录与时间
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+ 开启后批量修改「是否可以寄卖」
+
+
+
+
+
+
+
+
+
+ 开启后批量修改「用户状态」
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -427,6 +666,8 @@ import {
updateLbUserCoupon
} from '@/api/lb-user'
import { getAllTenantList } from '@/api/tenant'
+import { getMemberInfoList, updateMemberInfo } from '@/api/member-info'
+import { updateHxrAdminUserResellStatusForAllMembers } from '@/api/lb-purchase-apply'
import { getBusinessHeaders } from '@/utils/business-headers'
function emptyForm() {
@@ -480,6 +721,29 @@ function parseOptionalInt(value) {
return Number.isFinite(n) ? n : undefined
}
+function emptyFixStatusForm() {
+ return {
+ id: '',
+ phone: '',
+ nickname: '',
+ status: undefined,
+ auditStatus: undefined,
+ canConsign: undefined,
+ isPriorityBuy: undefined,
+ availableOrderCount: undefined,
+ availableGoodsCount: undefined
+ }
+}
+
+function emptyFixStatusAllForm() {
+ return {
+ isResellEnabled: false,
+ isResell: 1,
+ statusEnabled: false,
+ status: 1
+ }
+}
+
export default {
name: 'LbUserManage',
data() {
@@ -535,7 +799,35 @@ export default {
tenantId: [{ required: true, message: '请选择租户', trigger: 'change' }]
},
tenantLoading: false,
- tenantOptions: []
+ tenantOptions: [],
+ activeTab: 'list',
+ fixStatusLoading: false,
+ fixStatusSubmitLoading: false,
+ fixStatusList: [],
+ fixStatusTotal: 0,
+ fixStatusSelectedRows: [],
+ fixStatusQueryParams: {
+ current: 1,
+ size: 10,
+ phone: '',
+ nickname: '',
+ inviteCode: '',
+ parentId: '',
+ userLevel: '',
+ status: undefined,
+ auditStatus: undefined,
+ canConsign: undefined
+ },
+ fixStatusDialogVisible: false,
+ fixStatusForm: emptyFixStatusForm(),
+ fixStatusFormRules: {
+ status: [{ required: true, message: '请选择状态', trigger: 'change' }],
+ auditStatus: [{ required: true, message: '请选择审核状态', trigger: 'change' }]
+ },
+ fixStatusAllDialogVisible: false,
+ fixStatusAllSubmitLoading: false,
+ fixStatusAllTenantIdDisplay: '',
+ fixStatusAllForm: emptyFixStatusAllForm()
}
},
created() {
@@ -885,6 +1177,236 @@ export default {
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+ },
+ fetchFixStatusList() {
+ this.fixStatusLoading = true
+ getMemberInfoList(this.buildFixStatusListParams())
+ .then((res) => {
+ if (res && (res.code === 20000 || res.code === 200 || res.success === true)) {
+ this.fixStatusList = Array.isArray(res.data) ? res.data : []
+ this.fixStatusTotal = typeof res.total === 'number'
+ ? res.total
+ : (res.page && typeof res.page.total === 'number' ? res.page.total : this.fixStatusList.length)
+ } else {
+ this.fixStatusList = []
+ this.fixStatusTotal = 0
+ if (res && res.message) {
+ this.$message.error(res.message)
+ }
+ }
+ })
+ .catch(() => {
+ this.fixStatusList = []
+ this.fixStatusTotal = 0
+ })
+ .finally(() => {
+ this.fixStatusLoading = false
+ })
+ },
+ buildFixStatusListParams() {
+ const {
+ current, size, phone, nickname, inviteCode, parentId, userLevel, status, auditStatus, canConsign
+ } = this.fixStatusQueryParams
+ const params = {
+ current,
+ size,
+ phone: phone || undefined,
+ nickname: nickname || undefined,
+ inviteCode: inviteCode || undefined,
+ parentId: parentId || undefined,
+ userLevel: userLevel || undefined,
+ status: status === 0 || status === 1 ? status : undefined,
+ auditStatus: auditStatus === 0 || auditStatus === 1 ? auditStatus : undefined,
+ canConsign: canConsign === 0 || canConsign === 1 ? canConsign : undefined
+ }
+ Object.keys(params).forEach((key) => {
+ if (params[key] === undefined || params[key] === '') delete params[key]
+ })
+ return params
+ },
+ handleFixStatusQuery() {
+ this.fixStatusQueryParams.current = 1
+ this.fetchFixStatusList()
+ },
+ resetFixStatusQuery() {
+ this.fixStatusQueryParams = {
+ current: 1,
+ size: 10,
+ phone: '',
+ nickname: '',
+ inviteCode: '',
+ parentId: '',
+ userLevel: '',
+ status: undefined,
+ auditStatus: undefined,
+ canConsign: undefined
+ }
+ this.fetchFixStatusList()
+ },
+ handleFixStatusSizeChange(size) {
+ this.fixStatusQueryParams.size = size
+ this.fetchFixStatusList()
+ },
+ handleFixStatusCurrentChange(current) {
+ this.fixStatusQueryParams.current = current
+ this.fetchFixStatusList()
+ },
+ openFixStatusEditDialog(row) {
+ this.fixStatusForm = {
+ id: row.id,
+ phone: row.phone || '',
+ nickname: row.nickname || '',
+ status: row.status !== undefined && row.status !== null ? Number(row.status) : undefined,
+ auditStatus: row.auditStatus !== undefined && row.auditStatus !== null
+ ? Number(row.auditStatus)
+ : undefined,
+ canConsign: row.canConsign !== undefined && row.canConsign !== null
+ ? Number(row.canConsign)
+ : undefined,
+ isPriorityBuy: row.isPriorityBuy !== undefined && row.isPriorityBuy !== null
+ ? Number(row.isPriorityBuy)
+ : undefined,
+ availableOrderCount: row.availableOrderCount !== undefined && row.availableOrderCount !== null
+ ? Number(row.availableOrderCount)
+ : undefined,
+ availableGoodsCount: row.availableGoodsCount !== undefined && row.availableGoodsCount !== null
+ ? Number(row.availableGoodsCount)
+ : undefined
+ }
+ this.fixStatusDialogVisible = true
+ this.$nextTick(() => {
+ this.$refs.fixStatusFormRef && this.$refs.fixStatusFormRef.clearValidate()
+ })
+ },
+ resetFixStatusForm() {
+ this.$refs.fixStatusFormRef && this.$refs.fixStatusFormRef.resetFields()
+ this.fixStatusForm = emptyFixStatusForm()
+ },
+ submitFixStatus() {
+ this.$refs.fixStatusFormRef.validate((valid) => {
+ if (!valid) return
+ const payload = {
+ id: this.fixStatusForm.id
+ }
+ if (this.fixStatusForm.status === 0 || this.fixStatusForm.status === 1) {
+ payload.status = this.fixStatusForm.status
+ }
+ if (this.fixStatusForm.auditStatus === 0 || this.fixStatusForm.auditStatus === 1) {
+ payload.auditStatus = this.fixStatusForm.auditStatus
+ }
+ if (this.fixStatusForm.canConsign === 0 || this.fixStatusForm.canConsign === 1) {
+ payload.canConsign = this.fixStatusForm.canConsign
+ }
+ if (this.fixStatusForm.isPriorityBuy === 0 || this.fixStatusForm.isPriorityBuy === 1) {
+ payload.isPriorityBuy = this.fixStatusForm.isPriorityBuy
+ }
+ if (this.fixStatusForm.availableOrderCount !== undefined && this.fixStatusForm.availableOrderCount !== '') {
+ payload.availableOrderCount = Number(this.fixStatusForm.availableOrderCount)
+ }
+ if (this.fixStatusForm.availableGoodsCount !== undefined && this.fixStatusForm.availableGoodsCount !== '') {
+ payload.availableGoodsCount = Number(this.fixStatusForm.availableGoodsCount)
+ }
+ this.fixStatusSubmitLoading = true
+ updateMemberInfo(payload)
+ .then((res) => {
+ const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
+ if (!isSuccess) {
+ this.$message.error((res && res.message) || '修正状态失败')
+ return
+ }
+ this.$message.success((res && res.message) || '修正状态成功')
+ this.fixStatusDialogVisible = false
+ this.fetchFixStatusList()
+ })
+ .finally(() => {
+ this.fixStatusSubmitLoading = false
+ })
+ })
+ },
+ formatMemberStatus(status) {
+ if (status === 1) return '正常'
+ if (status === 0) return '禁用'
+ return status !== undefined && status !== null ? status : '-'
+ },
+ formatAuditStatus(auditStatus) {
+ if (auditStatus === 1) return '已审核'
+ if (auditStatus === 0) return '未审核'
+ return auditStatus !== undefined && auditStatus !== null ? auditStatus : '-'
+ },
+ formatMemberLevel(level) {
+ const map = {
+ normal: '普通用户',
+ referral: '推荐人',
+ shopkeeper: '店长',
+ second_shopkeeper: '二代店长'
+ }
+ return map[level] || level || '-'
+ },
+ openFixStatusAllDialog() {
+ this.fixStatusAllTenantIdDisplay = this.getTenantIdFromBusinessHeaders()
+ this.fixStatusAllForm = emptyFixStatusAllForm()
+ this.fixStatusAllDialogVisible = true
+ },
+ resetFixStatusAllForm() {
+ this.fixStatusAllSubmitLoading = false
+ this.fixStatusAllTenantIdDisplay = ''
+ this.fixStatusAllForm = emptyFixStatusAllForm()
+ },
+ submitFixStatusAll() {
+ const tenantId = this.getTenantIdFromBusinessHeaders()
+ if (!tenantId) {
+ this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
+ return
+ }
+ const { isResellEnabled, isResell, statusEnabled, status } = this.fixStatusAllForm
+ if (!isResellEnabled && !statusEnabled) {
+ this.$message.warning('请至少开启一项要修改的状态(寄卖状态或用户状态)')
+ return
+ }
+ if (isResellEnabled && isResell !== 0 && isResell !== 1) {
+ this.$message.warning('请选择「是否可以寄卖」的值')
+ return
+ }
+ if (statusEnabled && status !== 0 && status !== 1) {
+ this.$message.warning('请选择「用户状态」的值')
+ return
+ }
+ const payload = {
+ tenantId,
+ isResellEnabled: !!isResellEnabled,
+ statusEnabled: !!statusEnabled
+ }
+ if (isResellEnabled) {
+ payload.isResell = Number(isResell)
+ }
+ if (statusEnabled) {
+ payload.status = Number(status)
+ }
+ this.$confirm(
+ `确认对 member_info 全部会员批量修正状态吗?该操作可能耗时较长。`,
+ '提示',
+ { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
+ )
+ .then(() => {
+ this.fixStatusAllSubmitLoading = true
+ return updateHxrAdminUserResellStatusForAllMembers(payload)
+ })
+ .then((res) => {
+ const ok = res && (res.success === true || res.code === 200 || res.code === 20000)
+ if (ok) {
+ this.$message.success((res && res.message) || '修正状态成功')
+ this.fixStatusAllDialogVisible = false
+ this.fetchFixStatusList()
+ } else {
+ this.$message.error((res && (res.message || res.msg)) || '修正状态失败')
+ }
+ })
+ .catch(() => {
+ // 错误提示由 @/utils/request 响应拦截器统一展示
+ })
+ .finally(() => {
+ this.fixStatusAllSubmitLoading = false
+ })
}
}
}
@@ -898,6 +1420,18 @@ export default {
.action-container {
margin-bottom: 20px;
+
+ .action-tip {
+ margin-left: 12px;
+ color: #909399;
+ font-size: 13px;
+ }
+ }
+
+ .fix-status-all-tip {
+ margin-left: 12px;
+ color: #909399;
+ font-size: 13px;
}
.table-container {