nurseWeChatAppletUI/pages/menttimeorder/menttimeorder.vue

236 lines
6.9 KiB
Vue
Raw Normal View History

<template>
2022-12-28 08:50:08 +08:00
<view class="app" v-if="list">
2023-01-12 16:16:36 +08:00
<view class="time" style="" v-if="list.orderStatus=='WAIT_PAY'">
2022-12-06 10:08:19 +08:00
剩余付款时间
<u-count-down style='' :timestamp="timestamp">
</u-count-down>
</view>
2023-01-12 16:16:36 +08:00
<view class="OrderStatus" v-if="list.orderStatus=='REFUNDED'||list.orderStatus=='CANCEL'">
订单已关闭
</view>
<view class="content">
<view class="name">
服务商家
</view>
<view class="details">
<view class="detailslist">
<image :src="baseurl+list.stationPictureUrl" mode=""></image>
<view class="model">
<view class="top">
<view>{{list.nurseStationName}}</view>
</view>
<view class="bottom">
<view>{{list.address}}</view>
</view>
<view class="callme" @tap="gophone()">
<u-icon class='icon' name="phone-fill" color="#ffffff" size="30"></u-icon>
<view class="text">联系我们</view>
</view>
</view>
</view>
</view>
</view>
<view class="content">
<view class="name">
服务项目
</view>
<view class="drug">·{{list.nurseItemName}} </view>
</view>
<view class="content">服务信息
2023-05-22 15:54:07 +08:00
<view class="" v-if="list.orderType=='COMPANION_IN_HOSPITAL'">
<view class="contacts" v-if="list.caregiverName">·姓名{{list.caregiverName}}</view>
<view class="contacts" v-if="list.caregiverPhone">·电话{{list.caregiverPhone}}</view>
<view class="contacts" v-if="list.hospitalName">·医院{{list.hospitalName}}</view>
<view class="contacts" v-if="list.departmentName">·科室{{list.departmentName}}</view>
<view class="contacts" v-if="list.hospitalBedNumber">·病床号{{list.hospitalBedNumber}}</view>
<view class="contacts" v-if="list.companionStartDate&&list.companionEndDate">
·时间{{list.companionStartDate}} - {{list.companionEndDate}}</view>
<view class="contacts" v-if="list.createTime">·下单时间{{list.createTime}}</view>
</view>
<view class="" v-else>
<view class="contacts" v-if="list.patientName">·姓名{{list.patientName}}</view>
<view class="contacts" v-if="list.patientPhone">·电话{{list.patientPhone}}</view>
<view class="contacts" v-if="list.serviceAddress">·地址{{list.serviceAddress}}</view>
<view class="contacts" v-if="list.serviceDate">·预约时间{{list.serviceDate}} {{list.serviceStartTime}}
</view>
<view class="contacts" v-if="list.createTime">·下单时间{{list.createTime}}</view>
</view>
</view>
<view class="Package">套餐信息
<span>{{list.nurseItemPrice}}</span>
<view class="detail">
·{{list.nurseItemName}}
</view>
</view>
2023-05-22 15:54:07 +08:00
<view class="Consumablespackage" v-if='list.itemConsumableList.length>0'>耗材包详情
2022-12-06 10:08:19 +08:00
<span v-if="list.consumableTotalPrice">{{list.consumableTotalPrice}}</span>
<span v-else>0</span>
<view class="detail" v-for='(item,index) in list.itemConsumableList' :key="index">
·{{item.orderConsumableName}}
2022-12-06 10:08:19 +08:00
<span
style='font-size: 30rpx;'>{{item.orderConsumableCount}}{{item.consumableUnit}}/{{item.orderConsumablePrice}}</span>
</view>
</view>
2023-05-22 15:54:07 +08:00
<view class="remarks" v-if="list.orderType!='COMPANION_IN_HOSPITAL'">
<view>备注</view>
<input placeholder="请输入" v-model='list.remark'>
</view>
<view class="evaluate">
<view class="price">
{{list.totalPrice}}
</view>
<!-- <view class="cancelorder " style="background: #4C7BC9;">评价</view> -->
<view class="cancelorder" @tap='buy' style="background-color: darkorange;"
2023-01-12 16:16:36 +08:00
v-if="list.orderStatus=='WAIT_PAY'">
去支付
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
appletAppointmentOrderPay
} from '@/api/appointmenttime/appointmenttime.js'
import baseurl from '@/api/baseurl.js'
import {
2023-04-27 14:19:41 +08:00
getAppointmentDetailsInfo,
handCloseOrder
} from '@/api/ServiceDetails/ServiceDetails.js'
export default {
data() {
return {
baseurl: '',
patientId: '', //id
openid: '', //id
2022-12-28 08:50:08 +08:00
list: null,
orderNo: '',
2022-12-06 10:08:19 +08:00
timestamp: 0,
2023-04-27 16:09:07 +08:00
timecount: null,
2023-04-27 14:19:41 +08:00
Timers: null,
}
},
2022-12-28 08:50:08 +08:00
onShow() {
this.getlist()
},
onLoad(options) {
var that = this
2022-12-28 08:50:08 +08:00
this.orderNo = JSON.parse(options.list).orderNo
2023-04-27 16:09:07 +08:00
this.baseurl = baseurl
2023-03-09 16:07:29 +08:00
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
}
const value2 = uni.getStorageSync('openid');
if (value2) {
that.openid = value2
}
2023-04-27 14:19:41 +08:00
},
onUnload() {
clearInterval(this.Timers); //清除该函数
},
watch: { //监听
timecount() {
if (this.timecount <= 0) {
clearInterval(this.Timers); //清除该函数
handCloseOrder().then(res => {
this.list.orderStatus = 'CANCEL'
})
}
},
},
methods: {
//支付
buy() {
var that = this
let obj = {
patientId: this.patientId,
openid: this.openid,
orderNo: this.list.orderNo,
orderChannel: "WECHAT_APPLET",
paymentPrice: this.list.totalPrice,
payType: "WECHAT_PAY",
buySource: "NURSE_STATION",
}
appletAppointmentOrderPay(obj).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',
2023-01-12 16:16:36 +08:00
duration: 1500,
url: `/pages/paysuccess/paysuccess?delta=${3}`
})
},
fail: function(err) {
that.$refs.uToast.show({
title: '取消支付',
type: 'error',
2023-01-12 16:16:36 +08:00
duration: 1500,
})
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
2023-01-12 16:16:36 +08:00
duration: 2000
})
}
})
},
//打电话
gophone() {
var that = this
uni.getSystemInfo({
success: function(res) {
if (res.platform == 'ios') {
uni.makePhoneCall({
2022-12-27 09:22:42 +08:00
phoneNumber: that.list.stationPhone //仅为示例
});
} else {
uni.showActionSheet({
itemList: ['呼叫', ],
success: function(res) {
if (res.tapIndex + 1 == 1) {
uni.makePhoneCall({
2022-12-27 09:22:42 +08:00
phoneNumber: that.list.stationPhone //仅为示例
});
}
},
fail: function(res) {}
});
}
}
});
},
// 信息
2022-12-28 08:50:08 +08:00
getlist() {
getAppointmentDetailsInfo(this.orderNo).then(res => {
this.list = res.data
2023-01-12 16:16:36 +08:00
var ordertimes = this.list.createTime.replaceAll(/\-/gi, "/")
2023-04-27 14:19:41 +08:00
var time = new Date(ordertimes).getTime() / 1000 + (60 * 60 * 2)
2022-12-06 10:08:19 +08:00
var times = new Date().getTime() / 1000
2023-04-27 16:49:58 +08:00
this.timestamp = time - times
if (this.timestamp >= 0) {
2023-04-27 16:09:07 +08:00
this.timecount = this.timestamp
this.Timers = setInterval(() => {
this.timecount--;
}, 1000)
}
})
},
}
}
</script>
<style lang="scss">
@import '../ServiceDetails/ServiceDetails.scss';
</style>