fk.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="content">
  3. <view class="row1 flex flex-space-between">
  4. <view>被投诉人</view>
  5. <view class='flex'>
  6. <image :src="dataDetails.driverPortrait" mode="widthFix" style="width: 40rpx;height: 40rpx;" class="img_css"> </image>
  7. <view>{{dataDetails.cargoOwnerName}}</view>
  8. </view>
  9. </view>
  10. <u-line class="line"></u-line>
  11. <view class="row2">
  12. <view class="title">投诉信息</view>
  13. <u--textarea v-model="value1" placeholder="输入要反馈的内容,10-300字" count maxlength='300'></u--textarea>
  14. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  15. name="1" multiple :maxCount="9"></u-upload>
  16. </view>
  17. <view class="row3" @click="submit">提交</view>
  18. <u-toast ref="uToast"></u-toast>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. mapState
  24. } from 'vuex';
  25. import permision from "@/js_sdk/wa-permission/permission.js"
  26. import uploadImage from '@/components/ossutil/uploadFile.js';
  27. export default {
  28. data() {
  29. return {
  30. imgList: [],
  31. value1: '',
  32. fileList1: [],
  33. dataDetails: {},
  34. };
  35. },
  36. onLoad(options) {
  37. this.get_camera_permission()
  38. this.dataDetails = JSON.parse(options.val)
  39. this.imgList = []
  40. },
  41. computed: {
  42. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  43. },
  44. methods: {
  45. async get_camera_permission() {
  46. var photol=await permision.requestAndroidPermission("android.permission.CAMERA")
  47. if(photol == false){
  48. uni.showModal({
  49. title: '提示',
  50. content: '您已经关闭相册权限,去设置',
  51. success: function (res) {
  52. if (res.confirm) {
  53. permision.gotoAppPermissionSetting()
  54. // plus.runtime.openURL("app-settings:");
  55. } else if (res.cancel) {
  56. console.log('用户点击取消');
  57. }
  58. }
  59. });
  60. }
  61. },
  62. submit() {
  63. uni.showLoading({
  64. title: '加载中'
  65. })
  66. this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
  67. initiator:this.firstAuthentication.driverName,
  68. initiatorNumber:this.firstAuthentication.driverPhone,
  69. commonId: this.firstAuthentication.commonId,
  70. passive: this.dataDetails.cargoOwnerName,
  71. passiveNumber: this.dataDetails.cargoOwnerPhone,
  72. passiveCommonId:this.dataDetails.commonId,
  73. content: this.value1,
  74. url: this.imgList.toString(),
  75. flag: 1,
  76. objectFlag:2
  77. }).then(res => {
  78. let that = this
  79. uni.hideLoading()
  80. this.$refs.uToast.show({
  81. type: 'success',
  82. message: "反馈成功",
  83. complete() {
  84. // uni.$u.route('/pages/goodSource/cargoOwnerSee', {
  85. // driver: JSON.stringify(that.dataDetails)
  86. // });
  87. uni.navigateBack({
  88. delta: 1
  89. });
  90. }
  91. })
  92. })
  93. .catch(res => {
  94. uni.$u.toast(res.message);
  95. });
  96. },
  97. // 删除图片
  98. deletePic(event) {
  99. this[`fileList${event.name}`].splice(event.index, 1)
  100. },
  101. // 新增图片
  102. async afterRead(event) {
  103. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  104. let lists = [].concat(event.file)
  105. let fileListLen = this[`fileList${event.name}`].length
  106. lists.map((item) => {
  107. this[`fileList${event.name}`].push({
  108. ...item,
  109. status: 'uploading',
  110. message: '上传中'
  111. })
  112. })
  113. for (let i = 0; i < lists.length; i++) {
  114. const result = await this.uploadFilePromise(lists[i].url)
  115. let item = this[`fileList${event.name}`][fileListLen]
  116. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  117. status: 'success',
  118. message: '',
  119. url: result
  120. }))
  121. fileListLen++
  122. }
  123. },
  124. uploadFilePromise(url) {
  125. uploadImage('image', url, 'appData/',
  126. result => {
  127. // 上传成功回调函数
  128. console.log('图片地址', result)
  129. this.imgList.push(result)
  130. }
  131. )
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. .content {
  138. background: white;
  139. }
  140. .img {
  141. width: 40rpx;
  142. }
  143. .row1,
  144. .row2 {
  145. padding: 40rpx;
  146. }
  147. .title {
  148. margin-bottom: 20rpx;
  149. }
  150. .row3 {
  151. width: 80%;
  152. background: #2772FB;
  153. text-align: center;
  154. color: white;
  155. padding: 20rpx;
  156. margin: auto;
  157. border-radius: 10rpx;
  158. }
  159. </style>