From 3bcc491fc261eee2e84e292636db4215441f2e59 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Thu, 5 Dec 2024 10:25:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E9=94=81=E8=A7=86=E9=A2=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 33 ++-- components/payPopus/payPopus.vue | 180 +++++++++--------- me/detail/detail.nvue | 120 ++++++------ me/detail/detail.vue | 47 +++-- me/detail/detailIOS.nvue | 138 ++++++++------ pages/me/index.vue | 8 +- uniCloud-aliyun/cloudfunctions/login/index.js | 19 -- 7 files changed, 292 insertions(+), 253 deletions(-) delete mode 100644 uniCloud-aliyun/cloudfunctions/login/index.js diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 01e9904..9cade79 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,17 +2,28 @@ "version" : "1.0", "configurations" : [ { - "default" : { - "launchtype" : "local" - }, - "h5" : { - "launchtype" : "local" - }, - "mp-weixin" : { - "launchtype" : "local" - }, - "provider" : "aliyun", - "type" : "uniCloud" + "app-plus" : + { + "launchtype" : "local" + }, + "default" : + { + "launchtype" : "local" + }, + "h5" : + { + "launchtype" : "local" + }, + "mp-weixin" : + { + "launchtype" : "local" + }, + "provider" : "aliyun", + "type" : "uniCloud" + }, + { + "playground" : "custom", + "type" : "uni-app:app-android" } ] } diff --git a/components/payPopus/payPopus.vue b/components/payPopus/payPopus.vue index ea06143..9c3cbab 100644 --- a/components/payPopus/payPopus.vue +++ b/components/payPopus/payPopus.vue @@ -3,7 +3,7 @@ 购买后继续观看 - + + - + - + - + @@ -132,6 +132,10 @@ type: Boolean, default: true }, + orderId: { + type: Number, + default: null + }, //需要支付的金豆 payPrice: { type: Number, @@ -176,55 +180,61 @@ // #endif // #ifdef APP-PLUS if (plus.os.name.toLowerCase() === 'android') { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }, { - image: '/static/images/pay/zhifubao.png', - text: '支付宝', - id: 1 - }]; - this.openWay = 2; - let syPaySel = this.$queue.getData('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) - } - } else { - let checkIosPay = this.$queue.getData('checkIosPay'); - if (checkIosPay === '是') { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '苹果', - id: 3 - }]; - this.openWay = 3; - } else { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }, { + this.openLists = [ + // { + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }, + { image: '/static/images/pay/zhifubao.png', text: '支付宝', id: 1 - }]; - this.openWay = 2; - let syPaySel = this.$queue.getData('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) } - } + ]; + this.openWay = 1; + let syPaySel = this.$queue.getData('syPaySel') + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } + } else { + let checkIosPay = this.$queue.getData('checkIosPay'); + // if (checkIosPay === '是') { + // this.openLists = [{ + // image: '/static/images/pay/weixin.png', + // text: '苹果', + // id: 3 + // }]; + // this.openWay = 3; + // } else { + this.openLists = [ + // { + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }, + { + image: '/static/images/pay/zhifubao.png', + text: '支付宝', + id: 1 + } + ]; + this.openWay = 1; + let syPaySel = this.$queue.getData('syPaySel') + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } + // } } // #endif @@ -240,31 +250,31 @@ // #ifdef H5 let ua = navigator.userAgent.toLowerCase(); - if (ua.indexOf('micromessenger') !== -1) { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }]; - this.openWay = 2; - } else { + // if (ua.indexOf('micromessenger') !== -1) { + // this.openLists = [{ + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }]; + // this.openWay = 2; + // } else { this.openLists = [{ image: '/static/images/pay/zhifubao.png', text: '支付宝', id: 1 }]; this.openWay = 1; - } + // } let syPaySel = this.$queue.getData('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) - } + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } // #endif }, methods: { @@ -562,28 +572,28 @@ // #endif } else if (this.openWay == 1) { + console.log(this.orderId) // APP支付宝支付 // #ifdef APP - this.$Request.postT("/app/aliPay/payMoney", { - classify: 1, - payClassifyId: this.wallet[this.current].payClassifyId, - }).then(ret => { + this.$Request.getT("/app/wuyou/payOrder/"+this.orderId, {}).then(ret => { console.log(ret) - this.isCheckPay(ret.code, 'alipay', ret.data); + // this.isCheckPay(ret.code, 'alipay', ret.data); + that.$emit('paySuccess', ret.data) }); // #endif // #ifdef H5 let data = { - classify: 2, - payClassifyId: this.wallet[this.current].payClassifyId, + orderId: this.orderId, } - this.$Request.postT('/app/aliPay/payMoney', data).then( + this.$Request.getT("/app/wuyou/payOrder/"+this.orderId, {}).then( res => { if (res.code === 0) { - const div = document.createElement('div') - div.innerHTML = res.data //此处form就是后台返回接收到的数据 - document.body.appendChild(div) - document.forms[0].submit() + console.log(res) + that.$emit('paySuccess', res.data) + // const div = document.createElement('div') + // div.innerHTML = res.data //此处form就是后台返回接收到的数据 + // document.body.appendChild(div) + // document.forms[0].submit() } else { uni.showToast({ icon: 'none', @@ -601,7 +611,7 @@ this.$Request.postT("/app/ios/insertPayMoneyOrders", data).then(res => { if (res.code === 0) { this.iosPayId = res.data.orderId; - this.iphonepay(); + // this.iphonepay(); } else { uni.showToast({ icon: 'none', diff --git a/me/detail/detail.nvue b/me/detail/detail.nvue index 818f852..a77c216 100644 --- a/me/detail/detail.nvue +++ b/me/detail/detail.nvue @@ -144,23 +144,23 @@ - + - {{countPrice}}金币解锁单集视频 + {{countPrice}}元解锁单集视频 - + @@ -188,7 +188,7 @@ src="../../static/images/me/closeIconss.png" mode=""> - + - + @@ -395,25 +395,28 @@ this.moneyTips = uni.getStorageSync('moneyTips') // #ifdef APP-PLUS if (plus.os.name.toLowerCase() === 'android') { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }, { - image: '/static/images/pay/zhifubao.png', - text: '支付宝', - id: 1 - }]; - this.openWay = 2; + this.openLists = [ + // { + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }, + { + image: '/static/images/pay/zhifubao.png', + text: '支付宝', + id: 1 + }, + ]; + this.openWay = 1; let syPaySel = uni.getStorageSync('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) - } + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } } else { let checkIosPay = uni.getStorageSync('checkIosPay'); if (checkIosPay === '是') { @@ -424,29 +427,38 @@ }]; this.openWay = 3; } else { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }, { - image: '/static/images/pay/zhifubao.png', - text: '支付宝', - id: 1 - }]; - this.openWay = 2; + this.openLists = [ + // { + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }, + { + image: '/static/images/pay/zhifubao.png', + text: '支付宝', + id: 1 + }, + ]; + this.openWay = 1; let syPaySel = uni.getStorageSync('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) - } + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } } } // #endif + this.$nextTick(()=>{ + this.closePopusPay() + }) + if(this.courseId){ + this.getDataList(this.courseId, this.courseDetailsId); + } }, onLoad(e) { //是开启整部购买 @@ -474,7 +486,6 @@ if (e.courseDetailsId && e.courseDetailsId != 'null') { this.courseDetailsId = e.courseDetailsId } - this.getDataList(this.courseId, this.courseDetailsId); this.getMyLoveStatus() this.getMoneyList() this.getMyMoney() @@ -633,15 +644,12 @@ payClassifyId: this.wallet[this.wallCurr].payClassifyId, }).then(ret => { this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data)); - }); + }) } else if (this.openWay == 1) { // APP支付宝支付 - httpsRequest.postT("/app/aliPay/payMoney", { - classify: 1, - payClassifyId: this.wallet[this.wallCurr].payClassifyId, - }).then(ret => { - console.log(ret) - this.isCheckPay(ret.code, 'alipay', ret.data); + httpsRequest.getT("/app/wuyou/payOrder/"+this.ordersId, {}).then(ret => { + plus.runtime.openURL(ret.data.h5Url) + // this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data)); }); } else if (this.openWay == 3) { let userId = uni.getStorageSync('userId'); @@ -865,7 +873,11 @@ if (res.code == 0) { this.ordersId = res.data.orders.ordersId //记录订单id this.payMoney = res.data.orders.payMoney //记录订单价格 - this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) + + this.closePay() //关闭购买选择弹窗 + this.payPrice = res.data.orders.payMoney //需要支付的价格 + this.openPopusPay() //显示充值弹窗 + // this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) } else { uni.showToast({ title: res.msg, diff --git a/me/detail/detail.vue b/me/detail/detail.vue index 1a2ae38..df5cb77 100644 --- a/me/detail/detail.vue +++ b/me/detail/detail.vue @@ -194,32 +194,32 @@ 当前视频 没有播放权限 - + - (解锁后永久有效) - + #ifdef MP-TOUTIAO || MP-WEIXIN--> + + - {{countPrice}}金豆解锁单集视频 + {{countPrice}}元解锁单集视频 (解锁后永久有效) - + - (会员期内免费观看) - + #ifdef MP-TOUTIAO || MP-WEIXIN--> + + @@ -250,7 +250,7 @@ - @@ -308,7 +308,6 @@ checked: false, payPrice: 0, //需要支付的价格 showMoney: false, //是否显示充值弹窗 - showPay: false, dyCourseId: '', nowBs: 1, //当前倍速 subList: [{ @@ -519,7 +518,6 @@ this.courseDetailsId = e.courseDetailsId } console.log(this.courseDetailsId, '跳转进来的id') - this.getDataList(this.courseId, this.courseDetailsId); this.getMyLoveStatus() } if (e.tt_album_id) { @@ -528,7 +526,7 @@ if (e.tt_episode_id) { this.tt_episode_id = e.tt_episode_id } - + console.log(1) // this.$u.get('/app/common/type/817').then(res => { //是否开启购买整部视频 817 // if (res.code == 0 && res.data) { // this.zhengbu = res.data.value; @@ -622,6 +620,10 @@ } // #endif this.isVips = uni.getStorageSync('isVips') ? uni.getStorageSync('isVips') : '否' + console.log(2) + if(this.courseId){ + this.getDataList(this.courseId, this.courseDetailsId); + } // uni.$on('back', (data) => { // if (data.flag == true) { @@ -1100,8 +1102,14 @@ }, //子组件支付成功的回调 - paySuccess() { - this.payOrder(this.ordersId, this.payMoney) + paySuccess(data) { + console.log(data) + // data.h5Url 跳转地址 + this.showMoney = false //显示充值弹窗 + // this.payOrder(this.ordersId, this.payMoney) + // #ifdef H5 + window.open(data.h5Url) + // #endif }, //自组件关闭的回调 closeMoney(data) { @@ -1120,7 +1128,10 @@ this.ordersId = res.data.orders.ordersId //记录订单id this.payMoney = res.data.orders.payMoney //记录订单价格 - this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) + this.showPay = false //关闭购买选择弹窗 + this.payPrice = res.data.orders.payMoney //需要支付的价格 + this.showMoney = true //显示充值弹窗 + // this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) } else { uni.showToast({ title: res.msg, diff --git a/me/detail/detailIOS.nvue b/me/detail/detailIOS.nvue index cdda899..18b804c 100644 --- a/me/detail/detailIOS.nvue +++ b/me/detail/detailIOS.nvue @@ -142,23 +142,23 @@ - + - {{countPrice}}金豆解锁单集视频 + {{countPrice}}元解锁单集视频 - + @@ -186,7 +186,7 @@ src="../../static/images/me/closeIconss.png" mode=""> - + - + @@ -396,58 +396,71 @@ this.moneyTips = uni.getStorageSync('moneyTips') // #ifdef APP-PLUS if (plus.os.name.toLowerCase() === 'android') { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }, { - image: '/static/images/pay/zhifubao.png', - text: '支付宝', - id: 1 - }]; - this.openWay = 2; - let syPaySel = uni.getStorageSync('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) - } - } else { - let checkIosPay = uni.getStorageSync('checkIosPay'); - if (checkIosPay === '是') { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '苹果', - id: 3 - }]; - this.openWay = 3; - } else { - this.openLists = [{ - image: '/static/images/pay/weixin.png', - text: '微信', - id: 2 - }, { + this.openLists = [ + // { + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }, + { image: '/static/images/pay/zhifubao.png', text: '支付宝', id: 1 - }]; - this.openWay = 2; + }, + ]; + this.openWay = 1; + let syPaySel = uni.getStorageSync('syPaySel') + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } + } else { + let checkIosPay = uni.getStorageSync('checkIosPay'); + // if (checkIosPay === '是') { + // this.openLists = [{ + // image: '/static/images/pay/weixin.png', + // text: '苹果', + // id: 3 + // }]; + // this.openWay = 3; + // } else { + this.openLists = [ + // { + // image: '/static/images/pay/weixin.png', + // text: '微信', + // id: 2 + // }, + { + image: '/static/images/pay/zhifubao.png', + text: '支付宝', + id: 1 + }, + ]; + this.openWay = 1; let syPaySel = uni.getStorageSync('syPaySel') - if (syPaySel === '是') { - let openListsItem = { - image: '/static/images/pay/shouyi.png', - text: '收益余额', - id: 4 - }; - this.openLists.push(openListsItem) - } - } + // if (syPaySel === '是') { + // let openListsItem = { + // image: '/static/images/pay/shouyi.png', + // text: '收益余额', + // id: 4 + // }; + // this.openLists.push(openListsItem) + // } + // } } // #endif + this.$nextTick(()=>{ + this.closePopusPay() + }) + if(this.courseId){ + this.getDataList(this.courseId, this.courseDetailsId); + + } }, onLoad(e) { let that = this @@ -472,7 +485,6 @@ if (e.courseDetailsId) { this.courseDetailsId = e.courseDetailsId; } - this.getDataList(this.courseId, this.courseDetailsId); this.getMyLoveStatus() this.getMoneyList() this.getMyMoney() @@ -621,12 +633,9 @@ }); } else if (this.openWay == 1) { // APP支付宝支付 - httpsRequest.postT("/app/aliPay/payMoney", { - classify: 1, - payClassifyId: this.wallet[this.wallCurr].payClassifyId, - }).then(ret => { - console.log(ret) - this.isCheckPay(ret.code, 'alipay', ret.data); + httpsRequest.getT("/app/wuyou/payOrder/"+this.ordersId, {}).then(ret => { + plus.runtime.openURL(ret.data.h5Url) + // this.isCheckPay(ret.code, 'wxpay', JSON.stringify(ret.data)); }); } else if (this.openWay == 3) { let userId = uni.getStorageSync('userId'); @@ -868,7 +877,12 @@ if (res.code == 0) { this.ordersId = res.data.orders.ordersId //记录订单id this.payMoney = res.data.orders.payMoney //记录订单价格 - this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) + + this.closePay() //关闭购买选择弹窗 + this.payPrice = res.data.orders.payMoney //需要支付的价格 + this.openPopusPay() //显示充值弹窗 + + // this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney) } else { uni.showToast({ title: res.msg, diff --git a/pages/me/index.vue b/pages/me/index.vue index 056150f..a5f8932 100644 --- a/pages/me/index.vue +++ b/pages/me/index.vue @@ -55,7 +55,7 @@ - + @@ -97,9 +97,9 @@ - + diff --git a/uniCloud-aliyun/cloudfunctions/login/index.js b/uniCloud-aliyun/cloudfunctions/login/index.js deleted file mode 100644 index db45eed..0000000 --- a/uniCloud-aliyun/cloudfunctions/login/index.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -const db = uniCloud.database() - -exports.main = async (event, context) => { - const res = await uniCloud.getPhoneNumber({ - appid: '__UNI__E0B05B1', // 替换成自己开通一键登录的应用的DCloud appid,使用callFunction方式调用时可以不传(会自动取当前客户端的appid),如果使用云函数URL化的方式访问必须传此参数 - provider: 'univerify', - apiKey: '999f511095b875f4e1ac9eb495e4d208', // 在开发者中心开通服务并获取apiKey - apiSecret: 'd81d7c58aa11848c687c0970f615c5dc', // 在开发者中心开通服务并获取apiSecret - access_token: event.access_token, - openid: event.openid - }); - - console.log(res); // res里的数据格式 { code: 0, success: true, phoneNumber: '186*****078' } - - // 执行入库等操作,正常情况下不要把完整手机号返回给前端 - return res; -}; \ No newline at end of file