123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <template>
- <view class="content">
- <view class="row1 flex flex-space-between">
- <view>被投诉人</view>
- <view class='flex'>
- <image :src="dataDetails.cargoOwnerPortrait" mode="widthFix" style="width: 40rpx;height: 40rpx;"
- class="img_css"> </image>
- <view>{{dataDetails.cargoOwnerName?dataDetails.cargoOwnerName:dataDetails.cargoOwner}}</view>
- </view>
- </view>
- <u-line class="line" color="#E6E6E6"></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" color="#E6E6E6"></u-line>
- <view class="row2">
- <view class="title">投诉信息</view>
- <u--textarea v-model="value1" placeholder="输入要反馈的内容,10-300字" maxlength='300' border="none">
- </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: [],
- dataDetails: {},
- orderList: [],
- isShow: false,
- type: 0
- };
- },
- onLoad(options) {
- this.get_camera_permission()
- this.dataDetails = JSON.parse(options.val)
- this.type = options.type
- console.log(this.dataDetails)
- this.imgList = []
- },
- onShow() {
- uni.showLoading({
- title: '加载中'
- })
- var commonId = ''
- if (this.type == 1) {
- commonId = this.dataDetails.cargoCommonId
- } else {
- commonId = this.dataDetails.commonId
- }
- this.$request.baseRequest('get', '/orderInfo/getAssociatedOrder', {
- cargoCommonId: commonId,
- commonId: this.userInfo.id
- }).then(res => {
- let that = this
- uni.hideLoading()
- this.orderList = [res.data]
- // console.log(this.orderList)
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
- },
- 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() {
- uni.showLoading({
- title: '加载中'
- })
- console.log()
- this.$request.baseRequest('post', '/feedbackReport/api/addInfo', {
- initiator: this.firstAuthentication.driverName,
- initiatorNumber: this.firstAuthentication.driverPhone,
- commonId: this.firstAuthentication.commonId,
- passive: this.dataDetails.cargoOwnerName,
- passiveNumber: this.dataDetails.cargoOwnerPhone,
- passiveCommonId: this.dataDetails.commonId,
- orderId: this.dataDetails.orderId,
- orderNo: this.dataDetails.orderNo,
- content: this.value1,
- url: this.imgList.toString(),
- flag: 1,
- objectFlag: 2
- }).then(res => {
- let that = this
- this.type = 0
- uni.hideLoading()
- this.$refs.uToast.show({
- type: 'success',
- message: "反馈成功",
- complete() {
- // uni.$u.route('/pages/goodSource/cargoOwnerSee', {
- // driver: JSON.stringify(that.dataDetails)
- // });
- uni.navigateBack({
- delta: 1
- });
- }
- })
- })
- .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;
- font-size: 28rpx;
- }
- .title {
- margin-bottom: 20rpx;
- }
- .row3 {
- width: 80%;
- background: #F5BA3C;
- text-align: center;
- color: white;
- padding: 25rpx;
- margin: auto;
- font-size: 36rpx;
- border-radius: 10rpx;
- }
- </style>
|