| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <template>
- <view class="complaint-list-root">
- <erp-nav-bar title="投诉与建议" />
- <scroll-view scroll-y class="list-scroll-view" :show-scrollbar="false" @scrolltolower="onReachEnd">
- <view class="list-inner">
- <view class="complaint-card" v-for="item in displayList" :key="item.id" @click="goDetail(item)">
- <view class="card-header">
- <view class="type-badge">{{ item.feedbackTypeLabel }}</view>
- <view class="status-text" :class="item.status === '1' ? 'done' : 'pending'">
- {{ item.status === '1' ? '已处理' : '待处理' }}
- </view>
- </view>
- <view class="card-content">
- <text class="content-text">{{ item.content }}</text>
- </view>
- <view class="card-footer">
- <text class="time-text">{{ item.createTime }}</text>
- <view class="arrow-icon"></view>
- </view>
- </view>
- <view class="list-status-info" v-if="displayList.length > 0">
- <view class="loading-wrap" v-if="loading">
- <text>加载中...</text>
- </view>
- <view class="nomore-wrap" v-if="noMore">
- <text class="nomore-text">没有更多了</text>
- </view>
- </view>
- <view class="empty-state" v-if="displayList.length === 0 && !loading">
- <image src="https://img.icons8.com/clouds/200/comments.png" mode="aspectFit"></image>
- <text class="empty-txt">暂无反馈记录</text>
- </view>
- <view class="safe-bottom"></view>
- </view>
- </scroll-view>
- <view class="footer-bar">
- <button class="submit-btn" @click="goSubmit">提交反馈</button>
- </view>
- </view>
- </template>
- <script>
- import ErpNavBar from '@/components/erp-nav-bar.vue';
- import { getMyComplaintList } from '@/api/system/complaint.js';
- import { getDictByType } from '@/api/system/dict.js';
- export default {
- components: { ErpNavBar },
- data() {
- return {
- loading: false,
- noMore: false,
- pageNum: 1,
- displayList: [],
- typeMap: {}
- }
- },
- onLoad() {
- this.loadDict();
- this.refresh();
- },
- onShow() {
- if (this.displayList.length > 0) {
- this.refresh();
- }
- },
- methods: {
- async loadDict() {
- try {
- const res = await getDictByType('sys_complaint_type');
- if (res && res.data) {
- const map = {};
- res.data.forEach(d => { map[d.dictValue] = d.dictLabel; });
- this.typeMap = map;
- }
- } catch (e) { /* 忽略字典加载失败 */ }
- },
- goBack() { uni.navigateBack(); },
- goSubmit() {
- uni.navigateTo({ url: '/pages/mine/complaint/submit/index' });
- },
- goDetail(item) {
- uni.navigateTo({ url: `/pages/mine/complaint/detail/index?id=${item.id}` });
- },
- refresh() {
- this.displayList = [];
- this.noMore = false;
- this.pageNum = 1;
- this.loadData();
- },
- onReachEnd() {
- if (!this.loading && !this.noMore) this.loadData();
- },
- async loadData() {
- if (this.loading || this.noMore) return;
- this.loading = true;
- try {
- const params = {
- pageNum: this.pageNum,
- pageSize: 10
- };
- const res = await getMyComplaintList(params);
- const rows = (res && res.rows) ? res.rows : [];
- const formatted = rows.map(item => ({
- id: item.id,
- feedbackType: item.feedbackType,
- feedbackTypeLabel: this.typeMap[item.feedbackType] || item.feedbackType || '未知类型',
- content: item.content,
- status: item.status || '0',
- createTime: item.createTime
- }));
- this.displayList = [...this.displayList, ...formatted];
- this.pageNum++;
- this.noMore = rows.length === 0 || this.displayList.length >= (res.total || 0);
- } catch (e) {
- console.error('加载反馈列表失败', e);
- uni.showToast({ title: e || '加载反馈列表失败', icon: 'none' });
- } finally {
- this.loading = false;
- }
- }
- }
- }
- </script>
- <style scoped>
- /deep/ ::-webkit-scrollbar {
- display: none !important;
- width: 0 !important;
- height: 0 !important;
- }
- .complaint-list-root {
- width: 100vw;
- height: 100vh;
- background: #f8fafb;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- }
- .list-scroll-view {
- flex: 1;
- height: 0;
- width: 100%;
- }
- .list-inner {
- padding: 30rpx;
- }
- .complaint-card {
- background: #fff;
- border-radius: 16rpx;
- padding: 30rpx;
- margin-bottom: 24rpx;
- box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
- }
- .card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .type-badge {
- font-size: 26rpx;
- color: #C1001C;
- background: rgba(193, 0, 28, 0.06);
- padding: 6rpx 16rpx;
- border-radius: 8rpx;
- }
- .status-text {
- font-size: 26rpx;
- }
- .status-text.pending {
- color: #ff9800;
- }
- .status-text.done {
- color: #4caf50;
- }
- .card-content {
- margin-bottom: 20rpx;
- }
- .content-text {
- font-size: 28rpx;
- color: #333;
- line-height: 1.6;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- overflow: hidden;
- }
- .card-footer {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .time-text {
- font-size: 24rpx;
- color: #bbb;
- }
- .arrow-icon {
- width: 14rpx;
- height: 14rpx;
- border-right: 3rpx solid #ccc;
- border-top: 3rpx solid #ccc;
- transform: rotate(45deg);
- margin-left: 10rpx;
- }
- .list-status-info {
- padding: 30rpx 0;
- display: flex;
- justify-content: center;
- }
- .loading-wrap {
- font-size: 26rpx;
- color: #999;
- }
- .nomore-wrap {
- display: flex;
- align-items: center;
- }
- .nomore-text {
- font-size: 26rpx;
- color: #ccc;
- }
- .empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-top: 150rpx;
- }
- .empty-state image {
- width: 200rpx;
- height: 200rpx;
- margin-bottom: 30rpx;
- }
- .empty-txt {
- font-size: 28rpx;
- color: #999;
- margin-bottom: 40rpx;
- }
- .safe-bottom {
- height: 40rpx;
- }
- .footer-bar {
- background: #fff;
- padding: 30rpx 40rpx calc(30rpx + env(safe-area-inset-bottom));
- flex-shrink: 0;
- border-top: 1rpx solid #f0f0f0;
- }
- .submit-btn {
- width: 100%;
- height: 96rpx;
- background: #C1001C;
- color: #fff;
- border-radius: 48rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 32rpx;
- font-weight: bold;
- border: none;
- }
- .submit-btn::after {
- border: none;
- }
- </style>
|