[更新]
This commit is contained in:
@@ -24,6 +24,7 @@ Page({
|
||||
remark : '', //使用须知
|
||||
score : '', //应付总积分
|
||||
freight : '', //运费
|
||||
welfareType : '', //权益类型
|
||||
noticeShow : false, //须知显示状态
|
||||
addressShow : false, //收货地址显示
|
||||
payWayIndex : 0,
|
||||
@@ -84,6 +85,7 @@ Page({
|
||||
amount : res.data.total,
|
||||
moreAmount : res.data.amount,
|
||||
score : res.data.score,
|
||||
welfareType : res.data.type,
|
||||
remark : res.data.detail.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
|
||||
content : res.data.detail.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
})
|
||||
@@ -157,6 +159,13 @@ Page({
|
||||
* 商品数量加减
|
||||
*/
|
||||
goodsNumber(e){
|
||||
if(this.data.welfareType == 'welfare') {
|
||||
wx.showToast({
|
||||
title : '抱歉,只能购买一张',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
let num = this.data.num
|
||||
if (e.currentTarget.dataset.type == 'plus'){
|
||||
num ++;
|
||||
@@ -207,93 +216,86 @@ Page({
|
||||
|
||||
wx.$api.user.washcarCreate(welfare_id, right_id, qty, address_id, is_deliver).then(res=>{
|
||||
let dataUrl = '', //定义接口来源名称
|
||||
type = res.data.type //订单来源
|
||||
Newtype = res.data.type //订单来源
|
||||
|
||||
// welfare为福利活动购买
|
||||
if(type == 'welfare') dataUrl = wx.$api.index.fridayInfo(welfare_id, address_id, is_deliver)
|
||||
if(Newtype == 'welfare') dataUrl = wx.$api.index.fridayPay(res.data.trade_no)
|
||||
|
||||
// right为权益购买
|
||||
if(type == 'right') dataUrl = wx.$api.index.rightStore(right_id, address_id, is_deliver, qty)
|
||||
if(Newtype == 'right') dataUrl = wx.$api.index.wechat(res.data.trade_no)
|
||||
|
||||
// 第一步接口调取
|
||||
dataUrl.then(dataRes=>{
|
||||
let payUrl = '', //定义接口来源名称
|
||||
Newtype = dataRes.data.type //订单来源
|
||||
// welfare为福利活动购买
|
||||
if(Newtype == 'welfare') payUrl = wx.$api.index.fridayPay(dataRes.data.trade_no)
|
||||
|
||||
// right为权益购买
|
||||
if(Newtype == 'right') payUrl = wx.$api.index.wechat(dataRes.data.trade_no)
|
||||
|
||||
// 第一步接口调取
|
||||
payUrl.then(payEes=>{
|
||||
let payInfo = JSON.parse(payEes.data)
|
||||
wx.requestPayment({
|
||||
timeStamp: payInfo.timeStamp,
|
||||
nonceStr : payInfo.nonceStr,
|
||||
package : payInfo.package,
|
||||
paySign : payInfo.paySign,
|
||||
signType : payInfo.signType,
|
||||
success : res=>{
|
||||
if(res.errMsg == "requestPayment:ok"){
|
||||
wx.showToast({
|
||||
title: '支付成功',
|
||||
icon : 'success'
|
||||
})
|
||||
if(Newtype == 'welfare'){
|
||||
setTimeout(()=>{
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfareGoods'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfare'
|
||||
})
|
||||
}
|
||||
},3000)
|
||||
}
|
||||
if(Newtype == 'right'){
|
||||
setTimeout(()=>{
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rightsCoupons'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rights'
|
||||
})
|
||||
}
|
||||
},3000)
|
||||
}
|
||||
}
|
||||
},
|
||||
fail : res=>{
|
||||
dataUrl.then(payEes=>{
|
||||
let payInfo = JSON.parse(payEes.data)
|
||||
wx.requestPayment({
|
||||
timeStamp: payInfo.timeStamp,
|
||||
nonceStr : payInfo.nonceStr,
|
||||
package : payInfo.package,
|
||||
paySign : payInfo.paySign,
|
||||
signType : payInfo.signType,
|
||||
success : res=>{
|
||||
if(res.errMsg == "requestPayment:ok"){
|
||||
wx.showToast({
|
||||
title: '支付成功',
|
||||
icon : 'success'
|
||||
})
|
||||
if(Newtype == 'welfare'){
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfareGoods&stateType=unpay'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfare&stateType=unpay'
|
||||
})
|
||||
}
|
||||
setTimeout(()=>{
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfareGoods'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfare'
|
||||
})
|
||||
}
|
||||
},3000)
|
||||
}
|
||||
if(Newtype == 'right'){
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rightsCoupons&stateType=unpay'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rights&stateType=unpay'
|
||||
})
|
||||
}
|
||||
setTimeout(()=>{
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rightsCoupons'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rights'
|
||||
})
|
||||
}
|
||||
},3000)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail : res=>{
|
||||
console.log(this.data.isdeliver)
|
||||
console.log(Newtype)
|
||||
if(Newtype == 'welfare'){
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfareGoods&stateType=unpay'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=welfare&stateType=unpay'
|
||||
})
|
||||
}
|
||||
}
|
||||
if(Newtype == 'right'){
|
||||
if(this.data.isdeliver == 1) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rightsCoupons&stateType=unpay'
|
||||
})
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?orderType=rights&stateType=unpay'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -1,5 +1,5 @@
|
||||
<!-- 下单状态 -->
|
||||
<view class="state">
|
||||
<view class="state {{platformCp[platIndex].name == '快递' ? 'active' : ''}}">
|
||||
<view class="state-title">
|
||||
等待买家付款
|
||||
<text>请您尽快下单购买</text>
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<!-- 默认地址 -->
|
||||
<view class="content">
|
||||
<view class="site">
|
||||
<view class="site" wx:if="{{platformCp[platIndex].name == '快递'}}">
|
||||
<view class="siteCont" wx:if="{{address != ''}}" bindtap="addressTap">
|
||||
<image class="siteCont-site" src="/static/img/car_site.png"></image>
|
||||
<view class="siteCont-right">
|
||||
@@ -62,7 +62,7 @@
|
||||
<view class="labelList-label">{{detail.attribute.form_pay}}</view>
|
||||
<view class="labelList-price rightsLabel-red">¥{{amount}}</view>
|
||||
</view>
|
||||
<view class="labelList">
|
||||
<view class="labelList" wx:if="{{platformCp[platIndex].name == '快递'}}">
|
||||
<view class="labelList-label">
|
||||
运费
|
||||
</view>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* 下单状态 */
|
||||
.state {
|
||||
background: #2e71e3;
|
||||
padding: 30rpx 100rpx 60rpx;
|
||||
padding: 30rpx 60rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
@@ -9,6 +9,10 @@
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.state.active {
|
||||
padding: 30rpx 100rpx 60rpx;
|
||||
}
|
||||
|
||||
.state-title {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
|
||||
@@ -77,13 +77,26 @@ Page({
|
||||
* 处理未登录时的转跳
|
||||
*/
|
||||
userNav(e){
|
||||
let id = e.currentTarget.dataset.id
|
||||
let newid = e.currentTarget.dataset.id,
|
||||
canFrom = e.currentTarget.dataset.from
|
||||
wx.getStorage({
|
||||
key : 'token',
|
||||
success:res=>{
|
||||
wx.navigateTo({
|
||||
url: '/pages/rights/rights?rightsId=' + id
|
||||
})
|
||||
if(canFrom == 'washcar') {
|
||||
wx.$api.index.washcarUrl('', newid).then(res=>{
|
||||
const newUrl = res.data
|
||||
let url= encodeURIComponent(newUrl)
|
||||
wx.redirectTo({
|
||||
// 跳转到webview页面
|
||||
url: `/pages/washcar/washcar?url=${url}`
|
||||
});
|
||||
})
|
||||
} else {
|
||||
// 跳转权益详情页
|
||||
wx.navigateTo({
|
||||
url: '/pages/rights/rights?rightsId=' + newid
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
wx.navigateTo({
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<view class="special-list">
|
||||
<block wx:if="{{infoItems.length > 0}}">
|
||||
<view bindtap="userNav" class="special-label" wx:for="{{infoItems}}" wx:key="infoItems"
|
||||
data-id="{{item.right_config_id}}">
|
||||
data-id="{{item.right_config_id}}" data-from="{{item.from}}">
|
||||
<view class="special-rebate" wx:if="{{item.label != ''}}">{{item.label}}</view>
|
||||
<scroll-view scroll-x class="welfareCont-top" scroll-with-animation>
|
||||
<view class="welfareCont-list-img" wx:for="{{item.logos}}" wx:key="logos" wx:for-item="items">
|
||||
|
||||
Reference in New Issue
Block a user