@@ -64,6 +64,9 @@ App({ | |||||
data: usrdata | data: usrdata | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
console.log(res.data.token) | |||||
console.log("-------------------------------------------token---------------------------------------") | |||||
if (res.data && res.data.score) { | if (res.data && res.data.score) { | ||||
if (res.data.score != 0) { | if (res.data.score != 0) { | ||||
that.globalData.score = res.data.score; | that.globalData.score = res.data.score; | ||||
@@ -18,16 +18,10 @@ Component({ | |||||
data: {}, | data: {}, | ||||
methods: { | methods: { | ||||
gotoDetail(e) { | gotoDetail(e) { | ||||
console.log(e.currentTarget.dataset.couponid); | |||||
console.log(e.currentTarget.dataset.title); | |||||
console.log(e.currentTarget.dataset.id); | |||||
let couponId = e.currentTarget.dataset.couponid; | let couponId = e.currentTarget.dataset.couponid; | ||||
let title = e.currentTarget.dataset.title; | let title = e.currentTarget.dataset.title; | ||||
let id = e.currentTarget.dataset.id; | let id = e.currentTarget.dataset.id; | ||||
let targetAd = e.currentTarget.dataset.targetad; | let targetAd = e.currentTarget.dataset.targetad; | ||||
if (targetAd) { | |||||
} | |||||
if (id && targetAd != 7) { | if (id && targetAd != 7) { | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `/pages/coupon/detail/index?couponChannelId=${id}&couponId=${couponId}&title=${title}`, | url: `/pages/coupon/detail/index?couponChannelId=${id}&couponId=${couponId}&title=${title}`, | ||||
@@ -96,10 +96,9 @@ Page({ | |||||
var birthdate = null; | var birthdate = null; | ||||
} | } | ||||
if (username == null || address == null || sex == 0 || birthdate == null) { | if (username == null || address == null || sex == 0 || birthdate == null) { | ||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '请输入完整的用户信息', | |||||
showCancel: false | |||||
wx.showToast({ | |||||
title: '请输入完整的用户信息', | |||||
icon:"none" | |||||
}) | }) | ||||
} else { | } else { | ||||
Http.post({ | Http.post({ | ||||
@@ -112,15 +111,11 @@ Page({ | |||||
} | } | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '修改成功', | |||||
showCancel: false, | |||||
success: function (res) { | |||||
wx.switchTab({ | |||||
url: '/pages/user/index', | |||||
}) | |||||
} | |||||
wx.showToast({ | |||||
title: "修改成功", | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}) | }) | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
@@ -129,7 +124,7 @@ Page({ | |||||
icon: 'none', | icon: 'none', | ||||
duration: 2000, | duration: 2000, | ||||
mask: false | mask: false | ||||
}); | |||||
}) | |||||
}) | }) | ||||
} | } | ||||
}, | }, | ||||
@@ -156,7 +151,7 @@ Page({ | |||||
}) | }) | ||||
} | } | ||||
var reg = RegExp(/address/); | var reg = RegExp(/address/); | ||||
if (res.data.address.match(reg)) { | |||||
if (res&&res.data&&res.data.address&&res.data.address.match(reg)) { | |||||
that.setData({ | that.setData({ | ||||
address: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name, | address: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name, | ||||
addressStr: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name | addressStr: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name | ||||
@@ -198,12 +193,12 @@ Page({ | |||||
} | } | ||||
}) | }) | ||||
.catch(error=>{ | .catch(error=>{ | ||||
console.log(error) | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: error.errMsg, | |||||
showCancel:false | |||||
}) | |||||
wx.showToast({ | |||||
title: error.errMsg, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
}) | }) | ||||
} | } | ||||
}) | }) |
@@ -28,6 +28,12 @@ Page({ | |||||
orderId:options.orderId | orderId:options.orderId | ||||
}) | }) | ||||
} | } | ||||
if (options && options.frommd && options.id){ | |||||
that.setData({ | |||||
id: options.id, | |||||
frommd: options.frommd | |||||
}) | |||||
} | |||||
that.setData({ | that.setData({ | ||||
optionData: wx.getStorageSync('options') ? JSON.parse(wx.getStorageSync('options')):null | optionData: wx.getStorageSync('options') ? JSON.parse(wx.getStorageSync('options')):null | ||||
}) | }) | ||||
@@ -120,6 +126,18 @@ Page({ | |||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: `/pages/topicDetail/index?id=${that.data.optionData.id}` | url: `/pages/topicDetail/index?id=${that.data.optionData.id}` | ||||
}); | }); | ||||
} | |||||
// 门店详情 | |||||
else if (that.data.optionData.id && app.globalData.type == 'md') { | |||||
wx.redirectTo({ | |||||
url: `/pages/index/searchbar/detail/index?id=${that.data.optionData.id}` | |||||
}); | |||||
} | |||||
// 通过分享进入的门店详情页面 | |||||
else if (that.data.id && that.data.frommd == 'md') { | |||||
wx.redirectTo({ | |||||
url: `/pages/index/searchbar/detail/index?id=${that.data.id}` | |||||
}); | |||||
} else if (that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') { | } else if (that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') { | ||||
// 宣传页详情 | // 宣传页详情 | ||||
if (that.data.optionData.bt == '2') { | if (that.data.optionData.bt == '2') { | ||||
@@ -13,6 +13,7 @@ Page({ | |||||
*/ | */ | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
let that = this; | let that = this; | ||||
console.log(options) | |||||
wx.showToast({ | wx.showToast({ | ||||
title: '加载中', | title: '加载中', | ||||
icon: "loading", | icon: "loading", | ||||
@@ -35,6 +36,7 @@ Page({ | |||||
that.setData({ | that.setData({ | ||||
newArr: this.data.scene.split(':') | newArr: this.data.scene.split(':') | ||||
}) | }) | ||||
//// 大屏-二维码-start | //// 大屏-二维码-start | ||||
if (this.data.newArr[0] == 'JC') { | if (this.data.newArr[0] == 'JC') { | ||||
// 跳转券详情 | // 跳转券详情 | ||||
@@ -59,14 +61,16 @@ Page({ | |||||
} else if (options.type == 'td') { | } else if (options.type == 'td') { | ||||
// 专题活动页 | // 专题活动页 | ||||
options.id = this.data.newArr[2]; | options.id = this.data.newArr[2]; | ||||
} else if (options.type == 'md') { | |||||
// 门店详情 | |||||
options.id = this.data.newArr[2]; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
wx.setStorageSync('options', JSON.stringify(options)) | wx.setStorageSync('options', JSON.stringify(options)) | ||||
wx.setStorageSync('imgurl', imgurl) | |||||
wx.setStorageSync('imgurl', imgurl); | |||||
// app.getLocation(); | |||||
if (app.globalData.token) { | if (app.globalData.token) { | ||||
if (options.couponChannelId || options.orderId || options.id) { | if (options.couponChannelId || options.orderId || options.id) { | ||||
that.userStatus(options); | that.userStatus(options); | ||||
@@ -171,6 +175,12 @@ Page({ | |||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: `/pages/topicDetail/index?id=${options.id}` | url: `/pages/topicDetail/index?id=${options.id}` | ||||
}); | }); | ||||
} | |||||
// 门店详情 | |||||
else if (options && options.id && app.globalData.type == 'md') { | |||||
wx.redirectTo({ | |||||
url: `/pages/index/searchbar/detail/index?id=${options.id}` | |||||
}); | |||||
} | } | ||||
// 参与砍价 | // 参与砍价 | ||||
else if (options && options.orderId) { | else if (options && options.orderId) { | ||||
@@ -275,11 +285,16 @@ Page({ | |||||
} | } | ||||
// 门店 | // 门店 | ||||
else if (app.globalData.type == 'ml') { | else if (app.globalData.type == 'ml') { | ||||
// 门店 | |||||
wx.switchTab({ | wx.switchTab({ | ||||
url: '/pages/index/searchbar/index' | url: '/pages/index/searchbar/index' | ||||
}) | }) | ||||
} else { | |||||
} | |||||
// 通过分享进入的门店详情 | |||||
else if (options && options.id && options.frommd == 'md') { | |||||
wx.redirectTo({ | |||||
url: `/pages/index/searchbar/detail/index?id=${options.id}` | |||||
}); | |||||
}else { | |||||
// 主页 | // 主页 | ||||
wx.switchTab({ | wx.switchTab({ | ||||
url: '/pages/main/index' | url: '/pages/main/index' | ||||
@@ -319,6 +334,12 @@ Page({ | |||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: `/pages/getuserinfo/index?orderId=${options.orderId}&from='${"discount"}` | url: `/pages/getuserinfo/index?orderId=${options.orderId}&from='${"discount"}` | ||||
}) | }) | ||||
} | |||||
// 通过分享进入的门店详情 | |||||
else if (options && options.id && options.frommd == 'md') { | |||||
wx.redirectTo({ | |||||
url: `/pages/getuserinfo/index?id=${options.id}&frommd=md` | |||||
}); | |||||
} else { | } else { | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: `/pages/getuserinfo/index` | url: `/pages/getuserinfo/index` | ||||
@@ -22,7 +22,7 @@ Page({ | |||||
imglist: null, | imglist: null, | ||||
shopVoList: [], | shopVoList: [], | ||||
couponList: [], //活动劵列表 | couponList: [], //活动劵列表 | ||||
qrCodeL:'',//小程序码 | |||||
qrCodeL: '', //小程序码 | |||||
currentTab: 0, | currentTab: 0, | ||||
isshare: false, | isshare: false, | ||||
showpost: false, | showpost: false, | ||||
@@ -33,9 +33,6 @@ Page({ | |||||
totalHeight: 0, | totalHeight: 0, | ||||
canvasScale: 1.0, // 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图 | canvasScale: 1.0, // 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图 | ||||
}, | }, | ||||
/** | |||||
* 分享海报的生成 | |||||
*/ | |||||
//关闭海报 | //关闭海报 | ||||
closePoste: function() { | closePoste: function() { | ||||
this.setData({ | this.setData({ | ||||
@@ -64,9 +61,8 @@ Page({ | |||||
* 绘制分享海报 | * 绘制分享海报 | ||||
*/ | */ | ||||
begainDrawShareImage() { | begainDrawShareImage() { | ||||
wx.showLoading({ | |||||
title: '生成中...', | |||||
wx.showLoading({ | |||||
title: '生成中...', | |||||
}) | }) | ||||
var that = this | var that = this | ||||
@@ -88,10 +84,10 @@ Page({ | |||||
let bgimg1 = this.data.poterbg + `?imageView/2/w/${wW}/h/${wH}` | let bgimg1 = this.data.poterbg + `?imageView/2/w/${wW}/h/${wH}` | ||||
let bgimg2 = bgimg1.replace(imgOrgUrl1, imgNewUrl) | let bgimg2 = bgimg1.replace(imgOrgUrl1, imgNewUrl) | ||||
ctx.drawImage(bgimg2, 0, 0, wW, wH); | ctx.drawImage(bgimg2, 0, 0, wW, wH); | ||||
//绘制头像 | |||||
let avatar1 = this.data.avatarUrl + `?imageView/2/w/${wW}/h/${wH}` | |||||
let avatar2 = avatar1.replace(imgOrgUrl, imgNewUrl) | |||||
ctx.drawImage(avatar2, 15, 10, 30*scale,30*scale); | |||||
//绘制头像 | |||||
let avatar1 = this.data.avatarUrl + `?imageView/2/w/${wW}/h/${wH}` | |||||
let avatar2 = avatar1.replace(imgOrgUrl, imgNewUrl) | |||||
ctx.drawImage(avatar2, 15, 10, 30 * scale, 30 * scale); | |||||
// 首先要绘制顶部的背景图片,因为它在最底层,然后才能绘制其他内容 | // 首先要绘制顶部的背景图片,因为它在最底层,然后才能绘制其他内容 | ||||
let topImageWidth = parseInt(315 * scale) // 因为小数有时候会请求不到图片,所以转成int | let topImageWidth = parseInt(315 * scale) // 因为小数有时候会请求不到图片,所以转成int | ||||
let topImageHeight = parseInt(200 * scale) | let topImageHeight = parseInt(200 * scale) | ||||
@@ -102,22 +98,22 @@ Page({ | |||||
success: function(res) { | success: function(res) { | ||||
// 绘制白色背景 | // 绘制白色背景 | ||||
ctx.setFillStyle('#fff') | ctx.setFillStyle('#fff') | ||||
ctx.fillRect(25,45, topImageWidth+10, topImageHeight+10) | |||||
ctx.fillRect(25, 45, topImageWidth + 10, topImageHeight + 10) | |||||
ctx.draw() | ctx.draw() | ||||
ctx.drawImage(res.path, 30,50, topImageWidth, topImageHeight) | |||||
ctx.drawImage(res.path, 30, 50, topImageWidth, topImageHeight) | |||||
that.drawOtherContent(ctx, scale) | that.drawOtherContent(ctx, scale) | ||||
that.drawOtherImage(ctx, scale) | that.drawOtherImage(ctx, scale) | ||||
} | } | ||||
}) | }) | ||||
}, | }, | ||||
//获取头像和昵称 | //获取头像和昵称 | ||||
getUserInfo: function () { | |||||
getUserInfo: function() { | |||||
let that = this; | let that = this; | ||||
// 获取用户信息 | // 获取用户信息 | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getScore, | |||||
data: {} | |||||
}) | |||||
url: config.api.getScore, | |||||
data: {} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log(res) | console.log(res) | ||||
that.setData({ | that.setData({ | ||||
@@ -129,45 +125,45 @@ Page({ | |||||
// 绘制除了图片之外的剩余内容 | // 绘制除了图片之外的剩余内容 | ||||
drawOtherContent(ctx, scale) { | drawOtherContent(ctx, scale) { | ||||
//昵称 | //昵称 | ||||
this.drawNormalText(ctx, this.data.nickName+" 向您推荐", 50 * scale, 25 * scale, 16 * scale, '#fff', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, this.data.nickName + " 向您推荐", 50 * scale, 25 * scale, 16 * scale, '#fff', 'left', 'middle', scale); | |||||
//店铺名 | //店铺名 | ||||
this.drawNormalText(ctx, this.data.data.merchantName, 180 * scale, 280 * scale, 30 * scale, '#fff', 'center', 'middle', scale); | this.drawNormalText(ctx, this.data.data.merchantName, 180 * scale, 280 * scale, 30 * scale, '#fff', 'center', 'middle', scale); | ||||
//店铺电话 | //店铺电话 | ||||
// this.drawNormalText(ctx, "商铺电话:"+this.data.data.merchantLinkPhone, 100 * scale, 405 * scale, 16 * scale, '#000', 'left', 'middle', scale); | // this.drawNormalText(ctx, "商铺电话:"+this.data.data.merchantLinkPhone, 100 * scale, 405 * scale, 16 * scale, '#000', 'left', 'middle', scale); | ||||
if (this.data.couponList.length>0) { | |||||
if (this.data.couponList.length > 0) { | |||||
for (let i = 0; i < this.data.couponList.length; i++) { | for (let i = 0; i < this.data.couponList.length; i++) { | ||||
// 第一个商品信息 | // 第一个商品信息 | ||||
this.drawNormalText(ctx, this.substrTile(this.data.couponList[1].title), 40 * scale, 396 * scale, 14 * scale, '#000', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, "价格:"+this.data.couponList[1].salePrice, 40 * scale, 416 * scale, 14 * scale, '#FF3232', 'left', 'middle', scale); | |||||
//第二个商品信息 | |||||
this.drawNormalText(ctx, this.substrTile(this.data.couponList[2].title), 155 * scale, 396 * scale, 14 * scale, '#000', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, "价格:"+this.data.couponList[2].salePrice, 155 * scale, 416 * scale, 14 * scale, '#FF3232', 'left', 'middle', scale); | |||||
//第三个商品信息 | |||||
this.drawNormalText(ctx, this.substrTile(this.data.couponList[3].title), 270 * scale, 396 * scale, 14 * scale, '#000', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, "价格:"+this.data.couponList[3].salePrice, 270 * scale, 416 * scale, 14 * scale, '#FF3232', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, this.substrTile(this.data.couponList[1].title), 40 * scale, 396 * scale, 14 * scale, '#000', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, "价格:" + this.data.couponList[1].salePrice, 40 * scale, 416 * scale, 14 * scale, '#FF3232', 'left', 'middle', scale); | |||||
//第二个商品信息 | |||||
this.drawNormalText(ctx, this.substrTile(this.data.couponList[2].title), 155 * scale, 396 * scale, 14 * scale, '#000', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, "价格:" + this.data.couponList[2].salePrice, 155 * scale, 416 * scale, 14 * scale, '#FF3232', 'left', 'middle', scale); | |||||
//第三个商品信息 | |||||
this.drawNormalText(ctx, this.substrTile(this.data.couponList[3].title), 270 * scale, 396 * scale, 14 * scale, '#000', 'left', 'middle', scale); | |||||
this.drawNormalText(ctx, "价格:" + this.data.couponList[3].salePrice, 270 * scale, 416 * scale, 14 * scale, '#FF3232', 'left', 'middle', scale); | |||||
} | } | ||||
} | } | ||||
this.drawNormalText(ctx, "长按二维码识别小程序进店逛逛", 85 * scale, 570 * scale, 16 * scale, '#000', 'left', 'middle', scale); | this.drawNormalText(ctx, "长按二维码识别小程序进店逛逛", 85 * scale, 570 * scale, 16 * scale, '#000', 'left', 'middle', scale); | ||||
ctx.draw(true) | ctx.draw(true) | ||||
}, | }, | ||||
//截取商品名 | |||||
substrTile(str){ | |||||
return str.substr(0,5)+'...' | |||||
}, | |||||
//截取商品名 | |||||
substrTile(str) { | |||||
return str.substr(0, 5) + '...' | |||||
}, | |||||
// 绘制活动图片 | // 绘制活动图片 | ||||
drawOtherImage(ctx, scale) { | drawOtherImage(ctx, scale) { | ||||
var that = this | var that = this | ||||
// 如果该商户有活动商品 | // 如果该商户有活动商品 | ||||
if (that.data.couponList.length>0) { | |||||
if (that.data.couponList.length > 0) { | |||||
let cotentImageWidth = parseInt(80 * scale) | let cotentImageWidth = parseInt(80 * scale) | ||||
let cotentImageHeight = parseInt(80 * scale) | let cotentImageHeight = parseInt(80 * scale) | ||||
for (let i = 0; i < that.data.couponList.length; i++) { | for (let i = 0; i < that.data.couponList.length; i++) { | ||||
let imageItem = that.data.couponList[i].coverImg | let imageItem = that.data.couponList[i].coverImg | ||||
let src1 = imageItem + `?imageView/2/w/${cotentImageWidth}/h/${cotentImageHeight}` | let src1 = imageItem + `?imageView/2/w/${cotentImageWidth}/h/${cotentImageHeight}` | ||||
let src2 = src1.replace(imgOrgUrl, imgNewUrl) | |||||
let src2 = src1.replace(imgOrgUrl, imgNewUrl) | |||||
wx.getImageInfo({ | wx.getImageInfo({ | ||||
src: src2, | src: src2, | ||||
success: function(res) { | success: function(res) { | ||||
@@ -178,23 +174,23 @@ Page({ | |||||
} | } | ||||
}) | }) | ||||
} | } | ||||
} | |||||
if (this.data.qrCode) { | |||||
let coImageWidth = parseInt(120 * scale) | |||||
let coImageHeight = parseInt(120 * scale) | |||||
let src1 = this.data.qrCode + `?imageView/2/w/${coImageWidth}/h/${coImageHeight}` | |||||
let src2 = src1.replace(imgOrgUrl, imgNewUrl) | |||||
wx.getImageInfo({ | |||||
src: src2, | |||||
success: function(res) { | |||||
ctx.drawImage(res.path, 115 * scale, 425 * scale, coImageWidth, coImageHeight) | |||||
ctx.draw(true) | |||||
} | |||||
}) | |||||
} | } | ||||
if (this.data.qrCode) { | |||||
let coImageWidth = parseInt(120 * scale) | |||||
let coImageHeight = parseInt(120 * scale) | |||||
let src1 = this.data.qrCode + `?imageView/2/w/${coImageWidth}/h/${coImageHeight}` | |||||
let src2 = src1.replace(imgOrgUrl, imgNewUrl) | |||||
wx.getImageInfo({ | |||||
src: src2, | |||||
success: function(res) { | |||||
ctx.drawImage(res.path, 115 * scale, 425 * scale, coImageWidth, coImageHeight) | |||||
ctx.draw(true) | |||||
} | |||||
}) | |||||
} | |||||
wx.hideLoading() | |||||
wx.hideLoading() | |||||
}, | }, | ||||
// 绘制只有一行的文字 | // 绘制只有一行的文字 | ||||
drawNormalText(ctx, str, x, y, font, style, align, baseLine) { | drawNormalText(ctx, str, x, y, font, style, align, baseLine) { | ||||
@@ -244,103 +240,103 @@ Page({ | |||||
} | } | ||||
}, | }, | ||||
/** | /** | ||||
* 图片预览方法 | |||||
* 此处注意的一点就是,调用 "wx.previewImage"时,第二个参数要求为数组形式哦 | |||||
* 当然,做过图片上传功能的应该会注意到,如果涉及到多张图片预览,图片链接数组集合即为参数 urls! | |||||
*/ | |||||
previewImage: function() { | |||||
wx.canvasToTempFilePath({ | |||||
x: 0, | |||||
y: 0, | |||||
width: this.data.windowWidth * this.data.canvasScale, | |||||
height: this.data.totalHeight * this.data.canvasScale, | |||||
canvasId: 'myCanvas', | |||||
success: function (res) { | |||||
var current = res.tempFilePath; | |||||
wx.previewImage({ | |||||
current: current, | |||||
urls: [current] | |||||
}) | |||||
}, | |||||
fail: function (res) { | |||||
wx.showToast({ | |||||
title: '图片生成失败', | |||||
icon: 'none', | |||||
duration: 2000 | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
// 保存图片 | |||||
saveImage(){ | |||||
let that = this | |||||
wx.canvasToTempFilePath({ | |||||
x: 0, | |||||
y: 0, | |||||
width: this.data.windowWidth * this.data.canvasScale, | |||||
height: this.data.totalHeight * this.data.canvasScale, | |||||
canvasId: 'myCanvas', | |||||
success: function (res) { | |||||
that.saveImageToPhotos(res.tempFilePath); | |||||
}, | |||||
fail: function (res) { | |||||
wx.showToast({ | |||||
title: '图片生成失败', | |||||
icon: 'none', | |||||
duration: 2000 | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
saveImageToPhotos: function (tempFilePath) { | |||||
wx.saveImageToPhotosAlbum({ | |||||
filePath: tempFilePath, | |||||
success(result) { | |||||
wx.showToast({ | |||||
title: '保存成功,从相册中分享到朋友圈吧', | |||||
icon: 'none', | |||||
duration: 4000 | |||||
}) | |||||
}, | |||||
fail: function (err) { | |||||
if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny") { | |||||
// 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用 | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '需要您授权保存相册', | |||||
showCancel: false, | |||||
success:modalSuccess=>{ | |||||
wx.openSetting({ | |||||
success(settingdata) { | |||||
console.log("settingdata", settingdata) | |||||
if (settingdata.authSetting['scope.writePhotosAlbum']) { | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '获取权限成功,再次点击图片即可保存', | |||||
showCancel: false, | |||||
}) | |||||
} else { | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '获取权限失败,将无法保存到相册哦~', | |||||
showCancel: false, | |||||
}) | |||||
} | |||||
}, | |||||
fail(failData) { | |||||
console.log("failData",failData) | |||||
}, | |||||
complete(finishData) { | |||||
console.log("finishData", finishData) | |||||
} | |||||
}) | |||||
} | |||||
* 图片预览方法 | |||||
* 此处注意的一点就是,调用 "wx.previewImage"时,第二个参数要求为数组形式哦 | |||||
* 当然,做过图片上传功能的应该会注意到,如果涉及到多张图片预览,图片链接数组集合即为参数 urls! | |||||
*/ | |||||
previewImage: function() { | |||||
wx.canvasToTempFilePath({ | |||||
x: 0, | |||||
y: 0, | |||||
width: this.data.windowWidth * this.data.canvasScale, | |||||
height: this.data.totalHeight * this.data.canvasScale, | |||||
canvasId: 'myCanvas', | |||||
success: function(res) { | |||||
var current = res.tempFilePath; | |||||
wx.previewImage({ | |||||
current: current, | |||||
urls: [current] | |||||
}) | |||||
}, | |||||
fail: function(res) { | |||||
wx.showToast({ | |||||
title: '图片生成失败', | |||||
icon: 'none', | |||||
duration: 2000 | |||||
}) | }) | ||||
} | } | ||||
}, | |||||
}) | |||||
}, | |||||
}) | |||||
}, | |||||
// 保存图片 | |||||
saveImage() { | |||||
let that = this | |||||
wx.canvasToTempFilePath({ | |||||
x: 0, | |||||
y: 0, | |||||
width: this.data.windowWidth * this.data.canvasScale, | |||||
height: this.data.totalHeight * this.data.canvasScale, | |||||
canvasId: 'myCanvas', | |||||
success: function(res) { | |||||
that.saveImageToPhotos(res.tempFilePath); | |||||
}, | |||||
fail: function(res) { | |||||
wx.showToast({ | |||||
title: '图片生成失败', | |||||
icon: 'none', | |||||
duration: 2000 | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
saveImageToPhotos: function(tempFilePath) { | |||||
wx.saveImageToPhotosAlbum({ | |||||
filePath: tempFilePath, | |||||
success(result) { | |||||
wx.showToast({ | |||||
title: '保存成功,从相册中分享到朋友圈吧', | |||||
icon: 'none', | |||||
duration: 4000 | |||||
}) | |||||
}, | |||||
fail: function(err) { | |||||
if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny") { | |||||
// 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用 | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '需要您授权保存相册', | |||||
showCancel: false, | |||||
success: modalSuccess => { | |||||
wx.openSetting({ | |||||
success(settingdata) { | |||||
console.log("settingdata", settingdata) | |||||
if (settingdata.authSetting['scope.writePhotosAlbum']) { | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '获取权限成功,再次点击图片即可保存', | |||||
showCancel: false, | |||||
}) | |||||
} else { | |||||
wx.showModal({ | |||||
title: '提示', | |||||
content: '获取权限失败,将无法保存到相册哦~', | |||||
showCancel: false, | |||||
}) | |||||
} | |||||
}, | |||||
fail(failData) { | |||||
console.log("failData", failData) | |||||
}, | |||||
complete(finishData) { | |||||
console.log("finishData", finishData) | |||||
} | |||||
}) | |||||
} | |||||
}) | |||||
} | |||||
}, | |||||
}) | |||||
}, | |||||
/** | /** | ||||
* 拨打电话 | * 拨打电话 | ||||
*/ | */ | ||||
@@ -414,12 +410,14 @@ saveImageToPhotos: function (tempFilePath) { | |||||
url: config.api.merchantList, | url: config.api.merchantList, | ||||
data: data | data: data | ||||
}).then(res => { | }).then(res => { | ||||
console.log(res) | |||||
console.log("-----------------------------onShow---------------------------------------") | |||||
let imgList = []; | let imgList = []; | ||||
imgList.push(res.data.list[0].merchantImgUrl) | imgList.push(res.data.list[0].merchantImgUrl) | ||||
that.setData({ | that.setData({ | ||||
data: res.data.list[0], | data: res.data.list[0], | ||||
shopVoList: res.data.list[0].shopVoList, | shopVoList: res.data.list[0].shopVoList, | ||||
imglist: res.data.list[0].coverPicture == '[]' ? imgList:JSON.parse(res.data.list[0].coverPicture), | |||||
imglist: res.data.list[0].coverPicture == '[]' ? imgList : JSON.parse(res.data.list[0].coverPicture), | |||||
}) | }) | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
@@ -450,7 +448,7 @@ saveImageToPhotos: function (tempFilePath) { | |||||
}).then(res => { | }).then(res => { | ||||
that.setData({ | that.setData({ | ||||
couponList: res.data.page.list, | couponList: res.data.page.list, | ||||
qrCode:res.data.qrCode, | |||||
qrCode: res.data.qrCode, | |||||
}) | }) | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
@@ -470,24 +468,26 @@ saveImageToPhotos: function (tempFilePath) { | |||||
url: `/pages/index/merchantList/index?id=${e.currentTarget.dataset.id}` | url: `/pages/index/merchantList/index?id=${e.currentTarget.dataset.id}` | ||||
}) | }) | ||||
}, | }, | ||||
// onShareAppMessage: function(res) { | |||||
// var that = this; | |||||
// var shareObj = { | |||||
// title: that.data.data.title, | |||||
// path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, | |||||
// success: function(res) { | |||||
// if (res.errMsg == 'shareAppMessage:ok') {} | |||||
// }, | |||||
// fail: function(error) { | |||||
// if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} | |||||
// } | |||||
// }; | |||||
// // 来自页面内的按钮的转发 | |||||
// if (res.from === 'button') { | |||||
// var eData = res.target.dataset.id; | |||||
// shareObj.path = `/pages/index/index?couponChannelId=${eData}`; | |||||
// } | |||||
// // 返回shareObj | |||||
// return shareObj; | |||||
// }, | |||||
onShareAppMessage: function(res) { | |||||
let that = this; | |||||
let shareObj = { | |||||
title: that.data.data.merchantName, | |||||
path: `/pages/index/index?id=${that.data.id}&frommd=md`, | |||||
success: function(res) { | |||||
if (res.errMsg == 'shareAppMessage:ok') {} | |||||
}, | |||||
fail: function(error) { | |||||
if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} | |||||
} | |||||
}; | |||||
// 来自页面内的按钮的转发 | |||||
if (res.from === 'button') { | |||||
console.log(res) | |||||
var eData = res.target.dataset.id; | |||||
console.log(eData) | |||||
shareObj.path = `/pages/index/index?id=${eData}&frommd=md`; | |||||
} | |||||
// 返回shareObj | |||||
return shareObj; | |||||
} | |||||
}) | }) |
@@ -21,7 +21,7 @@ | |||||
<text>{{data.merchantName}}</text> | <text>{{data.merchantName}}</text> | ||||
<text class='title'>{{data.title}}</text> | <text class='title'>{{data.title}}</text> | ||||
</view> | </view> | ||||
<view class='fenxiang' wx:if="{{data.type!=50&&data.type!=51}}" bindtap='showshare'> | |||||
<view class='fenxiang' wx:if="{{data.type!=50&&data.type!=51}}" bindtap='showshare'> | |||||
<image class="fenxiang" src='{{share01}}' mode="widthFix"></image> | <image class="fenxiang" src='{{share01}}' mode="widthFix"></image> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
@@ -105,7 +105,7 @@ | |||||
<view class='modal' wx:if="{{isshare}}" bindtap='hidemodal'> | <view class='modal' wx:if="{{isshare}}" bindtap='hidemodal'> | ||||
<view class='modal-content'> | <view class='modal-content'> | ||||
<view> | <view> | ||||
<button class='share user-motto' data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button> | |||||
<button class='share user-motto' data-id="{{data.id}}" data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button> | |||||
<image src='./../../../../assets/images/wechat.png' mode='aspectFit'></image> | <image src='./../../../../assets/images/wechat.png' mode='aspectFit'></image> | ||||
<text>微信好友</text> | <text>微信好友</text> | ||||
</view> | </view> | ||||
@@ -30,13 +30,13 @@ Page({ | |||||
current: 0, | current: 0, | ||||
stopFees: {}, | stopFees: {}, | ||||
scroll: true, | scroll: true, | ||||
ifHaveCarModular:"", | |||||
ifHaveCarModular: "", | |||||
canIUse: wx.canIUse("navigator") | canIUse: wx.canIUse("navigator") | ||||
}, | }, | ||||
/** | /** | ||||
* 车牌轮播滑动 | * 车牌轮播滑动 | ||||
*/ | */ | ||||
onSlideChangeEnd: function (e) { | |||||
onSlideChangeEnd: function(e) { | |||||
var that = this; | var that = this; | ||||
/** | /** | ||||
* 获得当前的车牌号码 | * 获得当前的车牌号码 | ||||
@@ -52,25 +52,25 @@ Page({ | |||||
that.getStopFee(listCardNum); | that.getStopFee(listCardNum); | ||||
} | } | ||||
}, | }, | ||||
//停车费用为0 | //停车费用为0 | ||||
paySuccess:function(){ | |||||
paySuccess: function() { | |||||
wx.showModal({ | wx.showModal({ | ||||
title: '支付成功', | title: '支付成功', | ||||
content: '请尽快离场', | content: '请尽快离场', | ||||
showCancel:false | |||||
showCancel: false | |||||
}) | }) | ||||
}, | }, | ||||
gotomange: function () { | |||||
gotomange: function() { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/managelicenseplate/managelicenseplate', | url: '/pages/managelicenseplate/managelicenseplate', | ||||
}) | }) | ||||
}, | }, | ||||
bindfail: function (res) { | |||||
bindfail: function(res) { | |||||
console.log(res) | console.log(res) | ||||
}, | }, | ||||
gotoetcp: function () { | |||||
gotoetcp: function() { | |||||
wx.navigateToMiniProgram({ | wx.navigateToMiniProgram({ | ||||
appId: that.data.etcpAppId, | appId: that.data.etcpAppId, | ||||
extraData: this.data.extraData, | extraData: this.data.extraData, | ||||
@@ -78,19 +78,19 @@ Page({ | |||||
path: "pages/main/main", | path: "pages/main/main", | ||||
}) | }) | ||||
}, | }, | ||||
showquan: function () { | |||||
showquan: function() { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/passCar/couponList/couponList', | url: '/pages/passCar/couponList/couponList', | ||||
}) | }) | ||||
}, | }, | ||||
gotodetail: function (e) { | |||||
gotodetail: function(e) { | |||||
wx.showModal({ | wx.showModal({ | ||||
title: '缴费规则', | title: '缴费规则', | ||||
content: e.target.dataset.rule, | content: e.target.dataset.rule, | ||||
showCancel: false, | showCancel: false, | ||||
}) | }) | ||||
}, | }, | ||||
onShow: function (options) { | |||||
onShow: function(options) { | |||||
var that = this; | var that = this; | ||||
that.setData({ | that.setData({ | ||||
etcpAppId: extConfig.attr.etcpAppId, | etcpAppId: extConfig.attr.etcpAppId, | ||||
@@ -132,7 +132,7 @@ Page({ | |||||
}); | }); | ||||
} | } | ||||
}, | }, | ||||
onLoad: function (options) { | |||||
onLoad: function(options) { | |||||
var that = this; | var that = this; | ||||
/** | /** | ||||
* 获得分享小程序的 | * 获得分享小程序的 | ||||
@@ -140,35 +140,35 @@ Page({ | |||||
* desc | * desc | ||||
*/ | */ | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getWeapNote, | |||||
data: { | |||||
appId: config.weapp.AppId, | |||||
} | |||||
}) | |||||
.then(res => { | |||||
let weapNote = JSON.parse(res.data.weapNote); | |||||
that.setData({ | |||||
desc: weapNote.carpage.desc, | |||||
title: weapNote.carpage.title | |||||
url: config.api.getWeapNote, | |||||
data: { | |||||
appId: config.weapp.AppId, | |||||
} | |||||
}) | |||||
.then(res => { | |||||
let weapNote = JSON.parse(res.data.weapNote); | |||||
that.setData({ | |||||
desc: weapNote.carpage.desc, | |||||
title: weapNote.carpage.title | |||||
}) | |||||
}) | |||||
.catch(err => { | |||||
console.log(err); | |||||
}) | }) | ||||
}) | |||||
.catch(err => { | |||||
console.log(err); | |||||
}) | |||||
// 登录 | // 登录 | ||||
var scene = decodeURIComponent(options.scene); | var scene = decodeURIComponent(options.scene); | ||||
that.setData({ | that.setData({ | ||||
scene: scene | scene: scene | ||||
}); | }); | ||||
if (app.globalData.token) { } else { | |||||
if (app.globalData.token) {} else { | |||||
// app.getLocation(); | // app.getLocation(); | ||||
that.userLogin() | that.userLogin() | ||||
} | } | ||||
}, | }, | ||||
/** | /** | ||||
* 用户登录 | |||||
*/ | |||||
userLogin: function () { | |||||
* 用户登录 | |||||
*/ | |||||
userLogin: function() { | |||||
var that = this; | var that = this; | ||||
// 登录 | // 登录 | ||||
wx.login({ | wx.login({ | ||||
@@ -176,7 +176,7 @@ Page({ | |||||
code | code | ||||
}) => { | }) => { | ||||
wx.getSystemInfo({ | wx.getSystemInfo({ | ||||
success: function (res) { | |||||
success: function(res) { | |||||
that.setData({ | that.setData({ | ||||
systemInfo: JSON.stringify(res) | systemInfo: JSON.stringify(res) | ||||
}) | }) | ||||
@@ -201,14 +201,13 @@ Page({ | |||||
}; | }; | ||||
} | } | ||||
Http.post({ | Http.post({ | ||||
url: config.api.login, | |||||
data: usrdata | |||||
}) | |||||
url: config.api.login, | |||||
data: usrdata | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
app.globalData.token = res.data.token; | app.globalData.token = res.data.token; | ||||
Http.setToken(res.data.token); | Http.setToken(res.data.token); | ||||
that.checkUserCarStatus(); | that.checkUserCarStatus(); | ||||
// that.getUserInfo(); | |||||
that.getList(); | that.getList(); | ||||
that.init(); | that.init(); | ||||
that.initUsrCarList(); | that.initUsrCarList(); | ||||
@@ -217,8 +216,7 @@ Page({ | |||||
data: {} | data: {} | ||||
}); | }); | ||||
}) | }) | ||||
.then(res => { | |||||
}) | |||||
.then(res => {}) | |||||
.catch(err => { | .catch(err => { | ||||
if (err.code == 11004) { | if (err.code == 11004) { | ||||
// 用户昵称未授权 | // 用户昵称未授权 | ||||
@@ -237,49 +235,30 @@ Page({ | |||||
}); | }); | ||||
}, | }, | ||||
/** | /** | ||||
* 检查用户是否有车 | |||||
*/ | |||||
checkUserCarStatus: function () { | |||||
* 检查用户是否有车 | |||||
*/ | |||||
checkUserCarStatus: function() { | |||||
var that = this; | var that = this; | ||||
Http.get({ | Http.get({ | ||||
url: config.api.userCarCount, | |||||
data: {} | |||||
}).then(res => { | |||||
if (res.data > 0) { | |||||
// 用户名下有车 | |||||
app.globalData.phone = res.data.phone; | |||||
app.globalData.supportCar = true; | |||||
// 共同登录 | |||||
that.userCarLogin(); | |||||
} | |||||
}) | |||||
.catch(err => { | |||||
url: config.api.userCarCount, | |||||
data: {} | |||||
}).then(res => { | |||||
if (res.data > 0) { | |||||
// 用户名下有车 | |||||
app.globalData.phone = res.data.phone; | |||||
app.globalData.supportCar = true; | |||||
// 共同登录 | |||||
that.userCarLogin(); | |||||
} | |||||
}) | }) | ||||
.catch(err => {}) | |||||
}, | }, | ||||
/** | |||||
* 获取用户信息 | |||||
*/ | |||||
// getUserInfo: function () { | |||||
// // 获取用户信息 | |||||
// wx.getSetting({ | |||||
// success: res => { | |||||
// if (res.authSetting["scope.userInfo"]) { | |||||
// // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||||
// wx.getUserInfo({ | |||||
// success: res => { | |||||
// // 可以将 res 发送给后台解码出 unionId | |||||
// } | |||||
// }); | |||||
// } | |||||
// } | |||||
// }) | |||||
// }, | |||||
jumpToAdd: function () { | |||||
jumpToAdd: function() { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `/pages/addPark/addPark?flags=managepalte` | url: `/pages/addPark/addPark?flags=managepalte` | ||||
}); | }); | ||||
}, | }, | ||||
passc: function () { | |||||
passc: function() { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/ques/ques', | url: '/pages/ques/ques', | ||||
}) | }) | ||||
@@ -289,7 +268,7 @@ Page({ | |||||
/** | /** | ||||
* 券绑定车牌 | * 券绑定车牌 | ||||
*/ | */ | ||||
bindCoupon: function (quanid) { | |||||
bindCoupon: function(quanid) { | |||||
var that = this; | var that = this; | ||||
/** | /** | ||||
* etcp | * etcp | ||||
@@ -307,9 +286,9 @@ Page({ | |||||
}; | }; | ||||
var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; | var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; | ||||
Http.post({ | Http.post({ | ||||
url: config.api.getCarCoupon, | |||||
data: postCouponData | |||||
}) | |||||
url: config.api.getCarCoupon, | |||||
data: postCouponData | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
that.initUsrCarList(); | that.initUsrCarList(); | ||||
}) | }) | ||||
@@ -326,7 +305,7 @@ Page({ | |||||
/** | /** | ||||
* 选择优惠券 | * 选择优惠券 | ||||
*/ | */ | ||||
gotoquan: function () { | |||||
gotoquan: function() { | |||||
let that = this; | let that = this; | ||||
if (that.data.quanid) { | if (that.data.quanid) { | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
@@ -344,17 +323,17 @@ Page({ | |||||
getList() { | getList() { | ||||
var that = this; | var that = this; | ||||
Http.get({ | Http.get({ | ||||
url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 8, | |||||
couponOrderStatus: 0 | |||||
} | |||||
}).then(res => { | |||||
that.setData({ | |||||
couponList: res.data.list | |||||
}); | |||||
}) | |||||
url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 8, | |||||
couponOrderStatus: 0 | |||||
} | |||||
}).then(res => { | |||||
that.setData({ | |||||
couponList: res.data.list | |||||
}); | |||||
}) | |||||
.catch(err => { | .catch(err => { | ||||
console.log(err) | console.log(err) | ||||
}) | }) | ||||
@@ -364,7 +343,7 @@ Page({ | |||||
/** | /** | ||||
* 共同登录 | * 共同登录 | ||||
*/ | */ | ||||
init: function (carNumber) { | |||||
init: function(carNumber) { | |||||
var that = this; | var that = this; | ||||
app.parkInitCallback = token => { | app.parkInitCallback = token => { | ||||
that.initPark(); | that.initPark(); | ||||
@@ -374,9 +353,9 @@ Page({ | |||||
* 判断是否授权手机号 | * 判断是否授权手机号 | ||||
*/ | */ | ||||
Http.get({ | Http.get({ | ||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
Http.post({ | Http.post({ | ||||
url: config.api.carInit, | url: config.api.carInit, | ||||
@@ -426,7 +405,7 @@ Page({ | |||||
} | } | ||||
}, | }, | ||||
bindCar: function (carNum) { | |||||
bindCar: function(carNum) { | |||||
var that = this; | var that = this; | ||||
// ETCP | // ETCP | ||||
var etcpData = { | var etcpData = { | ||||
@@ -438,9 +417,9 @@ Page({ | |||||
}; | }; | ||||
var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; | var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; | ||||
Http.post({ | Http.post({ | ||||
url: config.api.bindCar, | |||||
data: postData | |||||
}) | |||||
url: config.api.bindCar, | |||||
data: postData | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
that.setData({ | that.setData({ | ||||
addCar: null | addCar: null | ||||
@@ -450,7 +429,7 @@ Page({ | |||||
title: "提示", | title: "提示", | ||||
showCancel: false, | showCancel: false, | ||||
content: "绑车牌成功!", | content: "绑车牌成功!", | ||||
success: function () { } | |||||
success: function() {} | |||||
}); | }); | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
@@ -458,19 +437,19 @@ Page({ | |||||
title: "提示", | title: "提示", | ||||
showCancel: false, | showCancel: false, | ||||
content: error.data.message, | content: error.data.message, | ||||
success: function () { } | |||||
success: function() {} | |||||
}); | }); | ||||
}); | }); | ||||
}, | }, | ||||
/** | /** | ||||
* 车场信息获取 | * 车场信息获取 | ||||
*/ | */ | ||||
initPark: function () { | |||||
initPark: function() { | |||||
var that = this; | var that = this; | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getParkInfo, | |||||
data: {} | |||||
}) | |||||
url: config.api.getParkInfo, | |||||
data: {} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
that.setData({ | that.setData({ | ||||
park: res.data | park: res.data | ||||
@@ -490,11 +469,11 @@ Page({ | |||||
/** | /** | ||||
* 车场状态获取 | * 车场状态获取 | ||||
*/ | */ | ||||
getParkStatus: function () { | |||||
getParkStatus: function() { | |||||
var that = this; | var that = this; | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getParkStatus, | |||||
}) | |||||
url: config.api.getParkStatus, | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log(res) | console.log(res) | ||||
}) | }) | ||||
@@ -511,30 +490,30 @@ Page({ | |||||
/** | /** | ||||
* 绑定车获取 | * 绑定车获取 | ||||
*/ | */ | ||||
initUsrCarList: function (flag) { | |||||
initUsrCarList: function(flag) { | |||||
var that = this; | var that = this; | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getUserCarList, | |||||
data: {} | |||||
}).then(res => { | |||||
that.setData({ | |||||
carList: res.data | |||||
}); | |||||
/** | |||||
* flag ==flags | |||||
* 表示从首页onShow进来的 | |||||
*/ | |||||
if (flag == "flags" && res.data.length > 0) { | |||||
var listCardNum = res.data[0].carNumber; | |||||
url: config.api.getUserCarList, | |||||
data: {} | |||||
}).then(res => { | |||||
that.setData({ | that.setData({ | ||||
listCardNum: listCardNum | |||||
}) | |||||
carList: res.data | |||||
}); | |||||
/** | /** | ||||
* 获得停车费用 | |||||
* flag ==flags | |||||
* 表示从首页onShow进来的 | |||||
*/ | */ | ||||
that.getStopFee(listCardNum); | |||||
} | |||||
}) | |||||
if (flag == "flags" && res.data.length > 0) { | |||||
var listCardNum = res.data[0].carNumber; | |||||
that.setData({ | |||||
listCardNum: listCardNum | |||||
}) | |||||
/** | |||||
* 获得停车费用 | |||||
*/ | |||||
that.getStopFee(listCardNum); | |||||
} | |||||
}) | |||||
.catch(err => { | .catch(err => { | ||||
wx.showToast({ | wx.showToast({ | ||||
title: err.message, | title: err.message, | ||||
@@ -548,20 +527,20 @@ Page({ | |||||
/** | /** | ||||
* 获得停车费用修改 | * 获得停车费用修改 | ||||
*/ | */ | ||||
getStopFee: function (carNumber) { | |||||
getStopFee: function(carNumber) { | |||||
let that = this; | let that = this; | ||||
let postData = | let postData = | ||||
app.globalData.parkVendor == 1 ? { | app.globalData.parkVendor == 1 ? { | ||||
etcpToken: app.globalData.etcpToken, | etcpToken: app.globalData.etcpToken, | ||||
carNumber: carNumber | carNumber: carNumber | ||||
} : { | } : { | ||||
carNumber: carNumber, | |||||
outCarId: outCarId | |||||
}; | |||||
carNumber: carNumber, | |||||
outCarId: outCarId | |||||
}; | |||||
Http.post({ | Http.post({ | ||||
url: config.api.getCarStopFee, | |||||
data: postData | |||||
}) | |||||
url: config.api.getCarStopFee, | |||||
data: postData | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log(res) | console.log(res) | ||||
var extraDataStr = { | var extraDataStr = { | ||||
@@ -595,22 +574,22 @@ Page({ | |||||
/** | /** | ||||
* 下拉刷新 | * 下拉刷新 | ||||
*/ | */ | ||||
onPullDownRefresh: function (e) { | |||||
onPullDownRefresh: function(e) { | |||||
let that = this; | let that = this; | ||||
that.initUsrCarList("flags"); | that.initUsrCarList("flags"); | ||||
wx.stopPullDownRefresh(); | wx.stopPullDownRefresh(); | ||||
}, | }, | ||||
// 用户点击右上角分享 | // 用户点击右上角分享 | ||||
onShareAppMessage: function () { | |||||
onShareAppMessage: function() { | |||||
return { | return { | ||||
title: this.data.title, | title: this.data.title, | ||||
desc: this.data.desc, | desc: this.data.desc, | ||||
success: function (res) { | |||||
success: function(res) { | |||||
wx.showToast({ | wx.showToast({ | ||||
title: "分享成功", | title: "分享成功", | ||||
duration: 1000, | duration: 1000, | ||||
icon: "success" | icon: "success" | ||||
}); | |||||
}) | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -13,7 +13,7 @@ | |||||
"checkInvalidKey": true | "checkInvalidKey": true | ||||
}, | }, | ||||
"compileType": "miniprogram", | "compileType": "miniprogram", | ||||
"libVersion": "2.2.0", | |||||
"libVersion": "2.5.0", | |||||
"appid": "wxb11603577a84a86d", | "appid": "wxb11603577a84a86d", | ||||
"projectname": "C%E7%AB%AF%E5%B0%8F%E7%A8%8B%E5%BA%8F", | "projectname": "C%E7%AB%AF%E5%B0%8F%E7%A8%8B%E5%BA%8F", | ||||
"isGameTourist": false, | "isGameTourist": false, | ||||