修改
This commit is contained in:
parent
abde8d360e
commit
10513ba43b
@ -21,3 +21,11 @@ export function trainingItemOrder(data) {
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function appletTrainingOrderPay(data) {
|
||||
return request({
|
||||
url: `/nurseApp/weChatPayment/appletTrainingOrderPay`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
@ -139,7 +139,6 @@
|
||||
"navigationBarTitleText": "视频学习",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<view class="app">
|
||||
<!-- v-if="list.trainingOrderStatus=='WAIT_PAY'" -->
|
||||
<view class="time" style="">
|
||||
<view class="time" style="" v-if="list.trainingOrderStatus=='WAIT_PAY'">
|
||||
剩余付款时间:
|
||||
<u-count-down :timestamp="timestamp"></u-count-down>
|
||||
</view>
|
||||
@ -30,10 +29,9 @@
|
||||
<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="buy" @tap='tobuy' v-if="list.trainingOrderStatus == 'WAIT_PAY'">
|
||||
<view class="pay">
|
||||
去支付
|
||||
确认支付
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
@ -41,6 +39,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
trainingItemOrder,
|
||||
appletTrainingOrderPay
|
||||
} from '@/api/learning/index.js'
|
||||
import baseurl from '@/api/baseurl.js'
|
||||
export default {
|
||||
data() {
|
||||
@ -53,11 +55,76 @@
|
||||
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
|
||||
var ordertimes = this.list.trainingOrderTime.replaceAll(/\-/gi, "/")
|
||||
var time = new Date(this.list.trainingOrderTime).getTime() / 1000 + (60 * 60 * 2)
|
||||
var times = new Date().getTime() / 1000
|
||||
this.timestamp = time - times
|
||||
console.log(this.list)
|
||||
},
|
||||
methods: {
|
||||
//购买
|
||||
tobuy() {
|
||||
var that = this
|
||||
var obj = {
|
||||
"trainingItemId": undefined,
|
||||
"nurseStationId": undefined,
|
||||
"nurseStationPersonId": undefined,
|
||||
"trainingOrderAmount": undefined,
|
||||
"nursePersonName": undefined,
|
||||
}
|
||||
obj.trainingItemId = this.list.trainingItemId
|
||||
obj.nurseStationId = uni.getStorageSync('nurseStationId');
|
||||
obj.nurseStationPersonId = uni.getStorageSync('nursePersonId');
|
||||
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.$refs.uToast.show({
|
||||
title: '支付成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
that.$refs.uToast.show({
|
||||
title: '取消支付',
|
||||
type: 'error',
|
||||
duration: 1500,
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: response.msg,
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -17,7 +17,8 @@
|
||||
<span v-else>¥0</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit" @tap='goOrderdetails(item)' style="background-color: #4271B9;">
|
||||
<view class="submit" @tap='goOrderdetails(item)' v-if="item.trainingOrderStatus=='WAIT_PAY'"
|
||||
style="background-color: #4271B9;">
|
||||
去支付
|
||||
</view>
|
||||
</view>
|
||||
@ -50,8 +51,7 @@
|
||||
const that = this
|
||||
const value = uni.getStorageSync('nursePersonId');
|
||||
if (value) {
|
||||
// that.nurseStationPersonId = value
|
||||
that.nurseStationPersonId = 61
|
||||
that.nurseStationPersonId = value
|
||||
that.info();
|
||||
} else {}
|
||||
},
|
||||
@ -64,9 +64,16 @@
|
||||
},
|
||||
//我的学习
|
||||
goOrderlearning(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/Orderlearning/Orderlearning?trainingParentId=${item.trainingItemId}`
|
||||
})
|
||||
item.trainingItemContent = undefined
|
||||
if (item.trainingOrderStatus == 'WAIT_PAY') {
|
||||
uni.navigateTo({
|
||||
url: `/pages/Orderdetails/Orderdetails?list=${JSON.stringify(item)}`
|
||||
})
|
||||
} else if (item.trainingOrderStatus == 'PAY') {
|
||||
uni.navigateTo({
|
||||
url: `/pages/Orderlearning/Orderlearning?trainingParentId=${item.trainingItemId}`
|
||||
})
|
||||
}
|
||||
},
|
||||
//列表信息
|
||||
info() {
|
||||
|
||||
@ -149,7 +149,6 @@
|
||||
this.baseurl = baseurl
|
||||
this.trainingItemId = options.trainingItemId
|
||||
this.trainingOrderNo = options.trainingOrderNo
|
||||
console.log(options.trainingItemId)
|
||||
this.info();
|
||||
const value = uni.getStorageSync('nursePersonId');
|
||||
if (value) {
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
<u-empty text="暂无目录" mode="list" icon-size='240' font-size='32'></u-empty>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottomitem">
|
||||
<view class="bottomitem" v-if="infoslist.trainingOrderDetailsBuy=='NOT_BUY'">
|
||||
<view class="price">
|
||||
¥{{infoslist.trainingItemPrice}}
|
||||
</view>
|
||||
@ -80,7 +80,8 @@
|
||||
import {
|
||||
selectNurseAppletPersonTrainingItemList,
|
||||
selectNurseAppletPersonTrainingParent,
|
||||
trainingItemOrder
|
||||
trainingItemOrder,
|
||||
appletTrainingOrderPay
|
||||
} from '@/api/learning/index.js'
|
||||
import baseurl from '@/api/baseurl.js'
|
||||
export default {
|
||||
@ -115,6 +116,7 @@
|
||||
methods: {
|
||||
//购买
|
||||
tobuy() {
|
||||
var that = this
|
||||
var obj = {
|
||||
"trainingItemId": undefined,
|
||||
"nurseStationId": undefined,
|
||||
@ -129,12 +131,51 @@
|
||||
obj.trainingOrderAmount = this.infoslist.trainingItemPrice
|
||||
trainingItemOrder(obj).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.buyshow = false
|
||||
this.$refs.uToast.show({
|
||||
title: '支付成功',
|
||||
type: 'success',
|
||||
duration: '1500'
|
||||
})
|
||||
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.infos();
|
||||
that.info();
|
||||
that.$refs.uToast.show({
|
||||
title: '支付成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
that.$refs.uToast.show({
|
||||
title: '取消支付',
|
||||
type: 'error',
|
||||
duration: 1500,
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: response.msg,
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
uni.setStorageSync("nursePersonId", res.data.nurseStationPersonId)
|
||||
}
|
||||
uni.setStorageSync("personRoleLoginFlag", res.data.personRoleLoginFlag)
|
||||
uni.setStorageSync("openid", res.data.openid)
|
||||
uni.setStorageSync("phone", res.data.phone)
|
||||
uni.setStorageSync("nursePersonName", res.data.nursePersonName)
|
||||
uni.setStorageSync("nurseStationId", res.data.nurseStationId)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user