增加金币解锁

This commit is contained in:
GaoHao
2024-12-07 18:26:08 +08:00
parent d5aa9080b6
commit 51d60f2dcb
5 changed files with 110 additions and 55 deletions

View File

@@ -151,13 +151,13 @@
{{getRedEnvelopeTips}}
</text>
<view class="pay-content">
<!-- <view class="pay-content-item" @click="payVideo(1)" v-if="zhengbu === '是'">
<view class="pay-content-item" @click="payVideo(1)">
<image class="pay-content-item-icon" src="../../static/images/me/rmIcon.png" mode=""></image>
<text class="pay-content-items">
{{zongPrice}}金币解锁整部视频
{{countPrice*scale}}金币解锁整部视频
</text>
</view> -->
<view class="pay-content-item" @click="payVideo(2)" v-if="danbu === '是'">
</view>
<view class="pay-content-item" @click="payVideo(2)">
<text class="pay-content-items">
{{countPrice}}元解锁单集视频
</text>
@@ -387,9 +387,9 @@
'width': '750rpx',
},
isShowVideo: '',
noBuyVideoIndex:null,
playFlag: false,
getRedEnvelopeTips: ''
getRedEnvelopeTips: '',
scale: 1,
};
},
onUnload() {
@@ -487,6 +487,7 @@
this.getRedEnvelopeTips= res.data
}
})
this.getScale()
},
onLoad(e) {
//是开启整部购买
@@ -510,6 +511,7 @@
this.boxStyle.height = this.wHeight + 5;
// 记录跳转过来的视频总id跟单集id
if (e.id) {
console.log(e)
this.courseId = e.id;
if (e.courseDetailsId && e.courseDetailsId != 'null') {
this.courseDetailsId = e.courseDetailsId
@@ -518,8 +520,19 @@
this.getMoneyList()
this.getMyMoney()
}
},
methods: {
/**
* 获取金币比例
*/
getScale () {
httpsRequest.getT("app/common/type/914", {}).then(res => {
if (res.code == 0) {
this.scale = Number(res.data.value)
}
});
},
//播放时的回掉
videoPlay(videoId,courseDetailsId) {
this.courseDetailsId = courseDetailsId
@@ -927,17 +940,23 @@
let data = {
courseId: this.courseId
}
if (type != 1) { //购买单集
data.courseDetailsId = this.videoList[this.current].courseDetailsId
}
data.courseDetailsId = this.videoList[this.current].courseDetailsId
httpsRequest.getT('/app/order/insertCourseOrders', data).then(res => {
if (res.code == 0) {
this.ordersId = res.data.orders.ordersId //记录订单id
this.payMoney = res.data.orders.payMoney //记录订单价格
this.closePay() //关闭购买选择弹窗
this.payPrice = res.data.orders.payMoney //需要支付的价格
this.openPopusPay() //显示充值弹窗
if (type == 1) { //金币
this.showPay = false
this.showMoney = false
this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
} else if(type == 2){ //支付宝
this.closePay() //关闭购买选择弹窗
this.payPrice = res.data.orders.payMoney //需要支付的价格
this.openPopusPay() //显示充值弹窗
}
// this.payOrder(res.data.orders.ordersId, res.data.orders.payMoney)
} else {
uni.showToast({
@@ -962,6 +981,7 @@
this.closePay()
that.showPay = false
that.showMoney = false
that.noBuyVideoIndex = null
setTimeout(() => {
that.getDataList(that.courseId, that.videoList[that.current].courseDetailsId,
true);
@@ -976,12 +996,11 @@
},
//打开购买弹窗
openPay() {
//获取总价跟单集价格
this.zongPrice = this.info.price
this.countPrice = this.videoList[this.current].price
this.$refs.popupPya.open('bottom')
this.noBuyVideoIndex=this.current
console.log(this.noBuyVideoIndex)
},
//关闭购买弹窗
closePay() {
@@ -1110,14 +1129,15 @@
},
//滚动到指定位置
goListPosition(courseDetailsId) {
let _this = this;
this.$nextTick(() => {
console.log(courseDetailsId, '开始移动了')
const el = this.$refs['list' + courseDetailsId][0]
const el = _this.$refs['list' + courseDetailsId][0]
listDom.scrollToElement(el, {
animated: false
})
this.$forceUpdate()
console.log(el, '移动结束')
_this.$forceUpdate()
console.log('移动结束',el)
})
},
/**
@@ -1139,6 +1159,7 @@
const indexs = arr.findIndex(menu => menu.courseDetailsId ===
Number(courseDetailsId));
this.current = indexs
console.log(this.current)
this.scrollIntoView = 'video' + indexs
arr.map((item, index) => {
item.num = index + 1;
@@ -1151,6 +1172,7 @@
});
//菜单数组
this.meunList = arr;
console.log(type)
if (type == true) { //购买视频后返回的
console.log('购买视频后返回的')
let courseDetailsIds = this.videoList[this.current].courseDetailsId;
@@ -1168,7 +1190,7 @@
}
})
})
if(this.noBuyVideoIndex!==null&&this.noBuyVideoIndex==indexss){
if(this.noBuyVideoIndex!==null&&this.noBuyVideoIndex==indexs){
this.noBuyVideoIndex=null
return uni.navigateTo({
url:'/me/choujiang/choujiang?orderId'+2144