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 @@
}
});
if
(
filter_arr
.
length
>
0
)
{
this
.
searchParams
.
container_name
=
filter_arr
[
0
].
name
;
this
.
searchParams
.
container_id
=
filter_arr
[
0
].
id
;
this
.
formParams
.
container_id
=
filter_arr
[
0
].
id
;
this
.
searchParams
.
container_name
=
''
;
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
}
this
.
getData
();
...
...
@@ -556,8 +556,8 @@
};
}
});
this
.
searchParams
.
container_id
=
id
[
0
].
id
;
this
.
formParams
.
container_id
=
id
[
0
].
id
;
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
}
else
{
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
...
...
pages/tallyReceive/operate.vue
View file @
1bc7258c
...
...
@@ -301,558 +301,558 @@
</template>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
debounce
from
'lodash/debounce'
;
import
{
API
}
from
'@/util/api.js'
;
import
debounce
from
'lodash/debounce'
;
export
default
{
data
()
{
return
{
is_watch
:
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
export
default
{
data
()
{
return
{
is_watch
:
false
,
//是否看货
is_print
:
false
,
//查询该销售单是否需要打印客户标签
coo
:
''
,
//产地
other_batch_attr
:
''
,
//其他批次属性
image_ids
:
[],
//图片
tally_remark
:
''
,
//理货备注
is_print
:
1
,
//打印入库标签
is_mobile_default_img
:
0
//整单照片
}
};
},
onLoad
(
options
)
{
this
.
stock_in_item_id
=
options
.
stock_in_item_id
||
''
;
this
.
stock_in_id
=
options
.
stock_in_id
||
''
;
this
.
searchParams
.
container_name
=
options
.
container_name
||
''
;
this
.
searchParams
.
container_id
=
options
.
container_id
||
''
;
},
onShow
()
{
if
(
this
.
noexebshowFalg
)
{
this
.
getData
();
}
},
watch
:
{
image_list
(
arr
)
{
if
(
arr
.
length
>
0
)
{
this
.
formParams
.
image_ids
=
arr
.
join
(
','
);
}
else
{
this
.
formParams
.
image_ids
=
''
;
}
}
},
methods
:
{
/**
* @param {Object} index
* tab切换
*/
tab
(
index
)
{
this
.
curr
=
index
;
},
/**
* @param {Object} e
* @param {Object} type
*/
bindPickerChange
:
function
(
e
,
type
)
{
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
;
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
:
''
,
//产地
other_batch_attr
:
''
,
//其他批次属性
image_ids
:
[],
//图片
tally_remark
:
''
,
//理货备注
is_print
:
1
,
//打印入库标签
is_mobile_default_img
:
0
//整单照片
}
}
else
{
this
.
index
=
e
.
detail
.
value
;
}
};
},
/**
* @param {Object} arr
* @param {Object} target
*/
findIndex
(
arr
,
target
)
{
const
result
=
[];
arr
.
map
((
item
,
index
)
=>
{
if
(
item
.
coo_en
===
target
)
{
result
.
push
(
index
);
}
});
return
result
;
onLoad
(
options
)
{
this
.
stock_in_item_id
=
options
.
stock_in_item_id
||
''
;
this
.
stock_in_id
=
options
.
stock_in_id
||
''
;
this
.
searchParams
.
container_name
=
options
.
container_name
||
''
;
this
.
searchParams
.
container_id
=
options
.
container_id
||
''
;
},
/**
* 监听理货数量
*/
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
;
onShow
()
{
if
(
this
.
noexebshowFalg
)
{
this
.
getData
();
}
},
/**
* 清空数据
*/
clearInput
(
type
)
{
if
(
type
==
1
)
{
this
.
input_flag
=
false
;
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
=
''
;
watch
:
{
image_list
(
arr
)
{
if
(
arr
.
length
>
0
)
{
this
.
formParams
.
image_ids
=
arr
.
join
(
','
);
}
else
{
this
.
formParams
.
image_ids
=
''
;
}
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
();
},
/**
*刷新容器
*/
createTallyContainer
(
type
)
{
if
(
type
==
1
)
{
var
params
=
{
is_mac
:
1
};
}
else
{
var
params
=
{};
}
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
;
methods
:
{
/**
* @param {Object} index
* tab切换
*/
tab
(
index
)
{
this
.
curr
=
index
;
},
/**
* @param {Object} e
* @param {Object} type
*/
bindPickerChange
:
function
(
e
,
type
)
{
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
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
this
.
index
=
e
.
detail
.
value
;
}
});
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput
:
debounce
(
function
(
type
,
event
)
{
var
val
=
event
.
target
.
value
;
if
(
val
)
{
},
/**
* @param {Object} arr
* @param {Object} target
*/
findIndex
(
arr
,
target
)
{
const
result
=
[];
arr
.
map
((
item
,
index
)
=>
{
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
)
{
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
stock_in_sn
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
this
.
print_flag
=
!
this
.
print_flag
;
this
.
formParams
.
is_print
=
this
.
print_flag
?
1
:
0
;
}
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
();
this
.
pic_flag
=
!
this
.
pic_flag
;
this
.
formParams
.
is_mobile_default_img
=
this
.
pic_flag
?
1
:
0
;
}
}
else
{
if
(
type
==
1
||
type
==
2
||
type
==
3
)
{
},
/**
* 清空数据
*/
clearInput
(
type
)
{
if
(
type
==
1
)
{
this
.
input_flag
=
false
;
this
.
getData
();
}
else
if
(
type
==
4
)
{
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
=
''
;
}
}
},
500
),
/**
* 获取产地
*/
getUseOption
()
{
this
.
request
(
API
.
getUseOption
,
'GET'
,
{
type
:
'coo'
},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
length
>
0
)
{
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
;
}
}
this
.
getData
();
},
/**
*刷新容器
*/
createTallyContainer
(
type
)
{
if
(
type
==
1
)
{
var
params
=
{
is_mac
:
1
};
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
var
params
=
{};
}
});
},
/**
* 获取详情数据
*/
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
];
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
+
'-理货'
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
;
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
/**
* 单号搜索
* @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
{
uni
.
showToast
({
title
:
res
.
msg
,
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'
});
if
(
type
==
1
||
type
==
2
||
type
==
3
)
{
this
.
input_flag
=
false
;
this
.
getData
();
}
else
if
(
type
==
4
)
{
this
.
input_contaion
=
false
;
}
}
});
},
/**
* 获取容器列表数据
*/
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
};
},
500
),
/**
* 获取产地
*/
getUseOption
()
{
this
.
request
(
API
.
getUseOption
,
'GET'
,
{
type
:
'coo'
},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
length
>
0
)
{
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
;
}
});
this
.
searchParams
.
container_id
=
id
[
0
].
id
;
}
}
else
{
this
.
searchParams
.
container_id
=
''
;
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
/**
* 选择图片
*/
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
:
'上传中...'
});
});
},
/**
* 获取详情数据
*/
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
];
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
();
//初始化产地
// 获取选择的图片路径数组
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
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
+
'-理货'
});
// 判断选择的图片数量是否超过最大限制数量
let
maxNum
=
Number
(
imagePaths
.
length
)
+
Number
(
this
.
image_list
.
length
);
//当前上传的+已经上传的
if
(
maxNum
>
this
.
maxNum
)
{
uni
.
hideLoading
();
this
.
getOrderIsPrintLabel
(
res
.
data
.
list
[
0
].
order_items_id
);
}
}
else
{
uni
.
showToast
({
title
:
'图片不超过'
+
this
.
maxNum
+
'张'
,
icon
:
'none'
title
:
res
.
msg
,
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
=>
{
// 使用compressImage 压缩图片
uni
.
compressImage
({
src
:
imagePath
,
quality
:
50
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success
:
compressedRes
=>
{
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
// 获取压缩后的图片路径
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
// 遍历图片路径数组,对每张图片进行压缩
imagePaths
.
forEach
(
imagePath
=>
{
// 使用compressImage 压缩图片
uni
.
compressImage
({
src
:
imagePath
,
quality
:
50
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success
:
compressedRes
=>
{
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
// 获取压缩后的图片路径
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
url
:
API
.
upload
+
'?sys_type=4'
,
filePath
:
compressedImagePath
,
name
:
'file'
,
header
:
{
'Content-Type'
:
'multipart/form-data'
},
success
:
uploadFileRes
=>
{
console
.
log
(
'服务器上传图片成功:'
,
uploadFileRes
);
uni
.
hideLoading
();
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
if
(
data
.
code
===
0
)
{
this
.
image_list
.
push
(
data
.
data
.
oss_image_url
);
}
else
{
uni
.
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
url
:
API
.
upload
+
'?sys_type=4'
,
filePath
:
compressedImagePath
,
name
:
'file'
,
header
:
{
'Content-Type'
:
'multipart/form-data'
},
success
:
uploadFileRes
=>
{
console
.
log
(
'服务器上传图片成功:'
,
uploadFileRes
);
uni
.
hideLoading
();
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
if
(
data
.
code
===
0
)
{
this
.
image_list
.
push
(
data
.
data
.
oss_image_url
);
}
else
{
uni
.
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
}
},
fail
:
error
=>
{
console
.
log
(
'上传图片失败:'
,
error
);
uni
.
hideLoading
();
}
},
fail
:
error
=>
{
console
.
log
(
'上传图片失败:'
,
error
);
uni
.
hideLoading
();
}
});
},
fail
:
err
=>
{
console
.
log
(
'压缩图片失败:'
,
err
);
}
});
},
fail
:
err
=>
{
console
.
log
(
'压缩图片失败:'
,
err
);
}
});
});
});
}
});
},
/**
* 删除图片
* @param {Object} index
*/
deletePic
(
index
)
{
this
.
image_list
.
splice
(
index
,
1
);
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
},
/**
* 理货提交
*/
createTallyReceive
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
if
(
this
.
company_id
==
1
)
{
if
(
this
.
searchParams
.
container_id
)
{
}
});
},
/**
* 删除图片
* @param {Object} index
*/
deletePic
(
index
)
{
this
.
image_list
.
splice
(
index
,
1
);
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
},
/**
* 理货提交
*/
createTallyReceive
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
if
(
this
.
company_id
==
1
)
{
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
)
{
uni
.
showToast
({
title
:
'请输入正确容器'
,
icon
:
'
none
'
icon
:
'
error
'
});
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
)
{
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
))
{
if
(
!
this
.
formParams
.
tally_qty
)
{
uni
.
showModal
({
t
itle
:
'提示'
,
content
:
'
D/C必须为四位数字
'
,
itle
:
'提示'
,
content
:
'
请填写理货数量
'
,
showCancel
:
false
});
return
false
;
}
}
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
)
{
//当前登录组织为深贸电子才必填
if
(
this
.
company_id
==
2
)
{
if
(
this
.
formParams
.
image_ids
.
length
<=
0
)
{
uni
.
showToast
({
title
:
'全部理货成功'
,
icon
:
'success'
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
({
title
:
'提示'
,
content
:
'D/C必须为四位数字'
,
showCancel
:
false
});
setTimeout
(()
=>
{
uni
.
navigateBack
({
delta
:
1
return
false
;
}
}
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
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'理货成功,点击确定可继续理货'
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
this
.
getData
();
}
else
if
(
res
.
cancel
)
{
// 用户点击取消操作
console
.
log
(
'用户点击取消'
);
}
}
content
:
res
.
msg
,
showCancel
:
false
});
}
}
else
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
msg
,
showCancel
:
false
});
}
});
},
showDrawer
()
{
this
.
$refs
.
showRight
.
open
();
},
closeDrawer
()
{
this
.
$refs
.
showRight
.
close
();
});
},
showDrawer
()
{
this
.
$refs
.
showRight
.
open
();
},
closeDrawer
()
{
this
.
$refs
.
showRight
.
close
();
}
}
}
};
};
</
script
>
<
style
scoped
lang=
"scss"
>
@import
'@/assets/css/tallyReceive/operate.scss'
;
</
style
>
@import
'@/assets/css/tallyReceive/operate.scss'
;
</
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