fk.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 uploadImage from '@/components/ossutil/uploadFile.js';
  26. export default {
  27. data() {
  28. return {
  29. imgList: [],
  30. value1: '',
  31. fileList1: [],
  32. dataDetails: {},
  33. };
  34. },
  35. onLoad(options) {
  36. this.dataDetails = JSON.parse(options.val)
  37. this.imgList = []
  38. },
  39. computed: {
  40. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  41. },
  42. methods: {
  43. submit() {
  44. uni.showLoading({
  45. title: '加载中'
  46. })
  47. this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
  48. initiator:this.firstAuthentication.driverName,
  49. initiatorNumber:this.firstAuthentication.driverPhone,
  50. commonId: this.firstAuthentication.commonId,
  51. passive: this.dataDetails.cargoOwnerName,
  52. passiveNumber: this.dataDetails.cargoOwnerPhone,
  53. passiveCommonId:this.dataDetails.commonId,
  54. content: this.value1,
  55. url: this.imgList.toString(),
  56. flag: 1,
  57. objectFlag:2
  58. }).then(res => {
  59. let that = this
  60. uni.hideLoading()
  61. this.$refs.uToast.show({
  62. type: 'success',
  63. message: "反馈成功",
  64. complete() {
  65. // uni.$u.route('/pages/goodSource/cargoOwnerSee', {
  66. // driver: JSON.stringify(that.dataDetails)
  67. // });
  68. uni.navigateBack({
  69. delta: 1
  70. });
  71. }
  72. })
  73. })
  74. .catch(res => {
  75. uni.$u.toast(res.message);
  76. });
  77. },
  78. // 删除图片
  79. deletePic(event) {
  80. this[`fileList${event.name}`].splice(event.index, 1)
  81. },
  82. // 新增图片
  83. async afterRead(event) {
  84. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  85. let lists = [].concat(event.file)
  86. let fileListLen = this[`fileList${event.name}`].length
  87. lists.map((item) => {
  88. this[`fileList${event.name}`].push({
  89. ...item,
  90. status: 'uploading',
  91. message: '上传中'
  92. })
  93. })
  94. for (let i = 0; i < lists.length; i++) {
  95. const result = await this.uploadFilePromise(lists[i].url)
  96. let item = this[`fileList${event.name}`][fileListLen]
  97. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  98. status: 'success',
  99. message: '',
  100. url: result
  101. }))
  102. fileListLen++
  103. }
  104. },
  105. uploadFilePromise(url) {
  106. uploadImage('image', url, 'appData/',
  107. result => {
  108. // 上传成功回调函数
  109. console.log('图片地址', result)
  110. this.imgList.push(result)
  111. }
  112. )
  113. },
  114. }
  115. }
  116. </script>
  117. <style lang="scss">
  118. .content {
  119. background: white;
  120. }
  121. .img {
  122. width: 40rpx;
  123. }
  124. .row1,
  125. .row2 {
  126. padding: 40rpx;
  127. }
  128. .title {
  129. margin-bottom: 20rpx;
  130. }
  131. .row3 {
  132. width: 80%;
  133. background: #2772FB;
  134. text-align: center;
  135. color: white;
  136. padding: 20rpx;
  137. margin: auto;
  138. border-radius: 10rpx;
  139. }
  140. </style>