fk.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="content">
  3. <view class="row1 flex flex-space-between">
  4. <view>被投诉人</view>
  5. <view style='align-items: center;' class='flex'>
  6. <image :src="dataDetails.avatarUrl" mode="widthFix" class="img"></image>
  7. <view>{{dataDetails.driverName}}</view>
  8. </view>
  9. </view>
  10. <u-line class="line"></u-line>
  11. <view class="row1 flex flex-space-between">
  12. <view>关联订单(选填)</view>
  13. <view style='align-items: center;' class='flex'>
  14. <view @click='selectorder'>{{dataDetails.orderNo?dataDetails.orderNo:'选择订单'}}></view>
  15. </view>
  16. </view>
  17. <u-line class="line"></u-line>
  18. <view class="row2">
  19. <view class="title">投诉信息</view>
  20. <u--textarea v-model="value1" placeholder="输入要反馈的内容,10-300字" count maxlength='300'></u--textarea>
  21. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  22. name="1" multiple :maxCount="9"></u-upload>
  23. </view>
  24. <view class="row3" @click="$u.throttle(submit, 5000)">提交</view>
  25. <u-picker :show="isShow" ref="uPicker" :columns="orderList" keyName="orderNo" @confirm="confirmorder"
  26. :closeOnClickOverlay='true' @close='isShow=false' @cancel='isShow=false'>
  27. </u-picker>
  28. <u-toast ref="uToast"></u-toast>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. mapState
  34. } from 'vuex';
  35. import uploadImage from '@/components/ossutil/uploadFile.js';
  36. import permision from "@/js_sdk/wa-permission/permission.js";
  37. export default {
  38. data() {
  39. return {
  40. imgList: [],
  41. value1: '',
  42. fileList1: [],
  43. orderList: [],
  44. dataDetails: {},
  45. isShow: false,
  46. };
  47. },
  48. computed: {
  49. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  50. },
  51. onLoad(options) {
  52. this.dataDetails = JSON.parse(options.val)
  53. console.log(this.dataDetails)
  54. this.imgList = []
  55. },
  56. onShow() {
  57. uni.showLoading({
  58. title: '加载中'
  59. })
  60. this.$request.baseRequest('get', '/orderInfo/getAssociatedOrder', {
  61. commonId: this.dataDetails.commonId,
  62. cargoCommonId: this.userInfo.id
  63. }).then(res => {
  64. uni.hideLoading()
  65. this.orderList = [res.data]
  66. // console.log(this.orderList)
  67. })
  68. .catch(res => {
  69. uni.$u.toast(res.message);
  70. });
  71. },
  72. methods: {
  73. confirmorder(e) {
  74. console.log(e)
  75. this.dataDetails.orderId = e.value[0].id
  76. this.dataDetails.orderNo = e.value[0].orderNo
  77. this.isShow = false
  78. },
  79. selectorder() {
  80. this.isShow = true
  81. },
  82. submit() {
  83. var that = this
  84. if (!this.value1) {
  85. that.$refs.uToast.show({
  86. type: 'error',
  87. message: "投诉信息不能为空!",
  88. })
  89. return
  90. }
  91. if (this.value1.length < 10 || this.value1.length > 300) {
  92. that.$refs.uToast.show({
  93. type: 'error',
  94. message: "投诉信息需输入10 ~ 300字之间!",
  95. })
  96. return
  97. }
  98. uni.showLoading({
  99. title: '加载中'
  100. })
  101. this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
  102. initiator: uni.getStorageSync("firstAuthentication").name,
  103. initiatorNumber: uni.getStorageSync("firstAuthentication").phone,
  104. commonId: this.userInfo.id,
  105. passive: this.dataDetails.driverName,
  106. passiveNumber: this.dataDetails.driverPhone,
  107. passiveCommonId: this.dataDetails.commonId,
  108. orderId: this.dataDetails.orderId,
  109. orderNo: this.dataDetails.orderNo,
  110. content: this.value1,
  111. url: this.imgList.toString(),
  112. flag: 1,
  113. objectFlag: 1,
  114. }).then(res => {
  115. let that = this
  116. uni.hideLoading()
  117. this.$refs.uToast.show({
  118. type: 'success',
  119. message: "反馈成功",
  120. complete() {
  121. // uni.navigateBack({
  122. // delta:1
  123. // })
  124. }
  125. })
  126. })
  127. .catch(res => {
  128. uni.$u.toast(res.message);
  129. });
  130. },
  131. // 删除图片
  132. deletePic(event) {
  133. this[`fileList${event.name}`].splice(event.index, 1)
  134. },
  135. // 新增图片
  136. async afterRead(event) {
  137. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  138. let lists = [].concat(event.file)
  139. let fileListLen = this[`fileList${event.name}`].length
  140. lists.map((item) => {
  141. this[`fileList${event.name}`].push({
  142. ...item,
  143. status: 'uploading',
  144. message: '上传中'
  145. })
  146. })
  147. for (let i = 0; i < lists.length; i++) {
  148. const result = await this.uploadFilePromise(lists[i].url)
  149. let item = this[`fileList${event.name}`][fileListLen]
  150. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  151. status: 'success',
  152. message: '',
  153. url: result
  154. }))
  155. fileListLen++
  156. }
  157. },
  158. uploadFilePromise(url) {
  159. uploadImage('image', url, 'appData/',
  160. result => {
  161. // 上传成功回调函数
  162. console.log('图片地址', result)
  163. this.imgList.push(result)
  164. }
  165. )
  166. },
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. .content {
  172. background: white;
  173. }
  174. .img {
  175. width: 40rpx;
  176. }
  177. .row1,
  178. .row2 {
  179. padding: 40rpx;
  180. }
  181. .title {
  182. margin-bottom: 20rpx;
  183. }
  184. .row3 {
  185. width: 80%;
  186. background: #2772FB;
  187. text-align: center;
  188. color: white;
  189. padding: 20rpx;
  190. margin: auto;
  191. border-radius: 10rpx;
  192. }
  193. </style>