nurseWeChatAppletUI/pages/Nursingstationserviceorder/Nursingstationserviceorder.vue

307 lines
8.7 KiB
Vue
Raw Normal View History

<template>
<view class="app">
<view class="" v-if="total>0">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="name">
{{item.createTime}}
2023-01-12 16:16:36 +08:00
<span>{{item.orderStatus=='WAIT_PAY'?'待付款':''}}
{{item.orderStatus=='PAY'?'已付款':''}}
{{item.orderStatus=='WAIT_DISPATCH'?'待服务':''}}
{{item.orderStatus=='NOT_FINISH'?'待完成':''}}
2022-12-01 16:59:32 +08:00
{{item.orderStatus=='COMPLETE'?'待评价':''}}
{{item.orderStatus=='EVALUATED'?'服务完成':''}}
{{item.orderStatus=='WAIT_REFUND'?'退款中':''}}
{{item.orderStatus=='REFUNDED'?'已退款':''}}
{{item.orderStatus=='CANCEL'?'已取消':''}}
</span>
</view>
<view class="detailslist" @tap="gofinished(item)">
<image :src="baseurl+item.itemPictureUrl" mode=""></image>
<view class="model">
<view class="top">
<span>{{item.nurseItemName}}</span>
<span>{{item.totalPrice}}</span>
</view>
<view class="bottom">
<span>服务时长{{item.itemServeDurationUnit}}</span>
</view>
</view>
</view>
<view class="submit" @tap='buy(item)' style="background-color: darkorange;"
2023-01-12 16:16:36 +08:00
v-if="item.orderStatus=='WAIT_PAY'">
去支付
</view>
<view class="submit" v-if="item.orderStatus=='WAIT_REFUND'" style="background-color: coral;">退款中</view>
2022-12-27 09:22:42 +08:00
<view class="submit" v-if="item.orderStatus=='COMPLETE'" @tap='gorate(item)'
style="background-color: #60c5f1;">立即评价</view>
<view class="submit" v-if="item.orderStatus=='EVALUATED'" @tap='lookrate(item)'>查看评价</view>
</view>
</view>
<view class="noorder" v-else>
2023-03-10 11:14:58 +08:00
<u-empty mode="list" icon-size='220' text='暂无服务订单'></u-empty>
</view>
<u-toast ref="uToast" />
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>
2022-12-27 09:22:42 +08:00
<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'>
确认
2022-12-27 09:22:42 +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'>
2022-12-27 09:22:42 +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?'非常差':''}}
2022-12-27 09:22:42 +08:00
</view>
2023-04-04 08:55:32 +08:00
</u-popup>
</view>
</template>
<script>
import baseurl from '@/api/baseurl.js'
2022-12-27 09:22:42 +08:00
import {
lookrate
} from '@/api/lookrate/index.js'
import {
appletAppointmentOrderPay
} from '@/api/appointmenttime/appointmenttime.js'
2022-12-27 09:22:42 +08:00
import {
addAppointmentEvaluate
} from '@/api/ServiceDetails/ServiceDetails.js'
import {
appServiceOrder
} from '@/api/Nursingstationserviceorder/Nursingstationserviceorder.js'
export default {
data() {
return {
2023-04-04 15:27:03 +08:00
timer: null, //time
baseurl: null,
rateimgtitle: { //评价mask
2022-12-27 09:22:42 +08:00
img: null,
title: null,
},
ratelist: null, //评价list
rateshow: false, //评价
lookrateshow: false, //查看评价
2023-04-04 15:27:03 +08:00
openid: null, //opedn
patientId: null, //patientId
rateval: 0, //评价星棵树
evaluateSatisfaction: null, //非常差/差/一般/满意/非常满意
pageNum: 1,
2022-12-01 16:59:32 +08:00
total: 0,
2022-12-27 09:22:42 +08:00
pageSize: 15,
2023-04-04 15:27:03 +08:00
list: [], //循环list
orderNo: null, //订单编号
}
},
2022-12-27 09:22:42 +08:00
onShow() {
let that = this
this.baseurl = baseurl
2022-12-27 09:22:42 +08:00
this.pageNum = 1;
2023-03-09 16:07:29 +08:00
const value3 = uni.getStorageSync('Refresh');
if (value3) {
that.getinfo();
}
2022-12-27 09:22:42 +08:00
},
onLoad() {
let that = this
2022-12-27 09:22:42 +08:00
this.pageNum = 1
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
that.getinfo()
2023-03-17 17:17:34 +08:00
} else {
this.$refs.uToast.show({
title: '未登录,请先登录',
type: 'error',
})
2023-03-09 16:07:29 +08:00
}
},
2023-04-04 15:27:03 +08:00
watch: { //监听
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: {
2022-12-27 09:22:42 +08:00
//查看评价
lookrate(item) {
2023-04-04 15:27:03 +08:00
this.rateval = 0
this.evaluateSatisfaction = null
2022-12-27 09:22:42 +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
this.lookrateshow = true
2022-12-27 09:22:42 +08:00
})
},
//去评价
2022-12-27 09:22:42 +08:00
gorate(item) {
2023-04-04 15:27:03 +08:00
this.rateval = 0
this.evaluateSatisfaction = null
2022-12-27 09:22:42 +08:00
this.orderNo = item.orderNo
this.rateshow = true
},
//评价
2023-04-04 15:27:03 +08:00
taprate() {
2022-12-27 09:22:42 +08:00
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
2022-12-27 09:22:42 +08:00
}
addAppointmentEvaluate(obj).then(res => {
2023-04-04 15:27:03 +08:00
uni.setStorageSync("Refresh", 'Refresh')
2022-12-27 09:22:42 +08:00
if (res.code == 200) {
2023-04-04 15:27:03 +08:00
this.getinfo();
2022-12-27 09:22:42 +08:00
this.orderNo = null
2023-04-04 15:27:03 +08:00
this.rateshow = false
2022-12-27 09:22:42 +08:00
this.$refs.uToast.show({
title: '评价成功',
type: 'success',
2023-04-04 15:27:03 +08:00
duration: '1500'
2022-12-27 09:22:42 +08:00
})
2023-04-04 15:27:03 +08:00
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(e => {
uni.navigateTo({
url: `/pages/ratesuccess/ratesuccess?delta=${1}`
})
}, 1500)
2022-12-27 09:22:42 +08:00
}
})
},
//支付
buy(item) {
let obj = {
patientId: this.patientId,
openid: this.openid,
orderNo: item.orderNo,
orderChannel: "WECHAT_APPLET",
paymentPrice: item.totalPrice,
payType: "WECHAT_PAY",
buySource: "NURSE_STATION",
}
2022-12-01 16:59:32 +08:00
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.$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`,
})
},
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
})
}
})
},
getinfo() {
appServiceOrder(this.patientId, this.pageSize, this.pageNum).then(res => {
2022-12-27 09:22:42 +08:00
if (res.code == 200) {
uni.removeStorageSync('Refresh');
this.list = res.rows;
2023-01-12 16:16:36 +08:00
// this.list.forEach(e => {
// e.timestamp = null
2023-04-27 14:19:41 +08:00
// var time = new Date(e.createTime).getTime() / 1000 + (60 * 60 * 2)
2023-01-12 16:16:36 +08:00
// var times = new Date().getTime() / 1000
// e.timestamp = time - times
// })
2022-12-27 09:22:42 +08:00
this.total = res.total
2023-03-17 16:35:28 +08:00
} else if (res.code == 9999) {
this.$refs.uToast.show({
title: '未登录,请先登录',
type: 'error',
})
2022-12-27 09:22:42 +08:00
}
})
},
gofinished(item) {
uni.navigateTo({
url: `/pages/ServiceDetails/ServiceDetails?orderNo=${item.orderNo}`
})
},
},
onReachBottom() { //下滑加载
if (this.list.length >= this.total) {} else {
this.pageNum++
appServiceOrder(this.patientId, this.pageSize, this.pageNum).then(res => {
res.rows.forEach(e => {
2023-01-12 16:16:36 +08:00
// e.timestamp = null
2023-04-27 14:19:41 +08:00
// var time = new Date(e.createTime).getTime() / 1000 + (60 * 60 * 2)
2023-01-12 16:16:36 +08:00
// var times = new Date().getTime() / 1000
// e.timestamp = time - times
this.list.push(e)
})
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
this.getinfo()
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
@import './Nursingstationserviceorder.scss';
</style>