绑定支付宝,视频解锁生成订单增加限制

This commit is contained in:
GaoHao
2024-12-26 14:07:51 +08:00
parent 646379471f
commit 440811c3fa
6 changed files with 56 additions and 36 deletions

View File

@@ -1,13 +1,13 @@
const ROOTPATH1 = "https://dj-api.hnsiyao.cn/sqx_fast/"; // // const ROOTPATH1 = "https://dj-api.hnsiyao.cn/czg/"; //
const ROOTPATH = "https://dj-api.hnsiyao.cn/sqx_fast/"; //后台服务域名 // const ROOTPATH = "https://dj-api.hnsiyao.cn/czg/"; //后台服务域名
const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名 // const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名
// const ROOTPATH1 = "https://video.hnsiyao.cn/sqx_fast/"; // const ROOTPATH1 = "https://video.hnsiyao.cn/czg/"; //
// const ROOTPATH = "https://video.hnsiyao.cn/sqx_fast/"; //后台服务域名 const ROOTPATH = "https://video.hnsiyao.cn/czg/"; //后台服务域名
// const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名 const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名
// const ROOTPATH1 = "http://192.168.1.5:8100/sqx_fast/"; // // const ROOTPATH1 = "http://192.168.1.5:8100/czg/"; //
// const ROOTPATH = "http://192.168.1.5:8100/sqx_fast/"; //后台服务域名 // const ROOTPATH = "http://192.168.1.5:8100/czg/"; //后台服务域名
// const ROOTPATH2 = "http://192.168.1.5:8100"; //后台服务域名 // const ROOTPATH2 = "http://192.168.1.5:8100"; //后台服务域名
module.exports = { module.exports = {

View File

@@ -406,7 +406,8 @@
getRedEnvelopeTips: '', getRedEnvelopeTips: '',
scale: 1, scale: 1,
// 防抖使用的变量 // 防抖使用的变量
appearTimeout: null appearTimeout: null,
isOrder: true
}; };
}, },
onUnload() { onUnload() {
@@ -1041,6 +1042,12 @@
* 2:购买单集视频 * 2:购买单集视频
*/ */
payVideo(type, num) { payVideo(type, num) {
console.log(this.isOrder)
if(!this.isOrder){
return;
}
console.log(1)
this.isOrder = false
if (uni.getStorageSync('token')) { if (uni.getStorageSync('token')) {
this.submitPay(type, num) this.submitPay(type, num)
} else { } else {
@@ -1061,6 +1068,7 @@
} }
httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' : httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' :
'/app/order/insertCourseOrders', data).then(res => { '/app/order/insertCourseOrders', data).then(res => {
console.log(3)
if (res.code == 0) { if (res.code == 0) {
this.ordersId = res.data.orders.ordersId //记录订单id this.ordersId = res.data.orders.ordersId //记录订单id
this.payMoney = res.data.orders.payMoney //记录订单价格 this.payMoney = res.data.orders.payMoney //记录订单价格
@@ -1077,6 +1085,7 @@
} else { } else {
if (res.status && res.status == 1) { if (res.status && res.status == 1) {
this.showPay = false //关闭购买选择弹窗 this.showPay = false //关闭购买选择弹窗
this.isOrder = true
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,
true); true);
return; return;
@@ -1103,6 +1112,7 @@
this.closePopusPay() this.closePopusPay()
this.closePay() this.closePay()
that.showPay = false that.showPay = false
this.isOrder = true
that.showMoney = false that.showMoney = false
that.noBuyVideoIndex = null that.noBuyVideoIndex = null
setTimeout(() => { setTimeout(() => {
@@ -1291,6 +1301,7 @@
token: uni.getStorageSync('token') ? uni.getStorageSync('token') : '' token: uni.getStorageSync('token') ? uni.getStorageSync('token') : ''
}; };
httpsRequest.getT('/app/course/selectCourseDetailsById', data).then(res => { httpsRequest.getT('/app/course/selectCourseDetailsById', data).then(res => {
if (res.code == 0) { if (res.code == 0) {
console.log(res) console.log(res)
if (res.data.listsDetail) { if (res.data.listsDetail) {

View File

@@ -433,6 +433,7 @@
playFlag: false, playFlag: false,
getRedEnvelopeTips: '', getRedEnvelopeTips: '',
scale: 1, scale: 1,
isOrder: true,
}; };
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
@@ -1260,6 +1261,10 @@
* 2:购买单集视频 * 2:购买单集视频
*/ */
payVideo(type) { payVideo(type) {
if(!this.isOrder){
return;
}
this.isOrder = false
if (uni.getStorageSync('token')) { if (uni.getStorageSync('token')) {
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
if (!this.checked) { if (!this.checked) {
@@ -1310,13 +1315,13 @@
if (res.code == 0) { if (res.code == 0) {
this.ordersId = res.data.orders.ordersId //记录订单id this.ordersId = res.data.orders.ordersId //记录订单id
this.payMoney = res.data.orders.payMoney //记录订单价格 this.payMoney = res.data.orders.payMoney //记录订单价格
console.log(type)
if (type == 1) { //金币 if (type == 1) { //金币
// this.showPay = false // this.showPay = false
// this.showMoney = false // this.showMoney = false
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney); this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney);
} else if (type == 2) { //支付宝 } else if (type == 2) { //支付宝
this.showPay = false //关闭购买选择弹窗 this.showPay = false //关闭购买选择弹窗
this.isOrder = true
this.payPrice = res.data.orders.payMoney //需要支付的价格 this.payPrice = res.data.orders.payMoney //需要支付的价格
this.showMoney = true //显示充值弹窗 this.showMoney = true //显示充值弹窗
} }
@@ -1324,6 +1329,7 @@
} else { } else {
if ( res.status && res.status == 1) { if ( res.status && res.status == 1) {
this.showPay = false //关闭购买选择弹窗 this.showPay = false //关闭购买选择弹窗
this.isOrder = true
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId, this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,
true); true);
return; return;
@@ -1348,6 +1354,7 @@
icon: 'none' icon: 'none'
}) })
that.showPay = false that.showPay = false
this.isOrder = true
that.showMoney = false that.showMoney = false
that.noBuyVideoIndex = null that.noBuyVideoIndex = null
setTimeout(() => { setTimeout(() => {
@@ -1573,17 +1580,13 @@
let indexs = -1 let indexs = -1
if (courseDetailsId) { //从记录进来的 if (courseDetailsId) { //从记录进来的
console.log(courseDetailsId)
console.log(this.meunList)
this.meunList.map((item, index) => { this.meunList.map((item, index) => {
if (item.courseDetailsId == courseDetailsId) { if (item.courseDetailsId == courseDetailsId) {
indexs = index indexs = index
} }
}) })
console.log(indexs)
if (indexs != -1) { //找到了 if (indexs != -1) { //找到了
if (Number(indexs + 1) === this.meunList.length) { //最后一条 if (Number(indexs + 1) === this.meunList.length) { //最后一条
console.log("最后一条")
if (this.meunList.length == 1) { //只有一条 if (this.meunList.length == 1) { //只有一条
this.videoList = this.meunList.slice(0, this.videoList = this.meunList.slice(0,
3) 3)
@@ -1807,10 +1810,17 @@
} }
} }
//考虑向下滑动 //考虑向下滑动
console.log(current+"---"+this.current)
if ((current == 0 && this.current == 2) || (current == 0 && this.current == if ((current == 0 && this.current == 2) || (current == 0 && this.current ==
0)) { //是否滑动到第一条虽然刚进入页面current为0但是首次不触发 0)) { //是否滑动到第一条虽然刚进入页面current为0但是首次不触发
//拿出当前的courseDetailsId //拿出当前的courseDetailsId
let courseDetailsId = this.videoList[2].courseDetailsId console.log(this.videoList)
let courseDetailsId =this.videoList[2].courseDetailsId
// if ( this.videoList.length > 1) {
// courseDetailsId = this.videoList[2].courseDetailsId
// } else {
// courseDetailsId = this.videoList[0].courseDetailsId
// }
indexs = this.meunList.findIndex(item => item.courseDetailsId === courseDetailsId); indexs = this.meunList.findIndex(item => item.courseDetailsId === courseDetailsId);
//记录当前数据在meunList中的下标 //记录当前数据在meunList中的下标
if (indexs != -1) { //找到了indexs就是对应下标 if (indexs != -1) { //找到了indexs就是对应下标
@@ -1906,15 +1916,13 @@
}, },
//播放时的回掉 //播放时的回掉
videoPlay(videoId) { videoPlay(videoId) {
console.log(courseDetailsId)
console.log(this.playFlag)
// this.courseDetailsId = courseDetailsId // this.courseDetailsId = courseDetailsId
if (!this.playFlag) { if (!this.playFlag) {
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,true); this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,true);
this.playFlag = true this.playFlag = true
httpsRequest.getT('app/course/viewCourse', { this.$Request.getT('app/course/viewCourse', {
courseId: this.courseId, courseId: this.courseId,
courseDetailsId: courseDetailsId, courseDetailsId: this.videoList[this.current].courseDetailsId,
type: 'start' type: 'start'
}).then(res => { }).then(res => {
console.log('播放开始') console.log('播放开始')

View File

@@ -245,7 +245,9 @@
} }
// h5携带邀请码去首页 // h5携带邀请码去首页
// #ifdef H5 // #ifdef H5
this.erweima = config.APIHOST2 + '/?invitation=' + this // this.erweima = config.APIHOST2 + '/?invitation=' + this
// .invitationCode + '&qdCode=' + this.qdCode
this.erweima = config.APIHOST2 + '/pages/login/registerApp/?invitation=' + this
.invitationCode + '&qdCode=' + this.qdCode .invitationCode + '&qdCode=' + this.qdCode
// #endif // #endif
// app直接去app注册页面 // app直接去app注册页面

View File

@@ -54,16 +54,9 @@
}, },
toLogin() { toLogin() {
// console.log(this.zhiFuBao )
// console.log(this.zhiFuBaoName )
// const {
// zhiFuBao,
// zhiFuBaoName
// } = this;
let zhiFuBao = this.zhiFuBao let zhiFuBao = this.zhiFuBao
let zhiFuBaoName = this.zhiFuBaoName let zhiFuBaoName = this.zhiFuBaoName
console.log(zhiFuBao)
console.log(zhiFuBaoName)
if (!zhiFuBao) { if (!zhiFuBao) {
uni.showToast({ uni.showToast({
title: '请设置收款人姓名', title: '请设置收款人姓名',
@@ -75,8 +68,10 @@
icon: 'none' icon: 'none'
}) })
} else { } else {
this.logining = true
this.$u.post('app/user/updateUser?zhiFuBao=' + zhiFuBao + '&zhiFuBaoName=' + zhiFuBaoName).then( this.$u.post('app/user/updateUser?zhiFuBao=' + zhiFuBao + '&zhiFuBaoName=' + zhiFuBaoName).then(
res => { res => {
this.logining = false
console.log(res); console.log(res);
if(res.code===0){ if(res.code===0){
uni.setStorageSync('zhiFuBao', zhiFuBao) uni.setStorageSync('zhiFuBao', zhiFuBao)

View File

@@ -162,6 +162,17 @@
this.adRewardedVideo = true; this.adRewardedVideo = true;
console.log('广告数据加载成功'); console.log('广告数据加载成功');
}, },
/**
* 广告加载失败回调
* @param {Object} e
*/
onaderror(e) { // 广告加载失败
this.$refs.adRewardedVideo.load();
// this.adRewardedVideo = false;
console.log("广告加载失败")
},
/** /**
* 广告播放成功回调 * 广告播放成功回调
* @param {Object} e * @param {Object} e
@@ -187,14 +198,7 @@
// 播放中途退出 // 播放中途退出
} }
}, },
/**
* 广告加载失败回调
* @param {Object} e
*/
onaderror(e) { // 广告加载失败
this.adRewardedVideo = false;
console.log("广告加载失败")
},
/** /**
* 获取签到数据 * 获取签到数据
*/ */