fk.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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.cargoOwnerPortrait" mode="widthFix" style="width: 40rpx;height: 40rpx;"
  7. class="img_css"> </image>
  8. <view>{{dataDetails.cargoOwnerName?dataDetails.cargoOwnerName:dataDetails.cargoOwner}}</view>
  9. </view>
  10. </view>
  11. <u-line class="line" color="#E6E6E6"></u-line>
  12. <view class="row1 flex flex-space-between">
  13. <view>关联订单(选填)</view>
  14. <view style='align-items: center;' class='flex'>
  15. <view @click='selectorder'>{{dataDetails.orderNo?dataDetails.orderNo:'选择订单'}}></view>
  16. </view>
  17. </view>
  18. <u-line class="line" color="#E6E6E6"></u-line>
  19. <view class="row2">
  20. <view class="title">投诉信息</view>
  21. <u--textarea v-model="value1" placeholder="输入要反馈的内容,10-300字" maxlength='300' border="none">
  22. </u--textarea>
  23. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  24. name="1" multiple :maxCount="9"></u-upload>
  25. </view>
  26. <view class="row3" @click="$u.throttle(submit, 1000)">提交</view>
  27. <u-picker :show="isShow" ref="uPicker" :columns="orderList" keyName="orderNo" @confirm="confirmorder"
  28. :closeOnClickOverlay='true' @close='isShow=false' @cancel='isShow=false'>
  29. </u-picker>
  30. <u-toast ref="uToast"></u-toast>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. mapState
  36. } from 'vuex';
  37. import permision from "@/js_sdk/wa-permission/permission.js"
  38. import uploadImage from '@/components/ossutil/uploadFile.js';
  39. export default {
  40. data() {
  41. return {
  42. imgList: [],
  43. value1: '',
  44. fileList1: [],
  45. dataDetails: {},
  46. orderList: [],
  47. isShow: false,
  48. type: 0
  49. };
  50. },
  51. onLoad(options) {
  52. this.get_camera_permission()
  53. this.dataDetails = JSON.parse(options.val)
  54. this.type = options.type
  55. console.log(this.dataDetails)
  56. this.imgList = []
  57. },
  58. onShow() {
  59. uni.showLoading({
  60. title: '加载中'
  61. })
  62. var commonId = ''
  63. if (this.type == 1) {
  64. commonId = this.dataDetails.cargoCommonId
  65. } else {
  66. commonId = this.dataDetails.commonId
  67. }
  68. this.$request.baseRequest('get', '/orderInfo/getAssociatedOrder', {
  69. cargoCommonId: commonId,
  70. commonId: this.userInfo.id
  71. }).then(res => {
  72. let that = this
  73. uni.hideLoading()
  74. this.orderList = [res.data]
  75. // console.log(this.orderList)
  76. })
  77. .catch(res => {
  78. uni.$u.toast(res.message);
  79. });
  80. },
  81. computed: {
  82. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  83. },
  84. methods: {
  85. confirmorder(e) {
  86. console.log(e)
  87. this.dataDetails.orderId = e.value[0].id
  88. this.dataDetails.orderNo = e.value[0].orderNo
  89. this.isShow = false
  90. },
  91. selectorder() {
  92. this.isShow = true
  93. },
  94. async get_camera_permission() {
  95. var photol = await permision.requestAndroidPermission("android.permission.CAMERA")
  96. if (photol == false) {
  97. uni.showModal({
  98. title: '提示',
  99. content: '您已经关闭相册权限,去设置',
  100. success: function(res) {
  101. if (res.confirm) {
  102. permision.gotoAppPermissionSetting()
  103. // plus.runtime.openURL("app-settings:");
  104. } else if (res.cancel) {
  105. console.log('用户点击取消');
  106. }
  107. }
  108. });
  109. }
  110. },
  111. submit() {
  112. uni.showLoading({
  113. title: '加载中'
  114. })
  115. console.log()
  116. this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
  117. initiator: this.firstAuthentication.driverName,
  118. initiatorNumber: this.firstAuthentication.driverPhone,
  119. commonId: this.firstAuthentication.commonId,
  120. passive: this.dataDetails.cargoOwnerName,
  121. passiveNumber: this.dataDetails.cargoOwnerPhone,
  122. passiveCommonId: this.dataDetails.commonId,
  123. orderId: this.dataDetails.orderId,
  124. orderNo: this.dataDetails.orderNo,
  125. content: this.value1,
  126. url: this.imgList.toString(),
  127. flag: 1,
  128. objectFlag: 2
  129. }).then(res => {
  130. let that = this
  131. this.type = 0
  132. uni.hideLoading()
  133. this.$refs.uToast.show({
  134. type: 'success',
  135. message: "反馈成功",
  136. complete() {
  137. // uni.$u.route('/pages/goodSource/cargoOwnerSee', {
  138. // driver: JSON.stringify(that.dataDetails)
  139. // });
  140. uni.navigateBack({
  141. delta: 1
  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. font-size: 28rpx;
  200. }
  201. .title {
  202. margin-bottom: 20rpx;
  203. }
  204. .row3 {
  205. width: 80%;
  206. background: #F5BA3C;
  207. text-align: center;
  208. color: white;
  209. padding: 25rpx;
  210. margin: auto;
  211. font-size: 36rpx;
  212. border-radius: 10rpx;
  213. }
  214. </style>