2024-09-01 21:51:50 +01:00

204 lines
4.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

new Vue({
el: "#app",
data: {
active: 0,
code: 'loading...',
mapShow: false,
mapAddress: {
name: '广州市诚投科技有限公司',
address: '广东省广州市番禺区节能科技园天安总部中心25号楼',
latitude: 22.825255,
longitude: 113.514967,
},
reports: ["./images/report1.jpg",
"./images/report2.jpg",
"./images/report3.jpg"
],
productMsg: [{
title: '产品名称:',
msg: '立健牌三清冲剂'
},
{
title: '产品规格:',
msg: '15g/袋x20袋/盒'
},
{
title: '产品型号:',
msg: '定制装'
},
{
title: '产品类别:',
msg: '保健食品'
},
{
title: '指导价格:',
msg: 'XX元/盒'
},
],
syMsg: [{
title: '产品名称:',
msg: '立健牌三清冲剂'
},
{
title: '生产批次:',
msg: '001'
},
{
title: '生产日期:',
msg: '2024年1月1日'
},
{
title: '生产企业:',
msg: '衍生健康医药(广东)有限公司'
},
{
title: '生产地址:',
msg: '广东省云浮市何杨公路1-8号衍生健康医药产业园'
},
],
btns: [{
img: './images/blue/rzicon1.png',
img1: './images/blue/rzicon2.png'
},
{
img: './images/blue/cpicon1.png',
img1: './images/blue/cpicon2.png'
},
{
img: './images/blue/jcicon1.png',
img1: './images/blue/jcicon2.png'
},
{
img: './images/blue/syicon1.png',
img1: './images/blue/syicon2.png'
},
{
img: './images/blue/ppicon1.png',
img1: './images/blue/ppicon2.png'
},
],
},
created() {
this.code = this.code.replace(/(.{4})/g, '$1 ')
},
methods: {
changeBtn(index) {
this.active = index
},
goDetails(index) {
location.href = "img_details.html?index=" + index
},
goPageZfsy() {
// location.href=this.zfsy_url
},
//---物流查询--------------
wl(code, type, area_code, area_addresss) {
let _this = this
if (type == 0) {
var url = "/open/wl?code=" + code
} else {
if (area_code) {
var url = "/open/wl?code=" + code + '&is_warn=1&adcode=' + area_code + '&area_addresss=' + area_addresss;
} else {
var url = "/open/wl?code=" + code + '&is_warn=1'
}
}
$
.ajax({
'url': URL + "/open/fw?code=" +
code + "&tenant_prefix=" + flag,
'type': 'get',
'dataType': 'json',
'success': function(data, statusText) {
if (data.success) {
var details = data.details;
_this.first_query_time = details.first_query_time
if (details.query_times == 1) {
_this.descn = "您所查询的是珞参麟品牌官方正品,品质保证,敬请放心食用。"
} else {
_this.descn = `您好!您所查询的防伪码已被查询,查询次数为${details.query_times}次,如有疑问请联系您所购买的产品的供应商。`
}
} else {
_this.descn = "该溯源码不存在,如有疑问请联系您所购买的产品的供应商。"
}
},
error: function(data) {
_this.descn = "正在为您努力计算密码请24小时候查询"
}
});
},
showImg(e) {
let url = e.currentTarget.dataset.url
vant.ImagePreview({
images: [url],
startPosition: 0
});
},
previewReport() {
let reports = this.reports
vant.ImagePreview({
images: reports,
startPosition: 0
});
},
openAddress() {
this.mapShow=true
},
getMapApp(mapType) {
const {
name,
address,
latitude,
longitude,
} = this.mapAddress;
if (wx && wx.miniProgram && wx.miniProgram.navigateTo) {
wx.miniProgram.navigateTo({
url: `/pages/nav/nav?latitude=${latitude}&longitude=${longitude}`,
});
} else {
let url = '';
switch (mapType) {
case '腾讯地图':
url = 'https://apis.map.qq.com/uri/v1/marker?marker=coord:' + latitude + ',' + longitude + ';addr:' +
address + ';title:'+name+'&referer=keyfree';
break;
case '高德地图':
url = 'https://uri.amap.com/marker?position=' + longitude + ',' + latitude + '&name=' + address +
'&callnative=1';
break;
case '百度地图':
url = 'http://api.map.baidu.com/marker?location=' + latitude + ',' + longitude + '&title='+name+'&content=' +
address + '&output=html&src=webapp.reformer.appname&coord_type=gcj02';
break;
default:
break;
}
window.location.href = url;
}
},
async reload() {
var url = 'api/properties/';
var r = await fetch(url);
var b = await r.json();
this.code = b.code;
},
},
mounted() {
this.reload();
},
})