feedback.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view style="padding: 30rpx 0;">
  5. <text>请选择您要反馈的问题类型:</text>
  6. </view>
  7. <radio-group class="block" @change="RadioChange">
  8. <view class="radioBox">
  9. <view class="radioItem" :class="data.feedbackType==item.feedbackType?'checkBorder':'defalutBorder'"
  10. v-for="(item,index) in typeList" :key="index">
  11. <label class="flex">
  12. <view class="">
  13. <radio style="transform: scale(.7);" class="round blue"
  14. :class="data.feedbackType===item.feedbackType?'checked':''"
  15. :checked="data.feedbackType==item.feedbackType?true:false"
  16. :value="item.feedbackType"></radio>
  17. </view>
  18. <view class="text-left padding-left-20 flex"
  19. style="flex-direction: column;justify-content: center;">
  20. {{item.title}}
  21. </view>
  22. </label>
  23. </view>
  24. </view>
  25. </radio-group>
  26. <view class="area">
  27. <view>
  28. <textarea @input="input" :value="data.content" maxlength="120"
  29. placeholder="请描述您的问题,以便我们尽快为您处理"></textarea>
  30. <view class="text-right text-df text-gray padding-bottom-10">
  31. {{data.content.length}} / 120
  32. </view>
  33. </view>
  34. <view class="imgArea">
  35. <view class="padding-bottom-20">
  36. <text class="">请提供相关问题的截图或照片(最多四张)</text>
  37. </view>
  38. <view class="cu-form-group" style="padding: 20rpx 0 0 0;">
  39. <view class="grid col-4 grid-square flex-sub">
  40. <view class="bg-img" v-for="(item,index) in imgList" :key="index" @click="viewImage(index)">
  41. <image :src="imgList[index]" mode="aspectFill"></image>
  42. <view class="cu-tag bg-red" @click.stop="DelImg(index)">
  43. <text class='cuIcon-close'></text>
  44. </view>
  45. </view>
  46. <view class="solids" @click="chooseImage" v-if="imgList.length<4">
  47. <text class='cuIcon-add ' style="font-size: 60rpx;color: #c9c9c9;"></text>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- <u-upload @on-choose-complete="chooseImage" :auto-upload="false" width="194" height="194" :action="action" max-count="4" :file-list="fileList" ></u-upload> -->
  52. </view>
  53. </view>
  54. <view class="bg-white" style="height: 150rpx;">
  55. </view>
  56. </view>
  57. <view class="bg-white margin-top-20 footer-fixed " @click="sumit">
  58. <view class="flex flex-direction padding-sm">
  59. <button class="radius cu-btn base-bg-color" style="padding: 45rpx;">提交反馈</button>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. var app = getApp();
  66. export default {
  67. data() {
  68. return {
  69. //图片回显
  70. imgList: [],
  71. data: {
  72. openId: '',
  73. phone: '',
  74. content: '',
  75. name: '',
  76. images: '',
  77. member_id: '',
  78. feedbackType: "0",
  79. residentialId: '',
  80. tenantType: 1
  81. },
  82. //选择项列表
  83. typeList: [{
  84. title: '功能异常:功能故障或不可用',
  85. feedbackType: '0'
  86. },
  87. {
  88. title: '产品建议:用的不爽,我有建议',
  89. feedbackType: '1'
  90. },
  91. {
  92. title: '其他问题',
  93. feedbackType: '2'
  94. },
  95. ],
  96. }
  97. },
  98. methods: {
  99. //选择反馈类型
  100. RadioChange(e) {
  101. this.data.feedbackType = e.detail.value
  102. },
  103. /**输入问题描述
  104. * @param {Object} e
  105. */
  106. input(e) {
  107. this.data.content = e.detail.value
  108. },
  109. sumit() {
  110. if (this.$isEmpty(this.data.content)) {
  111. uni.showToast({
  112. title: "问题描述不能为空",
  113. icon: "none"
  114. })
  115. return
  116. }
  117. if (this.data.content.length < 3) {
  118. uni.showToast({
  119. title: "问题描述不能少于三个字",
  120. icon: "none"
  121. })
  122. return
  123. }
  124. if (this.$isEmpty(this.imgList)) {
  125. uni.showToast({
  126. title: "请提供相关截图",
  127. icon: "none"
  128. })
  129. return
  130. }
  131. this.data.member_id = app.globalData.member.id
  132. this.data.openId = uni.getStorageSync('openid') || ''
  133. this.data.phone = uni.getStorageSync('myPhone') || ''
  134. this.data.name = app.globalData.member.name
  135. this.data.images = this.imgList.join(',')
  136. this.data.residentialId = uni.getStorageSync('residentialId') || ''
  137. this.$http.feedback(this.data).then(res => {
  138. if (res.data.success) {
  139. this.$dialog.showModal('提交成功', false).then(() => {
  140. uni.switchTab({
  141. url: "../wode"
  142. })
  143. })
  144. } else {
  145. this.$u.toast('提交失败')
  146. }
  147. })
  148. },
  149. /**
  150. * 上传问题截图
  151. */
  152. async chooseImage() {
  153. let paths = await this.$wxApi.chooseImage(4)
  154. for (let path of paths) {
  155. let url = (await this.$http.uploadFile(path)).data.data.link
  156. this.imgList.push(url)
  157. }
  158. },
  159. /*预览图片*/
  160. viewImage(index) {
  161. uni.previewImage({
  162. urls: this.imgList,
  163. current: index
  164. });
  165. },
  166. /*删除图片*/
  167. DelImg(index) {
  168. uni.showModal({
  169. title: '提示',
  170. content: '确定要删除这张照片吗?',
  171. cancelText: '取消',
  172. confirmText: '确定',
  173. success: res => {
  174. if (res.confirm) {
  175. this.imgList.splice(index, 1)
  176. }
  177. }
  178. })
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. .page {
  185. background-color: #FFFFFF;
  186. min-height: 100vh;
  187. }
  188. view {
  189. box-sizing: border-box;
  190. }
  191. .commit {
  192. color: #fff;
  193. font-size: 28upx;
  194. text-align: center;
  195. line-height: 88upx;
  196. margin: 0 20upx;
  197. width: 690upx;
  198. height: 88upx;
  199. background: #59a5f0;
  200. border-radius: 25px;
  201. margin-bottom: 50upx;
  202. position: absolute;
  203. left: 0;
  204. right: 0;
  205. bottom: 0;
  206. }
  207. .content {
  208. margin: 0 26rpx;
  209. .radioBox {
  210. padding-top: 10rpx;
  211. .radioItem {
  212. padding: 18rpx;
  213. margin-bottom: 15rpx;
  214. border-radius: 10rpx;
  215. }
  216. .defalutBorder {
  217. border: 1rpx solid #d1d1d1;
  218. }
  219. .checkBorder {
  220. border: 1rpx solid #59a5f0;
  221. color: #59a5f0;
  222. }
  223. }
  224. .area {
  225. margin-top: 20rpx;
  226. padding: 20rpx;
  227. border-radius: 12rpx;
  228. border: 1rpx solid #d1d1d1;
  229. textarea {
  230. width: 100%;
  231. line-height: 50rpx;
  232. }
  233. .imgArea {
  234. border-top: 1rpx solid #d1d1d1;
  235. padding-top: 30rpx;
  236. }
  237. }
  238. }
  239. </style>