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
c765edfd
authored
Oct 27, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
移动端一键理货容器为空异常
parent
e1972a83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
534 additions
and
530 deletions
pages/picking/me.vue
pages/tallyReceive/index.vue
pages/picking/me.vue
View file @
c765edfd
...
...
@@ -90,7 +90,7 @@
array
:
[
'出库单号'
],
list
:
[],
page
:
1
,
limit
:
2
0
,
limit
:
10
0
,
hasMoreData
:
true
,
//是否分页加载
searchParams
:
{
stock_out_sn
:
''
//出库单号
...
...
pages/tallyReceive/index.vue
View file @
c765edfd
...
...
@@ -47,9 +47,6 @@
</view>
<view>
<text
class=
"iconfont icon-juxing3"
@
click=
"createTallyContainer()"
></text>
<!--
<text class="iconfont icon-zimu-M" @click="createTallyContainer(1)"></text>
-->
<text
class=
"iconfont icon-a-juxing11"
@
click=
"clearInput(2)"
v-if=
"input_contaion"
></text>
</view>
</view>
...
...
@@ -119,7 +116,9 @@
<text
class=
"label"
>
待理货数量:
</text>
<text
class=
"ttt"
>
{{ item.wait_tally_qty }}
</text>
</view>
<navigator
class=
"btn-box row"
:url=
"'/pages/tallyReceive/operate?stock_in_item_id=' + item.stock_in_item_id + '&stock_in_id=' + item.stock_in_id + '&container_id=' + searchParams.container_id + '&container_name=' + searchParams.container_name"
hover-class=
"none"
><view
class=
"btn row rowCenter verCenter"
>
理货
</view></navigator>
<navigator
class=
"btn-box row"
:url=
"'/pages/tallyReceive/operate?stock_in_item_id=' + item.stock_in_item_id + '&stock_in_id=' + item.stock_in_id + '&container_id=' + searchParams.container_id + '&container_name=' + searchParams.container_name"
hover-class=
"none"
>
<view
class=
"btn row rowCenter verCenter"
>
理货
</view>
</navigator>
</view>
</view>
<view
class=
"no-date column rowCenter verCenter"
v-else
>
...
...
@@ -194,385 +193,405 @@
</template>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
{
createArray
}
from
'@/util/util.js'
;
import
debounce
from
'lodash/debounce'
;
import
{
API
}
from
'@/util/api.js'
;
import
{
createArray
}
from
'@/util/util.js'
;
import
debounce
from
'lodash/debounce'
;
export
default
{
data
()
{
return
{
timer
:
null
,
// 用于存储计时器
is_submit
:
true
,
noexebshowFalg
:
true
,
//控制是否会触发生命周期
print_flag
:
true
,
//是否打印
input_flag
:
false
,
input_contaion
:
false
,
company_id
:
uni
.
getStorageSync
(
'company_id'
)
||
1
,
//公司组织
all_flag
:
false
,
//全选标记
page
:
1
,
limit
:
50
,
index
:
0
,
indexContainer
:
-
1
,
array
:
[
'全量搜索'
,
'入仓号'
,
'FedEx'
,
'DigKey'
,
'Rochester'
],
list
:
[],
filter_list
:
[],
//筛选已选中的列表
filter_id
:
[],
//入库单列表的入库登记
detail
:
{},
//详情的数据
image_list
:
[],
//图片列表
maxNum
:
10
,
//最大上传图片数量
hasMoreData
:
true
,
//是否分页加载
is_watch
:
false
,
//是否看货
searchParams
:
{
mobile_wait_tally_all_search
:
''
,
//全量搜索
stock_in_with_stock_in_items_inhouse
:
''
,
//入仓单号
container_name
:
''
,
//容器编码
container_id
:
''
,
//容器id,
tracking_no
:
''
,
//fedex
goods_name
:
''
,
code_type
:
''
},
formParams
:
{
container_id
:
''
,
tally_remark
:
''
,
image_ids
:
''
,
is_print
:
1
}
};
},
watch
:
{
image_list
(
arr
)
{
if
(
arr
.
length
>
0
)
{
this
.
formParams
.
image_ids
=
arr
.
join
(
','
);
}
else
{
this
.
formParams
.
image_ids
=
''
;
}
}
},
onReachBottom
()
{
if
(
!
this
.
hasMoreData
)
{
return
;
}
this
.
page
++
;
this
.
getData
();
},
onNavigationBarButtonTap
(
e
)
{
if
(
e
.
index
==
0
)
{
uni
.
navigateTo
({
url
:
'/pages/tallyReceive/record'
});
}
},
onShow
()
{
if
(
this
.
noexebshowFalg
)
{
this
.
resetChange
();
this
.
getData
();
this
.
getTallyContainerDefault
();
}
},
methods
:
{
/**
* 是否打印
*/
toggle
()
{
this
.
print_flag
=
!
this
.
print_flag
;
if
(
this
.
print_flag
)
{
this
.
formParams
.
is_print
=
1
;
}
else
{
this
.
formParams
.
is_print
=
0
;
}
export
default
{
data
()
{
return
{
timer
:
null
,
// 用于存储计时器
is_submit
:
true
,
noexebshowFalg
:
true
,
//控制是否会触发生命周期
print_flag
:
true
,
//是否打印
input_flag
:
false
,
input_contaion
:
false
,
company_id
:
uni
.
getStorageSync
(
'company_id'
)
||
1
,
//公司组织
all_flag
:
false
,
//全选标记
page
:
1
,
limit
:
50
,
index
:
0
,
indexContainer
:
-
1
,
array
:
[
'全量搜索'
,
'入仓号'
,
'FedEx'
,
'DigKey'
,
'Rochester'
],
list
:
[],
filter_list
:
[],
//筛选已选中的列表
filter_id
:
[],
//入库单列表的入库登记
detail
:
{},
//详情的数据
image_list
:
[],
//图片列表
maxNum
:
10
,
//最大上传图片数量
hasMoreData
:
true
,
//是否分页加载
is_watch
:
false
,
//是否看货
searchParams
:
{
mobile_wait_tally_all_search
:
''
,
//全量搜索
stock_in_with_stock_in_items_inhouse
:
''
,
//入仓单号
container_name
:
''
,
//容器编码
container_id
:
''
,
//容器id,
tracking_no
:
''
,
//fedex
goods_name
:
''
,
code_type
:
''
},
formParams
:
{
container_id
:
''
,
tally_remark
:
''
,
image_ids
:
''
,
is_print
:
1
}
};
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex
(
arr
,
target
)
{
const
result
=
[];
arr
.
map
((
item
,
index
)
=>
{
if
(
item
===
target
)
{
result
.
push
(
index
);
watch
:
{
image_list
(
arr
)
{
if
(
arr
.
length
>
0
)
{
this
.
formParams
.
image_ids
=
arr
.
join
(
','
);
}
else
{
this
.
formParams
.
image_ids
=
''
;
}
});
return
result
;
}
},
/**
* 筛选过滤出选中的元素
*/
filterChange
(
index
)
{
this
.
$set
(
this
.
filter_list
,
index
,
(
this
.
filter_list
[
index
]
=
!
this
.
filter_list
[
index
]));
let
filter_arr
=
this
.
findIndex
(
this
.
filter_list
,
true
);
this
.
filter_id
=
filter_arr
.
map
(
i
=>
this
.
list
[
i
].
stock_in_item_id
);
let
is_watch_arr
=
filter_arr
.
map
(
i
=>
this
.
list
[
i
].
is_watch
);
this
.
is_watch
=
is_watch_arr
.
includes
(
1
);
onReachBottom
()
{
if
(
!
this
.
hasMoreData
)
{
return
;
}
this
.
page
++
;
this
.
getData
();
},
/**
* 全选
*/
allChnage
()
{
this
.
all_flag
=
!
this
.
all_flag
;
this
.
filter_list
=
createArray
(
this
.
list
.
length
,
this
.
all_flag
);
if
(
this
.
all_flag
)
{
this
.
filter_id
=
this
.
list
.
map
(
function
(
item
)
{
return
item
.
stock_in_item_id
;
});
let
is_watch_arr
=
this
.
list
.
map
(
function
(
item
)
{
return
item
.
is_watch
;
onNavigationBarButtonTap
(
e
)
{
if
(
e
.
index
==
0
)
{
uni
.
navigateTo
({
url
:
'/pages/tallyReceive/record'
});
this
.
is_watch
=
is_watch_arr
.
includes
(
1
);
}
else
{
this
.
filter_id
=
[];
}
},
/**
*刷新容器
*/
createTallyContainer
(
type
)
{
if
(
type
==
1
)
{
var
params
=
{
is_mac
:
1
};
}
else
{
var
params
=
{};
onShow
()
{
if
(
this
.
noexebshowFalg
)
{
this
.
resetChange
();
this
.
getData
();
this
.
getTallyContainerDefault
();
}
this
.
request
(
API
.
createTallyContainer
,
'GET'
,
params
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
searchParams
.
container_name
=
res
.
data
.
container_sn
;
this
.
searchParams
.
container_id
=
res
.
data
.
id
;
this
.
formParams
.
container_id
=
res
.
data
.
id
;
this
.
is_submit
=
true
;
},
methods
:
{
/**
* 是否打印
*/
toggle
()
{
this
.
print_flag
=
!
this
.
print_flag
;
if
(
this
.
print_flag
)
{
this
.
formParams
.
is_print
=
1
;
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
this
.
formParams
.
is_print
=
0
;
}
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex
(
arr
,
target
)
{
const
result
=
[];
arr
.
map
((
item
,
index
)
=>
{
if
(
item
===
target
)
{
result
.
push
(
index
);
}
});
return
result
;
},
/**
* 筛选过滤出选中的元素
*/
filterChange
(
index
)
{
this
.
$set
(
this
.
filter_list
,
index
,
(
this
.
filter_list
[
index
]
=
!
this
.
filter_list
[
index
]));
let
filter_arr
=
this
.
findIndex
(
this
.
filter_list
,
true
);
this
.
filter_id
=
filter_arr
.
map
(
i
=>
this
.
list
[
i
].
stock_in_item_id
);
let
is_watch_arr
=
filter_arr
.
map
(
i
=>
this
.
list
[
i
].
is_watch
);
this
.
is_watch
=
is_watch_arr
.
includes
(
1
);
},
/**
* 全选
*/
allChnage
()
{
this
.
all_flag
=
!
this
.
all_flag
;
this
.
filter_list
=
createArray
(
this
.
list
.
length
,
this
.
all_flag
);
if
(
this
.
all_flag
)
{
this
.
filter_id
=
this
.
list
.
map
(
function
(
item
)
{
return
item
.
stock_in_item_id
;
});
let
is_watch_arr
=
this
.
list
.
map
(
function
(
item
)
{
return
item
.
is_watch
;
});
this
.
is_watch
=
is_watch_arr
.
includes
(
1
);
}
else
{
this
.
filter_id
=
[];
}
});
},
/**
* 清空数据
*/
clearInput
(
type
)
{
this
.
resetChange
();
if
(
type
==
1
)
{
this
.
input_flag
=
false
;
if
(
this
.
index
==
0
)
{
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
}
else
if
(
this
.
index
==
1
)
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
}
else
if
(
this
.
index
==
2
)
{
this
.
searchParams
.
tracking_no
=
''
;
}
else
if
(
this
.
index
==
3
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
else
if
(
this
.
index
==
4
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
else
if
(
this
.
index
==
5
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
else
if
(
this
.
index
==
6
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
},
/**
*刷新容器
*/
createTallyContainer
(
type
)
{
if
(
type
==
1
)
{
var
params
=
{
is_mac
:
1
};
}
else
{
var
params
=
{};
}
}
else
{
this
.
input_contaion
=
false
;
this
.
searchParams
.
container_name
=
''
;
this
.
searchParams
.
container_id
=
''
;
}
this
.
getData
();
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput
:
debounce
(
function
(
type
,
event
)
{
var
val
=
event
.
target
.
value
;
if
(
val
)
{
this
.
request
(
API
.
createTallyContainer
,
'GET'
,
params
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
searchParams
.
container_name
=
res
.
data
.
container_sn
;
this
.
searchParams
.
container_id
=
res
.
data
.
id
;
this
.
formParams
.
container_id
=
res
.
data
.
id
;
this
.
is_submit
=
true
;
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
/**
* 清空数据
*/
clearInput
(
type
)
{
this
.
resetChange
();
if
(
type
==
1
)
{
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
this
.
input_flag
=
false
;
if
(
this
.
index
==
0
)
{
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
}
else
if
(
this
.
index
==
1
)
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
}
else
if
(
this
.
index
==
2
)
{
this
.
searchParams
.
tracking_no
=
''
;
}
else
if
(
this
.
index
==
3
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
else
if
(
this
.
index
==
4
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
else
if
(
this
.
index
==
5
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
else
if
(
this
.
index
==
6
)
{
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
goods_name
=
''
;
}
}
else
{
this
.
input_contaion
=
false
;
this
.
searchParams
.
container_name
=
''
;
this
.
searchParams
.
container_id
=
''
;
}
this
.
getData
();
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput
:
debounce
(
function
(
type
,
event
)
{
var
val
=
event
.
target
.
value
;
if
(
val
)
{
if
(
type
==
1
)
{
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
mobile_wait_tally_all_search
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
2
)
{
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
mobile_wait_tally_all_search
=
val
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
2
)
{
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
//入仓号
var
str
=
val
;
if
(
str
.
startsWith
(
'F'
))
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
val
;
}
else
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
str
.
slice
(
0
,
-
1
);
}
//入仓号
var
str
=
val
;
if
(
str
.
startsWith
(
'F'
))
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
val
;
}
else
{
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
str
.
slice
(
0
,
-
1
);
}
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
0
)
{
//选择了fedex
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
0
)
{
//选择了fedex
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
var
last12
=
val
.
slice
(
22
);
// 截取后12位
this
.
searchParams
.
tracking_no
=
last12
;
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
3
)
{
//一键理货的容器监听
this
.
searchParams
.
container_name
=
val
;
this
.
input_contaion
=
true
;
this
.
getTallyContainer
();
}
}
else
{
if
(
type
==
1
||
type
==
2
)
{
this
.
resetChange
();
this
.
input_flag
=
false
;
this
.
getData
();
}
else
if
(
type
==
3
)
{
//容器为空的时候清除值
this
.
formParams
.
container_id
=
''
;
this
.
searchParams
.
container_id
=
''
;
this
.
input_contaion
=
false
;
}
}
},
800
),
handleInputChange
:
debounce
(
function
(
event
)
{
var
val
=
event
.
target
.
value
;
if
(
val
)
{
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
var
last12
=
val
.
slice
(
22
);
// 截取后12位
this
.
searchParams
.
tracking_no
=
last12
;
this
.
searchParams
.
code_type
=
val
;
let
code_type
=
''
;
if
(
this
.
index
==
3
)
{
code_type
=
'DigKey'
;
}
else
if
(
this
.
index
==
4
)
{
code_type
=
'Rochester'
;
}
else
if
(
this
.
index
==
5
)
{
code_type
=
'TME'
;
}
else
if
(
this
.
index
==
6
)
{
code_type
=
'Chip1stop'
;
}
this
.
input_flag
=
true
;
this
.
getData
();
}
else
if
(
type
==
3
)
{
this
.
searchParams
.
container_name
=
val
;
this
.
input_contaion
=
true
;
this
.
getTallyContainer
();
}
}
else
{
if
(
type
==
1
||
type
==
2
)
{
this
.
resetChange
();
this
.
input_flag
=
false
;
this
.
getData
();
}
else
if
(
type
==
3
)
{
this
.
input_contaion
=
false
;
}
}
},
800
),
handleInputChange
:
debounce
(
function
(
event
)
{
var
val
=
event
.
target
.
value
;
if
(
val
)
{
this
.
resetChange
();
this
.
searchParams
.
mobile_wait_tally_all_search
=
''
;
this
.
searchParams
.
stock_in_with_stock_in_items_inhouse
=
''
;
this
.
searchParams
.
tracking_no
=
''
;
this
.
searchParams
.
code_type
=
''
;
this
.
searchParams
.
code_type
=
val
;
let
code_type
=
''
;
if
(
this
.
index
==
3
)
{
code_type
=
'DigKey'
;
}
else
if
(
this
.
index
==
4
)
{
code_type
=
'Rochester'
;
}
else
if
(
this
.
index
==
5
)
{
code_type
=
'TME'
;
}
else
if
(
this
.
index
==
6
)
{
code_type
=
'Chip1stop'
;
}
this
.
input_flag
=
true
;
this
.
identifyQrCodeNumAndSn
(
val
,
code_type
);
//识别二维码的数量和型号
}
else
{
this
.
input_flag
=
false
;
}
},
2000
),
bindPickerChange
:
function
(
e
)
{
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
detail
.
value
);
this
.
index
=
e
.
detail
.
value
;
},
/**
* 识别二维码的数量和型号
*/
identifyQrCodeNumAndSn
(
code_str
,
code_type
)
{
console
.
log
(
code_str
);
this
.
request
(
API
.
identifyQrCodeNumAndSn
,
'POST'
,
{
code_str
:
code_str
,
code_type
:
code_type
},
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
searchParams
.
goods_name
=
res
.
data
.
sn
;
this
.
getData
();
this
.
identifyQrCodeNumAndSn
(
val
,
code_type
);
//识别二维码的数量和型号
}
else
{
uni
.
showToast
({
title
:
'识别错误'
,
icon
:
'error'
});
this
.
input_flag
=
false
;
}
});
},
/**
* 获取列表数据
*/
getData
()
{
this
.
request
(
API
.
waitTallyReceiveList
,
'POST'
,
{
page
:
this
.
page
,
limit
:
this
.
limit
,
...
this
.
searchParams
},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
total
>
0
)
{
this
.
hasMoreData
=
true
;
this
.
list
=
this
.
list
.
concat
(
res
.
data
.
list
);
this
.
filter_list
=
createArray
(
this
.
list
.
length
,
false
);
},
2000
),
bindPickerChange
:
function
(
e
)
{
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
detail
.
value
);
this
.
index
=
e
.
detail
.
value
;
},
/**
* 识别二维码的数量和型号
*/
identifyQrCodeNumAndSn
(
code_str
,
code_type
)
{
console
.
log
(
code_str
);
this
.
request
(
API
.
identifyQrCodeNumAndSn
,
'POST'
,
{
code_str
:
code_str
,
code_type
:
code_type
},
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
searchParams
.
goods_name
=
res
.
data
.
sn
;
this
.
getData
();
}
else
{
this
.
hasMoreData
=
false
;
uni
.
showToast
({
title
:
'识别错误'
,
icon
:
'error'
});
}
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
getTallyContainerDefault
()
{
this
.
request
(
API
.
getTallyContainer
,
'GET'
,
{},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
checked_id
=
res
.
data
.
checked_id
;
let
list
=
res
.
data
.
list
;
let
filter_arr
=
list
.
filter
(
function
(
item
)
{
if
(
item
.
id
==
checked_id
)
{
return
item
;
});
},
/**
* 获取列表数据
*/
getData
()
{
this
.
request
(
API
.
waitTallyReceiveList
,
'POST'
,
{
page
:
this
.
page
,
limit
:
this
.
limit
,
...
this
.
searchParams
},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
total
>
0
)
{
this
.
hasMoreData
=
true
;
this
.
list
=
this
.
list
.
concat
(
res
.
data
.
list
);
this
.
filter_list
=
createArray
(
this
.
list
.
length
,
false
);
}
else
{
this
.
hasMoreData
=
false
;
}
}
);
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
;
}
else
{
uni
.
showToast
(
{
title
:
res
.
msg
,
icon
:
'error'
})
;
}
}
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
};
});
},
getTallyContainerDefault
()
{
this
.
request
(
API
.
getTallyContainer
,
'GET'
,
{},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
checked_id
=
res
.
data
.
checked_id
;
let
list
=
res
.
data
.
list
;
let
filter_arr
=
list
.
filter
(
function
(
item
)
{
if
(
item
.
id
==
checked_id
)
{
return
item
;
}
});
this
.
searchParams
.
container_id
=
id
[
0
].
id
;
this
.
formParams
.
container_id
=
id
[
0
].
id
;
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
;
}
}
else
{
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
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
=
id
[
0
].
id
;
this
.
formParams
.
container_id
=
id
[
0
].
id
;
}
else
{
this
.
searchParams
.
container_id
=
''
;
this
.
formParams
.
container_id
=
''
;
}
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
/**
* 一键理货提交
*/
createTallyReceiveSubmit
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
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
:
'none'
});
return
false
;
}
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
icon
:
'error'
});
}
});
},
/**
* 一键理货提交
*/
createTallyReceiveSubmit
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
if
(
this
.
company_id
==
1
)
{
if
(
this
.
searchParams
.
container_id
)
{
if
(
!
this
.
is_submit
)
{
uni
.
showToast
({
title
:
'请输入正确容器'
,
...
...
@@ -581,209 +600,193 @@ export default {
return
false
;
}
}
}
else
if
(
this
.
company_id
==
2
)
{
if
(
!
this
.
searchParams
.
container_id
)
{
uni
.
showToast
({
title
:
'请输入容器'
,
icon
:
'none'
});
return
false
;
}
if
(
!
this
.
is_submit
)
{
uni
.
showToast
({
title
:
'请输入正确容器'
,
icon
:
'none'
});
return
false
;
}
}
//当前登录组织为深贸电子才必填
if
(
this
.
company_id
==
2
)
{
if
(
this
.
formParams
.
image_ids
.
length
<=
0
)
{
uni
.
showToast
({
title
:
'请至少上传一张理货图片'
,
icon
:
'none'
});
return
false
;
//当前登录组织为深贸电子才必填
if
(
this
.
company_id
==
2
)
{
if
(
this
.
formParams
.
image_ids
.
length
<=
0
)
{
uni
.
showToast
({
title
:
'请至少上传一张理货图片'
,
icon
:
'none'
});
return
false
;
}
}
}
var
params
=
Object
.
assign
(
this
.
formParams
,
{
stock_in_item_id
:
this
.
filter_id
.
join
(
','
)
});
var
params
=
Object
.
assign
(
this
.
formParams
,
{
stock_in_item_id
:
this
.
filter_id
.
join
(
','
)
});
this
.
request
(
API
.
createTallyReceive
,
'POST'
,
params
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
uni
.
showToast
({
title
:
'一键理货成功'
,
icon
:
'success'
});
setTimeout
(()
=>
{
this
.
resetChange
();
this
.
getData
();
this
.
closeDrawer
();
},
2000
);
}
else
{
uni
.
showModal
({
itle
:
'提示'
,
content
:
res
.
msg
,
showCancel
:
false
});
}
});
},
showDrawer
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
if
(
this
.
company_id
==
1
)
{
if
(
this
.
searchParams
.
container_id
)
{
this
.
request
(
API
.
createTallyReceive
,
'POST'
,
params
,
true
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
uni
.
showToast
({
title
:
'一键理货成功'
,
icon
:
'success'
});
setTimeout
(()
=>
{
this
.
resetChange
();
this
.
getData
();
this
.
closeDrawer
();
},
2000
);
}
else
{
uni
.
showModal
({
itle
:
'提示'
,
content
:
res
.
msg
,
showCancel
:
false
});
}
});
},
showDrawer
()
{
//仅单据的组织为深贸电子时,容器必填,相应操作容器必填
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
)
{
if
(
this
.
filter_id
.
length
==
0
)
{
uni
.
showToast
({
title
:
'请
输入正确容器
'
,
title
:
'请
选择货品
'
,
icon
:
'error'
});
return
false
;
}
}
if
(
this
.
filter_id
.
length
==
0
)
{
uni
.
showToast
({
title
:
'请选择货品'
,
icon
:
'error'
});
return
false
;
}
this
.
image_list
=
[];
this
.
formParams
.
image_ids
=
[];
//每次打开先清空
this
.
formParams
.
tally_remark
=
''
;
//每次打开先清空
this
.
$refs
.
showRight
.
open
();
},
closeDrawer
()
{
this
.
$refs
.
showRight
.
close
();
},
/**
* 选择图片
*/
chooseImageChange
()
{
this
.
noexebshowFalg
=
false
;
// 使用 chooseImage选择图片
uni
.
chooseImage
({
count
:
this
.
maxNum
,
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
console
.
log
(
'选择图片成功:'
,
chooseImageRes
);
this
.
image_list
=
[];
this
.
formParams
.
image_ids
=
[];
//每次打开先清空
this
.
formParams
.
tally_remark
=
''
;
//每次打开先清空
this
.
$refs
.
showRight
.
open
();
},
closeDrawer
()
{
this
.
$refs
.
showRight
.
close
();
},
/**
* 选择图片
*/
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
:
'上传中...'
});
// 显示loading
uni
.
showLoading
({
title
:
'上传中...'
});
// 获取选择的图片路径数组
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
// 获取选择的图片路径数组
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
;
}
// 判断选择的图片数量是否超过最大限制数量
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
;
uni
.
previewImage
({
current
:
index
,
urls
:
img
}
);
},
/**
* 重置
*/
resetChange
()
{
this
.
list
=
[]
;
this
.
page
=
1
;
}
}
);
}
,
/**
* 删除图片
* @param {Object} index
*/
deletePic
(
index
)
{
this
.
image_list
.
splice
(
index
,
1
);
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
}
,
/**
* 重置
*/
resetChange
()
{
this
.
list
=
[];
this
.
page
=
1
;
}
}
}
};
};
</
script
>
<
style
scoped
lang=
"scss"
>
@import
'@/assets/css/tallyReceive/index.scss'
;
</
style
>
@import
'@/assets/css/tallyReceive/index.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