| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <view class="complaint-list-page">
- <nav-bar title="投诉管理"></nav-bar>
- <view class="list-container">
- <view class="empty-state" v-if="historyList.length === 0">
- <text>暂无投诉记录</text>
- </view>
- <view v-else class="history-card" v-for="item in historyList" :key="item.id">
- <view class="card-header">
- <view class="left-box">
- <text class="status-tag" :class="item.praiseFlag ? 'praise' : 'complaint'">{{ item.praiseFlag ? '赞' : '不赞' }}</text>
- <text class="order-no">单号:{{ item.orderCode || '-' }}</text>
- </view>
- <text class="status-text">已提交</text>
- </view>
- <view class="card-body">
- <view class="reason-row">
- <text class="label">{{ item.praiseFlag ? '理由:' : '不赞原因:' }}</text>
- <text class="reason-content">{{ item.reason || '未填写内容' }}</text>
- </view>
-
- <!-- 凭证图片展示 @Author: Antigravity -->
- <view class="photo-grid" v-if="item.photos">
- <image
- v-for="(url, index) in item.photos.split(',')"
- :key="index"
- :src="url"
- mode="aspectFill"
- class="photo-item"
- @click="previewImage(item.photos.split(','), index)"
- ></image>
- </view>
- </view>
- <view class="card-footer">
- <text class="time">{{ item.createTime || '-' }}</text>
- </view>
- </view>
-
- <view v-if="historyList.length > 0 && !hasMore" class="no-more">没有更多了</view>
- </view>
- </view>
- </template>
- <script setup>
- // @Author: Antigravity
- import { ref } from 'vue'
- import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
- import navBar from '@/components/nav-bar/index.vue'
- import { listMyComplaint } from '@/api/fulfiller/complaint'
- import { getInfo } from '@/api/system/user'
- const historyList = ref([])
- const pageNum = ref(1)
- const pageSize = ref(10)
- const hasMore = ref(true)
- const loadData = async (isLoadMore = false) => {
- try {
- uni.showNavigationBarLoading()
- const res = await listMyComplaint({
- pageNum: pageNum.value,
- pageSize: pageSize.value
- })
-
- const rows = res.rows || []
- if (isLoadMore) {
- historyList.value = [...historyList.value, ...rows]
- } else {
- historyList.value = rows
- }
- hasMore.value = historyList.value.length < (res.total || 0)
- } catch (error) {
- console.error('加载投诉记录失败', error)
- } finally {
- uni.hideNavigationBarLoading()
- uni.stopPullDownRefresh()
- }
- }
- onShow(() => {
- pageNum.value = 1
- loadData()
- })
- onPullDownRefresh(() => {
- pageNum.value = 1
- loadData()
- })
- onReachBottom(() => {
- if (hasMore.value) {
- pageNum.value++
- loadData(true)
- }
- })
- const previewImage = (urls, index) => {
- uni.previewImage({
- urls: urls,
- current: index
- })
- }
- </script>
- <style lang="scss" scoped>
- .complaint-list-page {
- min-height: 100vh;
- background: #f7f8fa;
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- }
- .list-container {
- padding: 24rpx;
- }
- .empty-state {
- text-align: center;
- padding: 100rpx 0;
- color: #999;
- font-size: 28rpx;
- }
- .history-card {
- background: #fff;
- border-radius: 20rpx;
- padding: 28rpx;
- margin-bottom: 24rpx;
- box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03);
- }
- .card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 2rpx solid #EEEEEE;
- }
- .left-box {
- display: flex;
- align-items: center;
- gap: 16rpx;
- }
- .order-no {
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- }
- .status-tag {
- font-size: 20rpx;
- padding: 2rpx 12rpx;
- border-radius: 6rpx;
- font-weight: 700;
- &.praise {
- color: #52c41a;
- background: #f6ffed;
- border: 1rpx solid #b7eb8f;
- }
- &.complaint {
- color: #ff4d4f;
- background: #fff1f0;
- border: 1rpx solid #ffa39e;
- }
- }
- .status-text {
- font-size: 24rpx;
- color: #999;
- }
- .reason-row {
- display: flex;
- flex-direction: column;
- gap: 12rpx;
- }
- .label {
- font-size: 24rpx;
- color: #999;
- }
- .reason-content {
- font-size: 28rpx;
- color: #333;
- line-height: 1.6;
- }
- .photo-grid {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 12rpx;
- margin-top: 20rpx;
- }
- .photo-item {
- width: 100%;
- height: 200rpx;
- border-radius: 12rpx;
- background: #f5f5f5;
- }
- .card-footer {
- margin-top: 24rpx;
- padding-top: 20rpx;
- border-top: 2rpx solid #EEEEEE;
- display: flex;
- justify-content: flex-end;
- }
- .time {
- font-size: 24rpx;
- color: #999;
- }
- .no-more {
- text-align: center;
- font-size: 24rpx;
- color: #ccc;
- padding: 20rpx 0;
- }
- </style>
|