|
|
|
@ -2,26 +2,51 @@
|
|
|
|
|
import { onLoad } from "@dcloudio/uni-app"
|
|
|
|
|
// import mySwiper from "@/components/mySwiper.vue"
|
|
|
|
|
import {ref,onMounted,nextTick,computed} from "vue"
|
|
|
|
|
import unCombox from '@/uni_modules/uni-combox/components/uni-combox/uni-combox.vue'
|
|
|
|
|
import {useStore} from '@/store/index.js'
|
|
|
|
|
const store = useStore()
|
|
|
|
|
import api from "@/api/index.js"
|
|
|
|
|
onLoad(() => {
|
|
|
|
|
// console.log(useStore.userInfo)
|
|
|
|
|
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
|
|
|
|
|
console.log(userinfo.value)
|
|
|
|
|
avatar.value = uni.getStorageSync('avatarUrl')
|
|
|
|
|
h_info.value = JSON.parse(uni.getStorageSync('operation_info'))
|
|
|
|
|
if(h_info.value) {
|
|
|
|
|
// console.log(h_info.value)
|
|
|
|
|
getHospital(h_info.value.hospitalId)
|
|
|
|
|
if(uni.getStorageSync('operation_info')) {
|
|
|
|
|
h_info.value = JSON.parse(uni.getStorageSync('operation_info'))
|
|
|
|
|
if(h_info.value) {
|
|
|
|
|
// console.log(h_info.value)
|
|
|
|
|
getHospital(h_info.value.hospitalId)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 变量
|
|
|
|
|
const h_queryParams = ref({
|
|
|
|
|
page:1,
|
|
|
|
|
pageSize:1000,
|
|
|
|
|
key:''
|
|
|
|
|
})
|
|
|
|
|
const hospitals = ref(null)
|
|
|
|
|
const userinfo = ref({})
|
|
|
|
|
const avatar = ref(null)
|
|
|
|
|
const h_info = ref(null)
|
|
|
|
|
const h_info = ref({})
|
|
|
|
|
const inputDialog = ref(null)
|
|
|
|
|
const input_title = ref(null)
|
|
|
|
|
const hValue = ref('') // 医院
|
|
|
|
|
const hValueId = ref('') // 医院id
|
|
|
|
|
// const form_data = ref({})
|
|
|
|
|
// const userForm = ref(null)
|
|
|
|
|
// 方法
|
|
|
|
|
async function getHospitalList() {
|
|
|
|
|
const res = await api.getHospitalList(h_queryParams.value)
|
|
|
|
|
if(res.code == 0) {
|
|
|
|
|
hospitals.value = res.data.list
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function onClickH() {
|
|
|
|
|
h_queryParams.value.key = hValue.value
|
|
|
|
|
getHospitalList()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
async function getHospital(id) {
|
|
|
|
|
const res = await api.getHospitalInfo(id)
|
|
|
|
|
if(res.code === 0) {
|
|
|
|
@ -55,10 +80,11 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function finishFunc() {
|
|
|
|
|
|
|
|
|
|
inputDialog.value.close()
|
|
|
|
|
}
|
|
|
|
|
const startDate = computed(() => getDate('start'))
|
|
|
|
|
const endDate = computed(() => getDate('end'))
|
|
|
|
|
const choosed_h = ref(null)
|
|
|
|
|
const date = ref(null)
|
|
|
|
|
function getDate(type) {
|
|
|
|
|
const date = new Date();
|
|
|
|
@ -75,8 +101,66 @@
|
|
|
|
|
day = day > 9 ? day : '0' + day;
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
}
|
|
|
|
|
function bindDateChange() {
|
|
|
|
|
|
|
|
|
|
function bindDateChange(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
h_info.value.surgery_time = e.detail.value
|
|
|
|
|
}
|
|
|
|
|
function toChooseH(item) {
|
|
|
|
|
console.log(item)
|
|
|
|
|
choosed_h.value = item
|
|
|
|
|
hValue.value = item.name
|
|
|
|
|
// hospitals.value = null
|
|
|
|
|
}
|
|
|
|
|
async function sumbmitFunc() {
|
|
|
|
|
console.log(choosed_h.value,h_info.value,userinfo.value)
|
|
|
|
|
let obj = {
|
|
|
|
|
id: userinfo.value.userId,
|
|
|
|
|
// isSurgery: 1, //是否已经手术 0为手术,1已经手术
|
|
|
|
|
surgery_time: h_info.value?.surgery_time, //手术时间
|
|
|
|
|
nickname: userinfo.value.nickname,
|
|
|
|
|
// avatar: '',
|
|
|
|
|
phone: userinfo.value.phone,
|
|
|
|
|
hospitalId:choosed_h.value?.ID
|
|
|
|
|
}
|
|
|
|
|
const res = await api.userinfoUpdae(obj)
|
|
|
|
|
if(res.code === 0) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title:res.msg,
|
|
|
|
|
icon:"success",
|
|
|
|
|
duration:2000,
|
|
|
|
|
async success() {
|
|
|
|
|
await wx_login(userinfo.value.userId)
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title:res.msg,
|
|
|
|
|
icon:"error",
|
|
|
|
|
duration:2000
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
async function wx_login(userId){
|
|
|
|
|
let res=await new Promise(resolve=>{
|
|
|
|
|
uni.login({
|
|
|
|
|
provider: 'weixin', //使用微信登录
|
|
|
|
|
success: function (loginRes) {
|
|
|
|
|
resolve(loginRes);
|
|
|
|
|
console.log(loginRes,'微信登录返回信息');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
let res2=await api.wx_login({code:res.code},userId);
|
|
|
|
|
if(res2.code === 0) {
|
|
|
|
|
uni.setStorageSync('userInfo',JSON.stringify(userinfo.value))
|
|
|
|
|
// is_login.value = custom.checkLogin()
|
|
|
|
|
store.checkLogin()
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uni.clearStorage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
@ -113,8 +197,13 @@
|
|
|
|
|
<uni-icons type="calendar" color="gray" size="26"></uni-icons>
|
|
|
|
|
手术时间</view>
|
|
|
|
|
<view class="rbc-content-row rbc-content-right">
|
|
|
|
|
{{h_info?.surgery_time}}
|
|
|
|
|
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
|
|
|
|
<!-- {{h_info?.surgery_time}} -->
|
|
|
|
|
<picker mode="date" :value="h_info?.surgery_time" :start="startDate" :end="endDate" @change="bindDateChange">
|
|
|
|
|
<view class="rbc-content-row rbc-content-right">
|
|
|
|
|
<view class="uni-input"> {{h_info?.surgery_time}}</view>
|
|
|
|
|
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
|
|
|
|
</view>
|
|
|
|
|
</picker>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
@ -124,7 +213,8 @@
|
|
|
|
|
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
|
|
|
|
|
手术医院</view>
|
|
|
|
|
<view class="rbc-content-row rbc-content-right">
|
|
|
|
|
{{h_info?.name}}
|
|
|
|
|
<!-- {{h_info?.name}} -->
|
|
|
|
|
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox>
|
|
|
|
|
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
@ -144,14 +234,11 @@
|
|
|
|
|
<uni-easyinput :inputBorder="false" v-else borderColor="#26758d" v-model="userinfo.phone" focus placeholder="输入您的电话"></uni-easyinput>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="pb-item pb-item-btn" @tap="finishFunc">提交</view>
|
|
|
|
|
<view class="pb-item pb-item-btn" @tap="finishFunc">确定</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</uni-popup>
|
|
|
|
|
<!-- 手术时间 -->
|
|
|
|
|
<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
|
|
|
|
|
<view class="uni-input"> {{h_info?.surgery_time}}</view>
|
|
|
|
|
</picker>
|
|
|
|
|
<view class="pb-item pb-item-btn" style="margin-top: 40rpx;" @tap="sumbmitFunc">确定</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|