Commit dbadfb2d by Jianli Ou

新境外条码查询页面接口对接

对接GTIN查询接口;每个查询项都携带验证码校验;
注:externalcopy.vue文件是原来的境外条码查询页面
parent f69bd572
......@@ -5,6 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve --mode development",
"test77": "vue-cli-service serve --mode test77",
"testBuild": "vue-cli-service build --mode test",
"build": "vue-cli-service build",
"build:prod1": "vue-cli-service build --mode prod1",
......
import {
POST
POST,
GET
} from "../fetch.js"
const Prefix = process.env.NODE_ENV === 'development' ? '/gs1' : '';
......@@ -45,6 +46,11 @@ const searchGlossary = (params = {}) => {
return POST(`${Prefix}/office/glossary/api/terminology`, params)
}
// 条码查询—境外码查询-通过GTIN查询验证产品
const searchGtin = (params = {}) => {
return GET(`${Prefix}/office/vbgOutSearch/api/verified`, params)
}
export default {
searchGln,
searchGetList,
......@@ -53,5 +59,6 @@ export default {
searchCompanyChange,
searchBike,
searchGlossary,
searchCodeGln
searchCodeGln,
searchGtin
}
......@@ -2,18 +2,18 @@
* GS1_Mark_List 境外条码信息查询 —— 验证其它GS1标识 —— 选择GS1标识 的下拉选择常量列表
*/
export const GS1_Mark_List = [
{ label: 'SSCC-系列货运包装箱代码', value: 'SSCC-系列货运包装箱代码' },
{ label: 'GRAI-全球可回收资产标识符', value: 'GRAI-全球可回收资产标识符' },
{ label: 'GIAI-单个资产标识代码', value: 'GIAI-单个资产标识代码' },
{ label: 'GSRN-全球服务关系代码', value: 'GSRN-全球服务关系代码' },
{ label: 'GDTI-全球文件类型标识符', value: 'GDTI-全球文件类型标识符' },
{ label: 'GINC-全球寄售识别号', value: 'GINC-全球寄售识别号' },
{ label: 'GSIN-全球货件识别号', value: 'GSIN-全球货件识别号' },
{ label: 'GCN-全球优惠券号码', value: 'GCN-全球优惠券号码' },
{ label: 'CPID-组件/零件标识符', value: 'CPID-组件/零件标识符' },
{ label: 'GMN-全球型号', value: 'GMN-全球型号' },
{ label: 'GTIN-商品条码', value: 'GTIN-商品条码' },
{ label: 'GLN-全球位置码', value: 'GLN-全球位置码' }
{ label: 'SSCC-系列货运包装箱代码', value: 'SSCC' },
{ label: 'GRAI-全球可回收资产标识符', value: 'GRAI' },
{ label: 'GIAI-单个资产标识代码', value: 'GIAI' },
{ label: 'GSRN-全球服务关系代码', value: 'GSRN' },
{ label: 'GDTI-全球文件类型标识符', value: 'GDTI' },
{ label: 'GINC-全球寄售识别号', value: 'GINC' },
{ label: 'GSIN-全球货件识别号', value: 'GSIN' },
{ label: 'GCN-全球优惠券号码', value: 'GCN' },
{ label: 'CPID-组件/零件标识符', value: 'CPID' },
{ label: 'GMN-全球型号', value: 'GMN' },
{ label: 'GTIN-商品条码', value: 'GTIN' },
{ label: 'GLN-全球位置码', value: 'GLN' }
]
/**
......
<template>
<div class="search-content">
<div class="banner-box">
<img src="./img/query_external_banner2.png"
@click="openUrl(`http://static.gds.org.cn/staticPage/GRPVbg/index.html`)"/>
<!-- https://import.gds.org.cn/#/home/index 中国进口商品信息服务平台-->
<!-- http://static.gds.org.cn/staticPage/GRPVbg/index.html 中文版VbG宣传页面-->
</div>
<div class="title">境外条码信息查询</div>
<div class="body">
<div style="padding-top: 20px">
<el-form label-position="left" label-width="180px" :model="search">
<el-form-item label="境外商品条码信息查询:">
<el-input
v-model="search.code"
placeholder="请输入正确的境外商品条码!"
class="w240"
></el-input>
</el-form-item>
<el-form-item label="验证码:">
<div class="y-center">
<el-input
v-model="captcha"
placeholder="请输入验证码"
class="w160"
></el-input>
<div class="validate-code">
<img :src="captchaPath" @click="getCaptcha()" alt=""/>
<!-- <img src="../../assets/image/validate.jpg" alt=""/> -->
</div>
<el-button
style="margin-left: 40px"
type="primary"
@click="handleSearch"
>查询
</el-button>
</div>
</el-form-item>
</el-form>
<div class="result-box" v-if="showResult">
<div class="result-box-title">查询 {{ searchCodeShow }} 结果</div>
<div class="result-box-body">
<template v-if="result">
<div class="company-info">
<el-table
:data="result"
header-cell-class-name="search-table-hc"
style="width: 100%"
>
<el-table-column prop="gs1CompanyPrefixLicensee.partyName" label="企业名称"></el-table-column>
<el-table-column prop="gepirRequestedKey.requestedKeyValue" label="GTIN"></el-table-column>
<el-table-column prop="address.streetAddressOne" label="地址"></el-table-column>
<el-table-column prop="address.city" label="城市"></el-table-column>
</el-table>
</div>
</template>
<span style="color: rgb(255, 59, 48)" v-else>{{ errorMsg }}</span>
</div>
</div>
</div>
</div>
<div class="notice">
<div class="title">友情提示</div>
<div class="content-wrapper">
<img src="./img/query-external-barcode.png" align="right" alt=""/>
<p>
1、目前,国际物品编码组织(GS1)已将690至699之间的前缀码分配给中国物品编码中心使用,通常以这些前缀码开始的厂商识别代码都是由中国物品编码中心负责分配和管理的;以其他前缀码开始的则由境外GS1成员组织负责,一般称为"境外条码",以下为您提供了境外商品条码信息的查询工具,请根据提示进行相关查询。欲了解GS1分配的前缀码,请点击:
<a href="/search/country" target="_blank" style="color: #5AC8FA;">了解更多 >></a>
</p>
<p style="color: #FF3B30;">2、本查询仅适用于中华人民共和国境外注册的商品条码信息。</p>
</div>
</div>
</div>
</template>
<script>
import validation from "@/views/Search/validation";
import {mapState} from "vuex";
const errorText = {
"1": '没有符合条件的记录!',
"2": '未找到该商品条码信息!',
"10": '厂商识别代码已注销!',
"14": '搜索频率过多!',
}
export default {
mixins: [validation],
data() {
return {
search: {code: ""},
searchCodeShow: "",
showResult: false,
result: null,
file: '',
};
},
created() {
if (this.$route.query.keyword) {
this.search.code=this.$route.query.keyword
}
},
computed: {
...mapState(["urls"]),
},
mounted(){
this.file = window.location.protocol + '//' + window.location.hostname + ':9091/office/uploadFileResource/'
},
methods: {
openUrl(url) {
window.open(url, '_blank')
},
async handleSearch() {
this.errorMsg ='正在查询……'
this.searchCodeShow = this.search.code;
if(this.hasSpecialString(this.searchCodeShow)){
return true
}
const params = {
"code": this.search.code,
"type": "GTIN",
"requestedLanguage": "en",
"captcha": this.captcha,
"uuid": this.uuid
};
const searchGlnRes = await this.$api.search.searchGln(params);
const {returnCode} = searchGlnRes;
console.log(searchGlnRes)
if (returnCode === "0") {
let redirectUrl='https://www.gds.org.cn/#/importList/index?type=importProduct&keyword='+this.search.code
window.open(redirectUrl, '_blank')
} else {
this.showResult = true;
this.errorMsg =
searchGlnRes.returnMsg ||
"您输入的商品条码格式不正确,请确认后重试。";
// this.result = null;
}
this.getCaptcha();
},
},
};
</script>
<style lang="scss">
.search-content {
.banner-box {
width: 100%;
height: auto;
> img {
width: 100%;
height: auto;
cursor: pointer;
}
}
.product-info {
margin-top: -15px;
.left {
.row_ {
display: flex;
align-items: center;
height: 42px;
.cell {
flex: 0 0 100px;
text-align: left;
font-size: 14px;
font-weight: 400;
color: #666666;
}
.value {
flex: 1;
font-size: 14px;
font-weight: 400;
color: #414345;
}
}
}
.right {
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment