|
@@ -137,7 +137,14 @@ const request = (options) => {
|
|
|
method: options.method || 'GET',
|
|
method: options.method || 'GET',
|
|
|
data: options.data || {},
|
|
data: options.data || {},
|
|
|
header,
|
|
header,
|
|
|
- success: (res) => res.statusCode === 200 ? resolve(res.data) : reject(new Error((res.data && res.data.message) || '请求失败')),
|
|
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ if (res.statusCode === 200) {
|
|
|
|
|
+ resolve(res.data)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const errorMsg = (res.data && res.data.message) || '请求失败'
|
|
|
|
|
+ reject(new Error(errorMsg))
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
fail: () => reject(new Error('网络异常'))
|
|
fail: () => reject(new Error('网络异常'))
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -255,7 +262,9 @@ const clearSearch = () => {
|
|
|
showSuggestions.value = false
|
|
showSuggestions.value = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const closeSuggestions = () => showSuggestions.value = false
|
|
|
|
|
|
|
+const closeSuggestions = () => {
|
|
|
|
|
+ showSuggestions.value = false
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const handleAddFromSuggestion = async (item) => {
|
|
const handleAddFromSuggestion = async (item) => {
|
|
|
if (stockList.value.some(s => s.code === item.code)) {
|
|
if (stockList.value.some(s => s.code === item.code)) {
|