Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1
Commits
c84c8975
Commit
c84c8975
authored
Nov 28, 2023
by
Jianli Ou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
问题处理
parent
0c1adbd8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
38 deletions
+86
-38
constant.js
src/utils/constant.js
+2
-2
external.vue
src/views/Search/external.vue
+84
-36
No files found.
src/utils/constant.js
View file @
c84c8975
...
...
@@ -12,8 +12,8 @@ export const GS1_Mark_List = [
{
label
:
'GCN-全球优惠券号码'
,
value
:
'GCN'
},
{
label
:
'CPID-组件/零件标识符'
,
value
:
'CPID'
},
{
label
:
'GMN-全球型号'
,
value
:
'GMN'
},
{
label
:
'GTIN-商品条码'
,
value
:
'GTIN'
},
{
label
:
'GLN-全球位置码'
,
value
:
'GLN'
}
//
{ label: 'GTIN-商品条码', value: 'GTIN' },
//
{ label: 'GLN-全球位置码', value: 'GLN' }
]
/**
...
...
src/views/Search/external.vue
View file @
c84c8975
...
...
@@ -105,7 +105,7 @@
<p
style=
"font-size:13px;margin:15px 0 0 0 ;"
>
该数据由Active Test Account企业提供,并于2023年5月2日最新更新
</p>
<p
style=
"font-size:13px;"
>
该GTIN信息完整
</p>
</div>
<div
class=
"hrefInfo "
>
<div
v-if=
"GtinResultData.linkset"
class=
"hrefInfo "
>
<p>
链接至其他产品信息
</p>
<div
v-if=
"GtinResultData.links.hasRetailers"
class=
"hrefInfoList"
>
<p>
有零售商
</p>
...
...
@@ -185,7 +185,7 @@
<div
class=
"gtin-cnt"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<el-input
v-model=
"glnInputValue"
placeholder=
"请输入GLN"
style=
"margin-top:5px"
><i
slot=
"prefix"
class=
"el-input__icon el-icon-search"
></i></el-input>
<el-input
v-model
.
number
=
"glnInputValue"
placeholder=
"请输入GLN"
style=
"margin-top:5px"
><i
slot=
"prefix"
class=
"el-input__icon el-icon-search"
></i></el-input>
</div>
<!--
<div
class=
"col-lg-1"
>
-->
<!--
<el-button
class=
"gtin-btn"
>
查询
</el-button>
-->
...
...
@@ -204,13 +204,14 @@
<el-button
class=
"gtin-btn"
@
click=
"searchGLN"
>
查询
</el-button>
</div>
</div>
<p
class=
"search-num"
>
搜索样例:
<span>
9506000140445
</span></p>
<!--
<p
class=
"search-num"
>
搜索样例:
<span>
9506000140445
</span></p>
-->
<p
class=
"search-num"
></p>
</div>
<div
v-if=
"glnResultData"
class=
"gtin-result"
>
<div
class=
"gtin-result-tip"
>
<img
src=
"../../assets/image/search/gtinIcon.png"
/>
<div>
<p>
此
商品条码
已经由“
{{
glnResultData
.
gs1Licence
.
licenseeName
}}
”公司注册
</p>
<p>
此
数据
已经由“
{{
glnResultData
.
gs1Licence
.
licenseeName
}}
”公司注册
</p>
</div>
</div>
<el-tabs
v-model=
"gtinActiveName2"
@
tab-click=
"handleClick"
>
...
...
@@ -477,14 +478,15 @@
<el-button
class=
"gtin-btn"
@
click=
"searchGS1"
>
查询
</el-button>
</div>
</div>
<p
class=
"search-num"
>
搜索样例:
<span>
9506000140445
</span></p>
<!--
<p
class=
"search-num"
>
搜索样例:
<span>
9506000140445
</span></p>
-->
<p
class=
"search-num"
></p>
</div>
<div
v-if=
"gs1ResultData"
class=
"gtin-result"
>
<div
class=
"gtin-result-tip"
style=
"margin-top:20px"
>
<img
src=
"../../assets/image/search/gtinIcon.png"
/>
<div>
<p>
{{
gs1ResultData
.
gtin
}}
</p>
<p>
此商品条码已经由“
{{
gs1ResultData
.
licenseeName
}}
”公司注册
</p>
<p>
此商品条码已经由“
{{
gs1ResultData
.
gs1Licence
.
licenseeName
}}
”公司注册
</p>
</div>
</div>
<el-tabs
v-model=
"gtinActiveName3"
@
tab-click=
"handleClick"
class=
"tab3"
>
...
...
@@ -607,7 +609,8 @@
layout=
"prev, pager, next"
:page-size=
"pageSize"
:current-page=
"currPage"
:total=
"totalMaxShowNum"
>
:total=
"totalMaxShowNum"
@
current-change=
"currPageChangeEvent"
>
</el-pagination>
</div>
<span
style=
"color: rgb(255, 59, 48)"
v-else
>
{{ errorMsg }}
</span>
...
...
@@ -714,6 +717,27 @@ export default {
this
.
errorMsg
=
''
this
.
captcha
=
''
this
.
getCaptcha
();
// 各个标签下的数据恢复初始值
this
.
GtinInputValue
=
''
this
.
GtinResultData
=
''
this
.
glnInputValue
=
''
this
.
glnResultData
=
''
this
.
gs1Type
=
''
this
.
gs1InputValue
=
''
this
.
gs1ResultData
=
''
this
.
countryCode
=
''
this
.
licenseeName
=
''
this
.
streetAddress
=
''
this
.
postalCode
=
''
this
.
addressLocality
=
''
this
.
otherFiled
=
false
this
.
qyResultData
=
''
this
.
currPage
=
1
this
.
pageSize
=
10
this
.
total
=
0
this
.
totalMaxShowNum
=
0
this
.
tableData
=
[]
},
handleClick
()
{
},
...
...
@@ -749,28 +773,30 @@ export default {
productSustainabilityInfo
:
''
,
// 可持续性和回收(不建议使用)
recipeInfo
:
''
// 食谱网站
}
Object
.
keys
(
data
[
0
].
linkset
).
forEach
(
item
=>
{
const
linkDataStructure
=
(
linkObj
)
=>
{
return
{
href
:
linkObj
.
href
,
hreflang
:
linkObj
.
hreflang
[
0
],
title
:
linkObj
.
title
,
type
:
linkObj
.
type
}
}
if
(
item
.
indexOf
(
'hasRetailers'
)
>=
0
)
{
data
[
0
].
links
.
hasRetailers
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
else
if
(
item
.
indexOf
(
'sustainabilityInfo'
)
>=
0
)
{
data
[
0
].
links
.
sustainabilityInfo
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
else
if
(
item
.
indexOf
(
'productSustainabilityInfo'
)
>=
0
)
{
data
[
0
].
links
.
productSustainabilityInfo
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
else
if
(
item
.
indexOf
(
'recipeInfo'
)
>=
0
)
{
data
[
0
].
links
.
recipeInfo
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
})
if
(
data
[
0
].
linkset
)
{
Object
.
keys
(
data
[
0
].
linkset
).
forEach
(
item
=>
{
const
linkDataStructure
=
(
linkObj
)
=>
{
return
{
href
:
linkObj
.
href
,
hreflang
:
linkObj
.
hreflang
[
0
],
title
:
linkObj
.
title
,
type
:
linkObj
.
type
}
}
if
(
item
.
indexOf
(
'hasRetailers'
)
>=
0
)
{
data
[
0
].
links
.
hasRetailers
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
else
if
(
item
.
indexOf
(
'sustainabilityInfo'
)
>=
0
)
{
data
[
0
].
links
.
sustainabilityInfo
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
else
if
(
item
.
indexOf
(
'productSustainabilityInfo'
)
>=
0
)
{
data
[
0
].
links
.
productSustainabilityInfo
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
else
if
(
item
.
indexOf
(
'recipeInfo'
)
>=
0
)
{
data
[
0
].
links
.
recipeInfo
=
data
[
0
].
linkset
[
item
].
map
(
linkObj
=>
{
return
linkDataStructure
(
linkObj
)
})
}
})
}
this
.
GtinResultData
=
data
[
0
]
}
!
data
&&
(
this
.
errorMsg
=
'没有查询到相关信息!'
)
...
...
@@ -789,16 +815,25 @@ export default {
})
},
async
searchGLN
()
{
if
(
String
(
this
.
glnInputValue
).
length
!==
13
)
{
this
.
errorMsg
=
'请输入13位GLN!'
return
}
this
.
glnResultData
=
''
this
.
errorMsg
=
'正在查询……'
const
params
=
{
gln
:
this
.
glnInputValue
,
gln
:
String
(
this
.
glnInputValue
)
,
uuid
:
this
.
uuid
,
captcha
:
this
.
captcha
};
const
searchResult
=
await
this
.
$api
.
search
.
searchGLN
(
params
);
const
{
returnCode
,
returnMsg
,
data
}
=
searchResult
;
if
(
returnCode
===
"0"
)
{
if
(
!
data
)
{
this
.
errorMsg
=
'没有查询到相关信息!'
this
.
getCaptcha
();
return
}
if
(
data
&&
data
[
0
].
glnRecords
)
{
data
[
0
].
glnRecords
.
forEach
(
item
=>
{
if
(
item
.
glnType
===
'LEGAL_ENTITY'
)
data
[
0
].
LEGAL_ENTITY
=
item
...
...
@@ -837,7 +872,6 @@ export default {
})
}
this
.
glnResultData
=
data
?
data
[
0
]
:
''
!
data
&&
(
this
.
errorMsg
=
'没有查询到相关信息!'
)
}
else
{
this
.
showResult
=
true
;
this
.
errorMsg
=
returnMsg
||
'没有查询到相关信息!'
;
...
...
@@ -857,14 +891,22 @@ export default {
const
{
returnCode
,
returnMsg
,
data
}
=
searchResult
;
if
(
returnCode
===
"0"
)
{
// if (data && this.gs1Type === 'GTIN') data[0] = {...data[0], gs1Licence: data[0]}
this
.
gs1ResultData
=
data
?
data
[
0
]
:
''
!
data
&&
(
this
.
errorMsg
=
'没有查询到相关信息!'
)
if
(
!
data
[
0
].
code
)
{
this
.
gs1ResultData
=
data
?
data
[
0
]
:
''
!
data
&&
(
this
.
errorMsg
=
'没有查询到相关信息!'
)
}
else
{
this
.
errorMsg
=
'没有查询到相关信息!'
}
}
else
{
this
.
showResult
=
true
;
this
.
errorMsg
=
returnMsg
||
'您输入的GS1标识不正确,请确认后重试。'
;
}
this
.
getCaptcha
();
},
currPageChangeEvent
(
e
)
{
this
.
currPage
=
e
this
.
tableData
=
this
.
qyResultData
.
filter
((
item
,
index
)
=>
e
===
1
?
index
<
10
:
index
>=
10
)
},
async
searchQY
()
{
this
.
qyResultData
=
''
this
.
errorMsg
=
'正在查询……'
...
...
@@ -877,7 +919,7 @@ export default {
uuid
:
this
.
uuid
,
captcha
:
this
.
captcha
,
pageindex
:
this
.
currPage
,
pagesize
:
this
.
pageSize
pagesize
:
20
};
const
searchResult
=
await
this
.
$api
.
search
.
searchQy
(
params
);
const
{
returnCode
,
returnMsg
,
data
}
=
searchResult
;
...
...
@@ -886,9 +928,8 @@ export default {
item
.
address
=
item
.
address
||
{
addressLocality
:
{
language
:
''
,
value
:
''
},
countryCode
:
''
}
return
{...
item
,
countrytitle
:
(
this
.
countryList
.
find
(
country
=>
country
.
twocode
===
item
.
address
.
countryCode
)
||
{
countrytitle
:
''
}).
countrytitle
}
})
console
.
log
(
data
.
list
)
this
.
qyResultData
=
data
.
list
this
.
tableData
=
data
.
list
this
.
tableData
=
data
.
list
.
filter
((
item
,
index
)
=>
index
<
10
)
this
.
total
=
data
.
totalCount
this
.
totalMaxShowNum
=
Math
.
min
(
data
.
totalCount
,
20
)
!
data
&&
(
this
.
errorMsg
=
'没有查询到相关信息!'
)
...
...
@@ -1320,4 +1361,11 @@ export default {
border-bottom-left-radius
:
4px
!important
;
}
}
.el-collapse-item__arrow
{
transform
:
rotate
(
90deg
);
}
.el-collapse-item__arrow.is-active
{
transform
:
rotate
(
270deg
);
}
</
style
>
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