feedback.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="feedback-page">
  3. <u-navbar title="反馈" :is-back="true" :border-bottom="false"></u-navbar>
  4. <view class="content">
  5. <view class="card">
  6. <view class="card-title">您在搜索书籍环节遇到了哪些问题?</view>
  7. <view class="input-container">
  8. <u-input v-model="description" type="textarea" placeholder="填写的信息越全,问题越可有效解决哦~" :border="false"
  9. :height="300" :auto-height="false" :custom-style="{ padding: '0' }" show-limit-word />
  10. <view class="upload-wrapper">
  11. <image-upload v-model="fileList" :max-count="3"></image-upload>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="card">
  16. <view class="card-title">您愿意为本次体验打多少分?</view>
  17. <view class="score-wrapper">
  18. <view class="score-text">体验糟糕</view>
  19. <view class="score-options">
  20. <view class="score-item" v-for="i in 5" :key="i" :class="{ active: score === i + 1 }"
  21. @click="score = i + 1">
  22. {{ i + 1 }}
  23. </view>
  24. </view>
  25. <view class="score-text">体验超赞</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="footer">
  30. <u-button type="success" shape="circle"
  31. :custom-style="{ backgroundColor: '#38C148', height: '88rpx', fontSize: '32rpx' }" @click="onSubmit">
  32. 提交
  33. </u-button>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import ImageUpload from '@/pages-sell/components/image-upload/index.vue';
  39. export default {
  40. components: {
  41. ImageUpload
  42. },
  43. data() {
  44. return {
  45. description: '',
  46. fileList: [],
  47. score: 5
  48. };
  49. },
  50. methods: {
  51. onSubmit() {
  52. if (!this.description.trim() && this.fileList.length === 0) {
  53. this.$u.toast('请填写问题描述或上传图片');
  54. return;
  55. }
  56. const params = {
  57. description: this.description,
  58. fileUrlList: this.fileList,
  59. score: this.score
  60. };
  61. uni.$u.http.post('/token/shop/feedback/submit', params).then(res => {
  62. this.$u.toast('提交成功');
  63. setTimeout(() => {
  64. uni.navigateBack();
  65. }, 1500);
  66. }).catch(err => {
  67. // 错误处理通常由拦截器完成,这里可以根据需要补充
  68. });
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .feedback-page {
  75. min-height: 100vh;
  76. background-color: #f8f8f8;
  77. }
  78. .content {
  79. padding: 20rpx 30rpx;
  80. }
  81. .card {
  82. background-color: #ffffff;
  83. border-radius: 16rpx;
  84. padding: 30rpx;
  85. margin-bottom: 30rpx;
  86. .card-title {
  87. font-size: 30rpx;
  88. font-weight: bold;
  89. color: #333333;
  90. margin-bottom: 30rpx;
  91. }
  92. }
  93. .input-container {
  94. background-color: #f8f8f8;
  95. border-radius: 12rpx;
  96. padding: 20rpx;
  97. .upload-wrapper {
  98. margin-top: 20rpx;
  99. }
  100. }
  101. .score-wrapper {
  102. display: flex;
  103. justify-content: space-between;
  104. align-items: center;
  105. padding: 0 10rpx;
  106. .score-text {
  107. font-size: 24rpx;
  108. color: #999999;
  109. }
  110. .score-options {
  111. display: flex;
  112. gap: 20rpx;
  113. }
  114. .score-item {
  115. width: 60rpx;
  116. height: 60rpx;
  117. background-color: #ffffff;
  118. border: 2rpx solid #e5e5e5;
  119. border-radius: 8rpx;
  120. display: flex;
  121. align-items: center;
  122. justify-content: center;
  123. font-size: 30rpx;
  124. color: #333333;
  125. font-weight: bold;
  126. &.active {
  127. background-color: #d7f4da; // Light green background for active
  128. border-color: #38C148;
  129. color: #38C148;
  130. }
  131. }
  132. }
  133. .footer {
  134. position: fixed;
  135. bottom: 0;
  136. left: 0;
  137. width: 100%;
  138. background-color: #ffffff;
  139. padding: 20rpx 30rpx;
  140. padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
  141. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  142. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  143. }
  144. </style>