index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. padding-bottom: 20rpx;
  122. border-bottom: 1rpx solid #f5f5f5;
  123. margin-bottom: 20rpx;
  124. }
  125. .left-box {
  126. display: flex;
  127. align-items: center;
  128. gap: 16rpx;
  129. }
  130. .order-no {
  131. font-size: 26rpx;
  132. color: #333;
  133. font-weight: 500;
  134. }
  135. .status-tag {
  136. font-size: 20rpx;
  137. padding: 2rpx 12rpx;
  138. border-radius: 6rpx;
  139. font-weight: 700;
  140. &.praise {
  141. color: #52c41a;
  142. background: #f6ffed;
  143. border: 1rpx solid #b7eb8f;
  144. }
  145. &.complaint {
  146. color: #ff4d4f;
  147. background: #fff1f0;
  148. border: 1rpx solid #ffa39e;
  149. }
  150. }
  151. .status-text {
  152. font-size: 24rpx;
  153. color: #999;
  154. }
  155. .reason-row {
  156. display: flex;
  157. flex-direction: column;
  158. gap: 12rpx;
  159. }
  160. .label {
  161. font-size: 24rpx;
  162. color: #999;
  163. }
  164. .reason-content {
  165. font-size: 28rpx;
  166. color: #333;
  167. line-height: 1.6;
  168. }
  169. .photo-grid {
  170. display: grid;
  171. grid-template-columns: repeat(3, 1fr);
  172. gap: 12rpx;
  173. margin-top: 20rpx;
  174. }
  175. .photo-item {
  176. width: 100%;
  177. height: 200rpx;
  178. border-radius: 12rpx;
  179. background: #f5f5f5;
  180. }
  181. .card-footer {
  182. margin-top: 24rpx;
  183. padding-top: 20rpx;
  184. border-top: 1rpx solid #f5f5f5;
  185. display: flex;
  186. justify-content: flex-end;
  187. }
  188. .time {
  189. font-size: 24rpx;
  190. color: #999;
  191. }
  192. .no-more {
  193. text-align: center;
  194. font-size: 24rpx;
  195. color: #ccc;
  196. padding: 20rpx 0;
  197. }
  198. </style>