Commit 3a6fda5b authored by wangmeng's avatar wangmeng

Merge branch 'dev_wm' into 'master'

防伪码

See merge request !167
parents 00e7e015 b7c23f10
import request from "@/utils/request";
/**
* 防伪码
* @param {*} params securityCode shaValue
* @param {*}
* @returns
*/
export function scanCode(params) {
return request({
url: "/admin/scanCode",
method: "get",
params
});
}
/**
* 防伪码信息详情
* @param {*} params
* @returns
*/
export function productInfo(params) {
return request({
url: "/admin/productInfo",
method: "get",
params
});
}
// /**
// * 提现发送验证码
// * @param {*} params userId
// * @returns
// */
// export function sendSms(params) {
// return request({
// url: "/bank/sendSmsCode",
// method: "get",
// params
// });
// }
//
// /**
// * 提现
// * @param {*} params code 验证码
// * @param {*} params money 提现金额
// * @returns
// */
// export function cashOut(params) {
// return request({
// url: "/bank/userWithdrawBank",
// method: "post",
// data: params
// });
// }
//
// /**
// * 获取用户银行卡信息
// * @param {*} params userId
// * @returns
// */
// export function getUserBankInfo(params) {
// return request({
// url: "/bank/getByUserId",
// method: "get",
// params
// });
// }
//
// /**
// * 获取银行卡列表
// * @returns
// */
// export function getBankList() {
// return request({
// url: "/bank/getBankNameList",
// method: "get"
// });
// }
//
// /**
// * 获取扣稅説明
// * @returns
// */
// export function getTaxRate(params) {
// return request({
// url: "/bank/getTaxRate",
// method: "get",
// params
// });
// }
...@@ -7,13 +7,13 @@ import "minirefresh/dist/debug/minirefresh.css"; ...@@ -7,13 +7,13 @@ import "minirefresh/dist/debug/minirefresh.css";
import "amfe-flexible"; import "amfe-flexible";
import "@/plugins/vant-ui.js"; import "@/plugins/vant-ui.js";
import "@/plugins/echarts-plugins.js"; import "@/plugins/echarts-plugins.js";
import Vconsole from "vconsole"; // import Vconsole from "vconsole";
import bridgeToAppFun from "@/utils/bridgeToAppFun"; import bridgeToAppFun from "@/utils/bridgeToAppFun";
Vue.prototype.$bridgeToAppFun = new bridgeToAppFun(); Vue.prototype.$bridgeToAppFun = new bridgeToAppFun();
/*生产环境请注释掉 */ /*生产环境请注释掉 */
Vue.prototype.$vConsole = new Vconsole(); // Vue.prototype.$vConsole = new Vconsole();
Vue.use(MiniRefreshTools); Vue.use(MiniRefreshTools);
Vue.config.productionTip = false; Vue.config.productionTip = false;
......
...@@ -153,7 +153,19 @@ const routes = [ ...@@ -153,7 +153,19 @@ const routes = [
name: "AboutUs", name: "AboutUs",
component: () => import("@/views/aboutUs"), component: () => import("@/views/aboutUs"),
meta: { title: "公司简介", noNav: false } meta: { title: "公司简介", noNav: false }
} },
{
path: "/certification",
name: "Certification",
component: () => import("@/views/certification"),
meta: { title: "产品认证信息", noNav: true }
},
{
path: "/blockChain",
name: "BlockChain",
component: () => import("@/views/blockChain"),
meta: { title: "区块链溯源", noNav: true }
}
]; ];
const router = new VueRouter({ const router = new VueRouter({
......
<template>
<div class="grade-status">
<div class="nav">
<van-icon
name="arrow-left"
size="20"
class="nav-left"
@click="handlerBack"
/>
<span class="nav-title">区块链溯源</span>
</div>
<div class="forest-content">
<span class="name-class">{{name}}</span>
<span class="nameSum-class">{{nameSum}}</span>
<div class="pass-word">
<van-password-input
:value="value"
info="刮开图层,请输入6位溯源密码"
:focused="showKeyboard"
@focus="showKeyboard = true"
:gutter="5"
/>
<!-- 数字键盘 -->
<van-number-keyboard
:show="showKeyboard"
@input="onInput"
@delete="onDelete"
@blur="showKeyboard = false"
/>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { PasswordInput, NumberKeyboard } from 'vant';
import { scanCode,} from "@/api/security";
Vue.use(PasswordInput);
Vue.use(NumberKeyboard);
export default {
data() {
return {
name:'西田森商品',
nameSum:'溯源查询',
value: '',
showKeyboard: true,
shaValue:'',
};
},
created() {
this.sheetShow = true
let params = window.location.search;
if (params) {
let shaValue = params.split("=")[1];
if (shaValue) {
this.shaValue = shaValue;
}
}
},
methods: {
handlerBack() {
try {
this.$bridgeToAppFun.navigateBack();
} catch {
this.$router.go(-1);
}
},
onInput(key) {
this.value = (this.value + key).slice(0, 6);
if(this.value.length == 6){
const params = {
securityCode: this.value,
shaValue:this.shaValue,
};
scanCode(params).then(res => {
if (res.code == 0) {
localStorage.setItem("shaValue", res.data);
this.$router.push("/certification");
} else {
this.$toast.fail(res.message);
}
});
}
},
onDelete() {
this.value = this.value.slice(0, this.value.length - 1);
}
}
};
</script>
<style lang="scss" scoped>
$white: #ffffff;
.grade-status {
width: 100%;
height: 298px;
background-image: url("../assets/images/森林状态.png");
background-size: cover;
.nav {
position: relative;
display: flex;
align-items: center;
width: 100%;
height: 46px;
color: #fff;
.nav-left {
position: absolute;
top: 0;
bottom: 0;
width: 52px;
height: 100%;
line-height: 46px;
text-align: center;
}
.nav-title {
max-width: 60%;
margin: 0 auto;
font-weight: bold;
font-size: 16px;
}
}
.forest-content {
text-align: center;
padding-top: 25px;
width: 345px;
height: 578px;
margin-left: 15px;
background-color: #ffffff;
.name-class{
font-size: 16px;
color: #666666;
float: left;
padding-left: 20px;
}
.nameSum-class{
display: block;
font-size: 24px;
color: #333333;
padding-top: 89px;
}
.pass-word{
padding-top: 40px;
.van-password-input__item{
background-color: #ebedf0;
}
}
}
}
</style>
<style lang="scss">
</style>
<template>
<div class="grade-status">
<div class="nav">
<van-icon
name="arrow-left"
size="20"
class="nav-left"
@click="handlerBack"
/>
<span class="nav-title">产品认证信息</span>
</div>
<div class="forest-content">
<span class="name-class">{{brand}}</span>
<span class="nameSum-class">{{specification}}</span>
<div class="forest-list">
<p class="countries">原产国
<span class="countries-class">{{productCountry}}</span>
</p>
<p class="countries">生产日期
<span class="countries-class">{{produceTime}}</span>
</p>
<p class="countries">有效期截止
<span class="countries-class">{{validTime}}</span>
</p>
<p class="countries">企业名称
<span class="countries-class">{{companyName}}</span>
</p>
<p class="countries" style="height: 37px">企业地址
<span class="countries-class">{{companyAddress}}</span>
</p>
<p class="countries">企业网址
<span class="countries-class">{{companyUrl}}</span>
</p>
<p class="countries">货运单号
<span class="countries-class">{{trackingNumber}}</span>
</p>
<p class="countries" style="height: 53px">物流轨迹查询平台
<span class="countries-class">{{logisticsUrl}}</span>
</p>
<p class="countries">海关进境备案编号
<span class="countries-class">{{recordNumber}}</span>
</p>
</div>
</div>
<van-popup v-model="sheetShow" round class="popup-class">
<span class="dialog-class" >{{popupName}}</span>
<p class="sum-form"><span>{{shaValue1}}</span></p>
<p class="sha-name" v-if="shaName == '非正品'" style="color: #ee0a24">{{shaName}}</p>
<p class="sha-name" v-else style="color: #2bee16">{{shaName}}</p>
</van-popup>
</div>
</template>
<script>
import { productInfo,} from "@/api/security";
export default {
data() {
return {
brand:'西田森NMN 1300mg',
specification:'60粒/瓶',
productCountry:'加拿大',
produceTime:'2021/1/1',
validTime:'2021/1/1',
companyName:'日本西田森制药株式会社',
companyAddress:'东京都千代田区东神田2丁目6番7号608',
trackingNumber:'741741741741',
logisticsUrl:'随意随意随意随意随意随意随意随意随意随意随意随意随意随意随意随意随',
recordNumber:'4646135146813',
sheetShow: false,
popupName:'本产品采用区块链技术验证防伪链上数据显示',
companyUrl:'',
shaValue:"",
shaValue1:"",
shaName:"",
};
},
created() {
this.stCertList()
},
methods: {
handlerBack() {
try {
this.$bridgeToAppFun.navigateBack();
} catch {
this.$router.go(-1);
}
},
stCertList(){
this.shaValue = localStorage.getItem("shaValue")
this.sheetShow = true
if(this.shaValue.indexOf("非")){
this.shaValue1 = this.shaValue.substring(0,this.shaValue.length-4);
this.shaName = "非正品";
}else {
this.shaValue1 = this.shaValue.substring(0,this.shaValue.length-3);
this.shaName = "正品";
}
const params = {
shaValue: this.shaValue,
};
productInfo(params).then(res => {
if (res.code == 0) {
this.brand = res.data.brand
this.specification = res.data.specification
this.productCountry = res.data.productCountry
this.produceTime = res.data.produceTime
this.validTime = res.data.validTime
this.companyName = res.data.companyName
this.companyAddress = res.data.companyAddress
this.trackingNumber = res.data.trackingNumber
this.logisticsUrl = res.data.logisticsUrl
this.recordNumber = res.data.recordNumber
this.popupName = res.data.popupName
this.companyUrl = res.data.companyUrl
} else {
this.$toast.fail(res.message);
}
});
},
}
};
</script>
<style lang="scss" scoped>
$white: #ffffff;
.grade-status {
width: 100%;
height: 298px;
background-image: url("../assets/images/森林状态.png");
background-size: cover;
.nav {
position: relative;
display: flex;
align-items: center;
width: 100%;
height: 46px;
color: #fff;
.nav-left {
position: absolute;
top: 0;
bottom: 0;
width: 52px;
height: 100%;
line-height: 46px;
text-align: center;
}
.nav-title {
max-width: 60%;
margin: 0 auto;
font-weight: bold;
font-size: 16px;
}
}
.forest-content {
text-align: center;
padding-top: 25px;
width: 345px;
height: 578px;
margin-left: 15px;
background-color: #ffffff;
.name-class{
font-size: 18px;
color: #333333;
}
.nameSum-class{
display: block;
font-size: 13px;
color: #666666;
margin-top: 10px;
}
}
.forest-list{
margin-top: 40px;
.countries{
font-size: 14px;
color: #666666;
text-align: left;
padding-left: 20px;
}
.countries-class{
width: 177px;
float: right;
color: #333333;
margin-right: 20px;
text-align: right;
}
}
.popup-class{
width: 315px;
height: 323px;
.dialog-class{
font-size: 17px;
color: #999999;
width: 250px;
text-align: center;
display:block;
padding-left: 30px;
padding-top: 24px;
}
.sum-form{
width: 270px;
height: 16px;
padding-top: 10px;
color: #333333;
font-size: 18px;
padding-left: 26px;
text-align: center;
}
.sha-name{
text-align: center;
font-size: 30px;
padding-top: 45px;
}
}
}
</style>
<style lang="scss">
</style>
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
}, },
getRecommendInfo() { getRecommendInfo() {
const params = { const params = {
userId: JSON.parse(localStorage.getItem("user")).userId userId: 15901538273
}; };
recomendInfo(params).then(res => { recomendInfo(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
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