2023-04-24 15:53:03 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="app">
|
2023-04-25 16:25:50 +08:00
|
|
|
|
<view class="time" style="" v-if="list.trainingOrderStatus=='WAIT_PAY'">
|
2023-04-24 15:53:03 +08:00
|
|
|
|
剩余付款时间:
|
|
|
|
|
|
<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>
|
2023-04-25 16:25:50 +08:00
|
|
|
|
<view class="buy" @tap='tobuy' v-if="list.trainingOrderStatus == 'WAIT_PAY'">
|
2023-04-24 15:53:03 +08:00
|
|
|
|
<view class="pay">
|
2023-04-25 16:25:50 +08:00
|
|
|
|
确认支付
|
2023-04-24 15:53:03 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<u-toast ref="uToast" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-04-25 16:25:50 +08:00
|
|
|
|
import {
|
|
|
|
|
|
trainingItemOrder,
|
|
|
|
|
|
appletTrainingOrderPay
|
|
|
|
|
|
} from '@/api/learning/index.js'
|
2023-04-24 15:53:03 +08:00
|
|
|
|
import baseurl from '@/api/baseurl.js'
|
|
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
baseurl: undefined,
|
2023-04-27 09:09:43 +08:00
|
|
|
|
list: undefined,
|
2023-04-24 15:53:03 +08:00
|
|
|
|
timestamp: 0,
|
2023-04-27 09:09:43 +08:00
|
|
|
|
timestamp2: 0,
|
|
|
|
|
|
timer: null,
|
2023-04-24 15:53:03 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
2023-04-27 09:09:43 +08:00
|
|
|
|
onUnload() {
|
|
|
|
|
|
clearInterval(this.Timer); //清除该函数
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
timestamp2() {
|
|
|
|
|
|
if (this.timestamp2 <= 0) {}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-04-24 15:53:03 +08:00
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
this.baseurl = baseurl
|
|
|
|
|
|
this.list = JSON.parse(options.list)
|
2023-04-25 16:25:50 +08:00
|
|
|
|
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
|
2023-04-27 09:09:43 +08:00
|
|
|
|
this.timestamp2 = this.timestamp
|
|
|
|
|
|
this.timer = setInterval(() => {
|
|
|
|
|
|
this.timestamp2--;
|
|
|
|
|
|
}, 1000)
|
2023-04-25 16:25:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
//购买
|
|
|
|
|
|
tobuy() {
|
|
|
|
|
|
var that = this
|
2023-04-27 09:17:34 +08:00
|
|
|
|
if (this.list.trainingItemPrice > 0) {
|
|
|
|
|
|
let objs = {
|
|
|
|
|
|
"openid": uni.getStorageSync('openid'),
|
|
|
|
|
|
"nurseStationPersonId": this.list.nurseStationPersonId,
|
|
|
|
|
|
"orderNo": this.list.trainingOrderNo,
|
|
|
|
|
|
"payType": "WECHAT_PAY",
|
|
|
|
|
|
"orderChannel": "WECHAT_APPLET",
|
|
|
|
|
|
"buySource": "TRAINING",
|
|
|
|
|
|
"paymentPrice": this.list.trainingItemPrice,
|
|
|
|
|
|
}
|
|
|
|
|
|
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: '取消支付',
|
2023-04-25 16:25:50 +08:00
|
|
|
|
type: 'error',
|
2023-04-27 09:17:34 +08:00
|
|
|
|
duration: 1500,
|
2023-04-25 16:25:50 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-04-27 09:17:34 +08:00
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
|
|
title: response.msg,
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
duration: 2000
|
2023-04-25 16:25:50 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-04-27 09:17:34 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-04-25 16:25:50 +08:00
|
|
|
|
},
|
2023-04-24 15:53:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2023-04-25 15:06:35 +08:00
|
|
|
|
@import "./Orderdetails.scss";
|
2023-04-24 15:53:03 +08:00
|
|
|
|
</style>
|