|
|
@@ -18,7 +18,7 @@
|
|
|
isAllowSeek="ifViewed"
|
|
|
:showPlaybackRateBtn="false"
|
|
|
:enablePlayGesture="true"
|
|
|
- :playbackRate=playbackRate
|
|
|
+ :playbackRate="playbackRate"
|
|
|
@statechange="onStateChange"
|
|
|
></polyv-player>
|
|
|
</view>
|
|
|
@@ -177,15 +177,83 @@
|
|
|
<view class="confrim-btn" style="margin-top: 10rpx;"><u-button @click="showBox = false">取消</u-button></view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
+ <u-popup v-model="showPricePop" mode="bottom" border-radius="14">
|
|
|
+ <view class="topBox">
|
|
|
+ <view class="firstTopL">
|
|
|
+ <view class="imageBs"><image :src="$method.splitImgHost(pageData.coverUrl)" mode=""></image></view>
|
|
|
+ <view class="textBs">{{ pageData.courseName }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="boldFonstType">
|
|
|
+ 类型:
|
|
|
+ <span style="font-weight: bold;">{{ pageData.categoryName }}</span>
|
|
|
+ </view>
|
|
|
+ <view class="priceBxs">
|
|
|
+ <view class="pricleft">
|
|
|
+ 活动价
|
|
|
+ <span style="font-weight: bold;">¥{{ pageData.price }}</span>
|
|
|
+ </view>
|
|
|
+ <view class="pricright" style="text-decoration: line-through;color: #666;">¥{{ pageData.price }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="yh">
|
|
|
+ <view class="yhtitle">
|
|
|
+ <span>优惠</span>
|
|
|
+ <u-icon
|
|
|
+ style="transition: all 0.2s;"
|
|
|
+ name="arrow-right"
|
|
|
+ color="#999"
|
|
|
+ size="28"
|
|
|
+ @click="getConfiguration"
|
|
|
+ :style="pricestatus ? 'transform: rotate(90deg);' : ''"
|
|
|
+ ></u-icon>
|
|
|
+ </view>
|
|
|
+ <view class="ts">
|
|
|
+ <u-icon name="error-circle" color="#999" size="24"></u-icon>
|
|
|
+ 平台所有优惠均不可同时使用
|
|
|
+ </view>
|
|
|
+ <radio-group @change="activeCoupon" v-show="pricestatus">
|
|
|
+ <view class="yhj">
|
|
|
+ <view class="yhjtit">优惠券</view>
|
|
|
+ <view class="yhjList" v-for="(item, index) in configList" :key="index">
|
|
|
+ <view class="yhjLefts">
|
|
|
+ <view class="yhl">
|
|
|
+ {{ item.couponType === 0 ? '现金券' : item.couponType === 1 ? '折扣券' : '未知' }}:{{ item.price
|
|
|
+ }}{{ item.couponType === 0 ? '元' : item.couponType === 1 ? '折' : '未知' }}
|
|
|
+ </view>
|
|
|
+ <view class="yhbq" v-if="item.endTime - newDate <= 3 * 24 * 3600">即将到期</view>
|
|
|
+ </view>
|
|
|
+ <radio :value="JSON.stringify([1, item.couponId])" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="hdyhj">
|
|
|
+ <view class="yhjtit">活动优惠</view>
|
|
|
+ <view class="yhjList" v-for="(item, index) in activityList" :key="index">
|
|
|
+ <view class="yhjLefts">
|
|
|
+ <view class="yhl">{{ item.activityName }}:{{ item.description }}</view>
|
|
|
+ <view class="yhbq" v-if="item.endTime - newDate <= 3 * 24 * 3600">即将到期</view>
|
|
|
+ </view>
|
|
|
+ <radio :value="JSON.stringify([2, item.id])" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </radio-group>
|
|
|
+ </view>
|
|
|
+ <view class="btnspric">
|
|
|
+ <view class="lefprL">
|
|
|
+ 实付:
|
|
|
+ <span style="color: #E91313;">¥{{ prices }}</span>
|
|
|
+ </view>
|
|
|
+ <view class="lefprR" @click="getorder">提交订单</view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {mapGetters} from 'vuex';
|
|
|
+import { mapGetters } from 'vuex';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- playbackRate:[0.5,0.8,1.0,1.25,1.5],
|
|
|
+ playbackRate: [0.5, 0.8, 1.0, 1.25, 1.5],
|
|
|
list: [
|
|
|
{
|
|
|
name: '课程目录'
|
|
|
@@ -233,42 +301,48 @@ export default {
|
|
|
commendList: [], //推荐课程列表
|
|
|
collecStatus: false, //收藏状态
|
|
|
initH4: 0,
|
|
|
- id:0,
|
|
|
- PlayDuration:0,
|
|
|
- firstPlay:true
|
|
|
+ id: 0,
|
|
|
+ PlayDuration: 0,
|
|
|
+ firstPlay: true,
|
|
|
+ showPricePop: false, //购买详情弹窗
|
|
|
+ configList: [], //优惠卷列表
|
|
|
+ activityList: [], //活动优惠列表
|
|
|
+ activeCouponId: [], //当前优惠卷ID [0] : 1 优惠卷 2 活动优惠
|
|
|
+ pricestatus: false, //当前优惠卷展开状态
|
|
|
+ newDate: 0, //现在时间戳
|
|
|
+ prices: 0 //实付
|
|
|
};
|
|
|
},
|
|
|
- onUnload(){
|
|
|
+ onUnload() {
|
|
|
var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
- if(polyvPlayerContext!=null){
|
|
|
+ if (polyvPlayerContext != null) {
|
|
|
//存储播放记录
|
|
|
- let PlayCurrentTime = polyvPlayerContext.getCurrentTime()
|
|
|
- if(PlayCurrentTime){
|
|
|
- let key = this.vid
|
|
|
+ let PlayCurrentTime = polyvPlayerContext.getCurrentTime();
|
|
|
+ if (PlayCurrentTime) {
|
|
|
+ let key = this.vid;
|
|
|
uni.setStorageSync(key, PlayCurrentTime);
|
|
|
- this.addStudyRecord(PlayCurrentTime)
|
|
|
+ this.addStudyRecord(PlayCurrentTime);
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
- computed: {...mapGetters(['userInfo'])},
|
|
|
+ computed: { ...mapGetters(['userInfo']) },
|
|
|
onLoad(option) {
|
|
|
const Verify = require('@/wxcomponents/verify_mpsdk/main.js');
|
|
|
Verify.init();
|
|
|
- this.id = option.id
|
|
|
+ this.id = option.id;
|
|
|
this.$api.courseInfo(option.id).then(res => {
|
|
|
this.pageData = res.data.data;
|
|
|
+ this.prices = res.data.data.price.toFixed(2);
|
|
|
this.getTeacher(res.data.data.teacherIds);
|
|
|
});
|
|
|
this.getChapter(this.id);
|
|
|
this.getcommendList(this.id);
|
|
|
- let time = uni.getStorageSync('face')
|
|
|
- if(time){
|
|
|
- let nowTime = (new Date).getTime()/1000
|
|
|
- if((nowTime-time)<24*3600){
|
|
|
- this.faceGetState = true
|
|
|
+ let time = uni.getStorageSync('face');
|
|
|
+ if (time) {
|
|
|
+ let nowTime = new Date().getTime() / 1000;
|
|
|
+ if (nowTime - time < 24 * 3600) {
|
|
|
+ this.faceGetState = true;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
@@ -300,35 +374,111 @@ export default {
|
|
|
this.current = 3;
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
methods: {
|
|
|
- addStudyRecord(study_duration){
|
|
|
- console.log(study_duration,66)
|
|
|
- let data = {
|
|
|
- courseId:this.id,
|
|
|
- sectionId:this.infoData.sectionId ,
|
|
|
- studyDuration:study_duration
|
|
|
+ getorder(){
|
|
|
+ var self = this
|
|
|
+ var data = {
|
|
|
+ goodsList: [{
|
|
|
+ goodsId: self.pageData.courseId,
|
|
|
+ num: 1,
|
|
|
+ goodsType: 1
|
|
|
+ }]
|
|
|
}
|
|
|
- this.$api.studyRecord(data).then(result => {
|
|
|
-
|
|
|
- });
|
|
|
+ if(self.activeCouponId.length !== 0){
|
|
|
+ if(self.activeCouponId[0] === 1){
|
|
|
+ data.couponId = self.activeCouponId[1]
|
|
|
+ }
|
|
|
+ if(self.activeCouponId[0] === 2){
|
|
|
+ data.activityId = self.activeCouponId[1]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.$api.order(data).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //选择卷触发
|
|
|
+ activeCoupon(e) {
|
|
|
+ var self = this;
|
|
|
+ self.activeCouponId = JSON.parse(e.detail.value);
|
|
|
+ self.computedPrice(JSON.parse(e.detail.value));
|
|
|
+ },
|
|
|
+ //计算价格
|
|
|
+ async computedPrice(arrs) {
|
|
|
+ var self = this;
|
|
|
+ const aites = await this.$api.courseInfo(this.id)
|
|
|
+ self.prices = aites.data.data.price.toFixed(2);
|
|
|
+ if (arrs[0] === 1) {
|
|
|
+ self.configList.forEach((item, index) => {
|
|
|
+ if (item.couponId === arrs[1]) {
|
|
|
+ if (item.couponType === 0) {
|
|
|
+ self.prices = (self.prices - item.price).toFixed(2);
|
|
|
+ }
|
|
|
+ if (item.couponType === 1) {
|
|
|
+ self.prices = (self.prices * (item.price * 0.1)).toFixed(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (arrs[0] === 2) {
|
|
|
+ self.activityList.forEach((item, index) => {
|
|
|
+ if (item.id === arrs[1]) {
|
|
|
+ if (item.activityType === '0') {
|
|
|
+ self.prices = (self.prices - item.price).toFixed(2);
|
|
|
+ }
|
|
|
+ if (item.activityType === '1') {
|
|
|
+ self.prices = (self.prices * (item.price * 0.1)).toFixed(2);
|
|
|
+ }
|
|
|
+ if (item.activityType === '2') {
|
|
|
+
|
|
|
+ }
|
|
|
+ if (item.activityType === '3') {
|
|
|
+ self.prices = item.price.toFixed(2);
|
|
|
+ }
|
|
|
+ if (item.activityType === '4') {
|
|
|
+ self.prices = (self.prices - item.price).toFixed(2);
|
|
|
+ }
|
|
|
+ if (item.activityType === '5') {
|
|
|
+ self.prices = (self.prices * (item.price * 0.1)).toFixed(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(self.prices)
|
|
|
+ },
|
|
|
+ //优惠卷
|
|
|
+ getConfiguration() {
|
|
|
+ var self = this;
|
|
|
+ self.newDate = self.$method.timest();
|
|
|
+ if (this.pricestatus) {
|
|
|
+ self.pricestatus = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ self.pricestatus = true;
|
|
|
},
|
|
|
- onStateChange(newstate,oldstate){
|
|
|
- if(newstate.detail.newstate=='playing'){
|
|
|
- if(this.firstPlay){
|
|
|
+ addStudyRecord(study_duration) {
|
|
|
+ let data = {
|
|
|
+ courseId: this.id,
|
|
|
+ sectionId: this.infoData.sectionId,
|
|
|
+ studyDuration: study_duration
|
|
|
+ };
|
|
|
+ this.$api.studyRecord(data).then(result => {});
|
|
|
+ },
|
|
|
+ onStateChange(newstate, oldstate) {
|
|
|
+ if (newstate.detail.newstate == 'playing') {
|
|
|
+ if (this.firstPlay) {
|
|
|
var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
- if(polyvPlayerContext!=null){
|
|
|
+ if (polyvPlayerContext != null) {
|
|
|
//获取播放记录
|
|
|
- let key = this.vid
|
|
|
+ let key = this.vid;
|
|
|
let PlayDuration = uni.getStorageSync(key);
|
|
|
- if(PlayDuration){
|
|
|
+ if (PlayDuration) {
|
|
|
polyvPlayerContext.seek(parseInt(PlayDuration));
|
|
|
- this.firstPlay = false
|
|
|
- }
|
|
|
- }
|
|
|
+ this.firstPlay = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- console.log(23)
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
swipStatus() {
|
|
|
this.activeStatus = !this.activeStatus;
|
|
|
@@ -446,7 +596,7 @@ export default {
|
|
|
this.vid = this.infoData.vid;
|
|
|
this.activeStatusCata = item.chapterId;
|
|
|
this.showBox = false;
|
|
|
- this.firstPlay = true
|
|
|
+ this.firstPlay = true;
|
|
|
},
|
|
|
getChapter(v) {
|
|
|
var self = this;
|
|
|
@@ -487,7 +637,7 @@ export default {
|
|
|
url: '/pages/login/login'
|
|
|
});
|
|
|
} else {
|
|
|
- if(this.userInfo.certified!=1){
|
|
|
+ if (this.userInfo.certified != 1) {
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '请先实名认证',
|
|
|
@@ -500,7 +650,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
//模拟今天是否人脸识别
|
|
|
if (!this.faceGetState) {
|
|
|
@@ -537,15 +687,15 @@ export default {
|
|
|
var self = this;
|
|
|
const faceBiz = await self.$api.facecertificationPicBizToken();
|
|
|
self.BizToken = faceBiz.data.data.bizToken;
|
|
|
- let time = (new Date()).getTime()/1000
|
|
|
- uni.setStorageSync("face",time)
|
|
|
+ let time = new Date().getTime() / 1000;
|
|
|
+ uni.setStorageSync('face', time);
|
|
|
wx.startVerify({
|
|
|
data: {
|
|
|
token: self.BizToken
|
|
|
},
|
|
|
success: result => {
|
|
|
setTimeout(() => {
|
|
|
- self.faceGetState = true
|
|
|
+ self.faceGetState = true;
|
|
|
self.$api.facecertificationPicDetectInfo(self.BizToken).then(faceRec => {
|
|
|
if (faceRec.data.data === 0) {
|
|
|
uni.showToast({
|
|
|
@@ -625,6 +775,17 @@ export default {
|
|
|
key: 'union_id',
|
|
|
success: function(res) {
|
|
|
// 继续操作
|
|
|
+ self.$api.configurationlistCoupon().then(configL => {
|
|
|
+ self.configList = configL.data.rows;
|
|
|
+ });
|
|
|
+ self.$api
|
|
|
+ .configurationlistConfig({
|
|
|
+ courseId: self.id
|
|
|
+ })
|
|
|
+ .then(activityL => {
|
|
|
+ self.activityList = activityL.data.rows;
|
|
|
+ });
|
|
|
+ self.showPricePop = true;
|
|
|
},
|
|
|
fail: function(err) {
|
|
|
//重新登入
|
|
|
@@ -643,6 +804,132 @@ export default {
|
|
|
}
|
|
|
</style>
|
|
|
<style scope>
|
|
|
+.btnspric {
|
|
|
+ border-top: 1rpx solid #eee;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 108rpx;
|
|
|
+ padding-left: 43rpx;
|
|
|
+ padding-right: 32rpx;
|
|
|
+}
|
|
|
+.btnspric > .lefprL {
|
|
|
+ font-size: 36rpx;
|
|
|
+ color: #0c141f;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+.btnspric > .lefprR {
|
|
|
+ padding: 0rpx 24rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
+ text-align: center;
|
|
|
+ color: #fff;
|
|
|
+ background: #32467b;
|
|
|
+ border-radius: 24rpx;
|
|
|
+ box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
|
|
|
+}
|
|
|
+.yhj,
|
|
|
+.hdyhj {
|
|
|
+ padding: 24rpx 29rpx 24rpx 34rpx;
|
|
|
+}
|
|
|
+.yhj {
|
|
|
+ border-bottom: 16rpx solid #f9f9f9;
|
|
|
+}
|
|
|
+.yhjtit {
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: #0c141f;
|
|
|
+ font-weight: 500;
|
|
|
+ margin-bottom: 14rpx;
|
|
|
+}
|
|
|
+.yhjList {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 14rpx;
|
|
|
+}
|
|
|
+.yhjList > .yhjLefts {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.yhjLefts > .yhl {
|
|
|
+ color: #32467b;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-right: 31rpx;
|
|
|
+}
|
|
|
+.yhjLefts > .yhbq {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #ff9500;
|
|
|
+ border-radius: 18rpx;
|
|
|
+ background-color: rgba(255, 149, 0, 0.2);
|
|
|
+ border: 2rpx solid #ff9500;
|
|
|
+ height: 38rpx;
|
|
|
+ line-height: 38rpx;
|
|
|
+ padding: 0rpx 16rpx;
|
|
|
+}
|
|
|
+.ts {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #999;
|
|
|
+ margin: 14rpx 0rpx;
|
|
|
+ padding-right: 29rpx;
|
|
|
+ padding-left: 34rpx;
|
|
|
+}
|
|
|
+.yh {
|
|
|
+ padding-top: 20rpx;
|
|
|
+}
|
|
|
+.yh > .yhtitle {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding-right: 29rpx;
|
|
|
+ padding-left: 34rpx;
|
|
|
+}
|
|
|
+.priceBxs {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.priceBxs > .pricleft {
|
|
|
+ border-radius: 24rpx;
|
|
|
+ border: 1rpx solid #e91313;
|
|
|
+ background-color: rgba(233, 19, 19, 0.1);
|
|
|
+ padding: 0rpx 18rpx;
|
|
|
+ height: 49rpx;
|
|
|
+ line-height: 49rpx;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 30rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #e91313;
|
|
|
+ margin-right: 13rpx;
|
|
|
+}
|
|
|
+.topBox {
|
|
|
+ padding: 32rpx 32rpx 24rpx;
|
|
|
+ border-bottom: 1rpx solid #eeeeee;
|
|
|
+}
|
|
|
+.topBox > .boldFonstType {
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin: 16rpx 0rpx 23rpx;
|
|
|
+}
|
|
|
+.topBox > .firstTopL {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.topBox > .firstTopL > .imageBs {
|
|
|
+ width: 331rpx;
|
|
|
+ height: 160rpx;
|
|
|
+ border-radius: 6rpx;
|
|
|
+ overflow: hidden;
|
|
|
+ margin-right: 8rpx;
|
|
|
+ box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
|
|
|
+}
|
|
|
+.topBox > .firstTopL > .imageBs > image {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+.topBox > .firstTopL > .textBs {
|
|
|
+ font-size: 30rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #0c141f;
|
|
|
+}
|
|
|
.content {
|
|
|
padding: 24rpx;
|
|
|
text-align: left;
|