|
@@ -35,7 +35,7 @@ Page({ |
|
|
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({ |
|
|
showpost: false |
|
|
showpost: false |
|
|
}) |
|
|
}) |
|
@@ -49,19 +49,20 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面加载 |
|
|
* 生命周期函数--监听页面加载 |
|
|
*/ |
|
|
*/ |
|
|
onLoad: function(options) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onLoad: function (options) { |
|
|
|
|
|
console.log(options, 'options'); |
|
|
let that = this; |
|
|
let that = this; |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
goHomeUrl: app.globalData.goHomeUrl, |
|
|
goHomeUrl: app.globalData.goHomeUrl, |
|
|
}) |
|
|
}) |
|
|
if (options && options.id) { |
|
|
if (options && options.id) { |
|
|
this.setData({ |
|
|
|
|
|
|
|
|
that.setData({ |
|
|
id: options.id |
|
|
id: options.id |
|
|
}); |
|
|
}); |
|
|
that.getList(options.id); |
|
|
that.getList(options.id); |
|
|
that.getCouponList(options.id); |
|
|
that.getCouponList(options.id); |
|
|
this.setData({ |
|
|
|
|
|
|
|
|
that.checkPhoneStatus() |
|
|
|
|
|
that.setData({ |
|
|
currentTab: 0 |
|
|
currentTab: 0 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
@@ -69,7 +70,7 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 拨打电话 |
|
|
* 拨打电话 |
|
|
*/ |
|
|
*/ |
|
|
phone: function(e) { |
|
|
|
|
|
|
|
|
phone: function (e) { |
|
|
let that = this; |
|
|
let that = this; |
|
|
wx.makePhoneCall({ |
|
|
wx.makePhoneCall({ |
|
|
phoneNumber: e.target.dataset.merchantlinkphone |
|
|
phoneNumber: e.target.dataset.merchantlinkphone |
|
@@ -78,7 +79,7 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 显示分享弹框 |
|
|
* 显示分享弹框 |
|
|
*/ |
|
|
*/ |
|
|
showshare: function() { |
|
|
|
|
|
|
|
|
showshare: function () { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
isshare: true, |
|
|
isshare: true, |
|
|
}) |
|
|
}) |
|
@@ -86,13 +87,13 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 隐藏分享弹框 |
|
|
* 隐藏分享弹框 |
|
|
*/ |
|
|
*/ |
|
|
hidemodal: function() { |
|
|
|
|
|
|
|
|
hidemodal: function () { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
isshare: false, |
|
|
isshare: false, |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//滑动切换 |
|
|
//滑动切换 |
|
|
swiperTabView: function(e) { |
|
|
|
|
|
|
|
|
swiperTabView: function (e) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
currentTab: e.detail.current |
|
|
currentTab: e.detail.current |
|
|
}); |
|
|
}); |
|
@@ -106,32 +107,32 @@ Page({ |
|
|
url: `/pages/canvas/index?merchantId=${this.data.id}` |
|
|
url: `/pages/canvas/index?merchantId=${this.data.id}` |
|
|
}) |
|
|
}) |
|
|
}, */ |
|
|
}, */ |
|
|
showPoster: function() { |
|
|
|
|
|
|
|
|
showPoster: function () { |
|
|
//跳转到海报生成页 |
|
|
//跳转到海报生成页 |
|
|
let that = this; |
|
|
let that = this; |
|
|
Http.get({ |
|
|
|
|
|
url: config.api.checkUserStatus, |
|
|
|
|
|
data: { |
|
|
|
|
|
token: app.globalData.token |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: `/pages/canvas/index?merchantId=${that.data.id}` |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
if (err.code == 11004) { |
|
|
|
|
|
// 用户昵称未授权 |
|
|
|
|
|
wx.redirectTo({ |
|
|
|
|
|
url: `/pages/getuserinfo/index?couponChannelId=${that.data.id}&fromflag=poster` |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Http.get({ |
|
|
|
|
|
url: config.api.checkUserStatus, |
|
|
|
|
|
data: { |
|
|
|
|
|
token: app.globalData.token |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: `/pages/canvas/index?merchantId=${that.data.id}` |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
if (err.code == 11004) { |
|
|
|
|
|
// 用户昵称未授权 |
|
|
|
|
|
wx.redirectTo({ |
|
|
|
|
|
url: `/pages/getuserinfo/index?couponChannelId=${that.data.id}&fromflag=poster` |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
//点击切换 |
|
|
//点击切换 |
|
|
clickTab: function(e) { |
|
|
|
|
|
|
|
|
clickTab: function (e) { |
|
|
if (this.data.currentTab === e.target.dataset.current) { |
|
|
if (this.data.currentTab === e.target.dataset.current) { |
|
|
return false; |
|
|
return false; |
|
|
} else { |
|
|
} else { |
|
@@ -143,7 +144,7 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 获取商户详情 |
|
|
* 获取商户详情 |
|
|
*/ |
|
|
*/ |
|
|
getList: function(id) { |
|
|
|
|
|
|
|
|
getList: function (id) { |
|
|
let that = this; |
|
|
let that = this; |
|
|
let data; |
|
|
let data; |
|
|
data = { |
|
|
data = { |
|
@@ -152,32 +153,32 @@ Page({ |
|
|
id: id |
|
|
id: id |
|
|
} |
|
|
} |
|
|
Http.get({ |
|
|
Http.get({ |
|
|
url: config.api.merchantList, |
|
|
|
|
|
data: data |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.data.list.length==0){ |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: '此商户已经停用', |
|
|
|
|
|
confirmText: "返回", |
|
|
|
|
|
showCancel:false, |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
wx.navigateBack({ |
|
|
|
|
|
url: '/index/searchbar', |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
url: config.api.merchantList, |
|
|
|
|
|
data: data |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.data.list.length == 0) { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: '此商户已经停用', |
|
|
|
|
|
confirmText: "返回", |
|
|
|
|
|
showCancel: false, |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
wx.navigateBack({ |
|
|
|
|
|
url: '/index/searchbar', |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
let imgList = []; |
|
|
|
|
|
imgList.push(res.data.list[0].merchantImgUrl) |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
data: res.data.list[0], |
|
|
|
|
|
shopVoList: res.data.list[0].shopVoList, |
|
|
|
|
|
imglist: res.data.list[0].coverPicture == '[]' ? imgList : JSON.parse(res.data.list[0].coverPicture), |
|
|
|
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
let imgList = []; |
|
|
|
|
|
imgList.push(res.data.list[0].merchantImgUrl) |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
data: res.data.list[0], |
|
|
|
|
|
shopVoList: res.data.list[0].shopVoList, |
|
|
|
|
|
imglist: res.data.list[0].coverPicture == '[]' ? imgList : JSON.parse(res.data.list[0].coverPicture), |
|
|
}) |
|
|
}) |
|
|
|
|
|
}) |
|
|
.catch(err => { |
|
|
.catch(err => { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: err.errMsg, |
|
|
title: err.errMsg, |
|
@@ -191,7 +192,7 @@ Page({ |
|
|
* 获取商户活动信息 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券 100.消费卡) |
|
|
* 获取商户活动信息 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券 100.消费卡) |
|
|
* 投放频道:(1.列表, 2.限时抢购, 3. banner图 4. 游戏 5.卡频道 6.砍价频道 7.拼团频道 8专题) |
|
|
* 投放频道:(1.列表, 2.限时抢购, 3. banner图 4. 游戏 5.卡频道 6.砍价频道 7.拼团频道 8专题) |
|
|
*/ |
|
|
*/ |
|
|
getCouponList: function(id) { |
|
|
|
|
|
|
|
|
getCouponList: function (id) { |
|
|
let that = this; |
|
|
let that = this; |
|
|
let data; |
|
|
let data; |
|
|
data = { |
|
|
data = { |
|
@@ -201,19 +202,19 @@ Page({ |
|
|
pageSize: 15, |
|
|
pageSize: 15, |
|
|
} |
|
|
} |
|
|
Http.post({ |
|
|
Http.post({ |
|
|
url: config.api.listByMerchant, |
|
|
|
|
|
data: data |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
couponList: res.data.page.list, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// if (res.data && res.data.qrCode){ |
|
|
|
|
|
// that.setData({ |
|
|
|
|
|
// qrCode: res.data.qrCode, |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
url: config.api.listByMerchant, |
|
|
|
|
|
data: data |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
couponList: res.data.page.list, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// if (res.data && res.data.qrCode){ |
|
|
|
|
|
// that.setData({ |
|
|
|
|
|
// qrCode: res.data.qrCode, |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
}) |
|
|
.catch(err => { |
|
|
.catch(err => { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: err.errMsg, |
|
|
title: err.errMsg, |
|
@@ -226,17 +227,17 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 获取多商铺列表 |
|
|
* 获取多商铺列表 |
|
|
*/ |
|
|
*/ |
|
|
onShareAppMessage: function(res) { |
|
|
|
|
|
|
|
|
onShareAppMessage: function (res) { |
|
|
app.globalData.previewFlag = true |
|
|
app.globalData.previewFlag = true |
|
|
let that = this; |
|
|
let that = this; |
|
|
let shareObj = { |
|
|
let shareObj = { |
|
|
title: that.data.data.merchantName, |
|
|
title: that.data.data.merchantName, |
|
|
path: `/pages/index/index?id=${that.data.id}&frommd=md`, |
|
|
path: `/pages/index/index?id=${that.data.id}&frommd=md`, |
|
|
success: function(res) { |
|
|
|
|
|
if (res.errMsg == 'shareAppMessage:ok') {} |
|
|
|
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
if (res.errMsg == 'shareAppMessage:ok') { } |
|
|
}, |
|
|
}, |
|
|
fail: function(error) { |
|
|
|
|
|
if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} |
|
|
|
|
|
|
|
|
fail: function (error) { |
|
|
|
|
|
if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
// 来自页面内的按钮的转发 |
|
|
// 来自页面内的按钮的转发 |
|
@@ -248,5 +249,29 @@ Page({ |
|
|
} |
|
|
} |
|
|
// 返回shareObj |
|
|
// 返回shareObj |
|
|
return shareObj; |
|
|
return shareObj; |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 检查用户登录状态 |
|
|
|
|
|
checkPhoneStatus() { |
|
|
|
|
|
let that = this; |
|
|
|
|
|
Http.get({ |
|
|
|
|
|
url: config.api.checkPhoneStatus, |
|
|
|
|
|
}) |
|
|
|
|
|
.then(res => { |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
if (err.code == 11005) { |
|
|
|
|
|
// 手机号没有授权,将值传到用户手机号授权的页面 |
|
|
|
|
|
wx.redirectTo({ |
|
|
|
|
|
url: "/pages/getphoneInfo/index?path=searchbarDetail", |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: err.message, |
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
duration: 2500 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
}) |
|
|
}) |