|
|
@@ -21,13 +21,7 @@
|
|
|
style="width: 150px;"
|
|
|
@click="showUserDialog"
|
|
|
@clear="handleUserClear"
|
|
|
- >
|
|
|
-<!-- <template #suffix>
|
|
|
- <el-icon style="cursor: pointer;">
|
|
|
- <Search />
|
|
|
- </el-icon>
|
|
|
- </template>-->
|
|
|
- </el-input>
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="积分类型">
|
|
|
<el-select
|
|
|
@@ -44,21 +38,6 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
-<!-- <el-form-item label="业务类型">
|
|
|
- <el-select
|
|
|
- v-model="searchForm.biz_type"
|
|
|
- placeholder="请选择业务类型"
|
|
|
- clearable
|
|
|
- style="width: 150px;"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in bizTypes"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>-->
|
|
|
<el-form-item label="时间范围">
|
|
|
<el-date-picker
|
|
|
v-model="searchForm.dateRange"
|
|
|
@@ -147,30 +126,8 @@
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-<!-- <el-table-column prop="biz_type" label="业务类型" width="120">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-tag
|
|
|
- type="info"
|
|
|
- size="small"
|
|
|
- >
|
|
|
- {{ getBizTypeName(row.biz_type) }}
|
|
|
- </el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="biz_id" label="业务ID" width="100" />-->
|
|
|
<el-table-column prop="remark" label="备注" min-width="200" show-overflow-tooltip />
|
|
|
<el-table-column prop="create_time" label="创建时间" width="180" />
|
|
|
-<!-- <el-table-column label="操作" width="120" fixed="right">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- @click="showDetailDialog(row)"
|
|
|
- >
|
|
|
- 查看详情
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>-->
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 分页 -->
|
|
|
@@ -213,7 +170,7 @@
|
|
|
<el-radio label="decrease">减少积分</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
+
|
|
|
<el-form-item label="积分数量" prop="point">
|
|
|
<el-input-number
|
|
|
v-model="adjustForm.point"
|
|
|
@@ -225,7 +182,6 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
-
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
<el-input
|
|
|
v-model="adjustForm.remark"
|
|
|
@@ -299,7 +255,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<el-pagination
|
|
|
:current-page="adjustUserPagination.page"
|
|
|
:page-size="adjustUserPagination.limit"
|
|
|
@@ -355,69 +311,6 @@
|
|
|
</el-descriptions>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- 调整积分用户选择对话框 -->
|
|
|
- <el-dialog
|
|
|
- v-model="adjustUserDialogVisible"
|
|
|
- title="选择用户"
|
|
|
- width="80%"
|
|
|
- >
|
|
|
- <div style="margin-bottom: 20px;">
|
|
|
- <el-input
|
|
|
- v-model="adjustUserSearchKeyword"
|
|
|
- placeholder="请输入用户ID、昵称或手机号进行搜索"
|
|
|
- clearable
|
|
|
- style="width: 300px;"
|
|
|
- @keyup.enter="handleAdjustUserSearch"
|
|
|
- >
|
|
|
- <template #append>
|
|
|
- <el-button @click="handleAdjustUserSearch">搜索</el-button>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- <el-button @click="resetAdjustUserSearch" style="margin-left: 10px;">重置</el-button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <el-table :data="adjustUserList" @row-click="selectAdjustUser" v-loading="adjustUserLoading" max-height="400px">
|
|
|
- <el-table-column prop="id" label="ID" min-width="80"></el-table-column>
|
|
|
- <el-table-column label="头像" min-width="80">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-avatar :size="40" :src="row.avatar" :alt="row.nickname">
|
|
|
- <template #default>
|
|
|
- <el-icon><User /></el-icon>
|
|
|
- </template>
|
|
|
- </el-avatar>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="nickname" label="昵称" min-width="80"></el-table-column>
|
|
|
- <el-table-column prop="mobile" label="手机号" min-width="120">
|
|
|
- <template #default="{ row }">
|
|
|
- {{ row.mobile || '-' }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="point" label="当前积分" min-width="100">
|
|
|
- <template #default="{ row }">
|
|
|
- <span class="point-value">{{ row.point || 0 }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="update_time" label="更新时间" min-width="200" />
|
|
|
- <el-table-column label="操作" width="80" fixed="right">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-button type="primary" size="small" @click="selectAdjustUser(row)">选择</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <el-pagination
|
|
|
- :current-page="adjustUserPagination.page"
|
|
|
- :page-size="adjustUserPagination.limit"
|
|
|
- :total="adjustUserPagination.total"
|
|
|
- :page-sizes="[10, 20, 50]"
|
|
|
- layout="total, sizes, prev, pager, next"
|
|
|
- style="margin-top: 20px; text-align: right;"
|
|
|
- @size-change="handleAdjustUserSizeChange"
|
|
|
- @current-change="handleAdjustUserCurrentChange"
|
|
|
- />
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
<!-- 用户选择对话框 -->
|
|
|
<el-dialog
|
|
|
v-model="userDialogVisible"
|
|
|
@@ -468,7 +361,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<el-pagination
|
|
|
:current-page="userPagination.page"
|
|
|
:page-size="userPagination.limit"
|
|
|
@@ -484,16 +377,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import request from '@/utils/request'
|
|
|
|
|
|
export default {
|
|
|
name: 'PointsLog',
|
|
|
|
|
|
- props: {
|
|
|
- axiosInstance: {
|
|
|
- type: Object,
|
|
|
- default: null
|
|
|
- }
|
|
|
- },
|
|
|
data() {
|
|
|
return {
|
|
|
// 搜索表单
|
|
|
@@ -532,7 +420,7 @@ export default {
|
|
|
adjustFormRef: null,
|
|
|
adjustForm: {
|
|
|
user_id: '',
|
|
|
- operation_type: 'increase', // 'increase' or 'decrease'
|
|
|
+ operation_type: 'increase',
|
|
|
point: 0,
|
|
|
remark: ''
|
|
|
},
|
|
|
@@ -548,7 +436,6 @@ export default {
|
|
|
{ type: 'number', min: 1, message: '积分数量必须大于0', trigger: 'blur' },
|
|
|
{ validator: this.validateInteger, message: '积分数量必须是整数', trigger: 'blur' }
|
|
|
],
|
|
|
-
|
|
|
remark: [
|
|
|
{ required: true, message: '请输入积分变动备注', trigger: 'blur' }
|
|
|
]
|
|
|
@@ -579,7 +466,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- // 添加计算属性用于显示用户昵称
|
|
|
selectedUserDisplay: {
|
|
|
get() {
|
|
|
if (!this.searchForm.user_id) return ''
|
|
|
@@ -587,7 +473,7 @@ export default {
|
|
|
return selectedUser ? selectedUser.nickname : this.searchForm.user_id
|
|
|
},
|
|
|
set(value) {
|
|
|
- // 不需要设置逻辑,因为显示和实际值分离
|
|
|
+ // 不需要设置逻辑
|
|
|
}
|
|
|
},
|
|
|
selectedAdjustUserDisplay: {
|
|
|
@@ -597,7 +483,7 @@ export default {
|
|
|
return selectedUser ? selectedUser.nickname : this.adjustForm.user_id
|
|
|
},
|
|
|
set(value) {
|
|
|
- // 不需要设置逻辑,因为显示和实际值分离
|
|
|
+ // 不需要设置逻辑
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -612,9 +498,9 @@ export default {
|
|
|
|
|
|
getTypeTagType(type) {
|
|
|
const typeMap = {
|
|
|
- 1: 'success', // 新增
|
|
|
- 2: 'danger', // 减少
|
|
|
- 3: 'warning' // 对冲
|
|
|
+ 1: 'success',
|
|
|
+ 2: 'danger',
|
|
|
+ 3: 'warning'
|
|
|
}
|
|
|
return typeMap[type] || 'info'
|
|
|
},
|
|
|
@@ -641,14 +527,13 @@ export default {
|
|
|
limit: this.pagination.limit,
|
|
|
...this.searchForm
|
|
|
}
|
|
|
-
|
|
|
- // 处理时间范围
|
|
|
+
|
|
|
if (this.searchForm.dateRange && this.searchForm.dateRange.length === 2) {
|
|
|
params.create_time = this.searchForm.dateRange
|
|
|
}
|
|
|
delete params.dateRange
|
|
|
|
|
|
- const response = await this.axiosInstance.get('/points/user_point_log', { params })
|
|
|
+ const response = await request.get('/points/user_point_log', { params })
|
|
|
this.pointsList = response.page.data || []
|
|
|
this.pagination.total = response.page.total || 0
|
|
|
this.statsData = response.data || {}
|
|
|
@@ -690,7 +575,7 @@ export default {
|
|
|
this.getUserPointLogs()
|
|
|
},
|
|
|
|
|
|
- // 新增: 用户清除处理方法
|
|
|
+ // 用户清除处理方法
|
|
|
handleUserClear() {
|
|
|
this.searchForm.user_id = ''
|
|
|
},
|
|
|
@@ -720,8 +605,8 @@ export default {
|
|
|
limit: this.adjustUserPagination.limit,
|
|
|
keyword: this.adjustUserSearchKeyword
|
|
|
}
|
|
|
-
|
|
|
- const response = await this.axiosInstance.get('/points/user_point', { params })
|
|
|
+
|
|
|
+ const response = await request.get('/points/user_point', { params })
|
|
|
this.adjustUserList = response.page.data || []
|
|
|
this.adjustUserPagination.total = response.page.total || 0
|
|
|
} catch (error) {
|
|
|
@@ -773,30 +658,28 @@ export default {
|
|
|
// 手动调整积分
|
|
|
async handleAdjustPoints() {
|
|
|
try {
|
|
|
- // 验证表单
|
|
|
await this.$refs.adjustFormRef.validate()
|
|
|
-
|
|
|
+
|
|
|
this.adjustLoading = true
|
|
|
-
|
|
|
- // 根据操作类型确定积分正负值和类型
|
|
|
+
|
|
|
let pointValue = parseInt(this.adjustForm.point, 10)
|
|
|
- let typeValue = 1; // 默认为增加
|
|
|
+ let typeValue = 1
|
|
|
if (this.adjustForm.operation_type === 'decrease') {
|
|
|
pointValue = -Math.abs(pointValue)
|
|
|
- typeValue = 2; // 减少
|
|
|
+ typeValue = 2
|
|
|
} else {
|
|
|
pointValue = Math.abs(pointValue)
|
|
|
- typeValue = 1; // 增加
|
|
|
+ typeValue = 1
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const data = {
|
|
|
user_id: this.adjustForm.user_id,
|
|
|
point: pointValue,
|
|
|
type: typeValue,
|
|
|
remark: this.adjustForm.remark
|
|
|
}
|
|
|
-
|
|
|
- await this.axiosInstance.put(`/points/user_point/${this.adjustForm.user_id}/adjust`, data)
|
|
|
+
|
|
|
+ await request.put(`/points/user_point/${this.adjustForm.user_id}/adjust`, data)
|
|
|
this.$message.success('积分调整成功')
|
|
|
this.adjustDialogVisible = false
|
|
|
this.resetAdjustForm()
|
|
|
@@ -834,8 +717,8 @@ export default {
|
|
|
limit: this.userPagination.limit,
|
|
|
keyword: this.userSearchKeyword
|
|
|
}
|
|
|
-
|
|
|
- const response = await this.axiosInstance.get('/points/user_point', { params })
|
|
|
+
|
|
|
+ const response = await request.get('/points/user_point', { params })
|
|
|
this.userList = response.page.data || []
|
|
|
this.userPagination.total = response.page.total || 0
|
|
|
} catch (error) {
|
|
|
@@ -866,65 +749,6 @@ export default {
|
|
|
this.$message.success(`已选择用户: ${user.nickname} (ID: ${user.id})`)
|
|
|
},
|
|
|
|
|
|
- // 显示调整积分用户选择对话框
|
|
|
- showAdjustUserDialog() {
|
|
|
- this.adjustUserDialogVisible = true
|
|
|
- this.getAdjustUserList()
|
|
|
- },
|
|
|
-
|
|
|
- // 获取调整积分用户列表
|
|
|
- async getAdjustUserList() {
|
|
|
- try {
|
|
|
- this.adjustUserLoading = true
|
|
|
- const params = {
|
|
|
- page: this.adjustUserPagination.page,
|
|
|
- limit: this.adjustUserPagination.limit,
|
|
|
- keyword: this.adjustUserSearchKeyword
|
|
|
- }
|
|
|
-
|
|
|
- const response = await this.axiosInstance.get('/points/user_point', { params })
|
|
|
- this.adjustUserList = response.page.data || []
|
|
|
- this.adjustUserPagination.total = response.page.total || 0
|
|
|
- } catch (error) {
|
|
|
- console.error('获取用户列表失败:', error)
|
|
|
- this.$message.error('获取用户列表失败')
|
|
|
- } finally {
|
|
|
- this.adjustUserLoading = false
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 选择调整积分用户
|
|
|
- selectAdjustUser(user) {
|
|
|
- this.adjustForm.user_id = user.id.toString()
|
|
|
- this.adjustUserDialogVisible = false
|
|
|
- this.$message.success(`已选择用户: ${user.nickname} (ID: ${user.id})`)
|
|
|
- },
|
|
|
-
|
|
|
- // 搜索调整积分用户
|
|
|
- handleAdjustUserSearch() {
|
|
|
- this.adjustUserPagination.page = 1
|
|
|
- this.getAdjustUserList()
|
|
|
- },
|
|
|
-
|
|
|
- // 重置调整积分用户搜索
|
|
|
- resetAdjustUserSearch() {
|
|
|
- this.adjustUserSearchKeyword = ''
|
|
|
- this.adjustUserPagination.page = 1
|
|
|
- this.getAdjustUserList()
|
|
|
- },
|
|
|
-
|
|
|
- // 调整积分用户列表分页处理
|
|
|
- handleAdjustUserSizeChange(newSize) {
|
|
|
- this.adjustUserPagination.limit = newSize
|
|
|
- this.adjustUserPagination.page = 1
|
|
|
- this.getAdjustUserList()
|
|
|
- },
|
|
|
-
|
|
|
- handleAdjustUserCurrentChange(newPage) {
|
|
|
- this.adjustUserPagination.page = newPage
|
|
|
- this.getAdjustUserList()
|
|
|
- },
|
|
|
-
|
|
|
// 用户列表分页处理
|
|
|
handleUserSizeChange(newSize) {
|
|
|
this.userPagination.limit = newSize
|
|
|
@@ -936,8 +760,6 @@ export default {
|
|
|
this.userPagination.page = newPage
|
|
|
this.getUserList()
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -1054,4 +876,4 @@ export default {
|
|
|
:deep(.el-input.is-readonly .el-input__inner) {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|