nurseWeChatAppletUI/pages/appointmenttime/appointmenttime.vue

472 lines
14 KiB
Vue
Raw Normal View History

<template>
<view class="app">
2023-02-22 17:09:55 +08:00
<view class="user">
<view class="item">
<span>姓名</span>
<span class='addition'>{{personInfo.patientName}}</span>
</view>
<view class="item">
<span>电话</span>
<span class='addition'>{{personInfo.phone}}</span>
</view>
<view class="addressitem">
<view class="leftaddress">地址</view>
<view class='addition'>{{personInfo.address}}</view>
</view>
<view class="item" style="border: 0;">
<span>上门时间</span>
<span class='addition'>请您选择希望护理员到达的时间</span>
</view>
<tabs :list="orderlist.appointmentTimeList" :current="timecurrent" @change="timechange">
</tabs>
<view class="timeyear">
<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>
2023-02-22 16:32:07 +08:00
</view>
2023-02-22 17:09:55 +08:00
<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}}
2023-02-17 09:36:17 +08:00
</view>
</view>
2023-02-22 17:09:55 +08:00
<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}}
2023-02-17 09:36:17 +08:00
</view>
</view>
</view>
</view>
2023-02-22 17:09:55 +08:00
</view>
<view class="remarks">
服务时长:
<span style='padding-left: 30rpx;' class='addition'>{{orderlist.serveDurationUnit}}</span>
</view>
<view class="Package">套餐信息
<text class="money">{{orderlist.nurseItemPrice}}</text>
<text class="detail">
{{orderlist.nurseItemName}}
</text>
</view>
<view class="Consumablespackage">耗材包详情
<text class="money">{{consumableTotalPrice}}</text>
<view class="detail">
2023-02-23 14:06:35 +08:00
<u-checkbox-group @change="checkboxGroupChange" :wrap='true'>
2023-02-22 17:09:55 +08:00
<u-checkbox @change="checkboxChange(item)" v-model="item.radio"
v-for="(item, index) in orderlist.itemConsumableList" :key="index"
:name="item.consumableDetail">
<view class='itemConsumabletitle'> {{item.consumableDetail}}</view>
<span>{{item.consumableCount}}{{item.consumableUnit}}/{{item.consumablePrice}}</span>
</u-checkbox>
</u-checkbox-group>
</view>
2023-02-22 17:09:55 +08:00
</view>
2023-03-30 11:02:14 +08:00
<view class="Package" style="height: 170rpx;">
是否失能
<span style='color:#F44B2F;padding-left: 10rpx;'>*</span>
<span style='color:#C5C3C3;padding-left: 10rpx;font-size: 30rpx;'>(请选择)</span>
<view class="checkboxs">
<u-checkbox-group @change="checkboxGroupChangetwo">
<u-checkbox @change="checkboxChangetwo(item)" v-model="item.checked" size='40' shape="circle"
v-for="(item, index) in checkboxlist" :key="index" :name="item.name">{{item.name}}</u-checkbox>
</u-checkbox-group>
</view>
</view>
2023-04-03 16:57:00 +08:00
<view class="remarks" v-if="disablingCondition == 'DISABLED'">
2023-03-30 11:02:14 +08:00
<span class='span' style='width: 25%;'>失能情况
<span style='color:#F44B2F;padding-left: 10rpx;'>*</span></span>
2023-04-07 14:29:23 +08:00
<input style="left:27%;width: 73%;" placeholder="请输入" v-model="personInfo.disablingReason">
2023-03-30 11:02:14 +08:00
</view>
2023-02-22 17:09:55 +08:00
<view class="remarks">
2023-03-30 11:02:14 +08:00
<span class='span'>备注</span>
2023-02-22 17:09:55 +08:00
<input placeholder="请输入" v-model="orderlist.remark">
</view>
<view class="radio-content">
<view class="radio-right" @tap="changeRadio">
<view class="radio" :class="radio == 2 ? 'radio-default':''">
<view :class="radio == 2 ? 'radio-active':''"></view>
</view>
</view>
2023-02-22 17:09:55 +08:00
<view class="agreement">我已阅读并同意<text @tap='maskshow=true'
style="color: #000000;border-bottom: 1rpx solid #000000;">用户协议</text></view>
</view>
<view class="priceback">
<view class="prices">{{orderlist.totalPrice}}</view>
<view class="xiugai" @tap='goaddress'>修改信息</view>
<view class="queren" @tap='updata'>确认预约</view>
</view>
<u-toast ref="uToast" />
<!-- //用户协议 -->
<u-mask :show="maskshow" class='mask' @click='maskshow=false'>
<view class="Agreement">
<view class="title">
护理站上门服务知情同意书
</view>
<scroll-view scroll-y="true" class="scroll-Y" style="">
<appointmenttext></appointmenttext>
</scroll-view>
<view class="cancel" @tap='maskshow=false'>
取消
</view>
<view class="determine" @tap='tapradio'>
确定并同意
</view>
</view>
</u-mask>
</view>
</template>
<script>
import {
getAppStationItemInfo,
getAppPatientList,
submitAppointment,
appletAppointmentOrderPay
} from '@/api/appointmenttime/appointmenttime.js'
import baseurl from '@/api/baseurl.js'
2023-05-22 16:01:59 +08:00
import appointmenttext from '../../components/appointmenttimetext.vue'
2023-02-17 09:36:17 +08:00
import tabs from '../utabs/u-tabs.vue'
export default {
components: {
2023-02-17 09:36:17 +08:00
appointmenttext,
tabs
},
data() {
return {
2023-02-17 09:36:17 +08:00
Soonerorlater: 'morning',
timecurrent: 0, //时间下标
openid: '',
maskshow: false, //用户协议开关
radio: 1, //用户协议
personInfo: {}, //用户信息
patientId: null,
useritem: null, //optionsuser信息
2022-12-28 12:08:50 +08:00
consumableTotalPrice: 0, //耗材包总价格
2023-05-22 09:47:19 +08:00
disablingCondition: undefined, //是否失能
orderlist: {
2023-05-22 09:47:19 +08:00
disablingCondition: undefined,
orderCount: 1,
patientId: '',
stationId: '',
stationItemId: '',
stationItemPriceId: '',
serviceAddress: "",
serviceDate: "",
2023-02-17 09:36:17 +08:00
serviceStartTime: null,
serviceEndTime: "",
nurseItemName: "",
nurseItemPrice: '',
serveDurationUnit: "",
consumableTotalPrice: '',
totalPrice: '',
remark: "",
2023-04-03 16:57:00 +08:00
disablingReason: '',
orderConsumableList: [],
orderChannel: '',
},
2023-02-17 09:36:17 +08:00
timeindex: 0,
2023-03-30 11:02:14 +08:00
checkboxlist: [{
name: '是',
checked: false,
},
{
name: '否',
checked: false,
}
]
}
},
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 {}
2023-05-05 11:43:11 +08:00
uni.$off('updata')
})
},
onLoad(options) {
var that = this
2023-03-09 16:07:29 +08:00
const value = uni.getStorageSync('openid');
if (value) {
that.openid = value
}
2023-04-07 14:37:18 +08:00
this.userinfo();
//耗材包详情方法调用
this.getPatientInfo(options.stationId, options.stationItemId, options.stationItemPriceId)
},
methods: {
2023-02-22 09:37:37 +08:00
//切换上下午
tapSoonerorlater(item) {
this.Soonerorlater = item
this.timeindex = 0
if (item == 'morning') {
2023-02-22 09:42:28 +08:00
this.orderlist.serviceStartTime = this.orderlist.appointmentTimeList[this.timecurrent].morningList[0]
2023-02-22 09:37:37 +08:00
} else if (item == 'after') {
2023-02-22 09:42:28 +08:00
this.orderlist.serviceStartTime = this.orderlist.appointmentTimeList[this.timecurrent].afternoonList[0]
2023-02-22 09:37:37 +08:00
}
},
2023-02-17 09:36:17 +08:00
//选择时间
taptime(item, index) {
this.orderlist.serviceStartTime = item
this.timeindex = index
},
userinfo() {
//取出patientId
var that = this
2023-03-09 16:07:29 +08:00
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
//被护理人信息
getAppPatientList(that.patientId).then(response => {
2023-05-22 09:47:19 +08:00
if (response.data.disablingCondition == 'DISABLED') {
2023-04-07 14:29:23 +08:00
that.checkboxlist[0].checked = true
that.disablingCondition = 'DISABLED'
2023-05-22 09:47:19 +08:00
} else {
that.checkboxlist[1].checked = true
that.disablingCondition = 'NOT_DISABLED'
2023-04-07 14:29:23 +08:00
}
2023-03-09 16:07:29 +08:00
that.personInfo = response.data
that.personInfo.address = response.data.areaName + response.data.address
})
}
},
2023-02-17 09:36:17 +08:00
timechange(index) {
2023-02-20 17:36:40 +08:00
this.orderlist.serviceDate = this.orderlist.appointmentTimeList[index].date
2023-02-17 09:36:17 +08:00
this.timecurrent = index
},
//获取耗材包详情
getPatientInfo(stationId, stationItemId, stationItemPriceId) {
getAppStationItemInfo(stationId, stationItemId, stationItemPriceId).then(res => {
2022-12-06 10:08:19 +08:00
res.data.nurseItemContent = ''
if (res.code == 200) {
2022-12-01 16:59:32 +08:00
if (res.data.itemConsumableList) {
res.data.itemConsumableList.forEach(e => {
e.radio = true
})
}
2023-02-17 09:36:17 +08:00
res.data.appointmentTimeList.forEach(e => {
e.dates = e.date.slice(5, 10)
e.name = e.week
})
this.orderlist = res.data
2023-02-17 09:36:17 +08:00
this.orderlist.serviceStartTime = res.data.appointmentTimeList[0].morningList[0]
this.orderlist.serviceDate = res.data.appointmentTimeList[0].date
2022-12-06 10:08:19 +08:00
this.consumableTotalPrice = res.data.consumableTotalPrice
2023-04-11 16:32:51 +08:00
this.orderlist.orderCommissionAmount = res.data.commissionAmount
2023-04-07 14:36:20 +08:00
this.orderlist.disablingCondition = this.personInfo.disablingCondition
}
})
},
//确认预约
updata() {
var that = this
2023-02-22 09:46:52 +08:00
if (this.radio == 1) {
this.$refs.uToast.show({
title: '请阅读用户协议并同意',
type: 'error',
})
2023-02-24 17:19:57 +08:00
this.maskshow = true
2023-02-22 09:46:52 +08:00
} 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)
}
})
}
2023-04-07 14:36:20 +08:00
this.orderlist.consumableTotalPrice = null
this.orderlist.orderChannel = 'WECHAT_APPLET'
this.orderlist.disablingReason = this.personInfo.disablingReason
2023-02-22 09:46:52 +08:00
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
2023-04-07 10:29:05 +08:00
this.orderlist.serviceAddress = this.personInfo.address
2023-05-10 08:55:48 +08:00
this.orderlist.disablingCondition = this.disablingCondition
2023-04-07 14:36:20 +08:00
if (this.orderlist.disablingCondition == 'NOT_DISABLED') {
this.orderlist.disablingReason = null
}
2023-02-22 09:46:52 +08:00
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
},
2023-03-30 11:02:14 +08:00
// 选中某个复选框时由checkbox时触发
2022-12-02 16:02:53 +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)
}
},
2023-03-30 11:02:14 +08:00
// 选中某个复选框时由checkbox时触发
checkboxChangetwo(e) {
this.checkboxlist.forEach(e => {
e.checked = false
})
e.checked = true
},
// 选中任一checkbox时由checkbox-group触发
2023-04-03 16:57:00 +08:00
checkboxGroupChangetwo(e) {
2023-05-22 09:47:19 +08:00
if (e[0] == '是') {
2023-04-03 16:57:00 +08:00
this.disablingCondition = 'DISABLED'
} else {
2023-05-22 09:47:19 +08:00
this.disablingCondition = 'NOT_DISABLED'
2023-04-03 16:57:00 +08:00
}
this.orderlist.disablingCondition = this.disablingCondition
},
2022-12-02 16:02:53 +08:00
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 16:59:32 +08:00
// 选中任一checkbox时由checkbox-group触发
checkboxGroupChange(e) {},
goaddress() {
uni.navigateTo({
2022-12-06 10:08:19 +08:00
url: `/pages/modifyAddress/modifyAddress?updata=${JSON.stringify(this.orderlist)}`
})
},
}
}
</script>
<style lang="scss">
@import './appointmenttime.scss'
</style>