This commit is contained in:
曹辉 2023-05-05 14:47:47 +08:00
parent ea4ae6d7ff
commit f12372cbb2
8 changed files with 445 additions and 17 deletions

View File

@ -23,10 +23,12 @@
info() {
selectNurseAppletPersonTrainingItemDetailsList(this.trainingItemId, this.nurseStationPersonId).then(
res => {
res.data.trainingItemContent = res.data.trainingItemContent.replace(/\<img/gi,
"<br/> <img class='richPic'")
res.data.trainingItemContent = res.data.trainingItemContent.replace(/\<p/gi,
"<p class='ptext'")
if (res.data.trainingItemContent) {
res.data.trainingItemContent = res.data.trainingItemContent.replace(/\<img/gi,
"<br/> <img class='richPic'")
res.data.trainingItemContent = res.data.trainingItemContent.replace(/\<p/gi,
"<p class='ptext'")
}
this.list = res.data
})
},

View File

@ -66,9 +66,15 @@
},
//
gographicvideo(item) {
uni.navigateTo({
url: `/pages/learning/learning?trainingParentId=${item.id}`
})
if (item.trainingItemType == 'VIDEO_LEARNING') {
uni.navigateTo({
url: `/pages/Videolearning/Videolearning?trainingItemId=${item.id}&&trainingItemType=${item.trainingItemType}`
})
} else {
uni.navigateTo({
url: `/pages/learning/learning?trainingParentId=${item.id}`
})
}
},
},
onReachBottom() { //

View File

@ -66,9 +66,15 @@
},
//
goOrderlearning(item) {
uni.navigateTo({
url: `/pages/Orderlearning/Orderlearning?trainingOrderStatus=${item.trainingOrderStatus}&trainingParentId=${item.trainingItemId}&trainingOrderNo=${item.trainingOrderNo}`
})
if (item.trainingItemType == 'VIDEO_LEARNING') {
uni.navigateTo({
url: `/pages/Ordervideolearning/Ordervideolearning?trainingItemType=${item.trainingItemType}&trainingOrderStatus=${item.trainingOrderStatus}&trainingItemId=${item.trainingItemId}&trainingOrderNo=${item.trainingOrderNo}&trainingOrderDetailsId=${item.trainingOrderDetailsId}`
})
} else {
uni.navigateTo({
url: `/pages/Orderlearning/Orderlearning?trainingOrderStatus=${item.trainingOrderStatus}&trainingParentId=${item.trainingItemId}&trainingOrderNo=${item.trainingOrderNo}`
})
}
},
//
info() {

View File

@ -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;

View File

@ -22,7 +22,7 @@
<view class="Introduce">
{{item.itemDirectoryIntroduce?item.itemDirectoryIntroduce:''}}
</view>
<view class="" v-if="trainingOrderStatus=='PAY'">
<view class="" v-if="list.trainingOrderStatus=='PAY'">
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'&&!item.videoshow">
@ -74,6 +74,26 @@
@play='videoplays'></video>
</u-popup> -->
<u-toast ref="uToast" />
<view class="bottomitem" v-if="bottombuyshow&&list.trainingOrderStatus=='WAIT_PAY'">
<view class="price">
{{list.trainingItemPrice?list.trainingItemPrice:0}}
</view>
<view class="buy" @tap='buy'>
购买
</view>
</view>
<u-popup v-model="buyshow" mode='bottom' height='500' class='popup' safe-area-inset-bottom>
<view class="popuptitle">请选择支付方式</view>
<view class="buyselect">
<image src="../../static/wechat.png" mode=""></image>
<view class="text">
微信支付
</view>
</view>
<view class="buybtn" @tap='tobuy'>
确认支付{{list.trainingItemPrice?list.trainingItemPrice:0}}
</view>
</u-popup>
</view>
<view class="" v-else style="padding-top: 100rpx;">
<u-empty text="暂无内容" mode="list" icon-size='240' font-size='32'></u-empty>
@ -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
}
},
}
</script>

View File

@ -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;

View File

@ -71,6 +71,26 @@
<!-- <u-popup v-model="videoshow" mode="center" closeable @close='videoshowfalse'>
</u-popup> -->
<u-toast ref="uToast" />
<view class="bottomitem" v-if="bottombuyshow&&list.trainingOrderDetailsBuy=='NOT_BUY'">
<view class="price">
{{list.trainingItemPrice?list.trainingItemPrice:0}}
</view>
<view class="buy" @tap='buy'>
购买
</view>
</view>
<u-popup v-model="buyshow" mode='bottom' height='500' class='popup' safe-area-inset-bottom>
<view class="popuptitle">请选择支付方式</view>
<view class="buyselect">
<image src="../../static/wechat.png" mode=""></image>
<view class="text">
微信支付
</view>
</view>
<view class="buybtn" @tap='tobuy'>
确认支付{{list.trainingItemPrice?list.trainingItemPrice:0}}
</view>
</u-popup>
</view>
<view class="" v-else style="padding-top: 100rpx;">
<u-empty text="暂无内容" mode="list" icon-size='240' font-size='32'></u-empty>
@ -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
}
},
}
</script>

View File

@ -257,10 +257,12 @@
//
infos() {
selectNurseAppletPersonTrainingParent(this.trainingParentId, this.nurseStationPersonId).then(res => {
res.rows[0].trainingItemContent = res.rows[0].trainingItemContent.replace(/\<img/gi,
"<br/> <img class='richPic'")
res.rows[0].trainingItemContent = res.rows[0].trainingItemContent.replace(/\<p/gi,
"<p class='ptext'")
if (res.rows[0].trainingItemContent) {
res.rows[0].trainingItemContent = res.rows[0].trainingItemContent.replace(/\<img/gi,
"<br/> <img class='richPic'")
res.rows[0].trainingItemContent = res.rows[0].trainingItemContent.replace(/\<p/gi,
"<p class='ptext'")
}
this.infoslist = res.rows[0]
})
},