jb.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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" class="img"></image>
  7. <view>{{dataDetails.cargoOwnerName}}</view>
  8. </view>
  9. </view>
  10. <u-line class="line" color="#E6E6E6"></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" color="#E6E6E6"></u-line>
  18. <view class="row2">
  19. <view class="title">举报信息</view>
  20. <u--textarea v-model="value1" placeholder="输入要举报的内容,10-300字" maxlength='300' border="none"></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, 1000)">提交</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 permision from "@/js_sdk/wa-permission/permission.js"
  36. import uploadImage from '@/components/ossutil/uploadFile.js';
  37. export default {
  38. data() {
  39. return {
  40. imgList: [],
  41. value1: '',
  42. fileList1: [],
  43. dataDetails: {},
  44. orderList: [],
  45. isShow: false,
  46. type: 0
  47. };
  48. },
  49. computed: {
  50. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  51. },
  52. onLoad(options) {
  53. this.get_camera_permission()
  54. this.dataDetails = JSON.parse(options.val)
  55. this.type = options.type
  56. console.log(this.dataDetails)
  57. this.imgList = []
  58. },
  59. onShow() {
  60. uni.showLoading({
  61. title: '加载中'
  62. })
  63. var commonId = ''
  64. if (this.type == 1) {
  65. commonId = this.dataDetails.cargoCommonId
  66. } else {
  67. commonId = this.dataDetails.commonId
  68. }
  69. this.$request.baseRequest('get', '/orderInfo/getAssociatedOrder', {
  70. cargoCommonId: commonId,
  71. commonId: this.userInfo.id
  72. }).then(res => {
  73. let that = this
  74. uni.hideLoading()
  75. this.orderList = [res.data]
  76. // console.log(this.orderList)
  77. })
  78. .catch(res => {
  79. uni.$u.toast(res.message);
  80. });
  81. },
  82. methods: {
  83. confirmorder(e) {
  84. console.log(e)
  85. this.dataDetails.orderId = e.value[0].id
  86. this.dataDetails.orderNo = e.value[0].orderNo
  87. this.isShow = false
  88. },
  89. selectorder() {
  90. this.isShow = true
  91. },
  92. async get_camera_permission() {
  93. var photol = await permision.requestAndroidPermission("android.permission.CAMERA")
  94. if (photol == false) {
  95. uni.showModal({
  96. title: '提示',
  97. content: '您已经关闭相册权限,去设置',
  98. success: function(res) {
  99. if (res.confirm) {
  100. permision.gotoAppPermissionSetting()
  101. // plus.runtime.openURL("app-settings:");
  102. } else if (res.cancel) {
  103. console.log('用户点击取消');
  104. }
  105. }
  106. });
  107. }
  108. },
  109. submit() {
  110. uni.showLoading({
  111. title: '加载中'
  112. })
  113. this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
  114. initiator: this.firstAuthentication.driverName,
  115. initiatorNumber: this.firstAuthentication.driverPhone,
  116. commonId: this.firstAuthentication.commonId,
  117. passive: this.dataDetails.cargoOwnerName,
  118. passiveNumber: this.dataDetails.cargoOwnerPhone,
  119. passiveCommonId: this.dataDetails.commonId,
  120. orderId: this.dataDetails.orderId,
  121. orderNo: this.dataDetails.orderNo,
  122. content: this.value1,
  123. url: this.imgList.toString(),
  124. flag: 2,
  125. objectFlag: 2
  126. }).then(res => {
  127. let that = this
  128. this.type = 0
  129. uni.hideLoading()
  130. this.$refs.uToast.show({
  131. type: 'success',
  132. message: "举报成功",
  133. complete() {
  134. // uni.$u.route('/pages/order/driverDetail', {
  135. // driver: JSON.stringify(that.dataDetails)
  136. // });
  137. uni.navigateBack({
  138. delta: 1
  139. })
  140. }
  141. })
  142. })
  143. .catch(res => {
  144. uni.$u.toast(res.message);
  145. });
  146. },
  147. // 删除图片
  148. deletePic(event) {
  149. this[`fileList${event.name}`].splice(event.index, 1)
  150. },
  151. // 新增图片
  152. async afterRead(event) {
  153. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  154. let lists = [].concat(event.file)
  155. let fileListLen = this[`fileList${event.name}`].length
  156. lists.map((item) => {
  157. this[`fileList${event.name}`].push({
  158. ...item,
  159. status: 'uploading',
  160. message: '上传中'
  161. })
  162. })
  163. for (let i = 0; i < lists.length; i++) {
  164. const result = await this.uploadFilePromise(lists[i].url)
  165. let item = this[`fileList${event.name}`][fileListLen]
  166. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  167. status: 'success',
  168. message: '',
  169. url: result
  170. }))
  171. fileListLen++
  172. }
  173. },
  174. uploadFilePromise(url) {
  175. uploadImage('image', url, 'appData/',
  176. result => {
  177. // 上传成功回调函数
  178. console.log('图片地址', result)
  179. this.imgList.push(result)
  180. }
  181. )
  182. },
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. .content {
  188. background: white;
  189. }
  190. .img {
  191. width: 40rpx;
  192. height: 40rpx;
  193. }
  194. .row1,
  195. .row2 {
  196. padding: 40rpx;
  197. font-size: 28rpx;
  198. }
  199. .title {
  200. margin-bottom: 20rpx;
  201. }
  202. .row3 {
  203. width: 80%;
  204. background: #2772FB;
  205. text-align: center;
  206. color: white;
  207. padding: 25rpx;
  208. margin: auto;
  209. font-size: 36rpx;
  210. border-radius: 10rpx;
  211. }
  212. </style>