123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <template>
- <view class="content">
- <view class="row1 flex flex-space-between">
- <view>被举报人</view>
- <view style='align-items: center;' class='flex'>
- <image :src="dataDetails.avatarUrl" mode="widthFix" class="img"></image>
- <view>{{dataDetails.driverName}}</view>
- </view>
- </view>
- <u-line class="line"></u-line>
- <view class="row1 flex flex-space-between">
- <view>关联订单(选填)</view>
- <view style='align-items: center;' class='flex'>
- <view @click='selectorder'>{{dataDetails.orderNo?dataDetails.orderNo:'选择订单'}}></view>
- </view>
- </view>
- <u-line class="line"></u-line>
- <view class="row2">
- <view class="title">举报信息</view>
- <u--textarea v-model="value1" placeholder="输入要举报的内容,10-300字" count maxlength='300'></u--textarea>
- <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
- name="1" multiple :maxCount="9"></u-upload>
- </view>
- <view class="row3" @click="$u.throttle(submit(), 1000)">提交</view>
- <u-picker :show="isShow" ref="uPicker" :columns="orderList" keyName="orderNo" @confirm="confirmorder"
- :closeOnClickOverlay='true' @close='isShow=false' @cancel='isShow=false'>
- </u-picker>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- import permision from "@/js_sdk/wa-permission/permission.js"
- import uploadImage from '@/components/ossutil/uploadFile.js';
- export default {
- data() {
- return {
- imgList: [],
- value1: '',
- fileList1: [],
- orderList: [],
- dataDetails: {},
- isShow: false,
- };
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
- },
- onLoad(options) {
- this.get_camera_permission()
- this.dataDetails = JSON.parse(options.val)
- console.log(this.dataDetails)
- this.imgList = []
- },
- onShow() {
- uni.showLoading({
- title: '加载中'
- })
- this.$request.baseRequest('get', '/orderInfo/getAssociatedOrder', {
- commonId: this.dataDetails.commonId,
- cargoCommonId: this.userInfo.id
- }).then(res => {
- uni.hideLoading()
- this.orderList = [res.data]
- // console.log(this.orderList)
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- methods: {
- confirmorder(e) {
- console.log(e)
- this.dataDetails.orderId = e.value[0].id
- this.dataDetails.orderNo = e.value[0].orderNo
- this.isShow = false
- },
- selectorder() {
- this.isShow = true
- },
- async get_camera_permission() {
- var photol = await permision.requestAndroidPermission("android.permission.CAMERA")
- if (photol == false) {
- uni.showModal({
- title: '提示',
- content: '您已经关闭相机权限,去设置',
- success: function(res) {
- if (res.confirm) {
- permision.gotoAppPermissionSetting()
- // plus.runtime.openURL("app-settings:");
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- },
- submit() {
- var that = this
- if (!this.value1) {
- that.$refs.uToast.show({
- type: 'error',
- message: "举报信息不能为空!",
- })
- return
- }
- if (this.value1.length < 10 || this.value1.length > 300) {
- that.$refs.uToast.show({
- type: 'error',
- message: "举报信息输入错误!",
- })
- return
- }
- uni.showLoading({
- title: '加载中'
- })
- this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
- initiator: uni.getStorageSync("firstAuthentication").name,
- initiatorNumber: uni.getStorageSync("firstAuthentication").phone,
- commonId: this.userInfo.id,
- passive: this.dataDetails.driverName,
- passiveNumber: this.dataDetails.driverPhone,
- orderId: this.dataDetails.orderId,
- orderNo: this.dataDetails.orderNo,
- passiveCommonId: this.dataDetails.commonId,
- content: this.value1,
- url: this.imgList.toString(),
- flag: 2,
- objectFlag: 1,
- }).then(res => {
- let that = this
- uni.hideLoading()
- this.$refs.uToast.show({
- type: 'success',
- message: "举报成功",
- complete() {
- uni.$u.route('/pages/order/driverDetail', {
- driver: JSON.stringify(that.dataDetails)
- });
- }
- })
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- uploadImage('image', url, 'appData/',
- result => {
- // 上传成功回调函数
- console.log('图片地址', result)
- this.imgList.push(result)
- }
- )
- },
- }
- }
- </script>
- <style lang="scss">
- .content {
- background: white;
- }
- .img {
- width: 40rpx;
- }
- .row1,
- .row2 {
- padding: 40rpx;
- }
- .title {
- margin-bottom: 20rpx;
- }
- .row3 {
- width: 80%;
- background: #2772FB;
- text-align: center;
- color: white;
- padding: 20rpx;
- margin: auto;
- border-radius: 10rpx;
- }
- </style>
|