jb.vue 5.6 KB

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