index.vue 4.4 KB

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