Files
peko-admin-web/src/views/users/FeedBack.vue
2024-07-08 19:01:21 +08:00

203 lines
4.9 KiB
Vue

<template>
<div class="box">
<!-- 查询 -->
<!-- 时间选择器 -->
<div class="inquire">
<div class="block">
<span class="demonstration">日期</span>
<el-date-picker
v-model="inquire.time"
type="datetimerange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</div>
</div>
<div class="inquire">
<span>反馈类型</span>
<el-select filterable v-model="inquire.value" placeholder="请选择">
<el-option
v-for="item in inquire.options"
:key="item.type"
:label="JsonFunc(item.desc).zh"
:value="item.type"
>
</el-option>
</el-select>
</div>
<!-- 查询按钮 -->
<el-button class="primary" type="primary" @click="getData()"
>查询</el-button
>
</div>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="desc" align="center" label="问题描述" />
<el-table-column prop="type" align="center" label="反馈类型">
<template #default="{ row }">
{{
row.type == 1
? "应用异常"
: row.type == 2
? "充值或收入"
: row.type == 3
? "账号申诉"
: row.type == 4
? "建议"
: ""
}}
</template>
</el-table-column>
<el-table-column
align="center"
prop="giftInfo"
label="反馈截图"
width="120"
>
<template v-slot="scope">
<el-image
v-if="scope.row.screenUrl"
style="width: 100px; height: 100px"
:src="scope.row.screenUrl"
:zoom-rate="1.1"
:preview-src-list="scope.row.screenUrl"
fit="cover"
preview-teleported="true"
hide-on-click-modal="true"
/>
<div v-else>/</div>
</template>
</el-table-column>
<el-table-column prop="contact" align="center" label="联系方式" />
<el-table-column prop="createTime" align="center" label="生成时间" />
</el-table>
<!-- 分页 -->
<el-pagination
style="margin-top: 10px"
class="paginationClass"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
layout="sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</template>
<script>
import { listType, pageRecord } from "@/api/feedBack/feedBack";
import { dateFormat } from "@/utils/system-helper";
import { ElMessage } from "element-plus";
export default {
name: "FeedBack",
data() {
return {
inquire: {
giftId: "",
userId: "",
time: "",
value: "",
options: [],
},
loading: false,
// 表格数据
tableData: [],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
};
},
created() {
listType().then((res) => {
this.inquire.options = res.data;
});
this.getData();
},
methods: {
getData() {
this.loading = true;
let startTime = "";
let endTime = "";
if (this.inquire.time && this.inquire.time.length > 0) {
startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
}
pageRecord({
startTime,
endTime,
type: this.inquire.value,
page: this.currentPage,
pageSize: this.pageSize,
})
.then((res) => {
if (res.code === 200) {
this.tableData = res.data.rows;
this.total = res.data.total;
} else {
ElMessage({
showClose: true,
message: res.message || "获取数据失败",
type: "error",
});
}
this.loading = false;
})
.catch((error) => {
console.error("请求出错:", error);
ElMessage({
showClose: true,
message: "请求出错,请稍后重试",
type: "error",
});
this.loading = false;
});
},
JsonFunc(val) {
var res = JSON.parse(val);
return res;
},
// 分页导航
handleSizeChange(size) {
this.pageSize = size;
this.getData();
},
handleCurrentChange(page) {
this.currentPage = page;
this.getData();
},
},
};
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
</style>