修改无法生成订单问题
This commit is contained in:
@@ -133,7 +133,7 @@
|
||||
</view>
|
||||
</uni-popup>
|
||||
<!-- 购买弹窗 -->
|
||||
<uni-popup ref="popupPya" :safe-area="false">
|
||||
<uni-popup ref="popupPya" @change="popupPyaClose" :safe-area="false">
|
||||
<view class="pay">
|
||||
<view class="list-title">
|
||||
<view class="list-title-l">
|
||||
@@ -371,7 +371,7 @@ export default {
|
||||
num: 1, //当前播放的集数
|
||||
showPay: false, //购买视频的弹窗
|
||||
info: {}, //整部的信息
|
||||
courseDetailsId: '', //详情id
|
||||
courseDetailsId: null, //详情id
|
||||
scrollIntoView: '', //当前播放视频的位置
|
||||
scrollIntoViews: 'video0', //当前播放视频的位置
|
||||
isVips: '否', //是否显示会员
|
||||
@@ -406,7 +406,9 @@ export default {
|
||||
getRedEnvelopeTips: '',
|
||||
scale: 1,
|
||||
// 防抖使用的变量
|
||||
appearTimeout: null
|
||||
appearTimeout: null,
|
||||
isOrder: true,
|
||||
isGetDataList: false,
|
||||
};
|
||||
},
|
||||
onUnload() {
|
||||
@@ -431,7 +433,7 @@ export default {
|
||||
if (data.flag == true) {
|
||||
that.showPay = false
|
||||
that.getDataList(that.courseId, that.courseDetailsId, true);
|
||||
that.getMyLoveStatus()
|
||||
// that.getMyLoveStatus()
|
||||
that.getMoneyList()
|
||||
that.getMyMoney()
|
||||
}
|
||||
@@ -534,11 +536,8 @@ export default {
|
||||
// 记录跳转过来的视频总id跟单集id
|
||||
if (e.id) {
|
||||
this.courseId = e.id;
|
||||
if (e.courseDetailsId && e.courseDetailsId != 'null') {
|
||||
this.courseDetailsId = e.courseDetailsId
|
||||
}
|
||||
console.log(this.courseDetailsId)
|
||||
this.getMyLoveStatus()
|
||||
|
||||
// this.getMyLoveStatus()
|
||||
this.getMoneyList()
|
||||
this.getMyMoney()
|
||||
} else {
|
||||
@@ -546,10 +545,8 @@ export default {
|
||||
if (e.allId) {
|
||||
const arr = e.allId.split('-')
|
||||
this.courseId = arr[0];
|
||||
if (arr[1] && arr[1] != 'null') {
|
||||
this.courseDetailsId = arr[1]
|
||||
}
|
||||
this.getMyLoveStatus()
|
||||
|
||||
// this.getMyLoveStatus()
|
||||
this.getMoneyList()
|
||||
this.getMyMoney()
|
||||
}
|
||||
@@ -574,10 +571,12 @@ export default {
|
||||
},
|
||||
//播放时的回掉
|
||||
videoPlay(videoId, courseDetailsId) {
|
||||
console.log(courseDetailsId)
|
||||
// this.courseDetailsId = courseDetailsId
|
||||
if (!this.playFlag) {
|
||||
this.playFlag = true
|
||||
if ( this.isGetDataList) {
|
||||
this.getDataList(this.courseId, courseDetailsId,true);
|
||||
}
|
||||
this.isGetDataList = true;
|
||||
httpsRequest.getT('app/course/viewCourse', {
|
||||
courseId: this.courseId,
|
||||
courseDetailsId: courseDetailsId,
|
||||
@@ -606,6 +605,7 @@ export default {
|
||||
|
||||
},
|
||||
appear(e, index) {
|
||||
this.playFlag = false
|
||||
this.courseDetailsId = e;
|
||||
// 清除已经设置的定时器
|
||||
clearTimeout(this.appearTimeout);
|
||||
@@ -618,12 +618,14 @@ export default {
|
||||
console.log("appear===" + e)
|
||||
console.log("appear===" + index)
|
||||
// this.courseDetailsId = e
|
||||
console.log(e)
|
||||
this.current = index
|
||||
this.showControls = true
|
||||
this.isShowVideo = e
|
||||
this.scrollIntoViews = 'video' + index
|
||||
this.scrollIntoView = 'video' + index
|
||||
console.log(this.scrollIntoViews, '当前位置')
|
||||
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId);
|
||||
//播放并更新video的上下文
|
||||
this.startPlay(index)
|
||||
//插入历史记录
|
||||
@@ -808,10 +810,19 @@ export default {
|
||||
console.log('nvue payType=' + paytype);
|
||||
httpsRequest.getT("/app/wuyou/payOrder/" + this.ordersId + '?payType=' + paytype, {}).then(ret => {
|
||||
// plus.runtime.openURL(ret.data.h5Url)
|
||||
|
||||
if(ret.code == 0 ) {
|
||||
uni.hideLoading()
|
||||
uni.navigateTo({
|
||||
url: '/pages/pays/pays?ordersId=' + this.ordersId + '&url=' + ret.data.h5Url
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: res.msg,
|
||||
title: '支付失败!'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/index/webView?ordersId='+this.ordersId+'url=' + ret.data.h5Url
|
||||
@@ -1032,12 +1043,24 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
popupPyaClose() {
|
||||
this.isOrder = true
|
||||
console.log(this.isOrder)
|
||||
},
|
||||
/**
|
||||
* @param {Object} type 类型
|
||||
* 1:购买整部视频
|
||||
* 2:购买单集视频
|
||||
*/
|
||||
payVideo(type, num) {
|
||||
console.log(this.isOrder)
|
||||
if(!this.isOrder){
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.isOrder = false
|
||||
if (uni.getStorageSync('token')) {
|
||||
this.submitPay(type, num)
|
||||
} else {
|
||||
@@ -1056,27 +1079,38 @@ export default {
|
||||
//单集解锁
|
||||
data.courseDetailsId = this.videoList[this.current].courseDetailsId
|
||||
}
|
||||
httpsRequest.getT((num && num == 10)?'/app/order/insertCourseOrders/limit10': '/app/order/insertCourseOrders', data).then(res => {
|
||||
console.log(this.current)
|
||||
console.log(data)
|
||||
httpsRequest.getT((num && num == 10) ? '/app/order/insertCourseOrders/limit10' :
|
||||
'/app/order/insertCourseOrders', data).then(res => {
|
||||
console.log(res)
|
||||
if (res.code == 0) {
|
||||
|
||||
if (res.status && res.status == 1) {
|
||||
uni.hideLoading()
|
||||
this.showPay = false //关闭购买选择弹窗
|
||||
this.isOrder = true
|
||||
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,
|
||||
true);
|
||||
return;
|
||||
} else{
|
||||
this.ordersId = res.data.orders.ordersId //记录订单id
|
||||
this.payMoney = res.data.orders.payMoney //记录订单价格
|
||||
|
||||
if (type == 1) { //金币
|
||||
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
|
||||
} else if (type == 2) { //支付宝
|
||||
uni.hideLoading()
|
||||
this.closePay() //关闭购买选择弹窗
|
||||
this.payPrice = res.data.orders.payMoney //需要支付的价格
|
||||
this.openPopusPay() //显示充值弹窗
|
||||
}
|
||||
|
||||
}
|
||||
console.log(this.isOrder)
|
||||
|
||||
// this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
|
||||
} else {
|
||||
if ( res.status && res.status == 1) {
|
||||
this.showPay = false //关闭购买选择弹窗
|
||||
this.getDataList(this.courseId, this.videoList[this.current].courseDetailsId,
|
||||
true);
|
||||
return;
|
||||
}
|
||||
this.isOrder = true
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
@@ -1090,6 +1124,7 @@ export default {
|
||||
httpsRequest.postT("/app/order/payOrders", {
|
||||
orderId: orderId,
|
||||
}).then(res => {
|
||||
console.log("orderIds==", res)
|
||||
if (res.code == 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
@@ -1117,6 +1152,7 @@ export default {
|
||||
// this.payPrice = payMoney //需要支付的价格
|
||||
// this.openPopusPay() //显示充值弹窗
|
||||
}
|
||||
this.isOrder = true
|
||||
});
|
||||
},
|
||||
//打开购买弹窗
|
||||
@@ -1130,6 +1166,7 @@ export default {
|
||||
},
|
||||
//关闭购买弹窗
|
||||
closePay() {
|
||||
console.log(1)
|
||||
this.$refs.popupPya.close()
|
||||
},
|
||||
//选择播放
|
||||
@@ -1214,9 +1251,9 @@ export default {
|
||||
//播放结束后播放下一集
|
||||
ended() {
|
||||
if (this.current < this.videoList.length - 1) {
|
||||
// this.current += 1
|
||||
this.$nextTick(() => {
|
||||
let courseDetailsId = this.videoList[this.current + 1].courseDetailsId
|
||||
this.current += 1
|
||||
let courseDetailsId = this.videoList[this.current].courseDetailsId
|
||||
console.log(courseDetailsId, '开始移动了')
|
||||
const el = this.$refs['list' + courseDetailsId][0]
|
||||
listDom.scrollToElement(el, {})
|
||||
@@ -1286,18 +1323,33 @@ export default {
|
||||
id: courseId,
|
||||
token: uni.getStorageSync('token') ? uni.getStorageSync('token') : ''
|
||||
};
|
||||
console.log("getDataList==="+courseDetailsId)
|
||||
console.log("getDataList===",data)
|
||||
httpsRequest.getT('/app/course/selectCourseDetailsById', data).then(res => {
|
||||
|
||||
if (res.code == 0) {
|
||||
console.log(res)
|
||||
if (res.data && res.data.isCollect && res.data.isCollect > 0) {
|
||||
this.isCollect = true
|
||||
} else {
|
||||
this.isCollect = false
|
||||
}
|
||||
if( res.data && res.data.courseDetailsId && !this.courseDetailsId && !courseDetailsId) {
|
||||
courseDetailsId = res.data.courseDetailsId
|
||||
}
|
||||
this.courseDetailsId = courseDetailsId
|
||||
console.log(courseDetailsId)
|
||||
if (res.data.listsDetail) {
|
||||
this.info = res.data;
|
||||
this.title = this.info.title;
|
||||
let arr = JSON.parse(JSON.stringify(res.data.listsDetail));
|
||||
const indexs = arr.findIndex(menu => menu.courseDetailsId ===
|
||||
Number(courseDetailsId));
|
||||
this.current = indexs
|
||||
const indexs = arr.findIndex(menu => menu.courseDetailsId == Number(courseDetailsId));
|
||||
//如果未找到将current值改为0,否则会导致选集无法弹窗,弹窗后点击相对应集数也无反应
|
||||
this.current = indexs===-1?0:indexs;
|
||||
console.log(indexs)
|
||||
console.log(this.current)
|
||||
this.scrollIntoViews = 'video' + indexs
|
||||
this.scrollIntoView = 'video' + indexs
|
||||
console.log(this.current)
|
||||
// this.scrollIntoView = 'video' + indexs
|
||||
arr.map((item, index) => {
|
||||
item.num = index + 1;
|
||||
@@ -1344,6 +1396,22 @@ export default {
|
||||
this.videoContext.play();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('播放')
|
||||
this.$nextTick(()=>{
|
||||
console.log('myVideo' + courseDetailsIds)
|
||||
this.videoContextId = 'myVideo' + courseDetailsIds;
|
||||
this.videoContext = uni.createVideoContext(this
|
||||
.videoContextId,
|
||||
this);
|
||||
if (this.videoList[this.current].videoUrl) {
|
||||
this.videoContext.play();
|
||||
}else {
|
||||
console.log("播放失败")
|
||||
this.getDataList(this.courseId, courseDetailsIds, true);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
// console.log('this.noBuyVideoIndex', this.noBuyVideoIndex)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user