index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="complaint-list-page">
  3. <nav-bar title="投诉管理"></nav-bar>
  4. <view class="list-container">
  5. <view class="empty-state" v-if="historyList.length === 0">
  6. <text>暂无投诉记录</text>
  7. </view>
  8. <view v-else class="history-card" v-for="item in historyList" :key="item.id">
  9. <view class="card-header">
  10. <view class="left-box">
  11. <text class="order-no">单号:{{ item.orderCode || '-' }}</text>
  12. <text class="submitted-tag">已提交</text>
  13. </view>
  14. <view :class="['praise-badge', item.praiseFlag ? 'agree' : 'disagree']">
  15. <image class="badge-icon"
  16. :src="item.praiseFlag ? '/static/images/complaint-agree.png' : '/static/images/complaint-disagree.png'"
  17. mode="aspectFit"></image>
  18. <text class="badge-text">{{ item.praiseFlag ? '赞' : '不赞' }}</text>
  19. </view>
  20. </view>
  21. <view class="card-time">{{ item.createTime || '-' }}</view>
  22. <view class="card-body">
  23. <view class="reason-row">
  24. <text class="reason-content">{{ item.reason || '未填写内容' }}</text>
  25. </view>
  26. <!-- 凭证图片展示 @Author: Antigravity -->
  27. <view class="photo-grid" v-if="item.photoUrls">
  28. <image v-for="(url, index) in item.photoUrls.split(',')" :key="index" :src="url"
  29. mode="aspectFill" class="photo-item"
  30. @click="previewImage(item.photoUrls.split(','), index)"></image>
  31. </view>
  32. </view>
  33. </view>
  34. <view v-if="historyList.length > 0 && !hasMore" class="no-more">没有更多了</view>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. // @Author: Antigravity
  40. import { ref } from 'vue'
  41. import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
  42. import navBar from '@/components/nav-bar/index.vue'
  43. import { listMyComplaint } from '@/api/fulfiller/complaint'
  44. import { getInfo } from '@/api/system/user'
  45. const historyList = ref([])
  46. const pageNum = ref(1)
  47. const pageSize = ref(10)
  48. const hasMore = ref(true)
  49. const loadData = async (isLoadMore = false) => {
  50. try {
  51. uni.showNavigationBarLoading()
  52. const res = await listMyComplaint({
  53. pageNum: pageNum.value,
  54. pageSize: pageSize.value
  55. })
  56. const rows = res.rows || []
  57. if (isLoadMore) {
  58. historyList.value = [...historyList.value, ...rows]
  59. } else {
  60. historyList.value = rows
  61. }
  62. hasMore.value = historyList.value.length < (res.total || 0)
  63. } catch (error) {
  64. console.error('加载投诉记录失败', error)
  65. uni.showToast({ title: typeof error === 'string' ? error : '加载投诉记录失败', icon: 'none' })
  66. } finally {
  67. uni.hideNavigationBarLoading()
  68. uni.stopPullDownRefresh()
  69. }
  70. }
  71. onShow(() => {
  72. pageNum.value = 1
  73. loadData()
  74. })
  75. onPullDownRefresh(() => {
  76. pageNum.value = 1
  77. loadData()
  78. })
  79. onReachBottom(() => {
  80. if (hasMore.value) {
  81. pageNum.value++
  82. loadData(true)
  83. }
  84. })
  85. const previewImage = (urls, index) => {
  86. uni.previewImage({
  87. urls: urls,
  88. current: index
  89. })
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .complaint-list-page {
  94. min-height: 100vh;
  95. background: #f7f8fa;
  96. padding-bottom: constant(safe-area-inset-bottom);
  97. padding-bottom: env(safe-area-inset-bottom);
  98. }
  99. .list-container {
  100. padding: 24rpx;
  101. }
  102. .empty-state {
  103. text-align: center;
  104. padding: 100rpx 0;
  105. color: #999;
  106. font-size: 28rpx;
  107. }
  108. .history-card {
  109. background: #fff;
  110. border-radius: 20rpx;
  111. padding: 28rpx;
  112. margin-bottom: 24rpx;
  113. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.03);
  114. }
  115. .card-header {
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. }
  120. .left-box {
  121. display: flex;
  122. align-items: center;
  123. gap: 12rpx;
  124. }
  125. .order-no {
  126. font-size: 26rpx;
  127. color: #333;
  128. font-weight: 500;
  129. }
  130. .submitted-tag {
  131. font-size: 20rpx;
  132. color: #999;
  133. background: #f0f0f0;
  134. padding: 2rpx 12rpx;
  135. border-radius: 6rpx;
  136. font-weight: 500;
  137. }
  138. .praise-badge {
  139. display: flex;
  140. align-items: center;
  141. gap: 6rpx;
  142. padding: 4rpx 14rpx;
  143. border-radius: 8rpx;
  144. font-size: 22rpx;
  145. font-weight: 600;
  146. flex-shrink: 0;
  147. &.agree {
  148. color: #52c41a;
  149. background: #f6ffed;
  150. }
  151. &.disagree {
  152. color: #ff4d4f;
  153. background: #fff1f0;
  154. }
  155. }
  156. .badge-icon {
  157. width: 28rpx;
  158. height: 28rpx;
  159. flex-shrink: 0;
  160. }
  161. .badge-text {
  162. line-height: 1;
  163. }
  164. .card-time {
  165. font-size: 24rpx;
  166. color: #999;
  167. margin-top: 12rpx;
  168. padding-bottom: 16rpx;
  169. border-bottom: 2rpx solid #EEEEEE;
  170. }
  171. .reason-row {
  172. display: flex;
  173. flex-direction: column;
  174. gap: 12rpx;
  175. }
  176. .reason-content {
  177. font-size: 28rpx;
  178. color: #333;
  179. line-height: 1.6;
  180. }
  181. .photo-grid {
  182. display: grid;
  183. grid-template-columns: repeat(3, 1fr);
  184. gap: 12rpx;
  185. margin-top: 20rpx;
  186. }
  187. .photo-item {
  188. width: 100%;
  189. height: 200rpx;
  190. border-radius: 12rpx;
  191. background: #f5f5f5;
  192. }
  193. .no-more {
  194. text-align: center;
  195. font-size: 24rpx;
  196. color: #ccc;
  197. padding: 20rpx 0;
  198. }
  199. </style>