This commit is contained in:
曹辉 2023-04-24 15:53:03 +08:00
parent c3d3384353
commit fcf6bcb995
8 changed files with 487 additions and 86 deletions

View File

@ -7,3 +7,12 @@ export function selectTrainingCategory(pageNum, pageSize, nurseStationPersonId)
method: 'GET' method: 'GET'
}) })
} }
//生成订单
export function trainingItemOrder(data) {
return request({
url: `/nurseApplet/personLearn/trainingItemOrder`,
method: 'POST',
data,
})
}

View File

@ -1,9 +1,9 @@
import request from "../request.js" import request from "../request.js"
//订单列表 //订单列表
export function selectTrainingOrderItemList(pageNum, pageSize, trainingItemType, nurseStationPersonId) { export function selectTrainingOrderItemList(pageNum, pageSize, nurseStationPersonId) {
return request({ return request({
url: `/nurseApplet/personLearn/selectTrainingOrderItemList?pageNum=${pageNum}&pageSize=${pageSize}&trainingItemType=${trainingItemType}&nurseStationPersonId=${nurseStationPersonId}`, url: `/nurseApplet/personLearn/selectTrainingOrderItemList?pageNum=${pageNum}&pageSize=${pageSize}&trainingItemType=${''}&nurseStationPersonId=${nurseStationPersonId}`,
method: 'GET' method: 'GET'
}) })
} }

View File

@ -1,18 +1,10 @@
import request from "../request.js" import request from "../request.js"
export function personTrainingItem(pageNum, pageSize, trainingItemId, nurseStationPersonId) { export function personTrainingItem(pageNum, pageSize, trainingParentId, nurseStationPersonId) {
return request({ return request({
url: `/nurseApplet/personLearn/personTrainingItem?pageNum=${pageNum}&pageSize=${pageSize}&trainingItemId=${trainingItemId}&nurseStationPersonId=${nurseStationPersonId}`, url: `/nurseApplet/personLearn/personTrainingItem?pageNum=${pageNum}&pageSize=${pageSize}&trainingParentId=${trainingParentId}&nurseStationPersonId=${nurseStationPersonId}`,
method: 'GET' method: 'GET'
}) })
} }
//生成订单
export function trainingItemOrder(data) {
return request({
url: `/nurseApplet/personLearn/trainingItemOrder`,
method: 'POST',
data,
})
}

View File

@ -9,20 +9,20 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},{ }, {
"path": "pages/Videolearning/Videolearning", "path": "pages/Videolearning/Videolearning",
"style": { "style": {
"navigationBarTitleText": "视频学习", "navigationBarTitleText": "视频学习",
"onReachBottomDistance": 50, // px "onReachBottomDistance": 50, // px
"enablePullDownRefresh": true //true "enablePullDownRefresh": true //true
} }
},{ }, {
"path": "pages/MyLearning/MyLearning", "path": "pages/MyLearning/MyLearning",
"style": { "style": {
"navigationBarTitleText": "我的学习", "navigationBarTitleText": "我的学习",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, { }, {
"path": "pages/Graphiclearning/Graphiclearning", "path": "pages/Graphiclearning/Graphiclearning",
"style": { "style": {
"navigationBarTitleText": "图文学习", "navigationBarTitleText": "图文学习",
@ -128,17 +128,20 @@
"navigationBarTitleText": "视频学习", "navigationBarTitleText": "视频学习",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, {
"path": "pages/Orderlist/Orderlist",
"style": {
"navigationBarTitleText": "我的学习",
"enablePullDownRefresh": false
}
}, {
"path": "pages/Orderdetails/Orderdetails",
"style": {
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false
}
} }
,{ ],
"path" : "pages/Orderlist/Orderlist",
"style" :
{
"navigationBarTitleText": "订单列表",
"enablePullDownRefresh": false
}
}
],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarTitleText": "", "navigationBarTitleText": "",

View File

@ -31,11 +31,24 @@
</view> </view>
</view> </view>
</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'>
确认支付{{buylist.trainingItemPrice}}
</view>
</u-popup>
</view> </view>
</template> </template>
<script> <script>
import { import {
selectTrainingCategory selectTrainingCategory,
trainingItemOrder
} from '@/api/Learningtraining/index.js' } from '@/api/Learningtraining/index.js'
import baseurl from '@/api/baseurl.js' import baseurl from '@/api/baseurl.js'
export default { export default {
@ -47,6 +60,8 @@
pageSize: 10, pageSize: 10,
list: [], list: [],
total: 0, total: 0,
buylist: {},
buyshow: false,
}; };
}, },
onShow() {}, onShow() {},
@ -62,6 +77,38 @@
} else {} } else {}
}, },
methods: { methods: {
//
tobuy() {
var obj = {
"trainingItemIdList": [],
"nurseStationId": undefined,
"nurseStationPersonId": undefined,
"trainingOrderAmount": undefined,
"nursePersonName": undefined,
"trainingItemType": undefined
}
obj.nurseStationId = uni.getStorageSync('nurseStationId');
obj.nursePersonName = uni.getStorageSync('nursePersonName');
obj.trainingItemIdList.push(this.buylist.trainingItemId)
obj.nurseStationPersonId = this.nursePersonId
obj.trainingOrderAmount = this.buylist.trainingItemPrice
obj.trainingItemType = this.buylist.trainingItemType
trainingItemOrder(obj).then(res => {
if (res.code == 200) {
this.buyshow = false
this.$refs.uToast.show({
title: '支付成功',
type: 'success',
duration: '1500'
})
}
})
},
//
buy(item) {
this.buylist = item
this.buyshow = true
},
info() { info() {
selectTrainingCategory(this.pageNum, this.pageSize, this.nursePersonId).then(res => { selectTrainingCategory(this.pageNum, this.pageSize, this.nursePersonId).then(res => {
this.list = res.rows this.list = res.rows
@ -72,11 +119,11 @@
gographicvideo(item) { gographicvideo(item) {
if (item.trainingItemTitle == '图文学习') { if (item.trainingItemTitle == '图文学习') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/Graphiclearning/Graphiclearning?trainingItemId=${item.trainingItemId}` url: `/pages/Graphiclearning/Graphiclearning?trainingParentId=${item.trainingItemId}`
}) })
} else if (item.trainingItemTitle == '视频学习') { } else if (item.trainingItemTitle == '视频学习') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/Videolearning/Videolearning?trainingItemId=${item.trainingItemId}` url: `/pages/Videolearning/Videolearning?trainingParentId=${item.trainingItemId}`
}) })
} }
} }
@ -106,6 +153,59 @@
color: #333333; color: #333333;
padding: 0; padding: 0;
.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 {
margin: 0;
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;
}
}
.card { .card {
width: 96%; width: 96%;
margin: 25rpx auto; margin: 25rpx auto;

View File

@ -0,0 +1,202 @@
<template>
<view class="app">
<!-- v-if="list.trainingOrderStatus=='WAIT_PAY'" -->
<view class="time" style="">
剩余付款时间
<u-count-down :timestamp="timestamp"></u-count-down>
</view>
<view class="trainingOrderStatus"
v-if="list.trainingOrderStatus=='REFUNDED'||list.trainingOrderStatus=='CANCEL'">
订单已关闭
</view>
<view class="content">
<view class="details">
<view class="detailslist">
<image :src="baseurl+list.trainingItemCoverUrl" mode=""></image>
<view class="model">
<span>{{list.trainingItemTitle}}</span>
</view>
</view>
<view class="payinfo">
<text class="pay">实付款</text>
<text class="price" v-if="list.trainingItemPrice">{{list.trainingItemPrice}}</text>
<text class="price" v-else>0</text>
</view>
</view>
</view>
<view class="info">
<span>护理人员<text>{{list.nursePersonName}}</text></span>
<!-- <span>联系电话<text>{{list.phone}}</text></span> -->
<span>订单编号<text>{{list.trainingOrderNo}}</text></span>
<!-- <span>下单时间<text>{{list.orderTime}}</text></span> -->
</view>
<!-- v-if="list.trainingOrderStatus == 'WAIT_PAY'" -->
<view class="buy" @tap='pay'>
<view class="pay">
去支付
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
baseurl: undefined,
list: {},
timestamp: 0,
};
},
onLoad(options) {
this.baseurl = baseurl
this.list = JSON.parse(options.list)
// var ordertimes = this.list.orderTime.replaceAll(/\-/gi, "/")
// var time = new Date(ordertimes).getTime() / 1000 + (60 * 60 * 2)
// var times = new Date().getTime() / 1000
// this.timestamp = time - times
console.log(this.list)
}
}
</script>
<style lang="scss">
.app {
padding: 0;
.buy {
background: #FFFFFF;
position: fixed;
bottom: 0;
height: 100rpx;
width: 100%;
.logistics {
width: 216rpx;
height: 68rpx;
text-align: center;
color: #ffffff;
border-radius: 26rpx;
font-size: 36rpx;
line-height: 68rpx;
position: absolute;
right: 260rpx;
top: 50%;
background: #E1AE3C;
transform: translateY(-50%);
z-index: 999;
}
.pay {
width: 216rpx;
height: 68rpx;
text-align: center;
color: #ffffff;
background: #4C7BC9;
border-radius: 26rpx;
font-size: 36rpx;
line-height: 68rpx;
position: absolute;
right: 20rpx;
top: 50%;
transform: translateY(-50%);
}
}
.info {
padding: 30rpx 0;
height: 40%;
background: #FFFFFF;
box-shadow: 0px 9px 31px 9px rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
width: 95%;
margin: 0 auto;
font-size: 30rpx;
color: #020000;
span {
display: block;
line-height: 65rpx;
margin-left: 20rpx;
text {
color: #BFBDBE;
word-break: break-all;
}
}
}
.content {
width: 95%;
background: #FFFFFF;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
margin: 30rpx auto;
position: relative;
.details {
height: 380rpx;
position: relative;
.detailslist {
display: flex;
image {
width: 182rpx;
height: 182rpx;
margin: 20rpx 0 0 20rpx;
}
.model {
width: 70%;
margin: 30rpx 0 0 20rpx;
span {
font-size: 32rpx;
color: #000000;
}
span:nth-child(1) {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 95%;
}
}
}
.payinfo {
width: 95%;
position: absolute;
left: 2.5%;
bottom: 20rpx;
.pay {
font-size: 30rpx;
color: #020000;
}
.price {
float: right;
font-size: 41rpx;
color: #D43953;
margin-right: 10rpx;
}
}
}
}
.time {
height: 80rpx;
width: 95%;
text-align: center;
line-height: 80rpx;
background-color: #fff;
margin: 30rpx auto 0;
border-radius: 20rpx;
}
}
</style>

View File

@ -1,23 +1,54 @@
<template> <template>
<view> <view class="app">
<view class="" v-if="total>0">
<view class="item" v-for="(item,index) in orderlist" :key="index">
<view class="name">
<span>{{item.trainingOrderStatus=='WAIT_PAY'?'待付款':''}}
{{item.trainingOrderStatus=='PAY'?'已付款':''}}
{{item.trainingOrderStatus=='REFUNDED'?'已退款':''}}
{{item.trainingOrderStatus=='CANCEL'?'已取消':''}}
</span>
</view>
<view class="detailslist" @tap="goMyLearning(item)">
<image :src="baseurl+item.trainingItemCoverUrl" mode=""></image>
<view class="model">
<span>{{item.trainingItemTitle}}</span>
<span v-if="item.trainingItemPrice">{{item.trainingItemPrice}}</span>
<span v-else>0</span>
</view>
</view>
<view class="submit" @tap='goOrderdetails(item)' style="background-color: #4271B9;">
去支付
</view>
<!-- v-if="item.trainingOrderStatus=='WAIT_PAY'" -->
</view>
</view>
<view class="noorder" v-else>
<u-empty mode="list" icon-size='220' text='暂无服务订单'></u-empty>
</view>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import baseurl from '@/api/baseurl.js'
import { import {
selectTrainingOrderItemList selectTrainingOrderItemList
} from '@/api/Orderlist/index.js' } from '@/api/Orderlist/index.js'
export default { export default {
data() { data() {
return { return {
trainingItemType: 'VIDEO_LEARNING', baseurl: undefined,
nurseStationPersonId: undefined, nurseStationPersonId: undefined,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderlist: [],
total: 0,
}; };
}, },
onShow() { onShow() {},
onLoad() {
this.baseurl = baseurl
const that = this const that = this
const value = uni.getStorageSync('nursePersonId'); const value = uni.getStorageSync('nursePersonId');
if (value) { if (value) {
@ -27,21 +58,130 @@
} else {} } else {}
}, },
methods: { methods: {
goMyLearning() { //
goOrderdetails(item) {
uni.navigateTo({
url: `/pages/Orderdetails/Orderdetails?list=${JSON.stringify(item)}`
})
},
//
goMyLearning(item) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/MyLearning/MyLearning" url: "/pages/MyLearning/MyLearning"
}) })
}, },
//
info() { info() {
selectTrainingOrderItemList(this.pageNum, this.pageSize, this.trainingItemType, this.nurseStationPersonId) selectTrainingOrderItemList(this.pageNum, this.pageSize, this.nurseStationPersonId)
.then(res => { .then(res => {
console.log(res) this.orderlist = res.rows
this.total = res.total
}) })
}, },
} },
onReachBottom() { //
if (this.list.length >= this.total) {} else {
this.pageNum++
selectTrainingOrderItemList(this.pageNum, this.pageSize, this.nurseStationPersonId)
.then(res => {
res.rows.forEach(e => {
this.orderlist.push(e)
})
})
}
},
onPullDownRefresh() { //
this.pageNum = 1
this.info();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.app {
padding: 0;
.noorder {
margin-top: 20%;
}
.item {
width: 99%;
background: #FFFFFF;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
padding: 0 0 100rpx 0;
margin: 20rpx auto;
position: relative;
.name {
width: 95%;
height: 90rpx;
font-size: 30rpx;
color: #969394;
line-height: 90rpx;
border-bottom: 1rpx solid #D8D4D4;
margin: 0 auto;
span {
color: #4C7BC9;
float: right;
}
image {
width: 15rpx;
height: 23rpx;
padding-left: 25rpx;
}
}
.detailslist {
display: flex;
image {
width: 182rpx;
height: 182rpx;
margin: 20rpx 0 0 20rpx;
}
.model {
width: 70%;
margin: 30rpx 0 0 20rpx;
span {
font-size: 34rpx;
color: #000000;
}
span:nth-child(1) {
display: inline-block;
width: 70%;
}
span:nth-child(2) {
color: #969394;
float: right;
margin-right: 30rpx;
}
}
}
.submit {
width: 25%;
height: 68rpx;
line-height: 68rpx;
background: #4C7BC9;
border-radius: 26rpx;
text-align: center;
font-size: 32rpx;
color: #FFFFFF;
position: absolute;
right: 2%;
}
}
}
</style> </style>

View File

@ -20,18 +20,6 @@
</view> --> </view> -->
</view> </view>
</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'>
确认支付{{buylist.trainingItemPrice}}
</view>
</u-popup> -->
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
@ -39,27 +27,24 @@
<script> <script>
import { import {
personTrainingItem, personTrainingItem,
trainingItemOrder
} from '@/api/Videolearning/index.js' } from '@/api/Videolearning/index.js'
import baseurl from '@/api/baseurl.js' import baseurl from '@/api/baseurl.js'
export default { export default {
data() { data() {
return { return {
buyshow: false,
baseurl: undefined, baseurl: undefined,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
trainingItemId: undefined, trainingParentId: undefined,
nurseStationPersonId: undefined, nurseStationPersonId: undefined,
list: [], list: [],
total: 0, total: 0,
buylist: {},
}; };
}, },
onLoad(options) { onLoad(options) {
const that = this const that = this
this.trainingItemId = options.trainingItemId this.trainingParentId = options.trainingParentId
// this.trainingItemId = 2 // this.trainingParentId = 2
this.baseurl = baseurl this.baseurl = baseurl
const value = uni.getStorageSync('nursePersonId'); const value = uni.getStorageSync('nursePersonId');
if (value) { if (value) {
@ -69,36 +54,6 @@
} else {} } else {}
}, },
methods: { methods: {
//
tobuy() {
var obj = {
"trainingItemIdList": [],
"nurseStationId": undefined,
"nurseStationPersonId": undefined,
"trainingOrderAmount": undefined,
"nursePersonName": undefined
}
obj.nurseStationId = uni.getStorageSync('nurseStationId');
obj.nursePersonName = uni.getStorageSync('nursePersonName');
obj.trainingItemIdList.push(this.buylist.trainingItemId)
obj.nurseStationPersonId = this.nurseStationPersonId
obj.trainingOrderAmount = this.buylist.trainingItemPrice
trainingItemOrder(obj).then(res => {
if (res.code == 200) {
this.buyshow = false
this.$refs.uToast.show({
title: '支付成功',
type: 'success',
duration: '1500'
})
}
})
},
//
buy(item) {
this.buylist = item
this.buyshow = true
},
// //
goVideolearningdetails(item) { goVideolearningdetails(item) {
uni.navigateTo({ uni.navigateTo({
@ -106,7 +61,7 @@
}) })
}, },
info() { info() {
personTrainingItem(this.pageNum, this.pageSize, this.trainingItemId, this.nurseStationPersonId).then( personTrainingItem(this.pageNum, this.pageSize, this.trainingParentId, this.nurseStationPersonId).then(
res => { res => {
this.list = res.rows this.list = res.rows
this.total = res.total this.total = res.total
@ -116,7 +71,7 @@
onReachBottom() { // onReachBottom() { //
if (this.list.length >= this.total) {} else { if (this.list.length >= this.total) {} else {
this.pageNum++ this.pageNum++
personTrainingItem(this.pageNum, this.pageSize, this.trainingItemId, this.nurseStationPersonId).then( personTrainingItem(this.pageNum, this.pageSize, this.trainingParentId, this.nurseStationPersonId).then(
res => { res => {
res.rows.forEach(e => { res.rows.forEach(e => {
this.list.push(e) this.list.push(e)