广告显示
This commit is contained in:
@@ -185,7 +185,7 @@ export default {
|
||||
onShow() {
|
||||
//改变字体大小
|
||||
var status = this.$baseFontSize();
|
||||
if (status == 5) {
|
||||
if (status == 4) {
|
||||
this.fontSizeBlod = true;
|
||||
} else {
|
||||
this.fontSizeBlod = false;
|
||||
@@ -205,7 +205,7 @@ export default {
|
||||
//改变字体大小
|
||||
console.log("this.fontSizeBlod at line 196:", this.fontSizeBlod);
|
||||
if (this.fontSizeBlod) {
|
||||
uni.setStorageSync("fontSize", 5);
|
||||
uni.setStorageSync("fontSize", 4);
|
||||
} else {
|
||||
uni.setStorageSync("fontSize", 3.5);
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
@click="openorderModal(item)"
|
||||
v-for="(item, index) in v.list"
|
||||
class="vip_button"
|
||||
:style="`background:${v.buttonbg ? v.buttonbg : '#f6f6f6'};`"
|
||||
><view style="max-width: 200rpx">{{ item.title }}</view>
|
||||
:style="`background:${v.buttonbg ? v.buttonbg : '#f6f6f6'};height:${ v.list.length>2?`calc(100% / ${ v.list.length}) !important`:'80rpx !important'}`">
|
||||
<view style="max-width: 200rpx">{{ item.title }}</view>
|
||||
<view style="margin: 0 5rpx">¥{{ item.lastFee }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -909,7 +909,7 @@ export default {
|
||||
}
|
||||
.vip_button_list {
|
||||
width: 100%;
|
||||
max-height: 200rpx;
|
||||
max-height: 450rpx;
|
||||
// @include themFlex(center, space-between);
|
||||
// flex-direction: column;
|
||||
padding-top: 0;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<template><page-meta
|
||||
:page-font-size="$baseFontSize() + 'px'"
|
||||
:root-font-size="$baseFontSize() + 'px'"
|
||||
></page-meta>
|
||||
<template><page-meta :page-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"></page-meta>
|
||||
<view class="container commonPageBox">
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
@@ -170,6 +167,7 @@
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
|
||||
// 隐藏原生的tabbar
|
||||
// this.iphonepay()
|
||||
// setTimeout(()=>{
|
||||
@@ -253,10 +251,12 @@
|
||||
provider: 'appleiap',
|
||||
orderInfo: orderInfo,
|
||||
success: (res) => {
|
||||
console.log('uni.requestPayment成功提示', res)
|
||||
that.iapCheck(res);
|
||||
resolve(res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('uni.requestPayment失败提示', err)
|
||||
uni.hideLoading()
|
||||
// console.log('其他支付错误', err);
|
||||
that.restoreComplateRequest()
|
||||
@@ -281,28 +281,28 @@
|
||||
async restoreComplateRequest() {
|
||||
let that = this
|
||||
console.log('检测未完成订单')
|
||||
// if (!that.checking) {
|
||||
// that.checking = true
|
||||
// console.log(this.iapChannel, 'this.iapChannel1')
|
||||
|
||||
await this.iapChannel.restoreCompletedTransactions({
|
||||
manualFinishTransaction: true
|
||||
}, function(results) {
|
||||
// console.log(that.checking)
|
||||
// results 格式为数组存放恢复的IAP商品交易信息对象 IAPTransaction,通用需将返回的支付凭证传给后端进行二次认证
|
||||
that.ComplateRequestArr = results
|
||||
console.log('未完成订单数组共有:=》', that.ComplateRequestArr.length)
|
||||
if (results && results.length > 0) {
|
||||
console.log('未完成订单数组共有resultsresultsresults:=》', results)
|
||||
results.map((item, index) => {
|
||||
// "0"为正在支付;"1"为支付成功;"2"为支付失败;"3"为支付已恢复。
|
||||
if (item.transactionState == '1') {
|
||||
// 已经支付,但是没有走逻辑的内购订单 就发给后台做验证
|
||||
that.iapCheck('未完成订单的验证', item, index)
|
||||
// that.finishTransaction(item)
|
||||
} else if (item.transactionState != '1' || item.transactionState != '0') {
|
||||
// 不是正在支付订单,也不是已经支付订单就关闭掉
|
||||
// 其他状态的内购订单
|
||||
that.finishTransaction(item)
|
||||
}
|
||||
// if (item.transactionState == '1') {
|
||||
// // 已经支付,但是没有走逻辑的内购订单 就发给后台做验证
|
||||
// that.iapCheck('未完成订单的验证', item, index)
|
||||
// // that.finishTransaction(item)
|
||||
// } else if (item.transactionState != '1' || item.transactionState != '0') {
|
||||
// // 不是正在支付订单,也不是已经支付订单就关闭掉
|
||||
// // 其他状态的内购订单
|
||||
|
||||
|
||||
console.log('未完成订单数组共有resultsresultsresults15:=》', results)
|
||||
that.finishTransaction(item)
|
||||
// }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -311,40 +311,34 @@
|
||||
|
||||
},
|
||||
async iphonepay() {
|
||||
//获取iap通道是判断当前设备是否支持苹果内购支付的必要条件
|
||||
const that = this;
|
||||
uni.showLoading({
|
||||
title: "检测支付环境"
|
||||
title: "购买中"
|
||||
})
|
||||
console.log("检测支付环境...");
|
||||
|
||||
this.iapChannel = await this.getProvider()
|
||||
console.log('that.iapChannel', this.iapChannel);
|
||||
|
||||
if (this.iapChannel) {
|
||||
this.requestOrder();
|
||||
await this.restoreComplateRequest()
|
||||
await this.requestOrder();
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '不支持内购支付',
|
||||
icon: 'none'
|
||||
})
|
||||
console.log("获取iap支付通道失败:" + e.message, that.iapChannel);
|
||||
}
|
||||
},
|
||||
requestOrder() {
|
||||
uni.showLoading({
|
||||
title: "获取商品信息",
|
||||
mask: true,
|
||||
});
|
||||
|
||||
const that = this;
|
||||
console.log(that.stepsCj.priceTypeId, 88888888);
|
||||
// ['xxxxx'] 是平台申请拿到的内购商品的id
|
||||
let IAPOrders = [];
|
||||
IAPOrders.push('Z' + that.stepsCj.priceTypeId);
|
||||
// console.log(IAPOrders, "IAPOrders");
|
||||
console.log(IAPOrders, "IAPOrders");
|
||||
// 新建订单
|
||||
uni.showLoading({
|
||||
title: "正在创建订单",
|
||||
mask: true,
|
||||
});
|
||||
// uni.showLoading({
|
||||
// title: "正在创建订单",
|
||||
// mask: true,
|
||||
// });
|
||||
that.iapChannel.requestProduct(
|
||||
IAPOrders,
|
||||
function(event) {
|
||||
@@ -367,16 +361,14 @@
|
||||
},
|
||||
async topay(id) {
|
||||
const that = this;
|
||||
uni.showLoading({
|
||||
title: "正在支付",
|
||||
mask: true,
|
||||
});
|
||||
|
||||
let orderInfo = {
|
||||
productid: id,
|
||||
username: that.orderSn, // 用户标识/订单标识
|
||||
quantity: 1,
|
||||
manualFinishTransaction: true, // 3.5.1+ 支持,设置此参数后需要开发者主动关闭订单,参见下面的关闭订单方法 finishTransaction()
|
||||
}
|
||||
console.log('支付后的订单信息', orderInfo);
|
||||
this.transaction = await this.requestPayment(orderInfo)
|
||||
console.log('支付后的that.transaction', this.transaction);
|
||||
},
|
||||
@@ -389,12 +381,13 @@
|
||||
productId: result.payment.productid.slice(1), // 产品id
|
||||
orderId: result.payment.username, // 系统订单号
|
||||
receiptData: result.transactionReceipt, // 苹果返回收据
|
||||
// isSandBox: true, //测试数据
|
||||
// body: that.stepsCj.priceTypeId // 充值类型id
|
||||
};
|
||||
console.log("提交给后台的数据", data);
|
||||
$http
|
||||
.request({
|
||||
url: "/Ipa/veri",
|
||||
url: "Ipa/veri",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: {
|
||||
@@ -404,22 +397,25 @@
|
||||
})
|
||||
.then((res) => {
|
||||
// console.log('res',res);
|
||||
console.log(JSON.stringify(res));
|
||||
|
||||
if (res.code == 0) {
|
||||
this.transaction = null
|
||||
uni.hideLoading()
|
||||
console.log(JSON.stringify(res), '返回信息');
|
||||
|
||||
uni.showToast({
|
||||
title: '充值成功!',
|
||||
icon: 'success'
|
||||
})
|
||||
console.log("充值订单已处理,请留意账户金额变动....");
|
||||
|
||||
uni.hideLoading()
|
||||
// console.log("充值订单已处理,请留意账户金额变动....");
|
||||
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
|
||||
that.finishTransaction(result);
|
||||
// that.finishTransaction(result);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading()
|
||||
console.log('后台验证失败=>', e);
|
||||
this.transaction = null
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
showCancel: false,
|
||||
@@ -512,10 +508,7 @@
|
||||
let that = this;
|
||||
that.payType = e;
|
||||
},
|
||||
//ios充值
|
||||
iosPay() {
|
||||
this.iphonepay();
|
||||
},
|
||||
|
||||
// 充值
|
||||
goToPay() {
|
||||
this.kaiChar();
|
||||
@@ -562,6 +555,8 @@
|
||||
})
|
||||
.then((res) => {
|
||||
that.orderSn = res.orderSn;
|
||||
|
||||
console.log(res.orderSn, 'dingdanhao111111111111')
|
||||
uni.hideLoading();
|
||||
if (res.code == 0) {
|
||||
if (that.payType == 2) {
|
||||
@@ -636,7 +631,7 @@
|
||||
// })
|
||||
} else if (that.payType == 3) {
|
||||
console.log("苹果支付");
|
||||
that.iosPay();
|
||||
that.iphonepay();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user