nurseWeChatAppletUI/pages/confirmation/confirmation.vue

333 lines
7.1 KiB
Vue
Raw Normal View History

<template>
<view class="app">
<view class="user">
<view class="item">
<span>姓名</span>
2023-03-09 15:28:28 +08:00
<span class='addition' v-if="userlist.patientName">{{userlist.patientName}}</span>
</view>
<view class="item">
<span>电话</span>
2023-03-09 15:28:28 +08:00
<span class='addition' v-if="userlist.phone">{{userlist.phone}}</span>
</view>
<view class="item" style="border: 0;">
<span>时间</span>
<span class='addition'>请选择</span>
</view>
<view class="worditem">
2023-03-10 11:14:58 +08:00
<view class="today" @tap='taptoday(item,index)'
2023-03-09 15:28:28 +08:00
:style="todayindex==index?'background: #FEF9F8;border: 1px solid #F44B2F;color: #F44B2F;':''"
v-for="(item,index) in userlist.appointmentTimeList" :key="index">
<span class="todaytime">
{{item.week}}
</span>
2023-03-09 15:28:28 +08:00
<span class="time">{{item.healthConsultationDate}}</span>
</view>
</view>
</view>
<view class="remarks">
<span>咨询内容</span>
2023-03-09 15:28:28 +08:00
<u-input v-model="updata.healthConsultationContent" type="textarea" :clearable='false' />
</view>
<view class="bottomitem">
2023-03-09 15:28:28 +08:00
<span>{{updata.totalPrice}}</span>
<view class="submit" @tap='buyshow=true'>确认</view>
</view>
<!-- 弹框 -->
2023-03-09 15:28:28 +08:00
<u-popup v-model="buyshow" mode="bottom" length="45%" border-radius="30" :closeable='true'>
<view class="payment">
请选择支付方式
</view>
<view class="chat">
<image src="/static/chat.png" mode=""></image>
<span>微信支付</span>
</view>
<view class="submits" @tap='buy'>
确认支付{{updata.totalPrice}}
</view>
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
<script>
2023-03-09 15:28:28 +08:00
import {
informationConfirmation,
addHealthConsultationOrder
} from '@/api/Informationconfirmation/index.js'
2023-03-09 16:48:35 +08:00
import {
appletGoodsOrderPay
} from '@/api/confirmOrder/index.js'
export default {
data() {
return {
2023-03-09 16:48:35 +08:00
openid: null,
2023-03-09 15:28:28 +08:00
buyshow: false,
price: 0,
userlist: {},
todayindex: 0,
updata: {
"orderChannel": "WECHAT_APPLET",
"patientId": null,
"phone": null,
"receiver": null,
"healthAppointDate": null,
"totalPrice": null,
"hospitalPersonId": null,
"healthConsultationContent": '',
2023-03-10 15:41:27 +08:00
"hospitalPersonName": null,
2023-03-09 15:28:28 +08:00
},
}
},
methods: {
2023-03-10 11:14:58 +08:00
taptoday(item, index) {
this.todayindex = index
this.updata.healthAppointDate = item.date
},
2023-03-09 15:28:28 +08:00
buy() {
2023-03-10 11:14:58 +08:00
var that = this
2023-03-09 15:28:28 +08:00
addHealthConsultationOrder(this.updata).then(res => {
2023-03-09 16:48:35 +08:00
res.data.payType = "WECHAT_PAY"
res.data.paymentPrice = res.data.totalPrice
res.data.openid = this.openid
2023-03-10 16:27:59 +08:00
let id = res.data.id
2023-03-10 11:14:58 +08:00
appletGoodsOrderPay(res.data).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,
url: `/pages/paysuccess/paysuccess`
})
},
fail: function(err) {
that.$refs.uToast.show({
title: '取消支付',
type: 'error',
duration: 1500,
2023-03-10 16:27:59 +08:00
url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
2023-03-10 11:14:58 +08:00
})
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 2000
})
}
2023-03-09 16:48:35 +08:00
})
2023-03-09 15:28:28 +08:00
})
},
},
2023-03-10 11:14:58 +08:00
onShow() {
2023-03-09 16:07:29 +08:00
var that = this
2023-03-09 15:28:28 +08:00
const value = uni.getStorageSync('patientId');
2023-03-09 16:48:35 +08:00
const value2 = uni.getStorageSync('openid');
if (value2) {
2023-03-10 11:14:58 +08:00
that.openid = value2
2023-03-09 16:48:35 +08:00
}
2023-03-09 15:28:28 +08:00
if (value) {
that.updata.patientId = value
informationConfirmation(value).then(res => {
that.userlist = res.data
that.updata.phone = res.data.phone
that.updata.receiver = res.data.patientName
that.updata.healthAppointDate = res.data.appointmentTimeList[0].date
})
}
2023-03-10 11:14:58 +08:00
},
onLoad(options) {
var that = this
2023-03-10 15:41:27 +08:00
this.updata.hospitalPersonName = options.personName
2023-03-10 11:14:58 +08:00
this.updata.totalPrice = Number(options.price)
this.updata.hospitalPersonId = Number(options.hospitalPersonId)
}
}
</script>
<style lang="scss">
.app {
font-size: 34rpx;
padding-top: 10rpx;
height: 100%;
-webkit-overflow-scrolling: touch;
.determine {
height: 70rpx;
line-height: 70rpx;
font-size: 32rpx;
width: 50%;
color: #F4F5F7;
background: #4C7BC9;
position: absolute;
bottom: 0;
left: 0;
}
.user {
background: #FFFFFF;
width: 94%;
height: 600rpx;
margin: 10rpx auto;
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
line-height: 93rpx;
.addressitem {
width: 97%;
border-bottom: 1rpx solid #D8D4D4;
margin-left: 3%;
// height: 100%;
.leftaddress {
width: 15%;
height: 100%;
display: flex;
display: inline-block;
}
.addition {
color: #666666;
display: inline-block;
line-height: 50rpx;
font-size: 28rpx;
}
}
.item {
width: 97%;
border-bottom: 1rpx solid #D8D4D4;
margin-left: 3%;
.addition {
color: #666666;
line-height: 30rpx;
font-size: 28rpx;
}
}
.worditem {
display: flex;
2023-03-09 15:28:28 +08:00
width: 100%;
justify-content: flex-start;
flex-wrap: wrap;
.today {
2023-03-09 15:28:28 +08:00
width: 20%;
margin: 0 2.5% 0 2.5%;
margin-top: 20rpx;
height: 90rpx;
text-align: center;
font-size: 26rpx;
2023-03-09 15:28:28 +08:00
border: 1px solid #DADADA;
border-radius: 5rpx;
.time {
font-size: 26rpx;
display: block;
2023-03-09 15:28:28 +08:00
line-height: 40rpx;
}
.todaytime {
2023-03-09 15:28:28 +08:00
padding-top: 5rpx;
font-size: 26rpx;
display: block;
2023-03-09 15:28:28 +08:00
line-height: 40rpx;
}
}
}
}
.remarks {
width: 94%;
margin: 10rpx auto;
font-size: 34rpx;
height: 440rpx;
background: #FFFFFF;
border-radius: 20rpx;
2023-03-09 15:28:28 +08:00
padding: 30rpx 0 0 30rpx;
}
.bottomitem {
2023-03-09 15:28:28 +08:00
width: 100%;
height: 120rpx;
background: #FFFFFF;
2023-03-09 15:28:28 +08:00
bottom: 0;
position: fixed;
span {
font-size: 48rpx;
2023-03-09 15:28:28 +08:00
line-height: 120rpx;
color: #F44B2F;
2023-03-09 15:28:28 +08:00
margin: 0 0 0 30rpx;
}
.submit {
width: 186rpx;
2023-03-09 15:28:28 +08:00
height: 70rpx;
background: #F44B2F;
color: #FFFFFF;
border-radius: 30rpx;
2023-03-09 15:28:28 +08:00
line-height: 70rpx;
text-align: center;
font-size: 32rpx;
float: right;
2023-03-09 15:28:28 +08:00
margin: 25rpx 30rpx 0 0;
}
}
// 弹框支付
.payment {
2023-03-09 15:28:28 +08:00
width: 100%;
height: 130rpx;
font-size: 42rpx;
color: #000000;
line-height: 130rpx;
text-align: center;
border-bottom: 1rpx solid #D8D4D4;
}
.chat {
2023-03-09 15:28:28 +08:00
position: relative;
height: 200rpx;
span {
2023-03-09 15:28:28 +08:00
position: absolute;
top: 50rpx;
left: 180rpx;
line-height: 70rpx;
font-size: 42rpx;
color: #000000;
}
image {
2023-03-09 15:28:28 +08:00
position: absolute;
top: 50rpx;
left: 70rpx;
width: 80rpx;
height: 70rpx;
}
}
.submits {
background: #F44B2F;
width: 501rpx;
height: 71rpx;
line-height: 71rpx;
border-radius: 36rpx;
font-size: 34rpx;
color: #FFFFFF;
text-align: center;
2023-03-09 15:28:28 +08:00
position: fixed;
bottom: 50rpx;
left: 50%;
transform: translateX(-50%);
}
}
</style>