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
1bc7258c
authored
Nov 14, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
容器默认去掉
parent
7f6c6a7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
498 additions
and
497 deletions
pages/tallyReceive/index.vue
pages/tallyReceive/operate.vue
pages/tallyReceive/index.vue
View file @
1bc7258c
...
@@ -524,9 +524,9 @@
...
@@ -524,9 +524,9 @@
}
}
});
});
if
(
filter_arr
.
length
>
0
)
{
if
(
filter_arr
.
length
>
0
)
{
this
.
searchParams
.
container_name
=
filter_arr
[
0
].
name
;
this
.
searchParams
.
container_name
=
''
;
this
.
searchParams
.
container_id
=
filter_arr
[
0
].
id
;
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
filter_arr
[
0
].
id
;
this
.
formParams
.
container_id
=
''
;
}
}
this
.
getData
();
this
.
getData
();
...
@@ -556,8 +556,8 @@
...
@@ -556,8 +556,8 @@
};
};
}
}
});
});
this
.
searchParams
.
container_id
=
id
[
0
].
id
;
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
id
[
0
].
id
;
this
.
formParams
.
container_id
=
''
;
}
else
{
}
else
{
this
.
searchParams
.
container_id
=
''
;
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
...
...
pages/tallyReceive/operate.vue
View file @
1bc7258c
...
@@ -301,558 +301,558 @@
...
@@ -301,558 +301,558 @@
</template>
</template>
<
script
>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
{
API
}
from
'@/util/api.js'
;
import
debounce
from
'lodash/debounce'
;
import
debounce
from
'lodash/debounce'
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
is_watch
:
false
,
//是否看货
is_watch
:
false
,
//是否看货
is_print
:
false
,
//查询该销售单是否需要打印客户标签
is_print
:
false
,
//查询该销售单是否需要打印客户标签
coo
:
''
,
//产地
is_submit
:
true
,
stock_in_item_id
:
''
,
stock_in_id
:
''
,
noexebshowFalg
:
true
,
//控制是否会触发生命周期
print_flag
:
true
,
//是否打印
pic_flag
:
false
,
//是否整单照片
input_flag
:
true
,
input_contaion
:
true
,
company_id
:
uni
.
getStorageSync
(
'company_id'
)
||
1
,
//公司组织
page
:
1
,
limit
:
1
,
index
:
0
,
curr
:
0
,
item
:
[
'货品信息'
,
'其他信息'
],
print_style
:
[
'基本样式'
,
'不带D/C'
],
print_style_index
:
0
,
indexContainer
:
-
1
,
array
:
[
'物流单号'
,
'入库单号'
,
'入仓号'
],
tallyContainer
:
[],
//容器列表
detail
:
{},
//详情的数据
image_list
:
[],
//图片列表
maxNum
:
10
,
//最大上传图片数量
useOptionIndex
:
-
1
,
useOption
:
[],
//产地
warehouse_id
:
''
,
//区分仓库
searchParams
:
{
stock_in_sn
:
''
,
//入库单号
tracking_no
:
''
,
//物流单号
stock_in_with_stock_in_items_inhouse
:
''
,
//入仓单号
container_name
:
''
,
//容器编码
container_id
:
''
//容器id
},
formParams
:
{
tally_qty
:
''
,
//理货数量,
date_code
:
''
,
//D/C
coo
:
''
,
//产地
coo
:
''
,
//产地
other_batch_attr
:
''
,
//其他批次属性
is_submit
:
true
,
image_ids
:
[],
//图片
stock_in_item_id
:
''
,
tally_remark
:
''
,
//理货备注
stock_in_id
:
''
,
is_print
:
1
,
//打印入库标签
noexebshowFalg
:
true
,
//控制是否会触发生命周期
is_mobile_default_img
:
0
//整单照片
print_flag
:
true
,
//是否打印
}
pic_flag
:
false
,
//是否整单照片
};
input_flag
:
true
,
},
input_contaion
:
true
,
onLoad
(
options
)
{
company_id
:
uni
.
getStorageSync
(
'company_id'
)
||
1
,
//公司组织
this
.
stock_in_item_id
=
options
.
stock_in_item_id
||
''
;
page
:
1
,
this
.
stock_in_id
=
options
.
stock_in_id
||
''
;
limit
:
1
,
this
.
searchParams
.
container_name
=
options
.
container_name
||
''
;
index
:
0
,
this
.
searchParams
.
container_id
=
options
.
container_id
||
''
;
curr
:
0
,
},
item
:
[
'货品信息'
,
'其他信息'
],
onShow
()
{
print_style
:
[
'基本样式'
,
'不带D/C'
],
if
(
this
.
noexebshowFalg
)
{
print_style_index
:
0
,
this
.
getData
();
indexContainer
:
-
1
,
}
array
:
[
'物流单号'
,
'入库单号'
,
'入仓号'
],
},
tallyContainer
:
[],
//容器列表
watch
:
{
detail
:
{},
//详情的数据
image_list
(
arr
)
{
image_list
:
[],
//图片列表
if
(
arr
.
length
>
0
)
{
maxNum
:
10
,
//最大上传图片数量
this
.
formParams
.
image_ids
=
arr
.
join
(
','
);
useOptionIndex
:
-
1
,
}
else
{
useOption
:
[],
//产地
this
.
formParams
.
image_ids
=
''
;
warehouse_id
:
''
,
//区分仓库
}
searchParams
:
{
}
stock_in_sn
:
''
,
//入库单号
},
tracking_no
:
''
,
//物流单号
methods
:
{
stock_in_with_stock_in_items_inhouse
:
''
,
//入仓单号
/**
container_name
:
''
,
//容器编码
* @param {Object} index
container_id
:
''
//容器id
* tab切换
},
*/
formParams
:
{
tab
(
index
)
{
tally_qty
:
''
,
//理货数量,
this
.
curr
=
index
;
date_code
:
''
,
//D/C
},
coo
:
''
,
//产地
/**
other_batch_attr
:
''
,
//其他批次属性
* @param {Object} e
image_ids
:
[],
//图片
* @param {Object} type
tally_remark
:
''
,
//理货备注
*/
is_print
:
1
,
//打印入库标签
bindPickerChange
:
function
(
e
,
type
)
{
is_mobile_default_img
:
0
//整单照片
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
detail
.
value
);
if
(
type
==
1
)
{
this
.
useOptionIndex
=
e
.
detail
.
value
;
this
.
formParams
.
coo
=
this
.
useOption
[
e
.
detail
.
value
].
coo_en
;
}
else
if
(
type
==
2
)
{
this
.
print_style_index
=
e
.
detail
.
value
;
//区分深圳自营和非深圳自营
if
(
this
.
warehouse_id
==
9
)
{
this
.
formParams
.
is_print
=
this
.
print_style_index
==
1
?
2
:
1
;
}
}
}
else
{
};
this
.
index
=
e
.
detail
.
value
;
}
},
},
/**
onLoad
(
options
)
{
* @param {Object} arr
this
.
stock_in_item_id
=
options
.
stock_in_item_id
||
''
;
* @param {Object} target
this
.
stock_in_id
=
options
.
stock_in_id
||
''
;
*/
this
.
searchParams
.
container_name
=
options
.
container_name
||
''
;
findIndex
(
arr
,
target
)
{
this
.
searchParams
.
container_id
=
options
.
container_id
||
''
;
const
result
=
[];
arr
.
map
((
item
,
index
)
=>
{
if
(
item
.
coo_en
===
target
)
{
result
.
push
(
index
);
}
});
return
result
;
},
},
/**
onShow
()
{
* 监听理货数量
if
(
this
.
noexebshowFalg
)
{
*/
this
.
getData
();
handleInputNumber
:
debounce
(
function
(
event
,
wait_tally_qty
)
{
var
wait_tally_qty
=
Number
(
wait_tally_qty
);
var
val
=
event
.
target
.
value
*
1
;
if
(
val
>
wait_tally_qty
)
{
this
.
formParams
.
tally_qty
=
wait_tally_qty
;
}
},
500
),
/**
* @param {Object} type
* class切换
* 1 打印入库标签
* 2 整单照片
*/
toggle
(
type
)
{
if
(
type
==
1
)
{
this
.
print_flag
=
!
this
.
print_flag
;
this
.
formParams
.
is_print
=
this
.
print_flag
?
1
:
0
;
}
else
if
(
type
==
2
)
{
this
.
pic_flag
=
!
this
.
pic_flag
;
this
.
formParams
.
is_mobile_default_img
=
this
.
pic_flag
?
1
:
0
;
}
}
},
},
/**
watch
:
{
* 清空数据
image_list
(
arr
)
{
*/
if
(
arr
.
length
>
0
)
{
clearInput
(
type
)
{
this
.
formParams
.
image_ids
=
arr
.
join
(
','
);
if
(
type
==
1
)
{
}
else
{
this
.
input_flag
=
false
;
this
.
formParams
.
image_ids
=
''
;
if
(
this
.
index
==
0
)
{
this
.
searchParams
.
tracking_no
=
''
;
}
else
if
(
this
.
index
==
1
)
{
this
.
searchParams
.
stock_in_sn
=
''
;
}
else
if
(
this
.
index
==
2
)
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
}
}
this
.
stock_in_item_id
=
this
.
detail
.
stock_in_item_id
;
}
else
{
this
.
input_contaion
=
false
;
this
.
searchParams
.
container_name
=
''
;
this
.
searchParams
.
container_id
=
''
;
}
}
this
.
getData
();
},
},
/**
methods
:
{
*刷新容器
/**
*/
* @param {Object} index
createTallyContainer
(
type
)
{
* tab切换
if
(
type
==
1
)
{
*/
var
params
=
{
tab
(
index
)
{
is_mac
:
1
this
.
curr
=
index
;
};
},
}
else
{
/**
var
params
=
{};
* @param {Object} e
}
* @param {Object} type
this
.
request
(
API
.
createTallyContainer
,
'GET'
,
params
,
false
).
then
(
res
=>
{
*/
if
(
res
.
code
===
0
)
{
bindPickerChange
:
function
(
e
,
type
)
{
this
.
is_submit
=
true
;
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
detail
.
value
);
this
.
searchParams
.
container_name
=
res
.
data
.
container_sn
;
if
(
type
==
1
)
{
this
.
searchParams
.
container_id
=
res
.
data
.
id
;
this
.
useOptionIndex
=
e
.
detail
.
value
;
this
.
formParams
.
coo
=
this
.
useOption
[
e
.
detail
.
value
].
coo_en
;
}
else
if
(
type
==
2
)
{
this
.
print_style_index
=
e
.
detail
.
value
;
//区分深圳自营和非深圳自营
if
(
this
.
warehouse_id
==
9
)
{
this
.
formParams
.
is_print
=
this
.
print_style_index
==
1
?
2
:
1
;
}
}
else
{
}
else
{
uni
.
showToast
({
this
.
index
=
e
.
detail
.
value
;
title
:
res
.
msg
,
icon
:
'error'
});
}
}
});
},
},
/**
/**
* @param {Object} arr
* 单号搜索
* @param {Object} target
* @param {Object} event
*/
*/
findIndex
(
arr
,
target
)
{
handleInput
:
debounce
(
function
(
type
,
event
)
{
const
result
=
[];
var
val
=
event
.
target
.
value
;
arr
.
map
((
item
,
index
)
=>
{
if
(
val
)
{
if
(
item
.
coo_en
===
target
)
{
result
.
push
(
index
);
}
});
return
result
;
},
/**
* 监听理货数量
*/
handleInputNumber
:
debounce
(
function
(
event
,
wait_tally_qty
)
{
var
wait_tally_qty
=
Number
(
wait_tally_qty
);
var
val
=
event
.
target
.
value
*
1
;
if
(
val
>
wait_tally_qty
)
{
this
.
formParams
.
tally_qty
=
wait_tally_qty
;
}
},
500
),
/**
* @param {Object} type
* class切换
* 1 打印入库标签
* 2 整单照片
*/
toggle
(
type
)
{
if
(
type
==
1
)
{
if
(
type
==
1
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
print_flag
=
!
this
.
print_flag
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
formParams
.
is_print
=
this
.
print_flag
?
1
:
0
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
pic_flag
=
!
this
.
pic_flag
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
formParams
.
is_mobile_default_img
=
this
.
pic_flag
?
1
:
0
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
stock_in_sn
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
3
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
4
)
{
this
.
searchParams
.
container_name
=
val
;
this
.
input_contaion
=
true
;
this
.
getTallyContainer
();
}
}
}
else
{
},
if
(
type
==
1
||
type
==
2
||
type
==
3
)
{
/**
* 清空数据
*/
clearInput
(
type
)
{
if
(
type
==
1
)
{
this
.
input_flag
=
false
;
this
.
input_flag
=
false
;
this
.
getData
();
if
(
this
.
index
==
0
)
{
}
else
if
(
type
==
4
)
{
this
.
searchParams
.
tracking_no
=
''
;
}
else
if
(
this
.
index
==
1
)
{
this
.
searchParams
.
stock_in_sn
=
''
;
}
else
if
(
this
.
index
==
2
)
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
}
this
.
stock_in_item_id
=
this
.
detail
.
stock_in_item_id
;
}
else
{
this
.
input_contaion
=
false
;
this
.
input_contaion
=
false
;
this
.
searchParams
.
container_name
=
''
;
this
.
searchParams
.
container_id
=
''
;
}
}
}
this
.
getData
();
},
500
),
},
/**
/**
* 获取产地
*刷新容器
*/
*/
getUseOption
()
{
createTallyContainer
(
type
)
{
this
.
request
(
API
.
getUseOption
,
'GET'
,
{
type
:
'coo'
},
false
).
then
(
res
=>
{
if
(
type
==
1
)
{
if
(
res
.
code
===
0
)
{
var
params
=
{
if
(
res
.
data
.
length
>
0
)
{
is_mac
:
1
this
.
useOption
=
res
.
data
;
};
let
filter_arr
=
this
.
findIndex
(
res
.
data
,
this
.
coo
);
if
(
filter_arr
.
length
>
0
)
{
this
.
useOptionIndex
=
filter_arr
[
0
];
this
.
formParams
.
coo
=
res
.
data
[
this
.
useOptionIndex
].
coo_en
;
}
}
}
else
{
}
else
{
uni
.
showToast
({
var
params
=
{};
title
:
res
.
msg
,
icon
:
'error'
});
}
}
});
this
.
request
(
API
.
createTallyContainer
,
'GET'
,
params
,
false
).
then
(
res
=>
{
},
if
(
res
.
code
===
0
)
{
/**
this
.
is_submit
=
true
;
* 获取详情数据
this
.
searchParams
.
container_name
=
res
.
data
.
container_sn
;
*/
this
.
searchParams
.
container_id
=
res
.
data
.
id
;
getData
()
{
}
else
{
this
.
request
(
API
.
waitTallyReceiveList
,
'POST'
,
{
page
:
this
.
page
,
limit
:
this
.
limit
,
stock_in_item_id
:
this
.
stock_in_item_id
,
...
this
.
searchParams
},
false
).
then
(
res
=>
{
uni
.
showToast
({
if
(
res
.
code
===
0
)
{
title
:
res
.
msg
,
if
(
res
.
data
.
list
.
length
>
0
)
{
icon
:
'error'
this
.
warehouse_id
=
res
.
data
.
list
[
0
].
warehouse_id
;
this
.
detail
=
res
.
data
.
list
[
0
];
this
.
formParams
.
tally_qty
=
res
.
data
.
list
[
0
].
wait_tally_qty
;
this
.
formParams
.
date_code
=
res
.
data
.
list
[
0
].
expect_date_code
;
this
.
coo
=
res
.
data
.
list
[
0
].
coo_key
;
//产地
this
.
is_watch
=
res
.
data
.
list
[
0
].
is_watch
==
1
?
true
:
false
;
//是否看货
this
.
getUseOption
();
//初始化产地
if
(
res
.
data
.
list
[
0
].
mobile_default_img
)
{
this
.
image_list
=
res
.
data
.
list
[
0
].
mobile_default_img
.
split
(
','
);
}
else
{
this
.
image_list
=
[];
}
uni
.
setNavigationBarTitle
({
title
:
res
.
data
.
list
[
0
].
stock_in_sn
+
'-理货'
});
});
}
});
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput
:
debounce
(
function
(
type
,
event
)
{
var
val
=
event
.
target
.
value
;
if
(
val
)
{
if
(
type
==
1
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
getOrderIsPrintLabel
(
res
.
data
.
list
[
0
].
order_items_id
);
this
.
searchParams
.
tracking_no
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
2
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
stock_in_sn
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
3
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
4
)
{
this
.
searchParams
.
container_name
=
val
;
this
.
input_contaion
=
true
;
this
.
getTallyContainer
();
}
}
}
else
{
}
else
{
uni
.
showToast
({
if
(
type
==
1
||
type
==
2
||
type
==
3
)
{
title
:
res
.
msg
,
this
.
input_flag
=
false
;
icon
:
'error'
this
.
getData
();
});
}
else
if
(
type
==
4
)
{
}
this
.
input_contaion
=
false
;
});
}
},
/**
* 获取订单销售ID是否需要打印标签
*/
getOrderIsPrintLabel
(
order_items_id
)
{
this
.
request
(
API
.
getOrderIsPrintLabel
,
'GET'
,
{
order_items_id
:
order_items_id
},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
is_print
=
res
.
data
.
is_print
==
0
?
false
:
true
;
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
}
});
},
500
),
},
/**
/**
* 获取产地
* 获取容器列表数据
*/
*/
getUseOption
()
{
getTallyContainer
()
{
this
.
request
(
API
.
getUseOption
,
'GET'
,
{
type
:
'coo'
},
false
).
then
(
res
=>
{
this
.
request
(
API
.
getTallyContainer
,
'GET'
,
{},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
length
>
0
)
{
var
name
=
this
.
searchParams
.
container_name
;
this
.
useOption
=
res
.
data
;
this
.
is_submit
=
res
.
data
.
list
.
some
(
function
(
obj
)
{
let
filter_arr
=
this
.
findIndex
(
res
.
data
,
this
.
coo
);
return
obj
.
name
===
name
;
if
(
filter_arr
.
length
>
0
)
{
});
this
.
useOptionIndex
=
filter_arr
[
0
];
if
(
this
.
is_submit
)
{
this
.
formParams
.
coo
=
res
.
data
[
this
.
useOptionIndex
].
coo_en
;
var
id
=
res
.
data
.
list
.
filter
(
function
(
item
)
{
if
(
item
.
name
==
name
)
{
return
{
id
:
item
.
id
};
}
}
});
}
this
.
searchParams
.
container_id
=
id
[
0
].
id
;
}
else
{
}
else
{
this
.
searchParams
.
container_id
=
''
;
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
}
}
else
{
});
uni
.
showToast
({
},
title
:
res
.
msg
,
/**
icon
:
'error'
* 获取详情数据
});
*/
}
getData
()
{
});
this
.
request
(
API
.
waitTallyReceiveList
,
'POST'
,
{
page
:
this
.
page
,
limit
:
this
.
limit
,
stock_in_item_id
:
this
.
stock_in_item_id
,
...
this
.
searchParams
},
false
).
then
(
res
=>
{
},
if
(
res
.
code
===
0
)
{
/**
if
(
res
.
data
.
list
.
length
>
0
)
{
* 选择图片
this
.
warehouse_id
=
res
.
data
.
list
[
0
].
warehouse_id
;
*/
this
.
detail
=
res
.
data
.
list
[
0
];
chooseImageChange
()
{
this
.
formParams
.
tally_qty
=
res
.
data
.
list
[
0
].
wait_tally_qty
;
this
.
noexebshowFalg
=
false
;
this
.
formParams
.
date_code
=
res
.
data
.
list
[
0
].
expect_date_code
;
// 使用 chooseImage选择图片
this
.
coo
=
res
.
data
.
list
[
0
].
coo_key
;
//产地
uni
.
chooseImage
({
this
.
is_watch
=
res
.
data
.
list
[
0
].
is_watch
==
1
?
true
:
false
;
//是否看货
count
:
this
.
maxNum
,
this
.
getUseOption
();
//初始化产地
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
console
.
log
(
'选择图片成功:'
,
chooseImageRes
);
// 显示loading
uni
.
showLoading
({
title
:
'上传中...'
});
// 获取选择的图片路径数组
if
(
res
.
data
.
list
[
0
].
mobile_default_img
)
{
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
this
.
image_list
=
res
.
data
.
list
[
0
].
mobile_default_img
.
split
(
','
);
}
else
{
this
.
image_list
=
[];
}
uni
.
setNavigationBarTitle
({
title
:
res
.
data
.
list
[
0
].
stock_in_sn
+
'-理货'
});
// 判断选择的图片数量是否超过最大限制数量
this
.
getOrderIsPrintLabel
(
res
.
data
.
list
[
0
].
order_items_id
);
let
maxNum
=
Number
(
imagePaths
.
length
)
+
Number
(
this
.
image_list
.
length
);
//当前上传的+已经上传的
}
if
(
maxNum
>
this
.
maxNum
)
{
}
else
{
uni
.
hideLoading
();
uni
.
showToast
({
uni
.
showToast
({
title
:
'图片不超过'
+
this
.
maxNum
+
'张'
,
title
:
res
.
msg
,
icon
:
'none'
icon
:
'error'
});
}
});
},
/**
* 获取订单销售ID是否需要打印标签
*/
getOrderIsPrintLabel
(
order_items_id
)
{
this
.
request
(
API
.
getOrderIsPrintLabel
,
'GET'
,
{
order_items_id
:
order_items_id
},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
is_print
=
res
.
data
.
is_print
==
0
?
false
:
true
;
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
/**
* 获取容器列表数据
*/
getTallyContainer
()
{
this
.
request
(
API
.
getTallyContainer
,
'GET'
,
{},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
var
name
=
this
.
searchParams
.
container_name
;
this
.
is_submit
=
res
.
data
.
list
.
some
(
function
(
obj
)
{
return
obj
.
name
===
name
;
});
if
(
this
.
is_submit
)
{
var
id
=
res
.
data
.
list
.
filter
(
function
(
item
)
{
if
(
item
.
name
==
name
)
{
return
{
id
:
item
.
id
};
}
});
this
.
searchParams
.
container_id
=
''
;
}
else
{
this
.
searchParams
.
container_id
=
''
;
}
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
});
return
false
;
}
}
});
},
/**
* 选择图片
*/
chooseImageChange
()
{
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
.
image_list
.
length
);
//当前上传的+已经上传的
if
(
maxNum
>
this
.
maxNum
)
{
uni
.
hideLoading
();
uni
.
showToast
({
title
:
'图片不超过'
+
this
.
maxNum
+
'张'
,
icon
:
'none'
});
return
false
;
}
// 遍历图片路径数组,对每张图片进行压缩
// 遍历图片路径数组,对每张图片进行压缩
imagePaths
.
forEach
(
imagePath
=>
{
imagePaths
.
forEach
(
imagePath
=>
{
// 使用compressImage 压缩图片
// 使用compressImage 压缩图片
uni
.
compressImage
({
uni
.
compressImage
({
src
:
imagePath
,
src
:
imagePath
,
quality
:
50
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
quality
:
50
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success
:
compressedRes
=>
{
success
:
compressedRes
=>
{
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
// 获取压缩后的图片路径
// 获取压缩后的图片路径
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
// 在这里处理压缩后的图片,上传到服务器
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
uni
.
uploadFile
({
url
:
API
.
upload
+
'?sys_type=4'
,
url
:
API
.
upload
+
'?sys_type=4'
,
filePath
:
compressedImagePath
,
filePath
:
compressedImagePath
,
name
:
'file'
,
name
:
'file'
,
header
:
{
header
:
{
'Content-Type'
:
'multipart/form-data'
'Content-Type'
:
'multipart/form-data'
},
},
success
:
uploadFileRes
=>
{
success
:
uploadFileRes
=>
{
console
.
log
(
'服务器上传图片成功:'
,
uploadFileRes
);
console
.
log
(
'服务器上传图片成功:'
,
uploadFileRes
);
uni
.
hideLoading
();
uni
.
hideLoading
();
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
if
(
data
.
code
===
0
)
{
if
(
data
.
code
===
0
)
{
this
.
image_list
.
push
(
data
.
data
.
oss_image_url
);
this
.
image_list
.
push
(
data
.
data
.
oss_image_url
);
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
data
.
msg
,
title
:
data
.
msg
,
icon
:
'none'
icon
:
'none'
});
});
}
},
fail
:
error
=>
{
console
.
log
(
'上传图片失败:'
,
error
);
uni
.
hideLoading
();
}
}
},
});
fail
:
error
=>
{
},
console
.
log
(
'上传图片失败:'
,
error
);
fail
:
err
=>
{
uni
.
hideLoading
();
console
.
log
(
'压缩图片失败:'
,
err
);
}
}
});
});
},
fail
:
err
=>
{
console
.
log
(
'压缩图片失败:'
,
err
);
}
});
});
});
}
}
});
});
},
},
/**
/**
* 删除图片
* 删除图片
* @param {Object} index
* @param {Object} index
*/
*/
deletePic
(
index
)
{
deletePic
(
index
)
{
this
.
image_list
.
splice
(
index
,
1
);
this
.
image_list
.
splice
(
index
,
1
);
},
},
/**
/**
* 预览图片
* 预览图片
* @param {Object} img
* @param {Object} img
* @param {Object} index
* @param {Object} index
*/
*/
previewChange
(
img
,
index
)
{
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
uni
.
previewImage
({
current
:
index
,
current
:
index
,
urls
:
img
urls
:
img
});
});
},
},
/**
/**
* 理货提交
* 理货提交
*/
*/
createTallyReceive
()
{
createTallyReceive
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
if
(
this
.
company_id
==
1
)
{
if
(
this
.
company_id
==
1
)
{
if
(
this
.
searchParams
.
container_id
)
{
if
(
this
.
searchParams
.
container_id
)
{
if
(
!
this
.
is_submit
)
{
uni
.
showToast
({
title
:
'请输入正确容器'
,
icon
:
'none'
});
return
false
;
}
}
}
else
if
(
this
.
company_id
==
2
)
{
if
(
!
this
.
searchParams
.
container_id
)
{
uni
.
showToast
({
title
:
'请输入容器'
,
icon
:
'error'
});
return
false
;
}
if
(
!
this
.
is_submit
)
{
if
(
!
this
.
is_submit
)
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'请输入正确容器'
,
title
:
'请输入正确容器'
,
icon
:
'
none
'
icon
:
'
error
'
});
});
return
false
;
return
false
;
}
}
}
}
}
else
if
(
this
.
company_id
==
2
)
{
if
(
!
this
.
searchParams
.
container_id
)
{
uni
.
showToast
({
title
:
'请输入容器'
,
icon
:
'error'
});
return
false
;
}
if
(
!
this
.
is_submit
)
{
uni
.
showToast
({
title
:
'请输入正确容器'
,
icon
:
'error'
});
return
false
;
}
}
if
(
!
this
.
formParams
.
tally_qty
)
{
if
(
!
this
.
formParams
.
tally_qty
)
{
uni
.
showModal
({
itle
:
'提示'
,
content
:
'请填写理货数量'
,
showCancel
:
false
});
return
false
;
}
//当前登录组织为深贸电子才必填
if
(
this
.
company_id
==
2
)
{
if
(
this
.
formParams
.
image_ids
.
length
<=
0
)
{
uni
.
showToast
({
title
:
'请至少上传一张理货图片'
,
icon
:
'none'
});
return
false
;
}
}
//【理货】、【一键理货】操作时,D/C 必填并且必须为四位数字
if
(
this
.
warehouse_id
==
9
)
{
const
dcRegex
=
/^
\d{4}
$/
;
// 匹配四位数字
if
(
!
dcRegex
.
test
(
this
.
formParams
.
date_code
))
{
uni
.
showModal
({
uni
.
showModal
({
t
itle
:
'提示'
,
itle
:
'提示'
,
content
:
'
D/C必须为四位数字
'
,
content
:
'
请填写理货数量
'
,
showCancel
:
false
showCancel
:
false
});
});
return
false
;
return
false
;
}
}
}
var
wait_tally_qty
=
Number
(
this
.
detail
.
wait_tally_qty
);
//当前登录组织为深贸电子才必填
if
(
this
.
company_id
==
2
)
{
var
params
=
{
if
(
this
.
formParams
.
image_ids
.
length
<=
0
)
{
container_id
:
this
.
searchParams
.
container_id
,
stock_in_id
:
this
.
stock_in_id
,
stock_in_item_id
:
this
.
stock_in_item_id
,
tally_qty
:
this
.
formParams
.
tally_qty
,
date_code
:
this
.
formParams
.
date_code
,
other_batch_attr
:
this
.
formParams
.
other_batch_attr
,
tally_remark
:
this
.
formParams
.
tally_remark
,
image_ids
:
this
.
formParams
.
image_ids
,
coo
:
this
.
formParams
.
coo
,
is_mobile_default_img
:
this
.
formParams
.
is_mobile_default_img
,
is_print
:
this
.
formParams
.
is_print
};
this
.
request
(
API
.
createTallyReceive
,
'POST'
,
params
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
wait_tally_qty
==
this
.
formParams
.
tally_qty
)
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'全部理货成功'
,
title
:
'请至少上传一张理货图片'
,
icon
:
'success'
icon
:
'none'
});
return
false
;
}
}
//【理货】、【一键理货】操作时,D/C 必填并且必须为四位数字
if
(
this
.
warehouse_id
==
9
)
{
const
dcRegex
=
/^
\d{4}
$/
;
// 匹配四位数字
if
(
!
dcRegex
.
test
(
this
.
formParams
.
date_code
))
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'D/C必须为四位数字'
,
showCancel
:
false
});
});
setTimeout
(()
=>
{
return
false
;
uni
.
navigateBack
({
}
delta
:
1
}
var
wait_tally_qty
=
Number
(
this
.
detail
.
wait_tally_qty
);
var
params
=
{
container_id
:
this
.
searchParams
.
container_id
,
stock_in_id
:
this
.
stock_in_id
,
stock_in_item_id
:
this
.
stock_in_item_id
,
tally_qty
:
this
.
formParams
.
tally_qty
,
date_code
:
this
.
formParams
.
date_code
,
other_batch_attr
:
this
.
formParams
.
other_batch_attr
,
tally_remark
:
this
.
formParams
.
tally_remark
,
image_ids
:
this
.
formParams
.
image_ids
,
coo
:
this
.
formParams
.
coo
,
is_mobile_default_img
:
this
.
formParams
.
is_mobile_default_img
,
is_print
:
this
.
formParams
.
is_print
};
this
.
request
(
API
.
createTallyReceive
,
'POST'
,
params
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
wait_tally_qty
==
this
.
formParams
.
tally_qty
)
{
uni
.
showToast
({
title
:
'全部理货成功'
,
icon
:
'success'
});
});
},
2000
);
setTimeout
(()
=>
{
uni
.
navigateBack
({
delta
:
1
});
},
2000
);
}
else
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'理货成功,点击确定可继续理货'
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
this
.
getData
();
}
else
if
(
res
.
cancel
)
{
// 用户点击取消操作
console
.
log
(
'用户点击取消'
);
}
}
});
}
}
else
{
}
else
{
uni
.
showModal
({
uni
.
showModal
({
title
:
'提示'
,
title
:
'提示'
,
content
:
'理货成功,点击确定可继续理货'
,
content
:
res
.
msg
,
showCancel
:
false
,
showCancel
:
false
success
:
res
=>
{
if
(
res
.
confirm
)
{
this
.
getData
();
}
else
if
(
res
.
cancel
)
{
// 用户点击取消操作
console
.
log
(
'用户点击取消'
);
}
}
});
});
}
}
}
else
{
});
uni
.
showModal
({
},
title
:
'提示'
,
showDrawer
()
{
content
:
res
.
msg
,
this
.
$refs
.
showRight
.
open
();
showCancel
:
false
},
});
closeDrawer
()
{
}
this
.
$refs
.
showRight
.
close
();
});
}
},
showDrawer
()
{
this
.
$refs
.
showRight
.
open
();
},
closeDrawer
()
{
this
.
$refs
.
showRight
.
close
();
}
}
}
};
};
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
@import
'@/assets/css/tallyReceive/operate.scss'
;
@import
'@/assets/css/tallyReceive/operate.scss'
;
</
style
>
</
style
>
\ No newline at end of file
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