nurseWeChatAppletUI/pages/Nursingstationserviceorder/Nursingstationserviceorder.vue

178 lines
4.5 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}}
<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;"
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)'>去评价</view> -->
<!-- <view class="submit"
v-if="item.orderStatus=='PAY'||item.orderStatus=='WAIT_DISPATCH'||item.orderStatus=='NOT_FINISH'">
确认完成
</view> -->
</view>
</view>
<view class="noorder" v-else>
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无服务订单
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import baseurl from '@/api/baseurl.js'
import {
appletAppointmentOrderPay
} from '@/api/appointmenttime/appointmenttime.js'
import {
appServiceOrder
} from '@/api/Nursingstationserviceorder/Nursingstationserviceorder.js'
export default {
data() {
return {
baseurl: '',
openid: null,
patientId: null,
pageNum: 1,
2022-12-01 16:59:32 +08:00
total: 0,
pageSize: 10,
list: [],
}
},
onShow() {
this.baseurl = baseurl
let that = this
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
that.getinfo()
}
} catch (e) {}
try {
const value = uni.getStorageSync('openid');
if (value) {
that.openid = value
}
} catch (e) {}
},
2022-12-01 16:59:32 +08:00
onLoad() {},
methods: {
//去评价
// gorate(){
// uni.navigateTo({
2022-12-01 16:59:32 +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) {
that.$refs.uToast.show({
title: '支付成功',
type: 'success',
toast: 1500,
})
that.getinfo()
},
fail: function(err) {
that.$refs.uToast.show({
title: '取消支付',
type: 'error',
toast: 1500,
})
}
});
} else {
this.$refs.uToast.show({
title: response.msg,
type: 'error',
toast: 2000
})
}
})
},
getinfo() {
appServiceOrder(this.patientId, this.pageSize, this.pageNum).then(res => {
this.list = res.rows;
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 => {
this.list.push(e)
})
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
this.getinfo()
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
@import './Nursingstationserviceorder.scss';
</style>