| | |
| | | return |
| | | } |
| | | uni.showLoading({ title: '上传中...' }) |
| | | uni.getLocation({ |
| | | type: 'gcj02', |
| | | success: (locationRes) => { |
| | | this.doUploadPhotos(locationRes.latitude, locationRes.longitude) |
| | | }, |
| | | fail: () => { |
| | | this.doUploadPhotos(null, null) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | doUploadPhotos(latitude, longitude) { |
| | | const uploadTasks = this.uploadedPhotos.map(path => { |
| | | return new Promise((resolve, reject) => { |
| | | const formData = { folder: 'orders' } |
| | | if (latitude && longitude) { |
| | | formData.latitude = latitude |
| | | formData.longitude = longitude |
| | | } |
| | | console.log('formData:', formData) |
| | | uni.uploadFile({ |
| | | url: this.$baseUrl + 'web/public/upload', |
| | | filePath: path, |
| | | name: 'file', |
| | | formData: { |
| | | folder: 'order' |
| | | }, |
| | | formData: formData, |
| | | success: (uploadRes) => { |
| | | const data = JSON.parse(uploadRes.data) |
| | | if (data.code === 200) { |
| | |
| | | images: images.map(img => img.imgaddr), |
| | | orderId: this.selectedOrder.id, |
| | | remark: this.photoRemark |
| | | } |
| | | if (latitude && longitude) { |
| | | params.latitude = latitude |
| | | params.longitude = longitude |
| | | } |
| | | return this.$u.api[api](params) |
| | | }).then(res => { |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background: #f5f7fb; |
| | | border-radius: 16rpx; |
| | | |
| | | image { |