From f12372cbb2df72acd97cb17d3b0d5e29aafb4a7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9B=B9=E8=BE=89?= <814457906@qq.com>
Date: Fri, 5 May 2023 14:47:47 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/Imglearning/Imglearning.vue | 10 +-
pages/Learningtraining/Learningtraining.vue | 12 +-
pages/Orderlist/Orderlist.vue | 12 +-
.../Ordervideolearning.scss | 83 +++++++++++
.../Ordervideolearning/Ordervideolearning.vue | 129 +++++++++++++++++-
pages/Videolearning/Videolearning.scss | 83 +++++++++++
pages/Videolearning/Videolearning.vue | 123 +++++++++++++++++
pages/learning/learning.vue | 10 +-
8 files changed, 445 insertions(+), 17 deletions(-)
diff --git a/pages/Imglearning/Imglearning.vue b/pages/Imglearning/Imglearning.vue
index 5ad7361..cef8248 100644
--- a/pages/Imglearning/Imglearning.vue
+++ b/pages/Imglearning/Imglearning.vue
@@ -23,10 +23,12 @@
info() {
selectNurseAppletPersonTrainingItemDetailsList(this.trainingItemId, this.nurseStationPersonId).then(
res => {
- res.data.trainingItemContent = res.data.trainingItemContent.replace(/\
{{item.itemDirectoryIntroduce?item.itemDirectoryIntroduce:''}}
-
+
@@ -74,6 +74,26 @@
@play='videoplays'>
-->
+
+
+ ¥{{list.trainingItemPrice?list.trainingItemPrice:0}}
+
+
+ 购买
+
+
+
@@ -86,6 +106,10 @@
insertTrainingItemWatchRecord,
getTrainingItemWatchRecord
} from '@/api/Ordervideolearning/index.js'
+ import {
+ trainingItemOrder,
+ appletTrainingOrderPay
+ } from '@/api/learning/index.js'
export default {
data() {
return {
@@ -104,10 +128,12 @@
videoitem: {
watchTime: 0,
}, //视频对象
- trainingOrderStatus: undefined,
+ // trainingOrderStatus: undefined,
trainingOrderDetailsId: undefined,
videoerroshow: true,
videoContext: undefined,
+ bottombuyshow: false, //下面的购买divcss
+ buyshow: false, //购买弹框
};
},
onUnload() {
@@ -141,6 +167,100 @@
// });
// },
methods: {
+ //购买
+ tobuy() {
+ var that = this
+ const nurseStationId = uni.getStorageSync('nurseStationId');
+ if (nurseStationId) {
+ var obj = {
+ "trainingItemId": undefined,
+ "nurseStationId": undefined,
+ "nurseStationPersonId": undefined,
+ "trainingOrderAmount": undefined,
+ "nursePersonName": undefined,
+ }
+ obj.trainingItemId = this.list.trainingItemId
+ obj.nurseStationId = uni.getStorageSync('nurseStationId');
+ obj.nurseStationPersonId = this.nurseStationPersonId
+ obj.nursePersonName = uni.getStorageSync('nursePersonName');
+ obj.trainingOrderAmount = this.list.trainingItemPrice
+ trainingItemOrder(obj).then(res => {
+ if (res.code == 200) {
+ if (res.data.trainingOrderAmount > 0) {
+ let objs = {
+ "openid": uni.getStorageSync('openid'),
+ "nurseStationPersonId": res.data.nurseStationPersonId,
+ "orderNo": res.data.trainingOrderNo,
+ "payType": "WECHAT_PAY",
+ "orderChannel": "WECHAT_APPLET",
+ "buySource": "TRAINING",
+ "paymentPrice": res.data.trainingOrderAmount,
+ }
+ appletTrainingOrderPay(objs).then(response => {
+ if (response.code == 200) {
+ uni.requestPayment({
+ timeStamp: response.data.timeStamp,
+ nonceStr: response.data.nonceStr,
+ package: response.data.prepayId,
+ signType: response.data.signType,
+ paySign: response.data.paySign,
+ success: function(res) {
+ that.buyshow = false
+ that.bottombuyshow = false
+ that.info();
+ that.$refs.uToast.show({
+ title: '支付成功',
+ type: 'success',
+ duration: 1500,
+ })
+ },
+ fail: function(err) {
+ that.$refs.uToast.show({
+ title: '取消支付',
+ type: 'error',
+ duration: 1500,
+ url: `/pages/Orderdetails/Orderdetails?trainingOrderNo=${res.data.trainingOrderNo}`
+ })
+ that.buyshow = false
+ }
+ });
+ } else {
+ this.buyshow = false
+ this.$refs.uToast.show({
+ title: response.msg,
+ type: 'error',
+ duration: 2000
+ })
+ }
+ })
+ } else {
+ that.buyshow = false
+ that.bottombuyshow = false
+ that.info();
+ }
+ } else {
+ this.buyshow = false
+ this.$refs.uToast.show({
+ title: res.msg,
+ type: 'error',
+ duration: 2000
+ })
+ }
+ })
+ } else {
+ that.buyshow = false
+ that.$refs.uToast.show({
+ title: '请您重新登录',
+ type: 'error',
+ duration: 1500,
+ url: "/pages/login/login"
+ })
+ }
+ },
+ //打开购买弹框
+ buy() {
+ this.buyshow = true
+ },
//播放到末尾
videoended(e) {
this.videoContext.stop()
@@ -327,7 +447,7 @@
watchTime: 0
}
this.baseurl = baseurl
- this.trainingOrderStatus = options.trainingOrderStatus
+ // this.trainingOrderStatus = options.trainingOrderStatus
this.trainingItemId = options.trainingItemId
this.trainingOrderNo = options.trainingOrderNo
this.trainingOrderDetailsId = options.trainingOrderDetailsId
@@ -336,6 +456,9 @@
if (value) {
that.nurseStationPersonId = value
} else {}
+ if (options.trainingItemType) {
+ this.bottombuyshow = true
+ }
},
}
diff --git a/pages/Videolearning/Videolearning.scss b/pages/Videolearning/Videolearning.scss
index 1f68857..20f4440 100644
--- a/pages/Videolearning/Videolearning.scss
+++ b/pages/Videolearning/Videolearning.scss
@@ -4,7 +4,90 @@
margin: 15rpx auto;
color: #666666;
background-color: #fff;
+ .popup {
+ position: fixed;
+ bottom: 0;
+ .buyselect {
+ width: 100%;
+ height: 100rpx;
+ margin: 40rpx auto 0;
+ position: absolute;
+ top: 100rpx;
+
+ image {
+ position: absolute;
+ top: 50%;
+ left: 48rpx;
+ transform: translateY(-50%);
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .text {
+ position: absolute;
+ left: 150rpx;
+ top: 50%;
+ transform: translateY(-50%);
+ line-height: 100rpx;
+ font-size: 32rpx;
+ }
+ }
+
+ .buybtn {
+ width: 70%;
+ height: 70rpx;
+ background: #4271B9;
+ border-radius: 5rpx;
+ line-height: 70rpx;
+ color: #fff;
+ text-align: center;
+ position: absolute;
+ bottom: 40rpx;
+ left: 15%;
+ }
+
+ .popuptitle {
+ width: 100%;
+ font-size: 41rpx;
+ text-align: center;
+ position: absolute;
+ top: 40rpx;
+ }
+ }
+ .bottomitem {
+ position: fixed;
+ bottom: 0;
+ width: 100%;
+ height: 150rpx;
+ background: #FFFFFF;
+ box-shadow: 0rpx 1rpx 21rpx 0rpx rgba(204, 204, 204, 0.75);
+
+ .buy {
+ width: 150rpx;
+ height: 70rpx;
+ background: #4271B9;
+ line-height: 70rpx;
+ border-radius: 5rpx;
+ text-align: center;
+ color: #fff;
+ position: absolute;
+ right: 50rpx;
+ top: 50%;
+ transform: translateY(-50%);
+ }
+
+ .price {
+ position: absolute;
+ left: 50rpx;
+ top: 50%;
+ transform: translateY(-50%);
+ font-size: 42rpx;
+ font-weight: 500;
+ color: #EA706A;
+ line-height: 130rpx;
+ }
+ }
.directory {
padding-bottom: 420rpx;
diff --git a/pages/Videolearning/Videolearning.vue b/pages/Videolearning/Videolearning.vue
index e844574..cb400bf 100644
--- a/pages/Videolearning/Videolearning.vue
+++ b/pages/Videolearning/Videolearning.vue
@@ -71,6 +71,26 @@
+
+
+ ¥{{list.trainingItemPrice?list.trainingItemPrice:0}}
+
+
+ 购买
+
+
+
@@ -83,6 +103,10 @@
insertTrainingItemWatchRecord,
getTrainingItemWatchRecord
} from '@/api/Videolearning/index.js'
+ import {
+ trainingItemOrder,
+ appletTrainingOrderPay
+ } from '@/api/learning/index.js'
export default {
data() {
return {
@@ -102,6 +126,8 @@
}, //视频对象
videoContext: null,
videoerroshow: true,
+ bottombuyshow: false, //下面的购买divcss
+ buyshow: false, //购买弹框
};
},
onUnload() {
@@ -135,6 +161,100 @@
plus.screen.lockOrientation("portrait-primary");
},
methods: {
+ //购买
+ tobuy() {
+ var that = this
+ const nurseStationId = uni.getStorageSync('nurseStationId');
+ if (nurseStationId) {
+ var obj = {
+ "trainingItemId": undefined,
+ "nurseStationId": undefined,
+ "nurseStationPersonId": undefined,
+ "trainingOrderAmount": undefined,
+ "nursePersonName": undefined,
+ }
+ obj.trainingItemId = this.list.trainingItemId
+ obj.nurseStationId = uni.getStorageSync('nurseStationId');
+ obj.nurseStationPersonId = this.nurseStationPersonId
+ obj.nursePersonName = uni.getStorageSync('nursePersonName');
+ obj.trainingOrderAmount = this.list.trainingItemPrice
+ trainingItemOrder(obj).then(res => {
+ if (res.code == 200) {
+ if (res.data.trainingOrderAmount > 0) {
+ let objs = {
+ "openid": uni.getStorageSync('openid'),
+ "nurseStationPersonId": res.data.nurseStationPersonId,
+ "orderNo": res.data.trainingOrderNo,
+ "payType": "WECHAT_PAY",
+ "orderChannel": "WECHAT_APPLET",
+ "buySource": "TRAINING",
+ "paymentPrice": res.data.trainingOrderAmount,
+ }
+ appletTrainingOrderPay(objs).then(response => {
+ if (response.code == 200) {
+ uni.requestPayment({
+ timeStamp: response.data.timeStamp,
+ nonceStr: response.data.nonceStr,
+ package: response.data.prepayId,
+ signType: response.data.signType,
+ paySign: response.data.paySign,
+ success: function(res) {
+ that.buyshow = false
+ that.bottombuyshow = false
+ that.info();
+ that.$refs.uToast.show({
+ title: '支付成功',
+ type: 'success',
+ duration: 1500,
+ })
+ },
+ fail: function(err) {
+ that.$refs.uToast.show({
+ title: '取消支付',
+ type: 'error',
+ duration: 1500,
+ url: `/pages/Orderdetails/Orderdetails?trainingOrderNo=${res.data.trainingOrderNo}`
+ })
+ that.buyshow = false
+ }
+ });
+ } else {
+ this.buyshow = false
+ this.$refs.uToast.show({
+ title: response.msg,
+ type: 'error',
+ duration: 2000
+ })
+ }
+ })
+ } else {
+ that.buyshow = false
+ that.bottombuyshow = false
+ that.info();
+ }
+ } else {
+ this.buyshow = false
+ this.$refs.uToast.show({
+ title: res.msg,
+ type: 'error',
+ duration: 2000
+ })
+ }
+ })
+ } else {
+ that.buyshow = false
+ that.$refs.uToast.show({
+ title: '请您重新登录',
+ type: 'error',
+ duration: 1500,
+ url: "/pages/login/login"
+ })
+ }
+ },
+ //打开购买弹框
+ buy() {
+ this.buyshow = true
+ },
//播放到末尾
videoended(e) {
this.videoContext.stop()
@@ -324,6 +444,9 @@
that.nurseStationPersonId = value
that.info();
} else {}
+ if (options.trainingItemType) {
+ this.bottombuyshow = true
+ }
},
}
diff --git a/pages/learning/learning.vue b/pages/learning/learning.vue
index 74d4f78..0f1480b 100644
--- a/pages/learning/learning.vue
+++ b/pages/learning/learning.vue
@@ -257,10 +257,12 @@
//主信息
infos() {
selectNurseAppletPersonTrainingParent(this.trainingParentId, this.nurseStationPersonId).then(res => {
- res.rows[0].trainingItemContent = res.rows[0].trainingItemContent.replace(/\
![]()