nurseWeChatAppletUI/pages/ServiceDetails/ServiceDetails.vue

363 lines
10 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>
<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">
2023-03-29 09:28:48 +08:00
<view v-if="list.nurseStationName">{{list.nurseStationName}}</view>
</view>
<view class="bottom">
2023-03-29 09:28:48 +08:00
<view v-if="list.address">{{list.address}}</view>
</view>
2023-03-29 09:28:48 +08:00
<view class="callme" @tap="gophone()" v-if='list.stationPhone'>
<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">服务信息
<view class="contacts">·联系人{{list.patientName}}</view>
2022-12-27 09:22:42 +08:00
<view class="contacts">·电话{{list.patientPhone}}</view>
<view class="contacts">·地址{{list.serviceAddress}}</view>
2023-02-22 15:04:55 +08:00
<view class="contacts">·预约时间{{list.serviceDate}} {{list.serviceStartTime}}</view>
<view class="contacts">·下单时间{{list.createTime}}</view>
</view>
<view class="Package">套餐信息
<span>{{list.nurseItemPrice}}</span>
<view class="detail">
·{{list.nurseItemName}}
</view>
</view>
<view class="Consumablespackage" v-if='list.itemConsumableList'>耗材包详情
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>
<view class="remarks">
<view>备注</view>
2022-12-27 09:22:42 +08:00
<input v-model='list.remark' :disabled="list.orderStatus=='WAIT_PAY'?false :true">
</view>
<view class="evaluate">
<view class="price">
{{list.totalPrice}}
</view>
<view class="cancelorder" @tap="cancelorderment()"
v-if="list.orderStatus=='PAY'||list.orderStatus=='WAIT_DISPATCH'||list.orderStatus=='NOT_FINISH'">取消订单
</view>
2023-04-04 15:27:03 +08:00
<view class="cancelorder" style="background: #60c5f1;" @tap='rateshowtrue'
2022-12-27 09:22:42 +08:00
v-if="list.orderStatus=='COMPLETE'">立即评价
</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>
2023-01-12 16:16:36 +08:00
<view class="cancelorder" style="background: #4C7BC9;" v-if="list.orderStatus=='EVALUATED'"
@tap='lookrate(list)'>查看评价</view>
</view>
2023-04-04 15:27:03 +08:00
<u-popup v-model="rateshow" mode="bottom" length="50%" border-radius="20" :closeable='true' class='masks'>
<view class="title">
综合评价
</view>
<view class="mask">
2023-04-04 15:27:03 +08:00
<u-rate :count="5" v-model="rateval" :size='70' active-color='#F4EA2A'></u-rate>
</view>
<view class="rateitem">
{{rateval==5?'非常满意':''}}
{{rateval==4?'满意':''}}
{{rateval==3?'一般':''}}
{{rateval==2?'差':''}}
{{rateval==1?'非常差':''}}
</view>
<view class="btn" @tap='taprate'>
确认
</view>
<!-- <view class="mask">
<view class="rateitem" @tap="taprate('SATISFIED')">
满意
</view>
<view class="rateitem" @tap="taprate('COMMONLY')">
一般
</view>
<view class="rateitem" @tap="taprate('DISSATISFIED')">
不满意
</view>
2023-04-04 15:27:03 +08:00
</view> -->
2023-04-04 08:55:32 +08:00
</u-popup>
2023-04-04 15:27:03 +08:00
<u-popup v-model="lookrateshow" mode="bottom" length="60%" border-radius="20" :closeable='true' class='masks'>
2023-01-12 16:16:36 +08:00
<image :src="baseurl+rateimgtitle.img" mode=""></image>
<view class="ratetitle">
{{rateimgtitle.title}}
</view>
2023-04-04 15:27:03 +08:00
<view class="mask" style="top: 450rpx;">
2023-04-04 15:37:59 +08:00
<u-rate :count="5" v-model="rateval" :size='70' active-color='#F4EA2A' disabled></u-rate>
2023-04-04 15:27:03 +08:00
</view>
<view class="rateitem" style="top: 580rpx;">
{{rateval==5?'非常满意':''}}
{{rateval==4?'满意':''}}
{{rateval==3?'一般':''}}
{{rateval==2?'差':''}}
{{rateval==1?'非常差':''}}
2023-01-12 16:16:36 +08:00
</view>
2023-04-04 10:30:04 +08:00
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
appletAppointmentOrderPay
} from '@/api/appointmenttime/appointmenttime.js'
import baseurl from '@/api/baseurl.js'
import {
getAppointmentDetailsInfo,
2023-04-27 14:19:41 +08:00
addAppointmentEvaluate,
handCloseOrder
} from '@/api/ServiceDetails/ServiceDetails.js'
2023-01-12 16:16:36 +08:00
import {
lookrate
} from '@/api/lookrate/index.js'
export default {
data() {
return {
rateshow: false, //评价
2023-04-04 15:27:03 +08:00
rateval: 0, //评价星数
evaluateSatisfaction: null, //非常差/差/一般/满意/非常满意
baseurl: '',
patientId: '', //id
openid: '', //id
2022-12-28 08:50:08 +08:00
list: null,
orderNo: '',
timer: null,
2022-12-06 10:08:19 +08:00
timestamp: 0,
2023-04-27 14:19:41 +08:00
timecount: 0,
2023-01-12 16:16:36 +08:00
lookrateshow: false, //查看评价
ratelist: null,
rateimgtitle: {
img: null,
title: null,
},
2023-04-27 14:19:41 +08:00
Timers: null,
}
},
2023-04-27 14:19:41 +08:00
onUnload() {
clearInterval(this.Timers); //清除该函数
},
2022-12-28 08:50:08 +08:00
onShow() {
this.getlist()
},
onLoad(options) {
2022-12-27 09:22:42 +08:00
this.baseurl = baseurl
this.orderNo = options.orderNo
var that = this
2023-03-09 16:07:29 +08:00
const value = uni.getStorageSync('patientId');
const value2 = uni.getStorageSync('openid');
if (value && value2) {
that.patientId = value
that.openid = value2
}
this.getlist()
2023-04-27 14:22:18 +08:00
if (this.timecount > 0) {
this.Timers = setInterval(() => {
this.timecount--;
}, 1000)
}
},
2023-04-04 15:27:03 +08:00
watch: { //监听
2023-04-27 14:19:41 +08:00
timecount() {
if (this.timecount <= 0) {
clearInterval(this.Timers); //清除该函数
handCloseOrder().then(res => {
this.list.orderStatus = 'CANCEL'
})
}
},
2023-04-04 15:27:03 +08:00
rateval() {
if (this.rateval == 5) {
this.evaluateSatisfaction = 'VERYSATISFIED'
} else if (this.rateval == 4) {
this.evaluateSatisfaction = 'SATISFIED'
} else if (this.rateval == 3) {
this.evaluateSatisfaction = 'COMMONLY'
} else if (this.rateval == 2) {
this.evaluateSatisfaction = 'DISSATISFIED'
} else if (this.rateval == 1) {
this.evaluateSatisfaction = 'VERYDISSATISFIED'
}
},
},
methods: {
2023-04-04 15:27:03 +08:00
//去评价
rateshowtrue() {
this.rateval = 0
this.evaluateSatisfaction = null
this.rateshow = true
},
2023-01-12 16:16:36 +08:00
//查看评价
lookrate(item) {
2023-04-04 15:27:03 +08:00
this.rateval = 0
this.evaluateSatisfaction = null
2023-01-12 16:16:36 +08:00
this.rateimgtitle.img = item.itemPictureUrl
this.rateimgtitle.title = item.nurseItemName
lookrate(item.orderNo).then(res => {
this.ratelist = res.data
2023-04-04 15:27:03 +08:00
this.rateval = res.data.compositeScore
2023-01-12 16:16:36 +08:00
this.lookrateshow = true
})
},
//支付
buy() {
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",
}
var that = this
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) {
2022-12-27 09:22:42 +08:00
uni.setStorageSync("Refresh", 'Refresh')
that.getlist()
that.$refs.uToast.show({
title: '支付成功',
type: 'success',
2023-01-12 16:16:36 +08:00
duration: 1500,
2022-12-27 09:22:42 +08:00
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 {
this.$refs.uToast.show({
title: response.msg,
type: 'error',
2023-01-12 16:16:36 +08:00
duration: 2000
})
}
})
},
//评价
2023-04-04 15:27:03 +08:00
taprate() {
var obj = {
"patientId": this.patientId,
"openid": this.openid,
"orderNo": this.orderNo,
"evaluateChannel": "WE_CHAT_APPLET",
2023-04-04 15:27:03 +08:00
"evaluateSatisfaction": this.evaluateSatisfaction,
"compositeScore": this.rateval
}
addAppointmentEvaluate(obj).then(res => {
if (res.code == 200) {
2023-04-04 15:27:03 +08:00
this.getlist();
this.$refs.uToast.show({
title: '评价成功',
type: 'success',
duration: '1500'
})
2023-04-04 15:27:03 +08:00
this.rateshow = false
2022-12-27 09:22:42 +08:00
uni.setStorageSync("Refresh", 'Refresh')
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(e => {
2022-12-27 09:22:42 +08:00
uni.navigateTo({
2023-04-04 15:27:03 +08:00
url: `/pages/ratesuccess/ratesuccess?delta=${1}`
2022-12-27 09:22:42 +08:00
})
}, 1500)
2022-12-27 09:22:42 +08:00
} else {
this.$refs.uToast.show({
title: '评价失败',
type: 'error',
duration: '1500'
})
}
})
},
//打电话
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) {}
});
}
}
});
},
// 信息
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
this.timestamp = time - times
2023-04-27 14:19:41 +08:00
this.timecount = this.timestamp
})
},
cancelorderment() {
uni.navigateTo({
url: `/pages/cancelorder/cancelorder?nurseItemPrice=${this.list.totalPrice}&appointmentOrderId=${this.list.appointmentOrderId}`
})
},
}
}
</script>
<style lang="scss">
@import './ServiceDetails.scss';
</style>