feedback.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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.type==item.type?'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.type===item.type?'checked':''"
  15. :checked="data.type==item.type?true:false"
  16. :value="item.type"></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.question" maxlength="120"
  29. placeholder="请描述您的问题,以便我们尽快为您处理"></textarea>
  30. <view class="text-right text-df text-gray padding-bottom-10">
  31. {{data.question.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-3 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. member_id: '',
  73. question: '',
  74. image_base64: [],
  75. type: "1",
  76. },
  77. //选择项列表
  78. typeList: [
  79. {
  80. title: '功能异常:功能故障或不可用',
  81. type: '1'
  82. },
  83. {
  84. title: '产品建议:用的不爽,我有建议',
  85. type: '2'
  86. },
  87. {
  88. title: '安全密码:密码,故障等',
  89. type: '3'
  90. },
  91. {
  92. title: '商户终端异常:无法支付,支付慢等',
  93. type: '4'
  94. },
  95. {
  96. title: '其他问题',
  97. type: '5'
  98. },
  99. ],
  100. }
  101. },
  102. methods: {
  103. //选择反馈类型
  104. RadioChange(e) {
  105. this.data.type = e.detail.value
  106. },
  107. /**输入问题描述
  108. * @param {Object} e
  109. */
  110. input(e) {
  111. this.data.question = e.detail.value
  112. },
  113. sumit() {
  114. if (this.$isEmpty(this.data.question)) {
  115. uni.showToast({
  116. title: "问题描述不能为空",
  117. icon: "none"
  118. })
  119. return
  120. }
  121. if (this.data.question.length < 3) {
  122. uni.showToast({
  123. title: "问题描述不能少于三个字",
  124. icon: "none"
  125. })
  126. return
  127. }
  128. if (this.$isEmpty(this.data.image_base64)) {
  129. uni.showToast({
  130. title: "请提供相关截图",
  131. icon: "none"
  132. })
  133. return
  134. }
  135. this.data.member_id = app.globalData.member.id
  136. console.log(this.data)
  137. let operation = 'userFeedback/addFeedback'
  138. app.globalData.postRequest(this.data, operation, function (res) {
  139. if (res.data.result_code == 1) {
  140. app.globalData.oneFailHint(res.data.result_msg, function () {
  141. uni.switchTab({
  142. url: "../wode"
  143. })
  144. });
  145. } else {
  146. app.globalData.oneFailHint(res.data.result_msg);
  147. }
  148. });
  149. },
  150. /**
  151. * 上传问题截图
  152. */
  153. chooseImage() {
  154. let that = this
  155. uni.chooseImage({
  156. count: 4 - this.imgList.length,
  157. sizeType: ['original', 'compressed'],
  158. sourceType: ['album'],
  159. success: (res) => {
  160. const tempFilePaths = res.tempFilePaths;
  161. for (let index in tempFilePaths) {
  162. //图片回显
  163. that.imgList.push(tempFilePaths[index])
  164. //图片转为base64的图片
  165. uni.getFileSystemManager().readFile({
  166. filePath: tempFilePaths[index],
  167. //选择图片返回的相对路径
  168. encoding: 'base64',
  169. //编码格式
  170. success: res => {
  171. //成功的回调
  172. that.data.image_base64.push('data:image/jpeg;base64,' + res.data)
  173. }
  174. });
  175. }
  176. }
  177. });
  178. },
  179. /*预览图片*/
  180. viewImage(index) {
  181. uni.previewImage({
  182. urls: this.imgList,
  183. current: index
  184. });
  185. },
  186. /*删除图片*/
  187. DelImg(index) {
  188. uni.showModal({
  189. title: '提示',
  190. content: '确定要删除这张照片吗?',
  191. cancelText: '取消',
  192. confirmText: '确定',
  193. success: res => {
  194. if (res.confirm) {
  195. this.imgList.splice(index, 1)
  196. }
  197. }
  198. })
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. .page {
  205. background-color: #FFFFFF;
  206. min-height: 100vh;
  207. }
  208. view {
  209. box-sizing: border-box;
  210. }
  211. .commit {
  212. color: #fff;
  213. font-size: 28 upx;
  214. text-align: center;
  215. line-height: 88 upx;
  216. margin: 0 20 upx;
  217. width: 690 upx;
  218. height: 88 upx;
  219. background: #59a5f0;
  220. border-radius: 25px;
  221. margin-bottom: 50 upx;
  222. position: absolute;
  223. left: 0;
  224. right: 0;
  225. bottom: 0;
  226. }
  227. .content {
  228. margin: 0 26 rpx;
  229. .radioBox {
  230. padding-top: 10 rpx;
  231. .radioItem {
  232. padding: 18 rpx;
  233. margin-bottom: 15 rpx;
  234. border-radius: 10 rpx;
  235. }
  236. .defalutBorder {
  237. border: 1 rpx solid #d1d1d1;
  238. }
  239. .checkBorder {
  240. border: 1 rpx solid #59a5f0;
  241. color: #59a5f0;
  242. }
  243. }
  244. .area {
  245. margin-top: 20 rpx;
  246. padding: 20 rpx;
  247. border-radius: 12 rpx;
  248. border: 1 rpx solid #d1d1d1;
  249. textarea {
  250. width: 100%;
  251. line-height: 50 rpx;
  252. }
  253. .imgArea {
  254. border-top: 1 rpx solid #d1d1d1;
  255. padding-top: 30 rpx;
  256. }
  257. }
  258. }
  259. </style>