微信支付完成
This commit is contained in:
@@ -279,7 +279,8 @@
|
||||
console.log('检测支付环境...')
|
||||
plus.payment.getChannels((channels) => {
|
||||
console.log(channels, 'channels')
|
||||
for (var i in channels) {
|
||||
//this.setUserInfo({channelList:channels}); // 将支付通道保存到本地
|
||||
for (var i in channels) {
|
||||
// 判断是否苹果支付1
|
||||
if (channels[i].id === 'appleiap') {
|
||||
this.iapChannel = channels[i]
|
||||
@@ -288,15 +289,14 @@
|
||||
this.restoreComplateRequest()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询未关闭订单
|
||||
restoreComplateRequest(){
|
||||
let that = this
|
||||
console.log('检测未完成订单')
|
||||
console.log(this.iapChannel,'this.iapChannel')
|
||||
|
||||
console.log(this.iapChannel,'this.iapChannel')
|
||||
this.iapChannel.restoreComplateRequest({
|
||||
manualFinishTransaction: true
|
||||
}, function(results) {
|
||||
|
||||
@@ -70,9 +70,9 @@
|
||||
<view class="nav_list" @click="onPageJump('../user/address')">
|
||||
<text>地址管理</text>
|
||||
</view>
|
||||
<view class="nav_list" @click="onGoing()">
|
||||
<!-- <view class="nav_list" @click="onGoing()">
|
||||
<text>帮助与反馈</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="nav_list" @click="signShow=true">
|
||||
<text>退出登录</text>
|
||||
</view>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
} from 'vuex';
|
||||
import {
|
||||
setPay,
|
||||
setPayAssign
|
||||
setPayAssign,setWXPay
|
||||
} from '@/config/utils';
|
||||
// const IAPOrders = [ // 根据这些ids获取到苹果app内商品信息,这些ids就是你上面设置的产品id
|
||||
// 'add69'
|
||||
@@ -163,6 +163,7 @@
|
||||
finishTransaction(trans){
|
||||
this.iapChannel.finishTransaction(trans, (success) => {
|
||||
console.log('关闭订单成功');
|
||||
this.setUserInfo({restoreFlag:false});
|
||||
}, (fail) => {
|
||||
console.log('关闭订单失败');
|
||||
});
|
||||
@@ -189,6 +190,7 @@
|
||||
},
|
||||
iphonepay() {
|
||||
const that = this
|
||||
// 如果ios已经绑定支付信息,就直接支付,如果没有绑定,就需要先绑定
|
||||
console.log('检测支付环境...')
|
||||
plus.payment.getChannels((channels) => {
|
||||
console.log(channels, 'channels')
|
||||
@@ -250,16 +252,18 @@
|
||||
// restoreFlag = false; // 支付成功清除标记 restoreFlag = false
|
||||
that.transaction = result
|
||||
// 支付成功,result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
|
||||
uni.hideLoading()
|
||||
that.iapCheck(result)
|
||||
}, function(e) {
|
||||
// restoreFlag = false; // 支付失败清楚标记
|
||||
that.setUserInfo({restoreFlag:false});
|
||||
that.finishTransaction(result);
|
||||
//console.log('订单关闭后的用户信息', that.userInfo);
|
||||
console.log(e)
|
||||
//console.log(e.message)
|
||||
uni.hideLoading()
|
||||
if(e.errCode == 2){
|
||||
// 用户未绑定支付方式,app内支付流程结束,系统弹出框引导用户绑定支付方式,此过程将跳转到系统应用 AppStore 进行绑定支付方式,绑定成功同步支付成功,用户成功付款
|
||||
plus.runtime.openURL("https://apps.apple.com/account/billing");
|
||||
}else{
|
||||
// restoreFlag = false; // 支付失败清楚标记
|
||||
that.finishTransaction(result);
|
||||
//console.log('订单关闭后的用户信息', that.userInfo);
|
||||
console.log(e)
|
||||
//console.log(e.message)
|
||||
}
|
||||
});
|
||||
},
|
||||
iapCheck(result) {
|
||||
@@ -291,12 +295,19 @@
|
||||
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
|
||||
that.finishTransaction(result);
|
||||
}
|
||||
}).catch(e => {
|
||||
uni.showToast({
|
||||
title:'支付验证失败,请稍后重启app,如不能解决您的问题,可联系官方客服',
|
||||
icon: 'none',
|
||||
duration:5000
|
||||
})
|
||||
}).catch(e => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
showCancel:false,
|
||||
content: '支付验证失败,请稍后重启app,如不能解决您的问题,可联系官方客服',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getDevName() {
|
||||
@@ -401,7 +412,7 @@
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
@@ -410,11 +421,42 @@
|
||||
}
|
||||
})
|
||||
} else if (that.payType == 1) {
|
||||
// 微信支付
|
||||
uni.showToast({
|
||||
title: '微信支付',
|
||||
none: 'none'
|
||||
})
|
||||
// 微信支付
|
||||
that.orderSn = res.orderSn
|
||||
let data1={
|
||||
orderSn:that.orderSn,
|
||||
// orderId:that.orderSn,
|
||||
}
|
||||
console.log(data1,'data1')
|
||||
// console.log(this.userInfo.channelList,'channelList')
|
||||
// this.userInfo.channelList.map(item => {
|
||||
// if(item.id == "wxpay"){
|
||||
// console.log('支持微信支付')
|
||||
setWXPay(data1,res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
if(res.data.errMsg.indexOf('User canceled') != -1){
|
||||
uni.showToast({
|
||||
title: "用户取消支付",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
// }
|
||||
// })
|
||||
|
||||
} else if (that.payType == 3) {
|
||||
console.log('苹果支付', )
|
||||
that.iosPay()
|
||||
|
||||
@@ -1602,12 +1602,12 @@ import { nextTick } from "vue";
|
||||
})
|
||||
//return
|
||||
if (this.domIndex > this.curPage.text[this.curPage.text.length - 1].paragraph) { // 是否跨页 是的话就翻页
|
||||
// console.log(this.curPage.text[this.curPage.text.length - 1].paragraph,'该翻页了')
|
||||
// this.musicItem.page = this.currentPage + 1
|
||||
|
||||
console.log(this.currentPage,'this.currentPage')
|
||||
this.musicItem ={
|
||||
page:this.currentPage + 1,
|
||||
musicIndexDom: this.domIndex
|
||||
musicIndexDom: this.domIndex,
|
||||
musicPlaying:true
|
||||
}
|
||||
this.goNextPage()
|
||||
|
||||
@@ -2364,7 +2364,7 @@ import { nextTick } from "vue";
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
this.showAnimation = true
|
||||
this.showAnimation = false // 关闭动画
|
||||
this.prePage.pageTranslate = [
|
||||
`(${-this.windowWidth}px,0)`,
|
||||
`(${-this.windowWidth}px,0)`,
|
||||
@@ -3214,9 +3214,10 @@ import { nextTick } from "vue";
|
||||
// page = $("#flipbook").turn('page')
|
||||
if(newVal.musicPlaying){
|
||||
// 开启听书
|
||||
console.log(newVal.page,'newVal.page')
|
||||
if(newVal.page > 0){ // 翻页
|
||||
console.log('翻页翻页', newVal.page+2)
|
||||
$("#flipbook").turn('page', newVal.page+2)
|
||||
$("#flipbook").turn('page', newVal.page+3)
|
||||
}
|
||||
$("#flipbook .paragraph").css({color:"#333"})
|
||||
$("#flipbook .paragraph"+newVal.musicIndexDom).css({color:"#e5d6a0"})
|
||||
@@ -3261,7 +3262,7 @@ import { nextTick } from "vue";
|
||||
var classname = ''
|
||||
var styleconteent = ''
|
||||
newVal.SimulationText[i][j].class == 'jushou' ? classname = 'shouhang' : 'notshouhang'
|
||||
newVal.SimulationText[i][j].class == 'jushou' ? styleconteent = "'text-indent:2em ;font-size:"+newVal.fontSize+"px; color: #5d5d5d; line-height:"+newVal.lineHeight*newVal.fontSize+"px;'": styleconteent = "'font-size:"+newVal.fontSize+"px ; line-height:"+newVal.lineHeight*newVal.fontSize+"px; color: #5d5d5d;'"
|
||||
newVal.SimulationText[i][j].class == 'jushou' ? styleconteent = "'text-indent:2em ;font-size:"+newVal.fontSize+"px; color: #5d5d5d; line-height:"+newVal.lineHeight*newVal.fontSize+"px;'": styleconteent = "'font-size:"+newVal.fontSize+"px ; display:inline;line-height:"+newVal.lineHeight*newVal.fontSize+"px; color: #5d5d5d;'"
|
||||
conntentHtml += "<p class='paragraph " + classname + " paragraph" + newVal.SimulationText[i][j].paragraph +"' style="+styleconteent+">" + newVal.SimulationText[i][j].list + "</p>"
|
||||
}
|
||||
var page1 = i+1
|
||||
|
||||
Reference in New Issue
Block a user