Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
wmsApp
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bda86a26
authored
Feb 26, 2025
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add
parent
25f7fc1e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
7 deletions
pages/stockRecheck/shipOut.vue
util/api.js
pages/stockRecheck/shipOut.vue
View file @
bda86a26
...
...
@@ -117,13 +117,13 @@
<view
class=
"input-box row"
style=
"flex: 0 0 100%;"
>
<text
class=
"label"
>
签收图片:
</text>
<view
class=
"pick_img_list row"
>
<
!--
<template
v-if=
"item.stock_out_status_val
.length > 0"
>
<view
class=
"img_list"
v-for=
"(v, i) in item.
recheck_img_list
"
:key=
"i"
>
<image
:src=
"v.small_image_url"
mode=
"aspectFill"
@
click=
"previewChange(item.
recheck_img_list
, i)"
></image>
<
template
v-if=
"item.sign_pic_ids
.length > 0"
>
<view
class=
"img_list"
v-for=
"(v, i) in item.
sign_pic_ids
"
:key=
"i"
>
<image
:src=
"v.small_image_url"
mode=
"aspectFill"
@
click=
"previewChange(item.
sign_pic_ids
, i)"
></image>
<text
class=
"iconfont icon-a-juxing11"
@
click=
"deletePic(index,i)"
></text>
</view>
</
template
>
-->
<view
class=
"default row rowCenter verCenter"
@
click=
"chooseImageChange(index)"
><text
class=
"iconfont icon-a-juxing3"
></text></view>
</
template
>
<view
class=
"default row rowCenter verCenter"
@
click=
"chooseImageChange(index)"
v-if=
"item.sign_pic_ids.length < maxNum"
><text
class=
"iconfont icon-a-juxing3"
></text></view>
</view>
</view>
<view
class=
"row"
style=
"justify-content: flex-end;width: 100%;"
>
...
...
@@ -340,7 +340,7 @@
export
default
{
data
()
{
return
{
is_focus
:
true
,
//获取焦点动态化
noexebshowFalg
:
true
,
//控制是否会触发生命周期
company_id
:
uni
.
getStorageSync
(
'company_id'
)
||
1
,
input_flag
:
false
,
flag
:
false
,
...
...
@@ -386,6 +386,11 @@
city
:
''
,
district
:
''
,
address
:
''
},
signUserPicParams
:
{
type
:
1
,
//1上传 2删除
img_id
:
''
,
stock_out_id
:
''
}
};
},
...
...
@@ -690,6 +695,10 @@
* 获取列表数据
*/
getData
()
{
if
(
!
this
.
noexebshowFalg
)
{
this
.
noexebshowFalg
=
true
;
// 重置标志位
return
;
}
this
.
request
(
API
.
getToPrintList
,
'POST'
,
{
page
:
this
.
page
,
limit
:
this
.
limit
,
...
this
.
searchParams
},
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
list
.
length
>
0
)
{
...
...
@@ -840,6 +849,155 @@
setTimeout
(()
=>
{
this
.
is_focus
=
true
;
},
200
);
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange
(
arr
,
index
)
{
var
data
=
arr
.
map
(
item
=>
{
return
item
.
big_image_url
;
});
this
.
noexebshowFalg
=
false
;
uni
.
previewImage
({
current
:
index
,
urls
:
data
});
},
/**
* 选择图片
*/
chooseImageChange
(
index
)
{
this
.
noexebshowFalg
=
false
;
// 使用 chooseImage选择图片
uni
.
chooseImage
({
count
:
this
.
maxNum
,
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
console
.
log
(
'选择图片成功:'
,
chooseImageRes
);
// 显示loading
uni
.
showLoading
({
title
:
'上传中...'
});
// 获取选择的图片路径数组
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
// 判断选择的图片数量是否超过最大限制数量
let
maxNum
=
Number
(
imagePaths
.
length
)
+
Number
(
this
.
list
[
index
].
recheck_img_list
.
length
);
//当前上传的+已经上传的
if
(
maxNum
>
this
.
maxNum
)
{
uni
.
hideLoading
();
uni
.
showToast
({
title
:
'图片不超过'
+
this
.
maxNum
+
'张'
,
icon
:
'none'
});
return
false
;
}
// 遍历图片路径数组,对每张图片进行压缩
imagePaths
.
forEach
(
imagePath
=>
{
// 使用compressImage 压缩图片
uni
.
compressImage
({
src
:
imagePath
,
quality
:
60
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success
:
compressedRes
=>
{
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
// 获取压缩后的图片路径
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
url
:
this
.
img_upload_url
+
'/uploadImage?sys_type=4'
,
filePath
:
compressedImagePath
,
name
:
'file'
,
timeout
:
10000
,
header
:
{
'Content-Type'
:
'multipart/form-data'
},
success
:
uploadFileRes
=>
{
console
.
log
(
'服务器上传图片成功:'
,
uploadFileRes
);
uni
.
hideLoading
();
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
if
(
data
.
code
===
0
)
{
// 根据参数index更新list里的数组recheck_img_list
let
itemToUpdate
=
this
.
list
[
index
];
itemToUpdate
.
recheck_img_list
.
push
({
pic_id
:
data
.
data
.
oss_image_id
,
small_image_url
:
data
.
data
.
small_image_url
,
big_image_url
:
data
.
data
.
big_image_url
});
// 更新整个list数组
this
.
list
=
[...
this
.
list
];
// 获取特定索引位置的recheck_img_list
let
pickImgList
=
this
.
list
[
index
].
recheck_img_list
;
// 使用flatMap获取所有的pic_id并拼接成字符串
let
pic_ids
=
pickImgList
.
flatMap
(
item
=>
item
.
pic_id
).
join
(
','
);
//签约图片更新
this
.
signUserPic
(
this
.
list
[
index
].
stock_out_id
,
pic_ids
,
1
);
}
else
{
uni
.
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
}
},
fail
:
error
=>
{
uni
.
showToast
({
title
:
'上传图片失败'
,
icon
:
'none'
});
uni
.
hideLoading
();
}
});
},
fail
:
err
=>
{
console
.
log
(
'压缩图片失败:'
,
err
);
}
});
});
}
});
},
/**
* 删除和新增签约图片
* @param {number} stock_out_id - 出库单ID
* @param {string} img_id - 图片ID,多个以逗号分隔
* @param {number} type - 操作类型:1-新增 2-删除
*/
signUserPic
(
stock_out_id
,
img_id
,
type
)
{
// 使用对象展开运算符一次性更新参数
this
.
signUserPicParams
=
{
...
this
.
signUserPicParams
,
stock_out_id
,
img_id
,
type
};
this
.
request
(
API
.
signUserPic
,
'POST'
,
this
.
signUserPicParams
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
uni
.
showToast
({
title
:
'操作成功'
,
icon
:
'success'
});
setTimeout
(()
=>
this
.
getData
(),
2000
);
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'none'
});
}
});
}
}
};
...
...
util/api.js
View file @
bda86a26
...
...
@@ -406,7 +406,11 @@ const API = {
/**
* 对外开放-物流联动信息获取
* */
getShippingList
:
API_BASE
+
'/open/shipping/getShippingList'
getShippingList
:
API_BASE
+
'/open/shipping/getShippingList'
,
/**
* 删除和新增签约图片
* */
signUserPic
:
API_BASE
+
'/api/stockout/signUserPic'
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment