This commit is contained in:
zhangmanman
2021-08-09 15:57:37 +08:00
parent c661dd0e16
commit 540d76bdb8
158 changed files with 4914 additions and 788 deletions

View File

@@ -4,6 +4,7 @@ Page({
* 页面的初始数据
*/
data: {
parentId : '', //分享者ID
address : '', //默认收货地址
allAddress : '', //收货地址列表
groupId : '', //权益id
@@ -16,7 +17,7 @@ Page({
content : '', //内容介绍
notification: '', //重要提示
remark : '', //使用须知
noticeShow : false, //须知显示状态
noticeShow : true, //须知显示状态
addressShow : false, //收货地址显示
getType : '', //是否显示自提
platIndex : 0, //选择提交方式下标
@@ -32,8 +33,8 @@ Page({
disabled : false,
payWayIndex : 0,
payWay :[
{value: 0, name: "微信支付"}
// {value: 1, name: "沃钱包支付"}
{value: 0, name: "微信支付"},
{value: 1, name: "沃钱包支付"}
]
},
@@ -45,17 +46,18 @@ Page({
groupId : options.rightsId || options.id,
typeWeb : options.type,
getType : options.getType,
openid : options.openid || ''
openid : options.openid || '',
parentId : options.parentid || ''
})
// 获取详情
this.rightsInfo();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取详情
this.rightsInfo();
},
onShow() {},
/**
* 详情
@@ -107,25 +109,10 @@ Page({
this.setData({
uniUrl : encodeURIComponent(res.data)
})
})
}).catch(err => {});
}
}
}).catch(err=>{
if(!err.login){
wx.showModal({
title : '用户登录已过期',
content : '请重新登录',
showCancel : false,
success : res => {
if (res.confirm) {
wx.redirectTo({
url: '/pages/login/login'
})
}
}
})
}
})
}).catch(err=>{})
},
/**
@@ -275,9 +262,10 @@ Page({
let right_id = this.data.detail.right_id,
address_id = this.data.address.id,
is_deliver = this.data.isdeliver,
qty = this.data.num
qty = this.data.num,
parent_id = this.data.parentId
wx.$api.index.rightStore(right_id, address_id, is_deliver, qty).then(res=>{
wx.$api.index.rightStore(right_id, address_id, is_deliver, qty, parent_id).then(res=>{
if(res.data.canPay == false) {
wx.showToast({
title : '支付成功',
@@ -299,66 +287,12 @@ Page({
rightsTap: true
})
}else {
// payWayIndex为0的时候为微信支付
if(this.data.payWayIndex == 0) {
wx.$api.index.wechat(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.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'
})
setTimeout(()=>{
if(this.data.isdeliver == 1) {
wx.reLaunch({
url: '/pages/order/order?orderType=rightsCoupons'
})
} else {
wx.reLaunch({
url: '/pages/order/order?orderType=rights'
})
}
// wx.reLaunch({
// url: '/pages/coupon/coupon?type=couponPublic'
// })
},3000)
}
},
fail : res=>{
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'
})
}
// wx.reLaunch({
// url: '/pages/order/order?stateType=unpay'
// })
}
})
})
}
// payWayIndex为1的时候为沃钱包支付
if(this.data.payWayIndex == 1) {
const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/webView/webView?url=${url}`
});
}
// 跳转收银台
wx.navigateTo({
url: "/pages/cashier/cashier?trade_no=" + res.data.trade_no + "&amount=" + this.data.amount + "&is_deliver=" + is_deliver + "&pay_type=rightsPay"
})
}
})
}).catch(err => {});
},