feedback.vue 6.3 KB

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