From db2beb84e51f885b51ec9f2665bd11e74f14a845 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Sun, 23 Apr 2023 15:11:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=81=E5=85=89=E6=8E=A8=E9=80=81=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/peanut/reCharge.vue | 118 ++++++++++++++++++++++++-------------- pages/yRead/angbook.vue | 37 ++++++++---- 2 files changed, 101 insertions(+), 54 deletions(-) diff --git a/pages/peanut/reCharge.vue b/pages/peanut/reCharge.vue index 3383849..9889e71 100644 --- a/pages/peanut/reCharge.vue +++ b/pages/peanut/reCharge.vue @@ -20,30 +20,29 @@ - - + + {{item.title}} - - - - + + {{item.title}} - - + @@ -57,12 +56,11 @@ * 我已阅读并同意《增值服务协议》 - + 立即充值 - - - 立即充值 - + + + @@ -143,6 +141,7 @@ onShow() { // 隐藏原生的tabbar uni.hideTabBar(); + this.getDevName() // this.requestIapOrder() }, computed: { @@ -182,8 +181,7 @@ // 判断是否苹果支付 if (channels[i].id === 'appleiap') { that.iapChannel = channels[i] - that.requestOrder() - consle.log(666666666) + that.requestOrder() } } }) @@ -191,7 +189,7 @@ }, requestOrder() { uni.showLoading({ - title: '到这...', + title: '获取商品信息', mask: true }) const that = this @@ -227,20 +225,21 @@ provider: 'appleiap', orderInfo: { productid: id, - username: 'ordersn', // 用户标识 + // username: 'ordersn', // 用户标识 + username: that.orderSn, // 用户标识 optimize: false // 设置 optimize: true 解决丢单问题 }, success: (res => { - console.log(res,'成功的返回值1') // 成功的返回值 + console.log(res,'成功的返回值') // 成功的返回值 uni.hideLoading() let data= { receipt:res.transactionReceipt, // 校验体 - TransactionID: this.orderSn, - transactionId: res.transactionIdentifier //交易id + orderId: this.orderSn, + transactionIdentifier: res.transactionIdentifier //交易id } - const orderId = this.orderId //这个订单id 是由后端返回的 - const transactionId = res.transactionIdentifier //交易id - const payload = res.transactionReceipt //校验体 + // const orderId = this.orderId //这个订单id 是由后端返回的 + // const transactionIdentifier = res.transactionIdentifier //交易id + // const payload = res.transactionReceipt //校验体 $http.request({ url: "/apple/applePay", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 @@ -249,12 +248,31 @@ 'Content-Type': 'application/json' }, }).then(res => { - console.log(res) - uni.showToast({ - title: '充值成功' - }) + // 发送给后台逻辑处理 // 进行后续操作 - ///that.getUserInfo() + console.log(res) + let data= { + // receipt: 'MIIUKAYJKoZIhvcNAQcCoIIUGTCCFBUCAQExCzAJBgUrDgMCGgUAMIIDZgYJKoZIhvcNAQcBoIIDVwSCA1MxggNPMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgELAgEBBAMCAQAwCwIBDwIBAQQDAgEAMAsCARACAQEEAwIBADALAgEZAgEBBAMCAQMwDAIBCgIBAQQEFgI0KzAMAgEOAgEBBAQCAgCJMA0CAQMCAQEEBQwDMTEwMA0CAQ0CAQEEBQIDAf4oMA0CARMCAQEEBQwDMS4wMA4CAQkCAQEEBgIEUDI2MDAYAgEEAgECBBAX4ibAXjZ7IAwLx10evzedMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBBQIBAQQUYpDtGI14h', + transactionId: res.transactionIdentifier, // 支付交易id + // userId: that.userInfo.id, + // productId: 'add69', + orderId: res.payment.username // 系统订单号 + receiptData: res.transactionReceipt //苹果返回状态码 + } + $http.request({ + url: "/Ipa/veri", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }).then(res => { + // alert(res) + uni.showToast({ + title: '充值成功' + }) + }) + }) }), fail: (e) => { @@ -266,8 +284,6 @@ } }) }, - - getDevName() { // 获取使用环境 if (uni.getSystemInfoSync().platform === 'android') { @@ -304,8 +320,7 @@ }, //ios充值 iosPay() { - if(this.radioValue == '1'){ - + // if(this.radioValue == '1'){ let that = this let data = { @@ -332,22 +347,25 @@ // this.topay(15) this.iphonepay() }) - }else{ - uni.showToast({ - title:'请勾选服务协议', - icon:'error' - }) - } + // }else{ + // uni.showToast({ + // title:'请勾选服务协议', + // icon:'error' + // }) + // } }, // 充值 kaiChar() { - if(this.radioValue == '1'){ - + if(this.radioValue == '1'){ + uni.showLoading({ + title:'支付中,请勿离开', + icon:'loading' + }) let that = this let data = { userId: that.userInfo.id, //下单人ID userPhone: that.userInfo.tel, //收货人手机号 - paymentMethod: that.payType, //1支付宝,2微信,3ios内购 + paymentMethod: that.payType, //2支付宝,1微信,3ios内购 orderMoney: that.stepsCj.money * 1, //订单金额 districtMoney: 0, //优惠金额 realMoney: that.stepsCj.money * 1, //实收金额 @@ -359,11 +377,13 @@ url: "book/buyorder/rechargeSave", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data, - header: { //默认 无 说明:请求头 + header: { //默认 无 说明:请求头1 'Content-Type': 'application/json' }, - }).then(res => { + }).then(res => { + uni.hideLoading() if (res.code == 0) { + if(that.payType == 2){ setPay({ typePay: 'alipay', subject: 'point', @@ -384,12 +404,22 @@ }); } }) + }else if(that.payType == 1){ + // 微信支付 + uni.showToast({ + title:'微信支付', + none: 'none' + }) + }else if(that.payType == 3){ + console.log('苹果支付',) + that.iosPay() + } } }) }else{ uni.showToast({ title:'请勾选 已阅读会员服务协议', - icon:'error' + icon:'none' }) return false } diff --git a/pages/yRead/angbook.vue b/pages/yRead/angbook.vue index 79ab24a..6cd8e28 100644 --- a/pages/yRead/angbook.vue +++ b/pages/yRead/angbook.vue @@ -692,7 +692,7 @@ import { nextTick } from "vue"; 'lineHeight':'', 'oldReadPage':0 }, - setShow: true, // 设置显示? + setShow: false, // 设置显示? clientlast: null, //开始位置 touchNum: 0, //点击次数 touchTime: null, //定时器清除 @@ -3178,13 +3178,22 @@ import { nextTick } from "vue"; musicPlaying:false, fontSize:'', lineHeight:'', - containerStyle: '' + containerStyle: '', + devName:false, + letterSpacing:1, } - }, + }, mounted() { - this.onTurn(); + this.onTurn(); + this.isAndroid() + console.log(this.devName,'devName') }, methods: { + isAndroid() { //判断是否为安卓手机 + var u = navigator.userAgent; + var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; + this.devName = isAndroid + }, updateReaderSet(newVal, oldVal){ // 阅读器设置更新 $("#flipbook .paragraph").css({fontSize:newVal.fontSize+"px", lineHeight:newVal.lineHeight*newVal.fontSize+"px"}) @@ -3233,7 +3242,7 @@ import { nextTick } from "vue"; }, updateSimulationText(newVal, oldVal) { - $("#flipbook").turn('pages',1) // 内容变化时,保留1页 + $("#flipbook").turn('pages',1) // 内容变化时,保留1页1 $("#flipbook").turn('pages',newVal.SimulationText.length) // this.onTurn(); // this.SimulationText = newVal @@ -3242,22 +3251,24 @@ import { nextTick } from "vue"; this.lineHeight = newVal.lineHeight newVal.background == 1 ? this.containerStyle = "#f7faf9" : this.containerStyle = "#000" //$(".myPage p").css({backgroundColor:this.containerStyle}) + this.devName ? this.letterSpacing = 2 : this.letterSpacing = 1 + console.log(this.letterSpacing,'-----------------------------') for (var i=0; i" + newVal.SimulationText[i][j].list + "

" } var page1 = i+1 var btnStyle = "display: block; padding: 20rpx; border: 1px solid #333; text-align: center;" - var tagHtml = "
"+ conntentHtml +"
"+page1+"/"+ newVal.SimulationText.length +"
"; + var tagHtml = "
"+ conntentHtml +"
"+page1+"/"+ newVal.SimulationText.length +"
"; // $("#flipbook").append(tagHtml); if (!$("#flipbook").turn('hasPage', i+2)) { - // Create an element for this page + // Create an element for this page. var element = $('
').html(''); // Add the page $("#flipbook").turn('addPage', element, i+2); @@ -3266,6 +3277,7 @@ import { nextTick } from "vue"; } // 如果有阅读缓存 if(newVal.oldReadPage>0){ + // alert('读取历史阅读进度') $("#flipbook").turn('page', newVal.oldReadPage+1) }else{ $("#flipbook").turn('page', 2) @@ -3326,7 +3338,7 @@ import { nextTick } from "vue"; } else { clearTimeout(this.touchTime) this.touchTime = setTimeout(() => { - //双击或则多次点击事件 + //双击或多次点击事件 this.touchNum = 0 }, 250) //console.log('单击') @@ -3361,6 +3373,11 @@ import { nextTick } from "vue";