fk.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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;" class="img_css"> </image>
  7. <view>{{dataDetails.cargoOwnerName?dataDetails.cargoOwnerName:dataDetails.cargoOwner}}</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, 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. onLoad(options) {
  50. this.get_camera_permission()
  51. this.dataDetails = JSON.parse(options.val)
  52. this.type=options.type
  53. console.log(this.dataDetails)
  54. this.imgList = []
  55. },
  56. onShow(){
  57. uni.showLoading({
  58. title: '加载中'
  59. })
  60. var commonId=''
  61. if(this.type==1){
  62. commonId=this.dataDetails.cargoCommonId
  63. }else{
  64. commonId=this.dataDetails.commonId
  65. }
  66. this.$request.baseRequest('get', '/orderInfo/getAssociatedOrder',{
  67. cargoCommonId: commonId,
  68. commonId:this.userInfo.id
  69. }).then(res => {
  70. let that = this
  71. uni.hideLoading()
  72. this.orderList=[res.data]
  73. // console.log(this.orderList)
  74. })
  75. .catch(res => {
  76. uni.$u.toast(res.message);
  77. });
  78. },
  79. computed: {
  80. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  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. console.log()
  114. this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
  115. initiator:this.firstAuthentication.driverName,
  116. initiatorNumber:this.firstAuthentication.driverPhone,
  117. commonId: this.firstAuthentication.commonId,
  118. passive: this.dataDetails.cargoOwnerName,
  119. passiveNumber: this.dataDetails.cargoOwnerPhone,
  120. passiveCommonId:this.dataDetails.commonId,
  121. orderId:this.dataDetails.orderId,
  122. orderNo:this.dataDetails.orderNo,
  123. content: this.value1,
  124. url: this.imgList.toString(),
  125. flag: 1,
  126. objectFlag:2
  127. }).then(res => {
  128. let that = this
  129. this.type=0
  130. uni.hideLoading()
  131. this.$refs.uToast.show({
  132. type: 'success',
  133. message: "反馈成功",
  134. complete() {
  135. // uni.$u.route('/pages/goodSource/cargoOwnerSee', {
  136. // driver: JSON.stringify(that.dataDetails)
  137. // });
  138. uni.navigateBack({
  139. delta: 1
  140. });
  141. }
  142. })
  143. })
  144. .catch(res => {
  145. uni.$u.toast(res.message);
  146. });
  147. },
  148. // 删除图片
  149. deletePic(event) {
  150. this[`fileList${event.name}`].splice(event.index, 1)
  151. },
  152. // 新增图片
  153. async afterRead(event) {
  154. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  155. let lists = [].concat(event.file)
  156. let fileListLen = this[`fileList${event.name}`].length
  157. lists.map((item) => {
  158. this[`fileList${event.name}`].push({
  159. ...item,
  160. status: 'uploading',
  161. message: '上传中'
  162. })
  163. })
  164. for (let i = 0; i < lists.length; i++) {
  165. const result = await this.uploadFilePromise(lists[i].url)
  166. let item = this[`fileList${event.name}`][fileListLen]
  167. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  168. status: 'success',
  169. message: '',
  170. url: result
  171. }))
  172. fileListLen++
  173. }
  174. },
  175. uploadFilePromise(url) {
  176. uploadImage('image', url, 'appData/',
  177. result => {
  178. // 上传成功回调函数
  179. console.log('图片地址', result)
  180. this.imgList.push(result)
  181. }
  182. )
  183. },
  184. }
  185. }
  186. </script>
  187. <style lang="scss">
  188. .content {
  189. background: white;
  190. }
  191. .img {
  192. width: 40rpx;
  193. }
  194. .row1,
  195. .row2 {
  196. padding: 40rpx;
  197. }
  198. .title {
  199. margin-bottom: 20rpx;
  200. }
  201. .row3 {
  202. width: 80%;
  203. background: #2772FB;
  204. text-align: center;
  205. color: white;
  206. padding: 20rpx;
  207. margin: auto;
  208. border-radius: 10rpx;
  209. }
  210. </style>