Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
wmsMin
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
336bf677
authored
Nov 06, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bug
parent
b403e98d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
630 additions
and
628 deletions
pages/goods/addReceiving.vue
pages/tallyGoods/confirm.vue
util/api.js
pages/goods/addReceiving.vue
View file @
336bf677
...
...
@@ -81,261 +81,260 @@
</template>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
{
titleCase
}
from
'@/util/util.js'
;
import
w_md5
from
'../../js_sdk/zww-md5/w_md5.js'
;
import
{
API
}
from
'@/util/api.js'
;
import
{
titleCase
}
from
'@/util/util.js'
;
import
w_md5
from
'../../js_sdk/zww-md5/w_md5.js'
;
export
default
{
data
()
{
return
{
noexebshowFalg
:
true
,
//控制是否会触发生命周期
array
:
[
'FedEx'
,
'DHL'
,
'UPS'
,
'顺丰'
,
'Air'
],
textArr
:
[
'物流'
,
'送货'
,
'上门取货'
],
unitArr
:
[
'件'
,
'箱'
],
index
:
-
1
,
flag
:
false
,
text
:
'展开'
,
currentIndex
:
0
,
unitIndex
:
0
,
limitword
:
0
,
id
:
''
,
form
:
{
delivery_method
:
1
,
//来货方式1物流2送货3上门取货
logistics_company
:
''
,
//物流公司
logistics_number
:
''
,
//物流单号
total_num
:
''
,
//登记数量
unit
:
'件'
,
//单位
check_in_pic
:
[],
//收货图片
check_in_remark
:
''
,
//收货备注
checkIn
:
''
,
erp_order_sn
:
''
//入仓号
}
};
},
onLoad
(
options
)
{
this
.
id
=
options
.
number
;
},
methods
:
{
getData
()
{
this
.
request
(
API
.
getCheckInList
,
'POST'
,
{
number
:
this
.
id
},
this
.
loading
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
form
.
checkIn
=
res
.
data
[
0
];
}
else
{
uni
.
showToast
({
title
:
res
.
err_msg
,
icon
:
'error'
});
export
default
{
data
()
{
return
{
noexebshowFalg
:
true
,
//控制是否会触发生命周期
array
:
[
'FedEx'
,
'DHL'
,
'UPS'
,
'顺丰'
,
'Air'
],
textArr
:
[
'物流'
,
'送货'
,
'上门取货'
],
unitArr
:
[
'件'
,
'箱'
],
index
:
-
1
,
flag
:
false
,
text
:
'展开'
,
currentIndex
:
0
,
unitIndex
:
0
,
limitword
:
0
,
id
:
''
,
form
:
{
delivery_method
:
1
,
//来货方式1物流2送货3上门取货
logistics_company
:
''
,
//物流公司
logistics_number
:
''
,
//物流单号
total_num
:
''
,
//登记数量
unit
:
'件'
,
//单位
check_in_pic
:
[],
//收货图片
check_in_remark
:
''
,
//收货备注
checkIn
:
''
,
erp_order_sn
:
''
//入仓号
}
}
)
;
};
},
scanChangeErp
()
{
this
.
form
.
erp_order_sn
=
''
;
uni
.
scanCode
({
success
:
res
=>
{
console
.
log
(
res
);
if
(
res
.
errMsg
==
'scanCode:ok'
)
{
this
.
form
.
erp_order_sn
=
res
.
result
;
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
);
uni
.
showToast
({
title
:
'扫码失败'
,
icon
:
'error'
});
}
});
onLoad
(
options
)
{
this
.
id
=
options
.
number
;
},
scanChange
()
{
this
.
form
.
logistics_number
=
''
;
uni
.
scanCode
({
success
:
res
=>
{
console
.
log
(
res
);
if
(
res
.
errMsg
==
'scanCode:ok'
)
{
this
.
form
.
logistics_number
=
res
.
result
;
methods
:
{
getData
()
{
this
.
request
(
API
.
getCheckInList
,
'POST'
,
{
number
:
this
.
id
},
this
.
loading
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
form
.
checkIn
=
res
.
data
[
0
];
}
else
{
uni
.
showToast
({
title
:
res
.
err_msg
,
icon
:
'error'
});
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
);
uni
.
showToast
({
title
:
'扫码失败'
,
icon
:
'error'
});
}
});
},
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
},
deletePic
(
index
)
{
this
.
form
.
check_in_pic
.
splice
(
index
,
1
);
},
chooseImageChange
()
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
var
self
=
this
;
var
time
=
parseInt
(
new
Date
().
getTime
()
/
1000
);
uni
.
chooseImage
({
count
:
4
,
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
uni
.
showLoading
({
title
:
'上传中...'
});
const
tempFilePaths
=
chooseImageRes
.
tempFilePaths
;
let
maxNum
=
tempFilePaths
.
length
*
1
+
self
.
form
.
check_in_pic
.
length
*
1
;
if
(
maxNum
>
4
)
{
uni
.
hideLoading
();
});
},
scanChangeErp
()
{
this
.
form
.
erp_order_sn
=
''
;
uni
.
scanCode
({
success
:
res
=>
{
console
.
log
(
res
);
if
(
res
.
errMsg
==
'scanCode:ok'
)
{
this
.
form
.
erp_order_sn
=
res
.
result
;
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
);
uni
.
showToast
({
title
:
'图片不超过4张'
title
:
'扫码失败'
,
icon
:
'error'
});
return
false
;
}
for
(
let
i
=
0
;
i
<
tempFilePaths
.
length
;
i
++
)
{
console
.
log
(
tempFilePaths
[
i
]);
uni
.
uploadFile
({
url
:
API
.
upload
,
filePath
:
tempFilePaths
[
i
],
name
:
'upload'
,
formData
:
{
source
:
'1'
,
k1
:
time
,
k2
:
w_md5
.
hex_md5_32
(
w_md5
.
hex_md5_32
(
String
(
time
))
+
'fh6y5t4rr351d2c3bryi'
)
},
success
:
uploadFileRes
=>
{
uni
.
hideLoading
();
var
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
console
.
log
(
data
);
if
(
data
.
code
===
200
)
{
self
.
form
.
check_in_pic
.
push
(
data
.
data
[
0
]);
}
else
{
uni
.
showToast
({
title
:
data
.
message
,
icon
:
'error'
});
}
},
fail
:
error
=>
{
uni
.
hideLoading
();
console
.
log
(
error
);
}
});
},
scanChange
()
{
this
.
form
.
logistics_number
=
''
;
uni
.
scanCode
({
success
:
res
=>
{
console
.
log
(
res
);
if
(
res
.
errMsg
==
'scanCode:ok'
)
{
this
.
form
.
logistics_number
=
res
.
result
;
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
);
uni
.
showToast
({
title
:
'扫码失败'
,
icon
:
'error'
});
}
}
});
},
inputChange
()
{
if
(
this
.
form
.
check_in_remark
.
length
<=
200
)
{
this
.
limitword
=
this
.
form
.
check_in_remark
.
length
;
}
},
changeTab
(
index
,
type
)
{
if
(
type
==
1
)
{
this
.
currentIndex
=
index
;
this
.
form
.
delivery_method
=
index
+
1
;
}
else
if
(
type
==
2
)
{
this
.
unitIndex
=
index
;
if
(
index
==
0
)
{
this
.
form
.
unit
=
'件'
;
}
else
if
(
index
==
1
)
{
this
.
form
.
unit
=
'箱'
;
}
}
},
toggle
()
{
this
.
flag
=
!
this
.
flag
;
},
bindPickerChange
:
function
(
e
)
{
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
target
.
value
);
this
.
index
=
e
.
target
.
value
;
this
.
form
.
logistics_company
=
this
.
array
[
e
.
target
.
value
];
},
submit
()
{
if
(
!
this
.
form
.
erp_order_sn
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请输入入仓号'
,
showCancel
:
false
});
return
false
;
}
if
(
!
this
.
form
.
total_num
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请输入登记数量'
,
showCancel
:
false
},
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
return
false
;
}
if
(
this
.
currentIndex
==
0
)
{
if
(
!
this
.
form
.
logistics_company
)
{
},
deletePic
(
index
)
{
this
.
form
.
check_in_pic
.
splice
(
index
,
1
);
},
chooseImageChange
()
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
var
self
=
this
;
var
time
=
parseInt
(
new
Date
().
getTime
()
/
1000
);
uni
.
chooseImage
({
count
:
4
,
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
uni
.
showLoading
({
title
:
'上传中...'
});
const
tempFilePaths
=
chooseImageRes
.
tempFilePaths
;
let
maxNum
=
tempFilePaths
.
length
*
1
+
self
.
form
.
check_in_pic
.
length
*
1
;
if
(
maxNum
>
4
)
{
uni
.
hideLoading
();
uni
.
showToast
({
title
:
'图片不超过4张'
});
return
false
;
}
for
(
let
i
=
0
;
i
<
tempFilePaths
.
length
;
i
++
)
{
console
.
log
(
tempFilePaths
[
i
]);
uni
.
uploadFile
({
url
:
API
.
upload
,
filePath
:
tempFilePaths
[
i
],
name
:
'upload'
,
formData
:
{
source
:
'1'
,
k1
:
time
,
k2
:
w_md5
.
hex_md5_32
(
w_md5
.
hex_md5_32
(
String
(
time
))
+
'fh6y5t4rr351d2c3bryi'
)
},
success
:
uploadFileRes
=>
{
uni
.
hideLoading
();
var
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
console
.
log
(
data
);
if
(
data
.
code
===
200
)
{
self
.
form
.
check_in_pic
.
push
(
data
.
data
[
0
]);
}
else
{
uni
.
showToast
({
title
:
data
.
message
,
icon
:
'error'
});
}
},
fail
:
error
=>
{
uni
.
hideLoading
();
console
.
log
(
error
);
}
});
}
}
});
},
inputChange
()
{
if
(
this
.
form
.
check_in_remark
.
length
<=
200
)
{
this
.
limitword
=
this
.
form
.
check_in_remark
.
length
;
}
},
changeTab
(
index
,
type
)
{
if
(
type
==
1
)
{
this
.
currentIndex
=
index
;
this
.
form
.
delivery_method
=
index
+
1
;
}
else
if
(
type
==
2
)
{
this
.
unitIndex
=
index
;
if
(
index
==
0
)
{
this
.
form
.
unit
=
'件'
;
}
else
if
(
index
==
1
)
{
this
.
form
.
unit
=
'箱'
;
}
}
},
toggle
()
{
this
.
flag
=
!
this
.
flag
;
},
bindPickerChange
:
function
(
e
)
{
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
target
.
value
);
this
.
index
=
e
.
target
.
value
;
this
.
form
.
logistics_company
=
this
.
array
[
e
.
target
.
value
];
},
submit
()
{
if
(
!
this
.
form
.
erp_order_sn
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请
选择物流公司
'
,
content
:
'请
输入入仓号
'
,
showCancel
:
false
});
return
false
;
}
if
(
!
this
.
form
.
logistics_number
)
{
if
(
!
this
.
form
.
total_num
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请输入
物流单号
'
,
content
:
'请输入
登记数量
'
,
showCancel
:
false
});
return
false
;
}
}
this
.
form
.
erp_order_sn
=
titleCase
(
this
.
form
.
erp_order_sn
);
//自动转成大写
if
(
this
.
currentIndex
==
0
)
{
if
(
!
this
.
form
.
logistics_company
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请选择物流公司'
,
showCancel
:
false
});
return
false
;
}
//如果选择的fedex就截取后12位
if
(
this
.
index
==
0
)
{
let
str
=
this
.
form
.
logistics_number
;
this
.
form
.
logistics_number
=
str
.
substring
(
str
.
length
-
12
);
}
if
(
!
this
.
form
.
logistics_number
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请输入物流单号'
,
showCancel
:
false
});
return
false
;
}
}
this
.
request
(
API
.
addCheckIn
,
'POST'
,
this
.
form
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
setTimeout
(()
=>
{
uni
.
navigateBack
({
delta
:
1
});
},
2000
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
this
.
form
.
erp_order_sn
=
titleCase
(
this
.
form
.
erp_order_sn
);
//自动转成大写
//如果选择的fedex就截取后12位
if
(
this
.
index
==
0
)
{
let
str
=
this
.
form
.
logistics_number
;
this
.
form
.
logistics_number
=
str
.
substring
(
str
.
length
-
12
);
}
this
.
request
(
API
.
addCheckIn
,
'POST'
,
this
.
form
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
setTimeout
(()
=>
{
uni
.
navigateBack
({
delta
:
1
});
},
2000
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
}
});
}
else
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
});
}
else
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
}
}
);
}
}
);
}
);
}
}
);
}
}
}
};
};
</
script
>
<
style
scoped
lang=
"scss"
>
@import
'../../assets/css/goods/addReceiving.scss'
;
</
style
>
@import
'../../assets/css/goods/addReceiving.scss'
;
</
style
>
\ No newline at end of file
pages/tallyGoods/confirm.vue
View file @
336bf677
...
...
@@ -94,7 +94,9 @@
<text
class=
"tt-l"
>
采购单上传(选填)
</text>
<text
class=
"tt-r"
v-if=
"switchFlag"
>
{{ image_list.length }}/4
</text>
</view>
<view
class=
"switch"
><switch
@
change=
"switchChange"
color=
"#197adb"
style=
"transform:scale(0.7)"
/></view>
<view
class=
"switch"
>
<switch
@
change=
"switchChange"
color=
"#197adb"
style=
"transform:scale(0.7)"
/>
</view>
</view>
<view
class=
"upload-list row verCenter"
v-if=
"switchFlag"
>
<
template
v-if=
"image_list.length > 0"
>
...
...
@@ -112,445 +114,444 @@
</template>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
import
{
titleCase
}
from
'@/util/util.js'
;
import
{
API
}
from
'@/util/api.js'
;
import
{
titleCase
}
from
'@/util/util.js'
;
export
default
{
data
()
{
return
{
isInspOrg
:
false
,
//是否商检
noexebshowFalg
:
true
,
//控制是否会触发生命周期
customs_clearance_price_options
:
[
'无'
,
'有'
],
//清关费选项
currentIndex
:
-
1
,
image_list
:
[],
//图片列表
goods_check_pic_list
:
[],
//商检图片列表
goods_check_pic_list_id
:
[],
//商检图片列表ID标识
list
:
[],
//商检型号列表
maxNum
:
4
,
//最大上传图片数量
disabled
:
false
,
switchFlag
:
false
,
form
:
{
erp_order_sn
:
''
,
//入仓号
customs_clearance_price
:
0
,
//清关费
box_num
:
''
,
//箱子
board_num
:
''
,
//板子
gross_weight
:
''
,
//合计毛重
pic_json
:
[],
//商检图片
detail_json
:
[],
//产地拆分数据
fix_erp_order_sn
:
''
,
//手动合箱
pur_pic
:
''
//采购单上传
}
};
},
watch
:
{
image_list
(
arr
)
{
if
(
arr
.
length
>
0
)
{
this
.
form
.
pur_pic
=
arr
.
join
(
','
);
}
else
{
this
.
form
.
pur_pic
=
''
;
}
}
},
onLoad
()
{
uni
.
removeStorageSync
(
'paramsOrigin'
);
},
onShow
()
{
//更新合箱数据
uni
.
$on
(
'updateData'
,
data
=>
{
if
(
data
.
length
>
0
)
{
this
.
form
.
fix_erp_order_sn
=
data
.
join
(
','
);
}
else
{
this
.
form
.
fix_erp_order_sn
=
''
;
}
});
//更新产地拆分国家的数据
uni
.
$on
(
'updateOriginData'
,
data
=>
{
if
(
data
)
{
this
.
form
.
detail_json
=
data
.
detail_json
;
uni
.
removeStorageSync
(
'paramsOrigin'
);
uni
.
setStorageSync
(
'paramsOrigin'
,
data
);
}
});
},
methods
:
{
/**
* 扫描二维码
*/
scanChange
()
{
uni
.
scanCode
({
success
:
res
=>
{
console
.
log
(
res
);
if
(
res
.
errMsg
==
'scanCode:ok'
)
{
this
.
form
.
erp_order_sn
=
res
.
result
;
this
.
checkErpOrderSnIsTally
();
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
);
uni
.
showToast
({
title
:
'扫码失败,请重试'
,
icon
:
'none'
});
export
default
{
data
()
{
return
{
isInspOrg
:
false
,
//是否商检
noexebshowFalg
:
true
,
//控制是否会触发生命周期
customs_clearance_price_options
:
[
'无'
,
'有'
],
//清关费选项
currentIndex
:
-
1
,
image_list
:
[],
//图片列表
goods_check_pic_list
:
[],
//商检图片列表
goods_check_pic_list_id
:
[],
//商检图片列表ID标识
list
:
[],
//商检型号列表
maxNum
:
4
,
//最大上传图片数量
disabled
:
false
,
switchFlag
:
false
,
form
:
{
erp_order_sn
:
''
,
//入仓号
customs_clearance_price
:
0
,
//清关费
box_num
:
''
,
//箱子
board_num
:
''
,
//板子
gross_weight
:
''
,
//合计毛重
pic_json
:
[],
//商检图片
detail_json
:
[],
//产地拆分数据
fix_erp_order_sn
:
''
,
//手动合箱
pur_pic
:
''
//采购单上传
}
}
)
;
};
},
switchChange
:
function
(
e
)
{
this
.
switchFlag
=
e
.
detail
.
value
;
console
.
log
(
'switch1 发生 change 事件,携带值为'
,
e
.
detail
.
value
);
watch
:
{
image_list
(
arr
)
{
if
(
arr
.
length
>
0
)
{
this
.
form
.
pur_pic
=
arr
.
join
(
','
);
}
else
{
this
.
form
.
pur_pic
=
''
;
}
}
},
onInput
()
{
// 清除之前的定时器
clearTimeout
(
this
.
timer
);
this
.
timer
=
setTimeout
(()
=>
{
this
.
checkErpOrderSnIsTally
();
},
800
);
onLoad
()
{
uni
.
removeStorageSync
(
'paramsOrigin'
);
},
/**
* 检测入仓号是否理货
*/
checkErpOrderSnIsTally
()
{
this
.
request
(
API
.
checkErpOrderSnIsTally
,
'GET'
,
{
erp_order_sn
:
this
.
form
.
erp_order_sn
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
getTallyGoods
();
this
.
disabled
=
false
;
onShow
()
{
//更新合箱数据
uni
.
$on
(
'updateData'
,
data
=>
{
if
(
data
.
length
>
0
)
{
this
.
form
.
fix_erp_order_sn
=
data
.
join
(
','
);
}
else
{
this
.
disabled
=
true
;
uni
.
showModal
({
content
:
res
.
err_msg
,
showCancel
:
false
});
this
.
form
.
fix_erp_order_sn
=
''
;
}
});
},
/**
* 获取入仓号的理货数据
*/
getTallyGoods
()
{
this
.
request
(
API
.
getTallyGoods
,
'GET'
,
{
erp_order_sn
:
this
.
form
.
erp_order_sn
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
disabled
=
false
;
this
.
isInspOrg
=
Boolean
(
res
.
data
.
isInspOrg
);
//是否商检
this
.
list
=
res
.
data
.
entrys
.
filter
(
function
(
entry
)
{
return
entry
.
isEntryInspOrg
===
true
;
});
this
.
goods_check_pic_list_id
=
this
.
list
.
map
(
function
(
entry
)
{
return
entry
.
ptEntryID
;
});
const
length
=
this
.
list
.
length
;
this
.
goods_check_pic_list
=
Array
.
from
({
length
},
()
=>
[]);
this
.
form
.
pic_json
=
this
.
list
.
map
(
item
=>
({
entryID
:
item
.
entryID
,
goods_check_pic
:
''
}));
}
else
{
this
.
disabled
=
true
;
this
.
list
=
[];
uni
.
showToast
({
title
:
res
.
err_msg
,
icon
:
'none'
});
//更新产地拆分国家的数据
uni
.
$on
(
'updateOriginData'
,
data
=>
{
if
(
data
)
{
this
.
form
.
detail_json
=
data
.
detail_json
;
uni
.
removeStorageSync
(
'paramsOrigin'
);
uni
.
setStorageSync
(
'paramsOrigin'
,
data
);
}
});
},
/**
* @param {Object} index
* 清空对应的商检图片
*/
clearFn
(
index
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'您确定清空嘛?'
,
showCancel
:
true
,
cancelText
:
'取消'
,
confirmText
:
'确定'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
// 用户点击了确定按钮,执行相关操作
this
.
goods_check_pic_list
[
index
]
=
[]
;
this
.
form
.
pic_json
[
index
].
goods_check_pic
=
''
;
this
.
$forceUpdate
();
}
else
if
(
res
.
cancel
)
{
// 用户点击了取消按钮,取消操作
methods
:
{
/**
* 扫描二维码
*/
scanChange
(
)
{
uni
.
scanCode
({
success
:
res
=>
{
console
.
log
(
res
);
if
(
res
.
errMsg
==
'scanCode:ok'
)
{
this
.
form
.
erp_order_sn
=
res
.
result
;
this
.
checkErpOrderSnIsTally
();
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
)
;
uni
.
showToast
({
title
:
'扫码失败,请重试'
,
icon
:
'none'
});
}
}
});
},
/**
*商检图片上传
*/
uploadBusinessChange
(
index
)
{
// 使用 chooseImage选择图片
uni
.
chooseImage
({
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
console
.
log
(
'选择图片成功:'
,
chooseImageRes
);
// 显示loading
uni
.
showLoading
({
title
:
'上传中...'
});
// 获取选择的图片路径数组
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
});
},
switchChange
:
function
(
e
)
{
this
.
switchFlag
=
e
.
detail
.
value
;
console
.
log
(
'switch1 发生 change 事件,携带值为'
,
e
.
detail
.
value
);
},
onInput
()
{
// 清除之前的定时器
clearTimeout
(
this
.
timer
);
this
.
timer
=
setTimeout
(()
=>
{
this
.
checkErpOrderSnIsTally
();
},
800
);
},
/**
* 检测入仓号是否理货
*/
checkErpOrderSnIsTally
()
{
this
.
request
(
API
.
checkErpOrderSnIsTally
,
'GET'
,
{
erp_order_sn
:
this
.
form
.
erp_order_sn
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
getTallyGoods
();
this
.
disabled
=
false
;
}
else
{
this
.
disabled
=
true
;
uni
.
showModal
({
content
:
res
.
err_msg
,
showCancel
:
false
});
}
});
},
/**
* 获取入仓号的理货数据
*/
getTallyGoods
()
{
this
.
request
(
API
.
getTallyGoods
,
'GET'
,
{
erp_order_sn
:
this
.
form
.
erp_order_sn
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
disabled
=
false
;
this
.
isInspOrg
=
Boolean
(
res
.
data
.
isInspOrg
);
//是否商检
// 遍历图片路径数组,对每张图片进行压缩
imagePaths
.
forEach
(
imagePath
=>
{
// 使用compressImage 压缩图片
uni
.
compressImage
({
src
:
imagePath
,
quality
:
50
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success
:
compressedRes
=>
{
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
// 获取压缩后的图片路径
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
this
.
list
=
res
.
data
.
entrys
.
filter
(
function
(
entry
)
{
return
entry
.
isEntryInspOrg
===
true
;
});
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
url
:
API
.
uploadImage
+
'?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
.
goods_check_pic_list
[
index
].
push
(
data
.
data
.
oss_image_url
);
this
.
form
.
pic_json
[
index
].
goods_check_pic
=
this
.
goods_check_pic_list
[
index
].
join
(
','
);
this
.
$forceUpdate
();
}
else
{
uni
.
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
}
},
fail
:
error
=>
{
console
.
log
(
'上传图片失败:'
,
error
);
uni
.
hideLoading
();
}
});
},
fail
:
err
=>
{
console
.
log
(
'压缩图片失败:'
,
err
);
}
this
.
goods_check_pic_list_id
=
this
.
list
.
map
(
function
(
entry
)
{
return
entry
.
ptEntryID
;
});
});
}
});
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
},
/**
* 删除图片
* @param {Object} index
*/
deletePic
(
index
)
{
this
.
image_list
.
splice
(
index
,
1
);
},
/**
* 选择图片
*/
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
length
=
this
.
list
.
length
;
// 获取选择的图片路径数组
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
this
.
goods_check_pic_list
=
Array
.
from
({
length
},
()
=>
[]);
// 判断选择的图片数量是否超过最大限制数量
let
maxNum
=
Number
(
imagePaths
.
length
)
+
Number
(
this
.
image_list
.
length
);
//当前上传的+已经上传的
if
(
maxNum
>
this
.
maxNum
)
{
uni
.
hideLoading
();
this
.
form
.
pic_json
=
this
.
list
.
map
(
item
=>
({
entryID
:
item
.
entryID
,
goods_check_pic
:
''
}));
}
else
{
this
.
disabled
=
true
;
this
.
list
=
[];
uni
.
showToast
({
title
:
'图片不超过'
+
this
.
maxNum
+
'张'
,
title
:
res
.
err_msg
,
icon
:
'none'
});
return
false
;
}
});
},
/**
* @param {Object} index
* 清空对应的商检图片
*/
clearFn
(
index
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'您确定清空嘛?'
,
showCancel
:
true
,
cancelText
:
'取消'
,
confirmText
:
'确定'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
// 用户点击了确定按钮,执行相关操作
this
.
goods_check_pic_list
[
index
]
=
[];
this
.
form
.
pic_json
[
index
].
goods_check_pic
=
''
;
this
.
$forceUpdate
();
}
else
if
(
res
.
cancel
)
{
// 用户点击了取消按钮,取消操作
}
}
});
},
/**
*商检图片上传
*/
uploadBusinessChange
(
index
)
{
// 使用 chooseImage选择图片
uni
.
chooseImage
({
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
console
.
log
(
'选择图片成功:'
,
chooseImageRes
);
// 显示loading
uni
.
showLoading
({
title
:
'上传中...'
});
// 遍历图片路径数组,对每张图片进行压缩
imagePaths
.
forEach
(
imagePath
=>
{
// 使用compressImage 压缩图片
uni
.
compressImage
({
src
:
imagePath
,
quality
:
50
,
//压缩质量,范围0~100,数值越小,质量越低,压缩率越高
success
:
compressedRes
=>
{
console
.
log
(
'压缩图片成功:'
,
compressedRes
);
// 获取压缩后的图片路径
const
compressedImagePath
=
compressedRes
.
tempFilePath
;
// 获取选择的图片路径数组
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
url
:
API
.
uploadImage
+
'?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'
});
// 遍历图片路径数组,对每张图片进行压缩
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
.
uploadImage
+
'?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
.
goods_check_pic_list
[
index
].
push
(
data
.
data
.
oss_image_url
);
this
.
form
.
pic_json
[
index
].
goods_check_pic
=
this
.
goods_check_pic_list
[
index
].
join
(
','
);
this
.
$forceUpdate
();
}
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
*/
tabChnage
(
index
)
{
this
.
currentIndex
=
index
;
this
.
form
.
customs_clearance_price
=
index
;
},
/**
* 提交
*/
submit
()
{
if
(
!
this
.
form
.
erp_order_sn
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
'请输入入仓号'
,
showCancel
:
false
});
return
false
;
}
if
(
this
.
disabled
)
{
uni
.
showModal
({
content
:
'请检查该入仓号是否正确'
,
showCancel
:
false
});
return
false
;
}
if
(
this
.
currentIndex
==
-
1
)
{
uni
.
showModal
({
content
:
'请选择清关费选项'
,
showCancel
:
false
});
return
false
;
}
if
(
!
this
.
form
.
box_num
)
{
uni
.
showModal
({
content
:
'请填写箱子数'
,
showCancel
:
false
});
return
false
;
}
if
(
!
this
.
form
.
board_num
)
{
uni
.
showModal
({
content
:
'请填写板子数'
,
showCancel
:
false
}
});
return
false
;
}
if
(
!
this
.
form
.
gross_weight
)
{
uni
.
showModal
({
content
:
'请填写箱毛重'
,
showCancel
:
false
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange
(
img
,
index
)
{
this
.
noexebshowFalg
=
false
;
//不允许再次触发onshow这个生命周期
uni
.
previewImage
({
current
:
index
,
urls
:
img
});
return
false
;
}
},
/**
* 删除图片
* @param {Object} index
*/
deletePic
(
index
)
{
this
.
image_list
.
splice
(
index
,
1
);
},
/**
* 选择图片
*/
chooseImageChange
()
{
this
.
noexebshowFalg
=
false
;
// 使用 chooseImage选择图片
uni
.
chooseImage
({
count
:
this
.
maxNum
,
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
chooseImageRes
=>
{
console
.
log
(
'选择图片成功:'
,
chooseImageRes
);
//商检图片必填
if
(
this
.
isInspOrg
)
{
// 使用every方法检查每个子数组是否满足条件
var
isValid
=
this
.
goods_check_pic_list
.
every
(
subArray
=>
subArray
.
length
>=
2
);
if
(
!
isValid
)
{
// 显示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
;
// 在这里处理压缩后的图片,上传到服务器
uni
.
uploadFile
({
url
:
API
.
uploadImage
+
'?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
:
err
=>
{
console
.
log
(
'压缩图片失败:'
,
err
);
}
});
});
}
});
},
/**
* 清关费选择
* @param {Object} index
*/
tabChnage
(
index
)
{
this
.
currentIndex
=
index
;
this
.
form
.
customs_clearance_price
=
index
;
},
/**
* 提交
*/
submit
()
{
if
(
!
this
.
form
.
erp_order_sn
)
{
uni
.
showModal
({
content
:
'商检图片上传须大于2张'
,
title
:
'提示'
,
content
:
'请输入入仓号'
,
showCancel
:
false
});
return
false
;
}
}
this
.
request
(
API
.
submitTallyGoods
,
'POST'
,
this
.
form
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
if
(
this
.
disabled
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
setTimeout
(()
=>
{
uni
.
navigateBack
({
delta
:
1
});
},
2000
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
content
:
'请检查该入仓号是否正确'
,
showCancel
:
false
});
}
else
{
return
false
;
}
if
(
this
.
currentIndex
==
-
1
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
content
:
'请选择清关费选项'
,
showCancel
:
false
});
return
false
;
}
});
if
(
!
this
.
form
.
box_num
)
{
uni
.
showModal
({
content
:
'请填写箱子数'
,
showCancel
:
false
});
return
false
;
}
if
(
!
this
.
form
.
board_num
)
{
uni
.
showModal
({
content
:
'请填写板子数'
,
showCancel
:
false
});
return
false
;
}
if
(
!
this
.
form
.
gross_weight
)
{
uni
.
showModal
({
content
:
'请填写箱毛重'
,
showCancel
:
false
});
return
false
;
}
//商检图片必填
if
(
this
.
isInspOrg
)
{
// 使用every方法检查每个子数组是否满足条件
var
isValid
=
this
.
goods_check_pic_list
.
every
(
subArray
=>
subArray
.
length
>=
2
);
if
(
!
isValid
)
{
uni
.
showModal
({
content
:
'商检图片上传须大于2张'
,
showCancel
:
false
});
return
false
;
}
}
this
.
request
(
API
.
submitTallyGoods
,
'POST'
,
this
.
form
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
setTimeout
(()
=>
{
uni
.
navigateBack
({
delta
:
1
});
},
2000
);
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
}
else
{
uni
.
showModal
({
title
:
'提示'
,
content
:
res
.
err_msg
,
showCancel
:
false
,
success
:
res
=>
{
if
(
res
.
confirm
)
{}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
}
});
}
}
}
};
};
</
script
>
<
style
scoped
lang=
"scss"
>
@import
'../../assets/css/tallyGoods/confirm.scss'
;
</
style
>
@import
'../../assets/css/tallyGoods/confirm.scss'
;
</
style
>
\ No newline at end of file
util/api.js
View file @
336bf677
const
API_BASE
=
'https://api.ichunt.com'
;
const
API_BASE_OSS
=
'https://image.ichunt.net'
;
//oss系统
//
const API_BASE = 'https://api.ichunt.com';
//
const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
//
const API_BASE = 'http://api.liexin.com';
//
const API_BASE_OSS = 'http://image.liexindev.net';
const
API_BASE
=
'http://api.liexin.com'
;
const
API_BASE_OSS
=
'http://image.liexindev.net'
;
const
API
=
{
/**
...
...
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