Commit 6cc13f41 by LJM

修复api

parent cf08ab1b
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
</template> </template>
<script> <script>
import { API } from '@/util/api.js'; import { API } from '@/util/api.js';
import { titleCase } from '@/util/util.js'; import { titleCase } from '@/util/util.js';
import w_md5 from '../../js_sdk/zww-md5/w_md5.js'; import w_md5 from '../../js_sdk/zww-md5/w_md5.js';
export default { export default {
data() { data() {
return { return {
logistics_company_arr: ['FedEx', 'DHL', 'UPS', '顺丰', 'Air'], //物流公司 logistics_company_arr: ['FedEx', 'DHL', 'UPS', '顺丰', 'Air'], //物流公司
...@@ -191,14 +191,16 @@ export default { ...@@ -191,14 +191,16 @@ export default {
chooseImageChange() { chooseImageChange() {
var self = this; var self = this;
var time = parseInt(new Date().getTime() / 1000); var time = parseInt(new Date().getTime() / 1000);
uni.chooseImage({ uni.chooseMedia({
count: 4, count: 4,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: chooseImageRes => { success: chooseImageRes => {
uni.showLoading({ uni.showLoading({
title: '上传中...' title: '上传中...'
}); });
const tempFilePaths = chooseImageRes.tempFilePaths; const tempFilePaths = chooseImageRes.tempFiles;
let maxNum = tempFilePaths.length * 1 + self.form.info_pic.length * 1; let maxNum = tempFilePaths.length * 1 + self.form.info_pic.length * 1;
if (maxNum > 4) { if (maxNum > 4) {
uni.hideLoading(); uni.hideLoading();
...@@ -211,7 +213,7 @@ export default { ...@@ -211,7 +213,7 @@ export default {
console.log(tempFilePaths[i]); console.log(tempFilePaths[i]);
uni.uploadFile({ uni.uploadFile({
url: API.upload, url: API.upload,
filePath: tempFilePaths[i], filePath: tempFilePaths[i].tempFilePath,
name: 'upload', name: 'upload',
formData: { formData: {
source: '1', source: '1',
...@@ -266,8 +268,7 @@ export default { ...@@ -266,8 +268,7 @@ export default {
content: '请上传收货图片', content: '请上传收货图片',
showCancel: false, showCancel: false,
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {} else if (res.cancel) {
} else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
} }
} }
...@@ -312,9 +313,9 @@ export default { ...@@ -312,9 +313,9 @@ export default {
}); });
} }
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '../../assets/css/goods/addExectionReceiving.scss'; @import '../../assets/css/goods/addExectionReceiving.scss';
</style> </style>
\ No newline at end of file
...@@ -178,14 +178,16 @@ ...@@ -178,14 +178,16 @@
this.noexebshowFalg = false; //不允许再次触发onshow这个生命周期 this.noexebshowFalg = false; //不允许再次触发onshow这个生命周期
var self = this; var self = this;
var time = parseInt(new Date().getTime() / 1000); var time = parseInt(new Date().getTime() / 1000);
uni.chooseImage({ uni.chooseMedia({
count: 4, count: 4,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: chooseImageRes => { success: chooseImageRes => {
uni.showLoading({ uni.showLoading({
title: '上传中...' title: '上传中...'
}); });
const tempFilePaths = chooseImageRes.tempFilePaths; const tempFilePaths = chooseImageRes.tempFiles;
let maxNum = tempFilePaths.length * 1 + self.form.check_in_pic.length * 1; let maxNum = tempFilePaths.length * 1 + self.form.check_in_pic.length * 1;
if (maxNum > 4) { if (maxNum > 4) {
uni.hideLoading(); uni.hideLoading();
...@@ -195,10 +197,9 @@ ...@@ -195,10 +197,9 @@
return false; return false;
} }
for (let i = 0; i < tempFilePaths.length; i++) { for (let i = 0; i < tempFilePaths.length; i++) {
console.log(tempFilePaths[i]);
uni.uploadFile({ uni.uploadFile({
url: API.upload, url: API.upload,
filePath: tempFilePaths[i], filePath: tempFilePaths[i].tempFilePath,
name: 'upload', name: 'upload',
formData: { formData: {
source: '1', source: '1',
...@@ -208,7 +209,6 @@ ...@@ -208,7 +209,6 @@
success: uploadFileRes => { success: uploadFileRes => {
uni.hideLoading(); uni.hideLoading();
var data = JSON.parse(uploadFileRes.data); var data = JSON.parse(uploadFileRes.data);
console.log(data);
if (data.code === 200) { if (data.code === 200) {
self.form.check_in_pic.push(data.data[0]); self.form.check_in_pic.push(data.data[0]);
} else { } else {
...@@ -220,7 +220,6 @@ ...@@ -220,7 +220,6 @@
}, },
fail: error => { fail: error => {
uni.hideLoading(); uni.hideLoading();
console.log(error);
} }
}); });
} }
......
...@@ -34,11 +34,13 @@ ...@@ -34,11 +34,13 @@
<view class="pic-list column"> <view class="pic-list column">
<text class="title">问题图片</text> <text class="title">问题图片</text>
<view class="list row verCenter"> <view class="list row verCenter">
<view class="box" @click="clickImg(operation_img, index)" v-for="(item, index) in operation_img" :key="index"><image :src="item" mode="aspectFill"></image></view> <view class="box" @click="clickImg(operation_img, index)" v-for="(item, index) in operation_img" :key="index">
<image :src="item" mode="aspectFill"></image>
</view> </view>
</view> </view>
</view> </view>
<view class="work-information"> </view>
<view class="work-information" v-if="warehouseOperationDetail.detail">
<view class="top row bothSide verCenter"> <view class="top row bothSide verCenter">
<view class="title row verCenter"> <view class="title row verCenter">
<text class="arrow row rowCenter verCenter"></text> <text class="arrow row rowCenter verCenter"></text>
...@@ -72,7 +74,7 @@ ...@@ -72,7 +74,7 @@
</view> </view>
</view> </view>
<view class="camera disable row rowCenter verCenter" v-if="item.operation_img">已上传</view> <view class="camera disable row rowCenter verCenter" v-if="item.operation_img">已上传</view>
<view class="camera row rowCenter verCenter" @click="chooseImageChange()" v-else="item.operation_img">拍照</view> <view class="camera row rowCenter verCenter" @click="chooseImageChange()" v-else-if="item.operation_img">拍照</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -81,10 +83,10 @@ ...@@ -81,10 +83,10 @@
</template> </template>
<script> <script>
import { API } from '@/util/api.js'; import { API } from '@/util/api.js';
import w_md5 from '../../js_sdk/zww-md5/w_md5.js'; import w_md5 from '../../js_sdk/zww-md5/w_md5.js';
export default { export default {
data() { data() {
return { return {
warehouseOperationDetail: {}, warehouseOperationDetail: {},
...@@ -112,19 +114,23 @@ export default { ...@@ -112,19 +114,23 @@ export default {
}); });
}, },
chooseImageChange() { chooseImageChange() {
uni.chooseImage({ uni.chooseMedia({
count: 1, count: 1,
mediaType: ['image'],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: chooseImageRes => { success: chooseImageRes => {
uni.showLoading({ uni.showLoading({
title: '上传中...' title: '上传中...'
}); });
const tempFilePaths = chooseImageRes.tempFilePaths;
const tempFilePaths = chooseImageRes.tempFiles;
const time = parseInt(new Date().getTime() / 1000); const time = parseInt(new Date().getTime() / 1000);
console.log(tempFilePaths);
uni.uploadFile({ uni.uploadFile({
url: API.upload, url: API.upload,
filePath: tempFilePaths[0], filePath: tempFilePaths[0].tempFilePath,
name: 'upload', name: 'upload',
formData: { formData: {
source: '1', source: '1',
...@@ -136,6 +142,7 @@ export default { ...@@ -136,6 +142,7 @@ export default {
uni.hideLoading(); uni.hideLoading();
var data = JSON.parse(uploadFileRes.data); var data = JSON.parse(uploadFileRes.data);
if (data.code === 200) { if (data.code === 200) {
this.operation_img.push(data.data[0]); this.operation_img.push(data.data[0]);
} else { } else {
...@@ -156,8 +163,7 @@ export default { ...@@ -156,8 +163,7 @@ export default {
submit() { submit() {
this.request( this.request(
API.execWarehouseOperation, API.execWarehouseOperation,
'POST', 'POST', {
{
weonlt_id: this.weonlt_id, weonlt_id: this.weonlt_id,
'weondl_id[]': this.weondl_ids.join(','), 'weondl_id[]': this.weondl_ids.join(','),
operation_img: this.operation_img.join(','), operation_img: this.operation_img.join(','),
...@@ -208,9 +214,9 @@ export default { ...@@ -208,9 +214,9 @@ export default {
}); });
} }
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '../../assets/css/goods/warehouseOperationConfirm.scss'; @import '../../assets/css/goods/warehouseOperationConfirm.scss';
</style> </style>
\ No newline at end of file
...@@ -171,20 +171,20 @@ ...@@ -171,20 +171,20 @@
chooseImageChange() { chooseImageChange() {
this.noexebshowFalg = false; this.noexebshowFalg = false;
// 使用 chooseImage选择图片 // 使用 chooseImage选择图片
uni.chooseImage({ uni.chooseMedia({
count: this.maxNum, count: this.maxNum,
mediaType: ['image'],
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: chooseImageRes => { success: chooseImageRes => {
console.log('选择图片成功:', chooseImageRes); console.log('选择图片成功:', chooseImageRes);
// 显示loading // 显示loading
uni.showLoading({ uni.showLoading({
title: '上传中...' title: '上传中...'
}); });
// 获取选择的图片路径数组 // 获取选择的图片路径数组
const imagePaths = chooseImageRes.tempFilePaths; const imagePaths = chooseImageRes.tempFiles;
// 判断选择的图片数量是否超过最大限制数量 // 判断选择的图片数量是否超过最大限制数量
let maxNum = Number(imagePaths.length) + Number(this.image_list.length); //当前上传的+已经上传的 let maxNum = Number(imagePaths.length) + Number(this.image_list.length); //当前上传的+已经上传的
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
imagePaths.forEach(imagePath => { imagePaths.forEach(imagePath => {
// 使用compressImage 压缩图片 // 使用compressImage 压缩图片
uni.compressImage({ uni.compressImage({
src: imagePath, src: imagePath.tempFilePath,
quality: 50, //压缩质量,范围0~100,数值越小,质量越低,压缩率越高 quality: 50, //压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success: compressedRes => { success: compressedRes => {
console.log('压缩图片成功:', compressedRes); console.log('压缩图片成功:', compressedRes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment