@@ -15,7 +15,6 @@ Page({ | |||
close02: imgurl.close02.url, | |||
share01: imgurl.share01.url, | |||
fail: imgurl.fail.url, | |||
share01: imgurl.share01.url, | |||
wmhome: imgurl.wmhome.url, | |||
hidden: "hidden", | |||
height: "", | |||
@@ -856,6 +855,7 @@ Page({ | |||
}, | |||
onShareAppMessage: function(options) { | |||
var that = this; | |||
console.log(options) | |||
var shareObj = { | |||
title: that.data.data.title, | |||
path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, | |||
@@ -13,6 +13,17 @@ Page({ | |||
}, | |||
onLoad: function(options) { | |||
var that = this; | |||
console.log(options) | |||
debugger | |||
if (options && options.spellGroup){ | |||
that.setData({ | |||
spellGroup: options.spellGroup | |||
}) | |||
}else{ | |||
that.setData({ | |||
spellGroup: null | |||
}) | |||
} | |||
if (options.couponChannelId && !options.cuserId||options.orderId) { | |||
that.setData({ | |||
couponChannelId: options.couponChannelId, | |||
@@ -89,17 +100,17 @@ Page({ | |||
}); | |||
} else { | |||
//返回主页 | |||
if (that.data.couponChannelId && !that.data.cuserId||that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') { | |||
if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup||that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') { | |||
// 跳转普通券/消费卡/限时秒杀/砍价详情 | |||
wx.navigateTo({ | |||
url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}` | |||
}); | |||
} else if (that.data.couponChannelId && that.data.cuserId) { | |||
} else if (that.data.couponChannelId && that.data.cuserId && !that.data.spellGroup) { | |||
// 来自转赠 | |||
wx.reLaunch({ | |||
url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}&couponOrderId=${that.data.couponOrderId}&updateDate=${that.data.updateDate}` | |||
}); | |||
} else if (that.data.couponChannelId && app.globalData.type == 'sd') { | |||
} else if (that.data.couponChannelId && app.globalData.type == 'sd' || that.data.couponChannelId && that.data.spellGroup) { | |||
// 拼团详情页 | |||
wx.redirectTo({ | |||
url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}`, | |||
@@ -106,7 +106,7 @@ Page({ | |||
return; | |||
} | |||
else if (options && options.couponChannelId) { | |||
else if (options && options.couponChannelId && !options.spellGroup) { | |||
// 转赠判断 | |||
if (options.cuserId){ | |||
wx.redirectTo({ | |||
@@ -120,7 +120,7 @@ Page({ | |||
} | |||
} | |||
// 拼团详情页(只有通过扫码进入才可能进入拼团详情页面,只有这一个入口) | |||
else if (options && options.couponChannelId && app.globalData.type == 'sd') { | |||
else if (options && options.couponChannelId && app.globalData.type == 'sd' || options && options.couponChannelId && options.spellGroup) { | |||
wx.redirectTo({ | |||
url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}`, | |||
}) | |||
@@ -272,10 +272,19 @@ Page({ | |||
}) | |||
return; | |||
} | |||
if (options && options.couponChannelId && !options.cuserId) { | |||
/** | |||
* spellGroup | |||
* 区分是通过拼团详情分享过来的还是从普通券分享过来的 | |||
* 注意:拼团券和普通券是两个页面 | |||
*/ | |||
if (options && options.couponChannelId && !options.cuserId && !options.spellGroup) { | |||
wx.redirectTo({ | |||
url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}` | |||
}); | |||
} else if (options && options.couponChannelId && !options.cuserId && options.spellGroup) { | |||
wx.redirectTo({ | |||
url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}&spellGroup=${options.spellGroup}` | |||
}); | |||
} else if (options && options.couponChannelId && options.cuserId) { | |||
/** | |||
* 转赠判断 | |||
@@ -263,45 +263,11 @@ Page({ | |||
}); | |||
}); | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload: function () { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh: function () { | |||
this.getDetail(this.data.paramData.couponChannelId); | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom: function () { | |||
} | |||
}) |
@@ -11,6 +11,7 @@ Page({ | |||
data: { | |||
teljpgUrl: imgurl.teljpg.url, | |||
wmhome: imgurl.wmhome.url, | |||
share01: imgurl.share01.url, | |||
couponChannelId: '', | |||
couponId: '', | |||
data: null, | |||
@@ -184,7 +185,7 @@ Page({ | |||
wx.stopPullDownRefresh(); | |||
let data = res.data; | |||
wx.setNavigationBarTitle({ | |||
title: res.data.title | |||
title: res.data.title | |||
}) | |||
data.price = (data.price / 100).toFixed(2) | |||
data.salePrice = (data.salePrice / 100).toFixed(2); | |||
@@ -202,21 +203,21 @@ Page({ | |||
let that = this; | |||
// 支付成功 | |||
Http.post({ | |||
url: config.api.toOrderGroup, | |||
data: { | |||
id: orderGroupId, | |||
orderId, | |||
couponId: _this.data.data.couponId | |||
} | |||
}) | |||
.then(res => { | |||
wx.navigateTo({ | |||
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.data.couponId}&orderGroupId=${res.data.orderGroupId}&couponChannelId=${_this.data.couponChannelId}` | |||
}); | |||
}) | |||
.catch(err => { | |||
console.log(err); | |||
}) | |||
url: config.api.toOrderGroup, | |||
data: { | |||
id: orderGroupId, | |||
orderId, | |||
couponId: _this.data.data.couponId | |||
} | |||
}) | |||
.then(res => { | |||
wx.navigateTo({ | |||
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.data.couponId}&orderGroupId=${res.data.orderGroupId}&couponChannelId=${_this.data.couponChannelId}` | |||
}); | |||
}) | |||
.catch(err => { | |||
console.log(err); | |||
}) | |||
}, | |||
/** | |||
* 支付订单更新 | |||
@@ -226,31 +227,31 @@ Page({ | |||
let that = this; | |||
// 支付成功 | |||
Http.post({ | |||
url: config.api.payOrderUpdate, | |||
data: { | |||
payOrderId: payOrderId, | |||
orderId: orderId, | |||
status: status, | |||
reason: reason | |||
} | |||
}) | |||
.then(res => { | |||
wx.hideLoading() | |||
if (orderGroupId == undefined) { | |||
wx.navigateTo({ | |||
url: '/pages/order/detail/index?orderId=' + res.data.id, | |||
}) | |||
} else { | |||
_this.goToOrderGroup(orderId, res.data.orderGroupId, _this) | |||
} | |||
}) | |||
.catch(err => { | |||
if (err.code != 12002) { | |||
setTimeout(function() { | |||
_this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId); | |||
}, 2000) | |||
} | |||
}) | |||
url: config.api.payOrderUpdate, | |||
data: { | |||
payOrderId: payOrderId, | |||
orderId: orderId, | |||
status: status, | |||
reason: reason | |||
} | |||
}) | |||
.then(res => { | |||
wx.hideLoading() | |||
if (orderGroupId == undefined) { | |||
wx.navigateTo({ | |||
url: '/pages/order/detail/index?orderId=' + res.data.id, | |||
}) | |||
} else { | |||
_this.goToOrderGroup(orderId, res.data.orderGroupId, _this) | |||
} | |||
}) | |||
.catch(err => { | |||
if (err.code != 12002) { | |||
setTimeout(function() { | |||
_this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId); | |||
}, 2000) | |||
} | |||
}) | |||
}, | |||
/** | |||
* 发起支付 | |||
@@ -345,12 +346,12 @@ Page({ | |||
duration: 2000, | |||
mask: false | |||
}); | |||
}else if (err.code == 3012) { | |||
} else if (err.code == 3012) { | |||
wx.showModal({ | |||
title: '提示', | |||
content: '您有未支付订单,请先进行支付', | |||
confirmText: "去支付", | |||
success: function (res) { | |||
success: function(res) { | |||
console.log(res.confirm) | |||
if (res.confirm) { | |||
wx.navigateTo({ | |||
@@ -500,4 +501,25 @@ Page({ | |||
that.getDetail(that.data.couponChannelId); | |||
that.getOneSpell(that.data.couponId) | |||
}, | |||
onShareAppMessage: function (options) { | |||
console.log(options) | |||
var that = this; | |||
var shareObj = { | |||
title: that.data.data.title, | |||
path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}&spellGroup=spellGroup`, | |||
success: function (res) { | |||
if (res.errMsg == 'shareAppMessage:ok') { } | |||
}, | |||
fail: function (error) { | |||
if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } | |||
} | |||
}; | |||
// 来自页面内的按钮的转发 | |||
if (options.from == 'button') { | |||
var eData = options.target.dataset.id; | |||
shareObj.path = `/pages/index/index?couponChannelId=${eData}&spellGroup=spellGroup`; | |||
} | |||
// 返回shareObj | |||
return shareObj; | |||
}, | |||
}) |
@@ -6,6 +6,10 @@ | |||
<view class='title'>{{data.title}}</view> | |||
<view class='text'> | |||
<view class='remark'>{{data.subTitle}}</view> | |||
<view class='fenxiang' wx:if="{{data.type!=50&&data.type!=51}}"> | |||
<image class="fenxiang" src='{{share01}}' mode="widthFix"></image> | |||
<button class='share user-motto' data-id='{{data.id}}' data-couponId='{{data.couponId}}' data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button> | |||
</view> | |||
<view class='des'> | |||
<view class='des-peoplenum'>【拼团购】{{data.pressLimitNum}}人拼团成功,单价仅需</view> | |||
<view class='des-saleprice'>{{data.salePriceStr}}元</view> | |||
@@ -44,6 +44,7 @@ button::after{ border: none; } | |||
padding-bottom: 130rpx; | |||
} | |||
.text{ | |||
position: relative; | |||
padding: 0 30rpx; | |||
} | |||
.title{ | |||
@@ -218,13 +219,11 @@ button::after{ border: none; } | |||
font-family:PingFang-SC-Medium; | |||
font-weight:500; | |||
color:rgba(254,254,254,1); | |||
margin-top: 6rpx; | |||
} | |||
.price-unit{ | |||
display: inline; | |||
font-size:27rpx; | |||
line-height: 27rpx; | |||
margin-top: 11rpx; | |||
font-family:PingFang-SC-Medium; | |||
font-weight:500; | |||
color:rgba(254,254,254,1); | |||
@@ -394,4 +393,28 @@ button::after{ border: none; } | |||
color: #fff; | |||
font-weight: bold; | |||
background: #ff4949; | |||
} | |||
} | |||
.fenxiang { | |||
position:absolute; | |||
right:28rpx; | |||
top:-27rpx; | |||
width:108rpx; | |||
z-index:1000; | |||
} | |||
.fenxiang image { | |||
width: 108rpx; | |||
position: absolute; | |||
top: 0; | |||
right: 0; | |||
z-index: 10; | |||
} | |||
.user-motto { | |||
position: relative; | |||
z-index: 100; | |||
width:118rpx; | |||
border:0; | |||
background:none; | |||
height:60rpx; | |||
color:#fff; | |||
} |