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

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

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

View File

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