@@ -59,6 +59,15 @@ Page({ | |||
}).then( | |||
function (res) { | |||
app.globalData.phone = res.data.phone; | |||
/** | |||
* 来自拼团详情 | |||
*/ | |||
if (that.path == 'spell') { | |||
wx.redirectTo({ | |||
url: "pages/spellGroup/mySpellGroup/index?couponChannelId=" + that.data.paramData.couponChannelId + "&couponId" + that.data.paramData.couponId | |||
}) | |||
return; | |||
} | |||
/** | |||
* fromId若存在来自卡转赠 | |||
*/ | |||
@@ -45,6 +45,15 @@ Page({ | |||
} | |||
}) | |||
.then(res => { | |||
/** | |||
* 来自拼团详情 | |||
*/ | |||
if (that.path == 'spell'){ | |||
wx.redirectTo({ | |||
url: "pages/spellGroup/mySpellGroup/index?couponChannelId=" + that.data.paramData.couponChannelId + "&couponId" + that.data.paramData.couponId | |||
}) | |||
return; | |||
} | |||
if (that.path != 'index'){ | |||
wx.redirectTo({ | |||
url: "/pages/game/index?url=" + that.data.paramData.url + "&id=" + that.data.paramData.id + "&gameId=" + that.data.paramData.gameId, | |||
@@ -8,10 +8,13 @@ Page({ | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
teljpgUrl: imgurl.teljpg.url, | |||
couponChannelId:'', | |||
couponId:'', | |||
detailData:[], | |||
spellData:null | |||
data:[], | |||
spellData:null, | |||
canSpell:true, | |||
canBuyIf:true | |||
}, | |||
/** | |||
@@ -25,6 +28,34 @@ Page({ | |||
this.getDetail(options.couponChannelId); | |||
this.getOneSpell(options.couponId) | |||
}, | |||
/** | |||
* 拨打电话 | |||
*/ | |||
phone: function (e) { | |||
let that = this; | |||
wx.makePhoneCall({ | |||
phoneNumber: e.target.dataset.merchantlinkphone | |||
}); | |||
}, | |||
/** | |||
* 直接购买 | |||
*/ | |||
gotoBuy(){ | |||
console.log(22222) | |||
this.setData({ | |||
canBuyIf: false | |||
}) | |||
}, | |||
/** | |||
* 发起拼团 | |||
*/ | |||
gotoSpell(){ | |||
console.log(111111111) | |||
this.setData({ | |||
canSpell:false | |||
}) | |||
this.orderFunc() | |||
}, | |||
/** | |||
* 获取一个拼团信息 | |||
*/ | |||
@@ -58,10 +89,219 @@ Page({ | |||
data.price = (data.price / 100).toFixed(2) | |||
data.salePrice = (data.salePrice / 100).toFixed(2) | |||
that.setData({ | |||
detailData: data | |||
data | |||
}); | |||
}); | |||
}, | |||
/** | |||
* 发起支付 | |||
*/ | |||
orderFunc(discount) { | |||
var that = this; | |||
Http.post({ | |||
url: config.api.checkPhoneStatus, | |||
data: {} | |||
}) | |||
.then(res => { | |||
/** | |||
* orderSave 下单 | |||
*/ | |||
debugger | |||
// return Http.post({ | |||
// url: config.api.orderSave, | |||
// data: data | |||
// }); | |||
}) | |||
.catch(err => { | |||
console.log(err); | |||
that.setData({ | |||
showbutton: false, | |||
showbutton1: false | |||
}) | |||
if (err.code == 2011) { | |||
wx.showToast({ | |||
title: "商户信息没找到", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 2013) { | |||
wx.showToast({ | |||
title: "商户信息禁用", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 3000) { | |||
wx.showToast({ | |||
title: "库存不足", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 3001) { | |||
wx.showToast({ | |||
title: "超过限购条件", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 3002) { | |||
wx.showToast({ | |||
title: "订单失败", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 3003) { | |||
wx.showToast({ | |||
title: "订单不存在", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 3004) { | |||
wx.showToast({ | |||
title: "订单不存在", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 4003) { | |||
wx.showToast({ | |||
title: "卡券已作废", | |||
image: './../../../assets/images/fail.png', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} else if (err.code == 11005) { | |||
/** | |||
* 将值传到用户手机号授权的页面 | |||
* | |||
*/ | |||
wx.redirectTo({ | |||
url: "/pages/getphoneInfo/index?path=spell&couponChannelId=" + | |||
that.data.couponChannelId + '&couponId=' + that.data.couponId | |||
}); | |||
} else if (err.code == 11006) { | |||
// 用户手机已加密 | |||
wx.redirectTo({ | |||
url: "/pages/phoneinput/phoneinput?path=spell&couponChannelId=" + | |||
that.data.couponChannelId + '&couponId=' + that.data.couponId | |||
}); | |||
} else { | |||
wx.showToast({ | |||
title: err.message, | |||
icon: 'none', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} | |||
}) | |||
.then(res => { | |||
console.log(res) | |||
if (discount != 'discount') { | |||
if (typeof (res) != "undefined") { | |||
let orderId = "" + res.data.id; | |||
that.setData({ | |||
orderId: orderId | |||
}); | |||
if (res.data.payment > 0) { | |||
// 支付金额不为0 | |||
/** | |||
* 支付订单创建 | |||
*/ | |||
Http.post({ | |||
url: config.api.payOrderCreate, | |||
data: { | |||
orderId: orderId | |||
} | |||
}) | |||
.then(res => { | |||
var payOrderId = "" + res.data.payOrderId; | |||
wx.hideLoading(); | |||
wx.requestPayment({ | |||
timeStamp: res.data.timeStamp, | |||
nonceStr: res.data.nonceStr, | |||
package: res.data.package, | |||
signType: (res.data.signType) ? res.data.signType : "MD5", | |||
paySign: res.data.paySign, | |||
success: res => { | |||
wx.showLoading({ | |||
title: '订单正在处理中...', | |||
}) | |||
setTimeout(function () { | |||
wx.hideLoading() | |||
}, 5000) | |||
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that); | |||
if (res.errMsg == "requestPayment:ok") { | |||
setTimeout(function () { | |||
wx.hideLoading(); | |||
}, 2000); | |||
/** | |||
* 用户支付成功以后跳转到券包列表 | |||
*/ | |||
if (that.data.cardType == 100) { | |||
wx.setStorage({ | |||
key: 'couponNum2', | |||
data: "couponNum2" | |||
}) | |||
} else if (that.data.data.type != 5) { | |||
wx.setStorage({ | |||
key: 'couponNum', | |||
data: "couponNum" | |||
}) | |||
} | |||
} | |||
}, | |||
fail: res => { | |||
/** | |||
* 支付失败,需要更新订单的状态 | |||
*/ | |||
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that); | |||
that.setData({ | |||
showbutton: false | |||
}) | |||
return; | |||
}, | |||
complete: res => { } | |||
}); | |||
/// End payment -------- | |||
}) | |||
.catch(err => { | |||
wx.showToast({ | |||
title: err.message, | |||
icon: 'none', | |||
duration: 2000, | |||
mask: false | |||
}); | |||
}) | |||
} else { | |||
console.log(that.data.type) | |||
// 免费券 | |||
that.payOrderUpdate(orderId, "0", 1, '', 'free'); | |||
if (that.data.cardType == 100) { | |||
wx.setStorage({ | |||
key: 'couponNum2', | |||
data: "couponNum2" | |||
}) | |||
} else if (that.data.data.type != "5") { | |||
wx.setStorage({ | |||
key: 'couponNum', | |||
data: "couponNum" | |||
}) | |||
} | |||
} | |||
} | |||
} else { | |||
if (res) { | |||
wx.navigateTo({ | |||
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`, | |||
}) | |||
} | |||
} | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
@@ -73,7 +313,10 @@ Page({ | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
this.setData({ | |||
canSpell:true, | |||
canBuyIf:true | |||
}) | |||
}, | |||
/** | |||
@@ -102,12 +345,5 @@ Page({ | |||
*/ | |||
onReachBottom: function () { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage: function () { | |||
} | |||
}) |
@@ -1,14 +1,14 @@ | |||
<view class="content-box"> | |||
<view class='content'> | |||
<view class='top-img'> | |||
<image src='{{detailData.coverImg}}'></image> | |||
<image src='{{data.coverImg}}'></image> | |||
</view> | |||
<view class='title'>{{detailData.title}}</view> | |||
<view class='title'>{{data.title}}</view> | |||
<view class='text'> | |||
<view class='remark'>{{detailData.subTitle}}</view> | |||
<view class='remark'>{{data.subTitle}}</view> | |||
<view class='des'> | |||
<view class='des-peoplenum'>【拼团购】{{detailData.pressLimitNum}}人拼团成功,单价仅需</view> | |||
<view class='des-saleprice'>{{detailData.salePriceStr}}元</view> | |||
<view class='des-peoplenum'>【拼团购】{{data.pressLimitNum}}人拼团成功,单价仅需</view> | |||
<view class='des-saleprice'>{{data.salePriceStr}}元</view> | |||
</view> | |||
<view class='status'> | |||
<view class='status01 st'> | |||
@@ -26,19 +26,33 @@ | |||
</view> | |||
<view class='p-des'> | |||
<view class='p-title'>商品详情:</view> | |||
<view class='p-list'>{{detailData.remark}}</view> | |||
<view class='p-list'>{{data.remark}}</view> | |||
</view> | |||
<view class='posi'> | |||
<view class='applyshop'>适用门店</view> | |||
<view class='posi_logo' wx:for="{{data.merchantVoList}}" wx:key="index"> | |||
<view> | |||
<image src='{{item.merchantImgUrl}}'></image> | |||
</view> | |||
<view> | |||
<text>{{item.merchantName}}</text> | |||
<text>{{item.addr}}{{item.buildingName}}{{item.floorName}}</text> | |||
</view> | |||
<image bindtap='phone' data-merchantLinkPhone='{{item.merchantLinkPhone}}' class="tel" src="{{teljpgUrl}}" mode="widthFix" /> | |||
</view> | |||
</view> | |||
<view class='edit'> | |||
<view class='edit-left'> | |||
<view class='edit-left' bindtap='{{canBuyIf?"gotoBuy":""}}'> | |||
<view class='edit-left-top'> | |||
<view class='price'>{{detailData.price}}</view> | |||
<view class='price'>{{data.price}}</view> | |||
<view class='price-unit'>元</view> | |||
</view> | |||
<view class='edit-left-bottom'>立即购买</view> | |||
</view> | |||
<view class='edit-right'> | |||
<!-- <button class='edit-right' id="shareBtn" open-type="share"></button> --> | |||
<view class='edit-right' bindtap='{{canSpell?"gotoSpell":""}}'> | |||
<view class='edit-right-top'> | |||
<view class='real-price'>{{detailData.salePrice}}</view> | |||
<view class='real-price'>{{data.salePrice}}</view> | |||
<view class='real-price-unit'>元</view> | |||
</view> | |||
<view class='edit-right-bottom'>发起拼团</view> | |||
@@ -171,6 +171,7 @@ | |||
float: right; | |||
width: 330rpx; | |||
height: 95rpx; | |||
line-height: 46rpx; | |||
background:linear-gradient(90deg,rgba(236,59,45,1) 0%,rgba(248,98,52,1) 100%); | |||
box-shadow:0px 8rpx 8rpx 1rpx rgba(246,93,51,0.32); | |||
border-radius:48rpx; | |||
@@ -207,17 +208,16 @@ | |||
} | |||
.edit-right-top{ | |||
height: 46rpx; | |||
line-height: 32rpx; | |||
text-align: center; | |||
margin-top: 13rpx; | |||
} | |||
.real-price{ | |||
display: inline; | |||
font-size:32rpx; | |||
line-height: 32rpx; | |||
font-family:PingFang-SC-Medium; | |||
font-weight:500; | |||
color:rgba(254,254,254,1); | |||
margin-top: 6rpx; | |||
} | |||
.real-price-unit{ | |||
display: inline; | |||
@@ -235,4 +235,85 @@ | |||
font-family:PingFang-SC-Medium; | |||
font-weight:500; | |||
color:rgba(254,254,254,1); | |||
} | |||
.posi { | |||
position: relative; | |||
} | |||
.applyshop{ | |||
font-size:32rpx; | |||
font-family:PingFang-SC-Bold; | |||
font-weight:bold; | |||
color:rgba(51,51,51,1); | |||
margin: 10rpx 0 20rpx 0; | |||
} | |||
.posi>view:nth-child(2) { | |||
width: 100%; | |||
height: 87rpx; | |||
display: flex; | |||
justify-content: space-between; | |||
line-height: 87rpx; | |||
} | |||
.posi>view:nth-child(2) text:nth-child(1) { | |||
font-size: 30rpx; | |||
color: #a9a9a9; | |||
} | |||
.posi>view:nth-child(2) text:nth-child(2) { | |||
font-size: 30rpx; | |||
color: #a9a9a9; | |||
} | |||
.posi_logo { | |||
width: 100%; | |||
display: flex; | |||
padding: 20rpx 0; | |||
background: #fff; | |||
height: 100rpx; | |||
margin-bottom: 20rpx; | |||
} | |||
.posi_logo view:nth-child(1) { | |||
width: 100rpx; | |||
height: 100rpx; | |||
border-radius: 16rpx; | |||
} | |||
.posi_logo view:nth-child(1) image { | |||
display: block; | |||
width: 100rpx; | |||
height: 100rpx; | |||
border-radius: 16rpx; | |||
border: 1px solid #e5e5e5; | |||
} | |||
.posi_logo view:nth-child(2) { | |||
display: flex; | |||
flex-direction: column; | |||
flex: 8; | |||
padding-left: 30rpx; | |||
} | |||
.posi_logo view:nth-child(2) text:nth-child(1) { | |||
font-size: 32rpx; | |||
color: #333; | |||
letter-spacing: 0; | |||
} | |||
.posi_logo view:nth-child(2) text:nth-child(2) { | |||
font-size: 24rpx; | |||
color: #b8b8b8; | |||
padding-top: 3rpx; | |||
width: 450rpx; | |||
height: 36rpx; | |||
overflow: hidden; | |||
} | |||
.tel { | |||
right: 0; | |||
top: 0; | |||
bottom: 0; | |||
margin: auto; | |||
width: 50rpx; | |||
height: 50rpx; | |||
} |