nurseWeChatAppletUI/pages/Nursingstationserviceorder/Nursingstationserviceorder.vue
2023-01-12 16:16:36 +08:00

284 lines
7.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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}}
<span>{{item.orderStatus=='WAIT_PAY'?'待付款':''}}
{{item.orderStatus=='PAY'?'已付款':''}}
{{item.orderStatus=='WAIT_DISPATCH'?'待服务':''}}
{{item.orderStatus=='NOT_FINISH'?'待完成':''}}
{{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;"
v-if="item.orderStatus=='WAIT_PAY'">
去支付
</view>
<view class="submit" v-if="item.orderStatus=='WAIT_REFUND'" style="background-color: coral;">退款中</view>
<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>
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无服务订单
</view>
</view>
<u-toast ref="uToast" />
<u-mask :show="rateshow" @tap="rateshow = false" class='masks'>
<view class="mask">
<view class="rateitem" @tap="taprate('SATISFIED')">
满意
</view>
<view class="rateitem" @tap="taprate('COMMONLY')">
一般
</view>
<view class="rateitem" @tap="taprate('DISSATISFIED')">
不满意
</view>
</view>
</u-mask>
<u-mask :show="lookrateshow" @tap="lookrateshow = false" class='masks'>
<image :src="baseurl+rateimgtitle.img" mode=""></image>
<view class="ratetitle">
{{rateimgtitle.title}}
</view>
<view class="mask">
<view class="lookrateitem" :style="ratelist.evaluateSatisfaction=='SATISFIED'?'background: #4C7BC9':''">
满意
</view>
<view class="lookrateitem" :style="ratelist.evaluateSatisfaction=='COMMONLY'?'background: #4C7BC9':''">
一般
</view>
<view class="lookrateitem"
:style="ratelist.evaluateSatisfaction=='DISSATISFIED'?'background: #4C7BC9':''">
不满意
</view>
</view>
</u-mask>
</view>
</template>
<script>
import baseurl from '@/api/baseurl.js'
import {
lookrate
} from '@/api/lookrate/index.js'
import {
appletAppointmentOrderPay
} from '@/api/appointmenttime/appointmenttime.js'
import {
addAppointmentEvaluate
} from '@/api/ServiceDetails/ServiceDetails.js'
import {
appServiceOrder
} from '@/api/Nursingstationserviceorder/Nursingstationserviceorder.js'
export default {
data() {
return {
rateimgtitle: {
img: null,
title: null,
},
ratelist: null, //评价list
rateshow: false, //评价
lookrateshow: false, //查看评价
baseurl: '',
openid: null,
patientId: null,
pageNum: 1,
total: 0,
pageSize: 15,
list: [],
orderNo: null,
timer: null,
}
},
onShow() {
let that = this
this.baseurl = baseurl
this.pageNum = 1;
try {
const value3 = uni.getStorageSync('Refresh');
if (value3) {
that.getinfo();
}
} catch (e) {}
try {
const value = uni.getStorageSync('openid');
if (value) {} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} catch (e) {}
},
onLoad() {
let that = this
this.pageNum = 1
try {
const value = uni.getStorageSync('patientId');
const value2 = uni.getStorageSync('openid');
if (value && value2) {
that.patientId = value
that.openid = value2
that.getinfo()
}
} catch (e) {}
},
methods: {
//查看评价
lookrate(item) {
this.rateimgtitle.img = item.itemPictureUrl
this.rateimgtitle.title = item.nurseItemName
this.lookrateshow = true
lookrate(item.orderNo).then(res => {
this.ratelist = res.data
})
},
//去评价
gorate(item) {
this.orderNo = item.orderNo
this.rateshow = true
},
//评价
taprate(item) {
var obj = {
"patientId": this.patientId,
"openid": this.openid,
"orderNo": this.orderNo,
"evaluateChannel": "WE_CHAT_APPLET",
"evaluateSatisfaction": item,
}
addAppointmentEvaluate(obj).then(res => {
if (res.code == 200) {
uni.setStorageSync("Refresh", 'Refresh')
this.orderNo = null
this.$refs.uToast.show({
title: '评价成功',
type: 'success',
duration: '1500'
})
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(e => {
uni.navigateTo({
url: `/pages/ratesuccess/ratesuccess`
})
}, 1500)
}
})
},
//支付
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",
}
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) {
uni.setStorageSync("Refresh", 'Refresh')
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,
})
}
});
} else {
this.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 2000
})
}
})
},
getinfo() {
appServiceOrder(this.patientId, this.pageSize, this.pageNum).then(res => {
if (res.code == 200) {
uni.removeStorageSync('Refresh');
this.list = res.rows;
// this.list.forEach(e => {
// e.timestamp = null
// var time = new Date(e.createTime).getTime() / 1000 + (60 * 60 * 24)
// var times = new Date().getTime() / 1000
// e.timestamp = time - times
// })
this.total = res.total
}
})
},
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 => {
// e.timestamp = null
// var time = new Date(e.createTime).getTime() / 1000 + (60 * 60 * 24)
// 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>