NurseStationApp/pages/appointmenttime/appointmenttime.vue
2022-12-06 10:10:34 +08:00

367 lines
11 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="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="item">
<span>地址</span>
<span class='addition'>{{personInfo.address}}</span>
</view>
<view class="item" style="border: 0;">
<span></span>
<span class='addition'>请您选择希望护理员到达的时间区间</span>
</view>
<view class="selecttime" @tap='yearshow=true'>
<span>日期</span>
<text v-if="yeartime==''" class='addition'>请选择日期
<image src="../../static/jiantou.png"></image>
</text>
<text v-else class='addition'>{{yeartime}}</text>
</view>
<view class="selecttime" @tap='timeshow=true'>
<span>时间:</span>
<text v-if="usertime==''" class='addition'>请选择时间区间
<image src="../../static/jiantou.png"></image>
</text>
<text v-else class='addition'>{{usertime}}</text>
</view>
</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">
·<span style='padding-left: 10rpx;'>{{orderlist.nurseItemName}}</span>
</text>
</view>
<view class="Consumablespackage">耗材包详情:
<text class="money">¥{{consumableTotalPrice}}</text>
<view class="detail">
<u-checkbox-group @change="checkboxGroupChange" wrap='true'>
<u-checkbox @change="checkboxChange(item)" v-model="item.radio"
v-for="(item, index) in orderlist.itemConsumableList" :key="index"
:name="item.consumableDetail">
<view style='display: inline-block;'> {{item.consumableDetail}}</view>
<span>{{item.consumableCount}}{{item.consumableUnit}}/¥{{item.consumablePrice}}</span>
</u-checkbox>
</u-checkbox-group>
</view>
</view>
<view class="remarks">
<span>备注:</span>
<input placeholder="">
</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>
<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-picker v-model="yearshow" mode="time" start-year='2022' :params="yearparams" @confirm='yeartimeconfirm'>
</u-picker>
<upicker v-model="timeshow" mode="time" :params="timeparams" @confirm='timeconfirm'></upicker>
<!-- //用户协议 -->
<u-mask :show="maskshow" class='mask' @click='maskshow=false'>
<view class="Agreement">
<view class="title">
护理站上门服务知情同意书
</view>
<scroll-view scroll-y="true" class="scroll-Y">
<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
} from '@/api/appointmenttime/appointmenttime.js'
import baseurl from '@/api/baseurl.js'
import upicker from '../picker/picker.vue'
import appointmenttext from './text.vue'
export default {
components: {
upicker,
appointmenttext
},
data() {
return {
timeparams: { //picker组件所需
year: false,
month: false,
day: false,
hour: true,
endhour: true,
minute: true,
endminute: true,
},
timeshow: false, //时间开关
usertime: '', //页面展示时间
yearparams: { //picker组件所需
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
yearshow: false, //时间开关
yeartime: '', //页面展示时间
maskshow: false, //用户协议开关
radio: 1, //用户协议
personInfo: [], //用户信息
patientId: null,
usertime: '', //页面展示时间
consumableTotalPrice: null, //耗材包总价格
orderlist: {
orderCount: 1,
patientId: '',
stationId: '',
stationItemId: '',
stationItemPriceId: '',
serviceAddress: "",
serviceDate: "",
serviceStartTime: "",
serviceEndTime: "",
nurseItemName: "",
nurseItemPrice: '',
serveDurationUnit: "",
consumableTotalPrice: '',
totalPrice: '',
remark: "",
orderConsumableList: [],
},
}
},
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 {}
})
setTimeout(e => {
if (!that.useritem) {
that.userinfo();
}
}, 500)
},
onLoad(options) {
//耗材包详情方法调用
this.getPatientInfo(options.stationId, options.stationItemId, options.stationItemPriceId)
},
methods: {
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));
},
userinfo() {
//取出patientId
var that = this
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
//被护理人信息
getAppPatientList(value).then(response => {
that.personInfo = response.data
that.personInfo.address = response.data.provinceName + response.data
.cityName + response.data.regionName + response.data.streetName +
response.data.address
that.orderlist.patientId = response.data.patientId
that.orderlist.serviceAddress = response.data.provinceName + response.data
.cityName + response.data.regionName + response.data.streetName +
response.data.address
})
}
} catch (e) {
// error
}
},
//获取耗材包详情
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
})
}
this.consumableTotalPrice = res.data.consumableTotalPrice
this.orderlist = res.data
}
})
},
//确认预约
updata() {
if (this.radio == 1) {
this.$refs.uToast.show({
title: '请阅读用户协议并同意',
type: 'error',
})
} else {
this.orderlist.consumableTotalPrice = null
this.orderlist.orderChannel = "MOBILE_APP"
this.orderlist.buySource = "NURSE_STATION"
this.orderlist.orderCount = 1;
this.orderlist.orderConsumableList = []
if (this.orderlist.itemConsumableList) {
this.orderlist.itemConsumableList.forEach(e => {
if (e.radio) {
this.orderlist.orderConsumableList.push(e)
}
})
}
// submitAppointment(this.orderlist).then(res => {
// if (res.code == 500) {
// this.$refs.uToast.show({
// title: res.msg,
// type: 'error',
// })
// } else if (res.code == 200) {
// this.$refs.uToast.show({
// title: '预约成功',
// type: 'success',
// url: '/pages/paysuccess/paysuccess',
// toast: 1500
// })
// }
// })
}
},
changeRadio() {
if (this.radio == 1) {
this.radio = 2;
} else {
this.radio = 1;
}
},
// 选中任一checkbox时由checkbox-group触发
checkboxGroupChange(e) {},
// 全选
checkedAll() {},
//获取时间
timeconfirm(e) {
this.orderlist.serviceStartTime = e.hour + ":" + e.minute
this.usertime = e.hour + ":" + e.minute + '--' + e.endhour + ":" + e.endminute
this.orderlist.serviceEndTime = e.endhour + ":" + e.endminute
this.orderlist.patientId = this.personInfo.patientId
this.orderlist.serviceAddress = this.personInfo.address
},
yeartimeconfirm(e) {
this.orderlist.serviceDate = e.year + '-' + e.month + '-' + e.day
this.yeartime = e.year + '年' + e.month + '月' + e.day + "日"
},
goaddress() {
uni.navigateTo({
url: `/pages/modifyAddress/modifyAddress?url=${'appointmenttime'}&updata=${JSON.stringify(this.orderlist)}`
})
},
tapradio() {
this.radio = 2;
this.maskshow = false;
},
}
}
</script>
<style lang="scss">
@import './appointmenttime.scss'
</style>