index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <view class="complaint-detail-root">
  3. <erp-nav-bar title="反馈详情" />
  4. <scroll-view scroll-y class="scroll-view-container" :show-scrollbar="false">
  5. <view class="detail-body" v-if="detail">
  6. <view class="section-card">
  7. <view class="section-title">反馈信息</view>
  8. <view class="info-row">
  9. <text class="info-label">反馈类型</text>
  10. <text class="info-value type-tag">{{ detail.feedbackTypeLabel }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="info-label">反馈时间</text>
  14. <text class="info-value">{{ detail.createTime }}</text>
  15. </view>
  16. </view>
  17. <view class="section-card">
  18. <view class="section-title">反馈内容</view>
  19. <view class="content-block">{{ detail.content }}</view>
  20. </view>
  21. <view class="section-card" v-if="detail.imageUrls && detail.imageUrls.length > 0">
  22. <view class="section-title">上传图片</view>
  23. <view class="upload-grid">
  24. <view class="img-item" v-for="(url, index) in detail.imageUrls" :key="index"
  25. @click="previewImage(index)">
  26. <image :src="url" mode="aspectFill"></image>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="section-card">
  31. <view class="section-title">处理状态</view>
  32. <view class="status-block">
  33. <view class="status-dot" :class="detail.status === '1' ? 'done' : 'pending'"></view>
  34. <text class="status-label">{{ detail.status === '1' ? '已处理' : '待处理' }}</text>
  35. </view>
  36. </view>
  37. <view class="section-card" v-if="detail.status === '1'">
  38. <view class="section-title">处理结果</view>
  39. <view class="content-block">{{ detail.dealResult || '暂无处理结果说明' }}</view>
  40. </view>
  41. <view class="section-card"
  42. v-if="detail.status === '1' && detail.dealImageUrls && detail.dealImageUrls.length > 0">
  43. <view class="section-title">处理凭证</view>
  44. <view class="upload-grid">
  45. <view class="img-item" v-for="(url, index) in detail.dealImageUrls" :key="'deal-' + index"
  46. @click="previewDealImage(index)">
  47. <image :src="url" mode="aspectFill"></image>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="bottom-placeholder"></view>
  52. </view>
  53. <view class="loading-state" v-if="!detail && loading">
  54. <text>加载中...</text>
  55. </view>
  56. </scroll-view>
  57. </view>
  58. </template>
  59. <script>
  60. import ErpNavBar from '@/components/erp-nav-bar.vue';
  61. import { getComplaintDetail } from '@/api/system/complaint.js';
  62. import { getDictByType } from '@/api/system/dict.js';
  63. export default {
  64. components: { ErpNavBar },
  65. data() {
  66. return {
  67. id: '',
  68. loading: false,
  69. detail: null,
  70. typeMap: {}
  71. }
  72. },
  73. onLoad(options) {
  74. this.id = options.id || '';
  75. this.loadDict().then(() => this.loadDetail());
  76. },
  77. methods: {
  78. goBack() { uni.navigateBack(); },
  79. async loadDict() {
  80. try {
  81. const res = await getDictByType('sys_complaint_type');
  82. if (res && res.data) {
  83. const map = {};
  84. res.data.forEach(d => { map[d.dictValue] = d.dictLabel; });
  85. this.typeMap = map;
  86. }
  87. } catch (e) { /* 忽略字典加载失败 */ }
  88. },
  89. async loadDetail() {
  90. if (!this.id) return;
  91. this.loading = true;
  92. try {
  93. const res = await getComplaintDetail(this.id);
  94. const data = res.data || res;
  95. if (data) {
  96. this.detail = {
  97. id: data.id,
  98. feedbackType: data.feedbackType,
  99. feedbackTypeLabel: this.typeMap[data.feedbackType] || data.feedbackType || '未知类型',
  100. content: data.content,
  101. status: data.status || '0',
  102. createTime: data.createTime,
  103. imageUrls: data.imageUrls ? data.imageUrls.split(',').filter(u => u) : [],
  104. dealResult: data.dealResult || '',
  105. dealImageUrls: data.dealImageUrls ? data.dealImageUrls.split(',').filter(u => u) : []
  106. };
  107. }
  108. } catch (e) {
  109. console.error('加载反馈详情失败', e);
  110. uni.showToast({ title: e || '加载反馈详情失败', icon: 'none' });
  111. } finally {
  112. this.loading = false;
  113. }
  114. },
  115. previewImage(index) {
  116. uni.previewImage({
  117. urls: this.detail.imageUrls,
  118. current: index
  119. });
  120. },
  121. previewDealImage(index) {
  122. uni.previewImage({
  123. urls: this.detail.dealImageUrls,
  124. current: index
  125. });
  126. }
  127. }
  128. }
  129. </script>
  130. <style scoped>
  131. .complaint-detail-root {
  132. width: 100vw;
  133. height: 100vh;
  134. background: #f8fafb;
  135. display: flex;
  136. flex-direction: column;
  137. overflow: hidden;
  138. }
  139. .scroll-view-container {
  140. flex: 1;
  141. height: 0;
  142. width: 100%;
  143. }
  144. .detail-body {
  145. padding: 30rpx;
  146. }
  147. .section-card {
  148. background: #fff;
  149. border-radius: 24rpx;
  150. padding: 40rpx 30rpx;
  151. margin-bottom: 30rpx;
  152. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
  153. }
  154. .section-title {
  155. font-size: 30rpx;
  156. font-weight: bold;
  157. color: #1a1a1a;
  158. margin-bottom: 30rpx;
  159. border-left: 8rpx solid #C1001C;
  160. padding-left: 20rpx;
  161. line-height: 1.2;
  162. }
  163. .info-row {
  164. display: flex;
  165. justify-content: space-between;
  166. align-items: center;
  167. padding: 16rpx 0;
  168. }
  169. .info-label {
  170. font-size: 28rpx;
  171. color: #999;
  172. }
  173. .info-value {
  174. font-size: 28rpx;
  175. color: #333;
  176. }
  177. .type-tag {
  178. color: #C1001C;
  179. font-weight: bold;
  180. }
  181. .content-block {
  182. font-size: 28rpx;
  183. color: #333;
  184. line-height: 1.8;
  185. white-space: pre-wrap;
  186. word-break: break-all;
  187. }
  188. .upload-grid {
  189. display: grid;
  190. grid-template-columns: repeat(3, 1fr);
  191. gap: 20rpx;
  192. }
  193. .img-item {
  194. position: relative;
  195. width: 100%;
  196. padding-top: 100%;
  197. border-radius: 16rpx;
  198. overflow: hidden;
  199. }
  200. .img-item image {
  201. position: absolute;
  202. top: 0;
  203. left: 0;
  204. width: 100%;
  205. height: 100%;
  206. }
  207. .status-block {
  208. display: flex;
  209. align-items: center;
  210. }
  211. .status-dot {
  212. width: 16rpx;
  213. height: 16rpx;
  214. border-radius: 50%;
  215. margin-right: 16rpx;
  216. }
  217. .status-dot.pending {
  218. background: #ff9800;
  219. }
  220. .status-dot.done {
  221. background: #4caf50;
  222. }
  223. .status-label {
  224. font-size: 28rpx;
  225. font-weight: bold;
  226. color: #333;
  227. }
  228. .bottom-placeholder {
  229. height: 40rpx;
  230. }
  231. .loading-state {
  232. padding-top: 200rpx;
  233. display: flex;
  234. justify-content: center;
  235. font-size: 28rpx;
  236. color: #999;
  237. }
  238. </style>