complaint.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="complaint-page">
  3. <!-- 表单区域 -->
  4. <view class="form-block">
  5. <!-- 投诉原因 -->
  6. <view class="form-item flex-a">
  7. <view class="common-text-2 required">投诉原因</view>
  8. <view class="input-wrapper flex-1" @click="showReasonPicker">
  9. <text class="placeholder" v-if="!complaintReason">请选择投诉原因</text>
  10. <text v-else>{{ complaintReason }}</text>
  11. <u-icon name="arrow-right" color="#333" size="32" top="3rpx"></u-icon>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="form-block">
  16. <!-- 联系方式 -->
  17. <view class="form-item flex-a" style="padding:14rpx 0">
  18. <view class="common-text-2 required">联系方式</view>
  19. <u-input class="flex-1" input-align="right" placeholder-style="color:#999;font-size:28rpx;"
  20. v-model="phone" placeholder="请输入联系方式" :border="false" type="number" maxlength="11"></u-input>
  21. </view>
  22. </view>
  23. <view class="common-text-2 required mb-20">投诉说明</view>
  24. <view class="form-block" style="padding: 20rpx;">
  25. <!-- 投诉说明 -->
  26. <u-input v-model="description" type="textarea" placeholder="请描述投诉情况,有助于客服更快处理" :height="200"
  27. :border="false"></u-input>
  28. </view>
  29. <!-- 图片上传 -->
  30. <view class="common-text-2 required mb-20">上传凭证(最多3张)</view>
  31. <u-upload class="upload-image" :fileList="fileList" @afterRead="afterRead" @delete="deletePic" :maxCount="3"
  32. :previewFullImage="true" uploadText="点击上传"></u-upload>
  33. <!-- 底部按钮 -->
  34. <view class="bottom-fixed-con">
  35. <u-button type="primary" @click="submitComplaint">提交</u-button>
  36. </view>
  37. <!-- 投诉原因选择器 -->
  38. <u-picker v-model="showPicker" mode="selector" :range="reasonList" @confirm="confirmReason"
  39. @cancel="showPicker = false"></u-picker>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. complaintReason: '',
  47. phone: '',
  48. description: '',
  49. fileList: [],
  50. showPicker: false,
  51. reasonList: ['价格问题', '质量问题', '服务态度', '其他问题']
  52. }
  53. },
  54. methods: {
  55. showReasonPicker() {
  56. this.showPicker = true
  57. },
  58. confirmReason(e) {
  59. this.complaintReason = e.value[0]
  60. this.showPicker = false
  61. },
  62. afterRead(event) {
  63. const {
  64. file
  65. } = event
  66. this.fileList.push({
  67. url: file.url,
  68. status: 'success',
  69. message: '上传成功'
  70. })
  71. },
  72. deletePic(event) {
  73. this.fileList.splice(event.index, 1)
  74. },
  75. submitComplaint() {
  76. if (!this.complaintReason) {
  77. return uni.$u.toast('请选择投诉原因')
  78. }
  79. if (!this.phone) {
  80. return uni.$u.toast('请输入联系方式')
  81. }
  82. if (!this.description) {
  83. return uni.$u.toast('请输入投诉说明')
  84. }
  85. // TODO: 提交投诉信息
  86. uni.$u.toast('投诉上报已上报给管理员')
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. .complaint-page {
  93. min-height: 100vh;
  94. background: #F8F8F8;
  95. padding: 20rpx;
  96. padding-bottom: 120rpx;
  97. .form-block {
  98. background: #FFFFFF;
  99. border-radius: 12rpx;
  100. padding: 0 30rpx;
  101. margin-bottom: 20rpx;
  102. }
  103. .required::before {
  104. content: '*';
  105. color: #FF5B5B;
  106. margin-right: 4rpx;
  107. }
  108. .form-item {
  109. padding: 30rpx 0;
  110. .input-wrapper {
  111. display: flex;
  112. justify-content: flex-end;
  113. align-items: center;
  114. font-size: 28rpx;
  115. color: #333;
  116. .placeholder {
  117. color: #999;
  118. }
  119. }
  120. }
  121. }
  122. ::v-deep .upload-image {
  123. .u-list-item {
  124. background: #ffffff;
  125. }
  126. }
  127. </style>