浏览代码

upload

newCard
HolyKnightIX 2 年前
父节点
当前提交
d58103dc0e
共有 2 个文件被更改,包括 110 次插入74 次删除
  1. +12
    -1
      pages/getphoneInfo/index.js
  2. +98
    -73
      pages/index/searchbar/detail/index.js

+ 12
- 1
pages/getphoneInfo/index.js 查看文件

@@ -14,7 +14,8 @@ Page({
skipUrl: 0,
fillIndentId: "",
couponId: "",
go: ''
go: '',
id: ''
// skip: app.globalData.skip
},
onLoad: function (options) {
@@ -27,6 +28,12 @@ Page({
})
}

if (options.id) {
that.setData({
id: options.id
})
}

if (options.go) {
that.setData({
go: options.go
@@ -232,6 +239,10 @@ Page({
wx.navigateTo({
url: `/pages/exchangeCard/exchangeCard`
})
} else if (that.data.path == 'searchbarDetail') {
wx.navigateTo({
url: `/pages/index/searchbar/detail/index?id=${that.data.id}`
})
} else {
wx.showToast({
title: res.data.msg,


+ 98
- 73
pages/index/searchbar/detail/index.js 查看文件

@@ -35,7 +35,7 @@ Page({
canvasScale: 1.0, // 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图
},
//关闭海报
closePoste: function() {
closePoste: function () {
this.setData({
showpost: false
})
@@ -49,19 +49,20 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
console.log(options, 'options');
let that = this;
that.setData({
goHomeUrl: app.globalData.goHomeUrl,
})
if (options && options.id) {
this.setData({
that.setData({
id: options.id
});
that.getList(options.id);
that.getCouponList(options.id);
this.setData({
that.checkPhoneStatus()
that.setData({
currentTab: 0
})
}
@@ -69,7 +70,7 @@ Page({
/**
* 拨打电话
*/
phone: function(e) {
phone: function (e) {
let that = this;
wx.makePhoneCall({
phoneNumber: e.target.dataset.merchantlinkphone
@@ -78,7 +79,7 @@ Page({
/**
* 显示分享弹框
*/
showshare: function() {
showshare: function () {
this.setData({
isshare: true,
})
@@ -86,13 +87,13 @@ Page({
/**
* 隐藏分享弹框
*/
hidemodal: function() {
hidemodal: function () {
this.setData({
isshare: false,
})
},
//滑动切换
swiperTabView: function(e) {
swiperTabView: function (e) {
this.setData({
currentTab: e.detail.current
});
@@ -106,32 +107,32 @@ Page({
url: `/pages/canvas/index?merchantId=${this.data.id}`
})
}, */
showPoster: function() {
showPoster: function () {
//跳转到海报生成页
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) {
return false;
} else {
@@ -143,7 +144,7 @@ Page({
/**
* 获取商户详情
*/
getList: function(id) {
getList: function (id) {
let that = this;
let data;
data = {
@@ -152,32 +153,32 @@ Page({
id: id
}
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 => {
wx.showToast({
title: err.errMsg,
@@ -191,7 +192,7 @@ Page({
* 获取商户活动信息 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券 100.消费卡)
* 投放频道:(1.列表, 2.限时抢购, 3. banner图 4. 游戏 5.卡频道 6.砍价频道 7.拼团频道 8专题)
*/
getCouponList: function(id) {
getCouponList: function (id) {
let that = this;
let data;
data = {
@@ -201,19 +202,19 @@ Page({
pageSize: 15,
}
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 => {
wx.showToast({
title: err.errMsg,
@@ -226,17 +227,17 @@ Page({
/**
* 获取多商铺列表
*/
onShareAppMessage: function(res) {
onShareAppMessage: function (res) {
app.globalData.previewFlag = true
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') {}
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
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
})
}
})
},
})

正在加载...
取消
保存