index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. uni.showToast({ title: typeof error === 'string' ? error : '加载投诉记录失败', icon: 'none' })
  69. } finally {
  70. uni.hideNavigationBarLoading()
  71. uni.stopPullDownRefresh()
  72. }
  73. }
  74. onShow(() => {
  75. pageNum.value = 1
  76. loadData()
  77. })
  78. onPullDownRefresh(() => {
  79. pageNum.value = 1
  80. loadData()
  81. })
  82. onReachBottom(() => {
  83. if (hasMore.value) {
  84. pageNum.value++
  85. loadData(true)
  86. }
  87. })
  88. const previewImage = (urls, index) => {
  89. uni.previewImage({
  90. urls: urls,
  91. current: index
  92. })
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .complaint-list-page {
  97. min-height: 100vh;
  98. background: #f7f8fa;
  99. padding-bottom: constant(safe-area-inset-bottom);
  100. padding-bottom: env(safe-area-inset-bottom);
  101. }
  102. .list-container {
  103. padding: 24rpx;
  104. }
  105. .empty-state {
  106. text-align: center;
  107. padding: 100rpx 0;
  108. color: #999;
  109. font-size: 28rpx;
  110. }
  111. .history-card {
  112. background: #fff;
  113. border-radius: 20rpx;
  114. padding: 28rpx;
  115. margin-bottom: 24rpx;
  116. box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03);
  117. }
  118. .card-header {
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. border-bottom: 2rpx solid #EEEEEE;
  123. }
  124. .left-box {
  125. display: flex;
  126. align-items: center;
  127. gap: 16rpx;
  128. }
  129. .order-no {
  130. font-size: 26rpx;
  131. color: #333;
  132. font-weight: 500;
  133. }
  134. .status-tag {
  135. font-size: 20rpx;
  136. padding: 2rpx 12rpx;
  137. border-radius: 6rpx;
  138. font-weight: 700;
  139. &.praise {
  140. color: #52c41a;
  141. background: #f6ffed;
  142. border: 1rpx solid #b7eb8f;
  143. }
  144. &.complaint {
  145. color: #ff4d4f;
  146. background: #fff1f0;
  147. border: 1rpx solid #ffa39e;
  148. }
  149. }
  150. .status-text {
  151. font-size: 24rpx;
  152. color: #999;
  153. }
  154. .reason-row {
  155. display: flex;
  156. flex-direction: column;
  157. gap: 12rpx;
  158. }
  159. .label {
  160. font-size: 24rpx;
  161. color: #999;
  162. }
  163. .reason-content {
  164. font-size: 28rpx;
  165. color: #333;
  166. line-height: 1.6;
  167. }
  168. .photo-grid {
  169. display: grid;
  170. grid-template-columns: repeat(3, 1fr);
  171. gap: 12rpx;
  172. margin-top: 20rpx;
  173. }
  174. .photo-item {
  175. width: 100%;
  176. height: 200rpx;
  177. border-radius: 12rpx;
  178. background: #f5f5f5;
  179. }
  180. .card-footer {
  181. margin-top: 24rpx;
  182. padding-top: 20rpx;
  183. border-top: 2rpx solid #EEEEEE;
  184. display: flex;
  185. justify-content: flex-end;
  186. }
  187. .time {
  188. font-size: 24rpx;
  189. color: #999;
  190. }
  191. .no-more {
  192. text-align: center;
  193. font-size: 24rpx;
  194. color: #ccc;
  195. padding: 20rpx 0;
  196. }
  197. </style>