NurseStationApp/pages/appointmenttime/appointmenttime.vue

416 lines
12 KiB
Vue
Raw Permalink Normal View History

2022-10-14 19:48:48 +08:00
<template>
2022-10-20 18:38:18 +08:00
<view class="app">
<view class="user">
<view class="item">
<span>姓名</span>
2022-10-31 09:04:45 +08:00
<span class='addition'>{{personInfo.patientName}}</span>
2022-10-20 18:38:18 +08:00
</view>
<view class="item">
<span>电话</span>
2022-10-31 09:04:45 +08:00
<span class='addition'>{{personInfo.phone}}</span>
2022-10-14 19:48:48 +08:00
</view>
2023-02-23 10:45:26 +08:00
<view class="addressitem">
<view class="leftaddress">地址</view>
<view class='addition'>{{personInfo.address}}</view>
2022-10-20 09:15:48 +08:00
</view>
2022-12-01 17:03:02 +08:00
<view class="item" style="border: 0;">
2023-02-23 10:45:26 +08:00
<span>上门时间</span>
<span class='addition'>请您选择希望护理员到达的时间</span>
2022-12-01 17:03:02 +08:00
</view>
2023-02-23 10:45:26 +08:00
<tabs :list="orderlist.appointmentTimeList" :current="timecurrent" @change="timechange">
</tabs>
<view class="timeyear" v-if="orderlist.appointmentTimeList">
<view class="toptext">
<view :class="Soonerorlater=='morning'?'Soonerorlaterclass':'Soonerorlater'"
@tap="tapSoonerorlater('morning')">
上午
</view>
<view class="">
</view>
<view :class="Soonerorlater=='after'?'Soonerorlaterclass':'Soonerorlater'"
@tap="tapSoonerorlater('after')">
下午
</view>
</view>
<view class="bottomtext">
<view class="items" v-if="Soonerorlater=='morning'">
<view @tap='taptime(item,index)'
v-for="(item ,index) in orderlist.appointmentTimeList[timecurrent].morningList"
:class="timeindex==index?'timeitemtap':'timeitem'">
{{item}}
</view>
</view>
<view class="items" v-if="Soonerorlater=='after'">
<view @tap='taptime(item,index)'
v-for="(item ,index) in orderlist.appointmentTimeList[timecurrent].afternoonList"
:class="timeindex==index?'timeitemtap':'timeitem'">
{{item}}
</view>
</view>
</view>
2022-10-20 18:38:18 +08:00
</view>
</view>
<view class="remarks">
2022-10-31 09:04:45 +08:00
服务时长:
<span style='padding-left: 30rpx;' class='addition'>{{orderlist.serveDurationUnit}}</span>
2022-10-20 09:15:48 +08:00
</view>
2022-10-20 18:38:18 +08:00
<view class="Package">套餐信息
<text class="money">{{orderlist.nurseItemPrice}}</text>
<text class="detail">
2023-02-23 10:45:26 +08:00
{{orderlist.nurseItemName}}
2022-10-20 18:38:18 +08:00
</text>
2022-10-14 19:48:48 +08:00
</view>
2022-10-20 18:38:18 +08:00
<view class="Consumablespackage">耗材包详情
2022-12-06 10:10:34 +08:00
<text class="money">{{consumableTotalPrice}}</text>
2022-12-01 17:03:02 +08:00
<view class="detail">
2023-02-23 10:45:26 +08:00
<u-checkbox-group @change="checkboxGroupChange" :wrap='true'>
2022-12-02 16:04:52 +08:00
<u-checkbox @change="checkboxChange(item)" v-model="item.radio"
2022-12-01 17:03:02 +08:00
v-for="(item, index) in orderlist.itemConsumableList" :key="index"
:name="item.consumableDetail">
2023-02-23 10:45:26 +08:00
<view class='itemConsumabletitle'> {{item.consumableDetail}}</view>
2022-12-02 16:04:52 +08:00
<span>{{item.consumableCount}}{{item.consumableUnit}}/{{item.consumablePrice}}</span>
2022-12-01 17:03:02 +08:00
</u-checkbox>
</u-checkbox-group>
2022-10-31 09:04:45 +08:00
</view>
2022-10-14 19:48:48 +08:00
</view>
2022-10-20 18:38:18 +08:00
<view class="remarks">
2022-10-17 18:35:58 +08:00
<span>备注</span>
2022-12-27 09:21:01 +08:00
<input placeholder="请输入" v-model="orderlist.remark">
2022-10-20 09:15:48 +08:00
</view>
2022-12-01 17:03:02 +08:00
<view class="radio-content">
2022-11-15 15:36:29 +08:00
<view class="radio-right" @tap="changeRadio">
2022-10-31 09:04:45 +08:00
<view class="radio" :class="radio == 2 ? 'radio-default':''">
<view :class="radio == 2 ? 'radio-active':''"></view>
2022-10-20 09:15:48 +08:00
</view>
</view>
2022-11-15 15:36:29 +08:00
<view class="agreement">我已阅读并同意<text @tap='maskshow=true'
style="color: #000000;border-bottom: 1rpx solid #000000;">用户协议</text></view>
2022-10-20 09:15:48 +08:00
</view>
<view class="priceback">
2022-10-20 18:38:18 +08:00
<view class="prices">{{orderlist.totalPrice}}</view>
2022-11-01 16:26:34 +08:00
<view class="xiugai" @tap='goaddress'>修改信息</view>
2022-10-20 09:15:48 +08:00
<view class="queren" @tap='updata'>确认预约</view>
2022-10-17 18:35:58 +08:00
</view>
2022-10-20 09:15:48 +08:00
<u-toast ref="uToast" />
2022-11-15 15:36:29 +08:00
<!-- //用户协议 -->
<u-mask :show="maskshow" class='mask' @click='maskshow=false'>
<view class="Agreement">
<view class="title">
护理站上门服务知情同意书
</view>
2023-02-23 10:45:26 +08:00
<scroll-view scroll-y="true" class="scroll-Y" style="">
2022-11-15 15:36:29 +08:00
<appointmenttext></appointmenttext>
</scroll-view>
<view class="cancel" @tap='maskshow=false'>
取消
</view>
<view class="determine" @tap='tapradio'>
确定并同意
</view>
</view>
</u-mask>
2022-10-14 19:48:48 +08:00
</view>
</template>
<script>
2022-10-20 09:15:48 +08:00
import {
getAppStationItemInfo,
getAppPatientList,
2023-02-23 10:45:26 +08:00
submitAppointment,
appletAppointmentOrderPay
2022-10-20 09:15:48 +08:00
} from '@/api/appointmenttime/appointmenttime.js'
import baseurl from '@/api/baseurl.js'
2022-11-15 15:36:29 +08:00
import appointmenttext from './text.vue'
2023-02-23 10:45:26 +08:00
import tabs from '../utabs/u-tabs.vue'
2022-10-14 19:48:48 +08:00
export default {
2022-10-21 11:01:04 +08:00
components: {
2023-02-23 10:45:26 +08:00
appointmenttext,
tabs
2022-10-21 11:01:04 +08:00
},
2022-10-14 19:48:48 +08:00
data() {
return {
2023-02-23 10:45:26 +08:00
Soonerorlater: 'morning',
timecurrent: 0, //时间下标
openid: '',
2022-10-31 09:04:45 +08:00
maskshow: false, //用户协议开关
radio: 1, //用户协议
2023-02-23 10:45:26 +08:00
personInfo: {}, //用户信息
2022-10-31 09:04:45 +08:00
patientId: null,
2023-02-23 10:45:26 +08:00
useritem: null, //optionsuser信息
consumableTotalPrice: 0, //耗材包总价格
2022-10-20 09:15:48 +08:00
orderlist: {
2022-10-31 09:04:45 +08:00
orderCount: 1,
patientId: '',
stationId: '',
stationItemId: '',
stationItemPriceId: '',
serviceAddress: "",
serviceDate: "",
2023-02-23 10:45:26 +08:00
serviceStartTime: null,
2022-10-31 09:04:45 +08:00
serviceEndTime: "",
nurseItemName: "",
nurseItemPrice: '',
serveDurationUnit: "",
consumableTotalPrice: '',
totalPrice: '',
remark: "",
2022-11-09 16:38:05 +08:00
orderConsumableList: [],
2023-02-23 10:45:26 +08:00
orderChannel: '',
2022-10-20 09:15:48 +08:00
},
2023-02-23 10:45:26 +08:00
timeindex: 0,
2022-10-14 19:48:48 +08:00
}
},
2022-11-09 16:38:05 +08:00
onShow() {
let that = this
uni.$on('updata', function(data) {
if (data.updata) {
that.orderlist = JSON.parse(data.updata)
}
if (data.useritem) {
that.useritem = JSON.parse(data.useritem)
that.orderlist.serviceAddress = that.useritem.address
that.personInfo.patientName = that.useritem.receiveName
that.personInfo.phone = that.useritem.receivePhone
that.personInfo.address = that.useritem.address
} else {}
})
},
2022-10-20 18:38:18 +08:00
onLoad(options) {
2023-02-23 10:45:26 +08:00
var that = this
try {
const value = uni.getStorageSync('openid');
if (value) {
that.openid = value
}
} catch (e) {}
2022-10-20 18:38:18 +08:00
//耗材包详情方法调用
2022-10-31 09:04:45 +08:00
this.getPatientInfo(options.stationId, options.stationItemId, options.stationItemPriceId)
2023-02-23 10:45:26 +08:00
this.userinfo();
2022-10-20 09:15:48 +08:00
},
2022-10-14 19:48:48 +08:00
methods: {
2023-02-23 10:45:26 +08:00
//切换上下午
tapSoonerorlater(item) {
this.Soonerorlater = item
this.timeindex = 0
if (item == 'morning') {
this.orderlist.serviceStartTime = this.orderlist.appointmentTimeList[this.timecurrent].morningList[0]
} else if (item == 'after') {
this.orderlist.serviceStartTime = this.orderlist.appointmentTimeList[this.timecurrent].afternoonList[0]
}
},
//选择时间
taptime(item, index) {
this.orderlist.serviceStartTime = item
this.timeindex = index
},
userinfo() {
//取出patientId
var that = this
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
//被护理人信息
getAppPatientList(that.patientId).then(response => {
that.personInfo = response.data
that.personInfo.address = response.data.areaName + response.data.address
})
}
} catch (e) {}
},
timechange(index) {
this.orderlist.serviceDate = this.orderlist.appointmentTimeList[index].date
this.timecurrent = index
},
//获取耗材包详情
getPatientInfo(stationId, stationItemId, stationItemPriceId) {
getAppStationItemInfo(stationId, stationItemId, stationItemPriceId).then(res => {
res.data.nurseItemContent = ''
if (res.code == 200) {
if (res.data.itemConsumableList) {
res.data.itemConsumableList.forEach(e => {
e.radio = true
})
}
res.data.appointmentTimeList.forEach(e => {
e.dates = e.date.slice(5, 10)
e.name = e.week
})
this.orderlist = res.data
this.orderlist.serviceStartTime = res.data.appointmentTimeList[0].morningList[0]
this.orderlist.serviceDate = res.data.appointmentTimeList[0].date
this.consumableTotalPrice = res.data.consumableTotalPrice
}
})
},
//确认预约
updata() {
var that = this
console.log(this.orderlist)
this.orderlist.consumableTotalPrice = null
this.orderlist.orderChannel = 'WECHAT_APPLET'
if (this.radio == 1) {
this.$refs.uToast.show({
title: '请阅读用户协议并同意',
type: 'error',
})
} else {
this.orderlist.orderCount = 1;
this.orderlist.orderConsumableList = []
if (this.orderlist.itemConsumableList) {
this.orderlist.itemConsumableList.forEach(e => {
if (e.radio) {
this.orderlist.orderConsumableList.push(e)
}
})
}
this.orderlist.afternoonOpenEndTime = this.orderlist.afternoonOpenEndTime.slice(0, 5)
this.orderlist.afternoonOpenStartTime = this.orderlist.afternoonOpenStartTime.slice(0, 5)
this.orderlist.morningOpenEndTime = this.orderlist.morningOpenEndTime.slice(0, 5)
this.orderlist.morningOpenStartTime = this.orderlist.morningOpenStartTime.slice(0, 5)
this.orderlist.patientId = this.patientId
this.orderlist.serviceAddress = this.personInfo.areaName + this.personInfo.address
submitAppointment(this.orderlist).then(res => {
if (res.code == 500) {
that.$refs.uToast.show({
title: res.msg,
type: 'error',
})
} else if (res.code == 200) {
let obj = {
patientId: res.data.patientId,
openid: that.openid,
orderNo: res.data.orderNo,
orderChannel: res.data.orderChannel,
paymentPrice: res.data.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',
duration: 1500,
url: `/pages/paysuccess/paysuccess`
})
},
fail: function(err) {
that.$refs.uToast.show({
title: '取消预约',
type: 'error',
duration: 1500,
url: `/pages/menttimeorder/menttimeorder?list=${JSON.stringify(obj)}`
})
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 2000
})
}
})
}
})
}
},
changeRadio() {
if (this.radio == 1) {
this.radio = 2;
} else {
this.radio = 1;
}
},
tapradio() {
this.radio = 2;
this.maskshow = false
},
2022-12-02 16:04:52 +08:00
checkboxChange(e) {
if (e.radio) {
this.orderlist.totalPrice = this.argSubtr(this.orderlist.totalPrice, e.consumablePrice)
} else {
this.orderlist.totalPrice = this.argAdd(this.orderlist.totalPrice, e.consumablePrice)
}
},
argAdd(arg1, arg2) {
// 加法函数
var _this = this,
r1 = 0,
r2 = 0,
m = 0;
try {
r1 = arg1.toString().split(".")[1].length
} catch (e) {}
try {
r2 = arg2.toString().split(".")[1].length
} catch (e) {}
m = Math.pow(10, Math.max(r1, r2))
return _this.argDiv((_this.argMul(arg1, m) + _this.argMul(arg2, m)), m)
},
argSubtr(arg1, arg2) {
// 减法函数
var _this = this,
r1 = 0,
r2 = 0,
m = 0;
try {
r1 = arg1.toString().split(".")[1].length
} catch (e) {}
try {
r2 = arg2.toString().split(".")[1].length
} catch (e) {}
m = Math.pow(10, Math.max(r1, r2));
return _this.argDiv((_this.argMul(arg1, m) - _this.argMul(arg2, m)), m)
},
argMul(arg1, arg2) {
// 乘法函数
var _this = this,
m = 0,
s1 = arg1.toString(),
s2 = arg2.toString();
try {
m += s1.split(".")[1].length
} catch (e) {}
try {
m += s2.split(".")[1].length
} catch (e) {}
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
},
argDiv(arg1, arg2) {
// 除法函数
var _this = this,
t1 = 0,
t2 = 0,
r1, r2;
try {
t1 = arg1.toString().split(".")[1].length
} catch (e) {}
try {
t2 = arg2.toString().split(".")[1].length
} catch (e) {}
r1 = Number(arg1.toString().replace(".", ""))
r2 = Number(arg2.toString().replace(".", ""))
return _this.argMul((r1 / r2), Math.pow(10, t2 - t1));
},
2022-12-01 17:03:02 +08:00
// 选中任一checkbox时由checkbox-group触发
checkboxGroupChange(e) {},
2022-11-01 16:26:34 +08:00
goaddress() {
uni.navigateTo({
2023-02-23 10:45:26 +08:00
url: `/pages/modifyAddress/modifyAddress?updata=${JSON.stringify(this.orderlist)}`
2022-11-01 16:26:34 +08:00
})
},
2022-10-20 18:38:18 +08:00
}
2022-10-17 18:35:58 +08:00
}
2022-10-20 18:38:18 +08:00
</script>
<style lang="scss">
2022-10-25 08:58:53 +08:00
@import './appointmenttime.scss'
2022-10-14 19:48:48 +08:00
</style>