|
@@ -25,7 +25,7 @@
|
|
|
</view>
|
|
|
<view class="flex-row align-center justify-between mt-4">
|
|
|
<text class="font text-black2">首选护理人员性别</text>
|
|
|
- <text class="font text-black2" @click="chooseGender">{{formData.sex === '0'?'女':'男'}}</text>
|
|
|
+ <text class="font text-black2" @click="chooseGender">{{formData.sex === '1'?'女':'男'}}</text>
|
|
|
</view>
|
|
|
<view class="flex-row align-center justify-between mt-4">
|
|
|
<text class="font text-black2">所在医院</text>
|
|
@@ -68,11 +68,16 @@
|
|
|
<script>
|
|
|
import dayjs from 'dayjs'
|
|
|
import {
|
|
|
- applyUrl
|
|
|
- } from '@/common/config/api.js'
|
|
|
+ applyUrl,
|
|
|
+ applyModifyUrl
|
|
|
+ } from '@/common/config/api.js';
|
|
|
+ import {
|
|
|
+ getCareInfo
|
|
|
+ } from '@/common/config/application-api.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ formId: '',
|
|
|
formData: {
|
|
|
personId: '',
|
|
|
name: '请选择申请人',
|
|
@@ -85,7 +90,16 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
+ onLoad(options) {
|
|
|
+
|
|
|
+ if (options.id) {
|
|
|
+ this.formId = options.id;
|
|
|
+ this.getApplyInfo();
|
|
|
+ } else {
|
|
|
+ this.formId = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 监听器
|
|
|
uni.$on('personChoose', (e) => {
|
|
|
console.log(e);
|
|
|
this.formData.personId = e.id;
|
|
@@ -102,6 +116,27 @@
|
|
|
uni.$off('hospitalChoose');
|
|
|
},
|
|
|
methods: {
|
|
|
+ getApplyInfo() {
|
|
|
+ getCareInfo({
|
|
|
+ id: this.formId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log('申请详情', res);
|
|
|
+ this.formData = {
|
|
|
+ personId: res.personId,
|
|
|
+ name: res.personName,
|
|
|
+ demand: res.careNeeds,
|
|
|
+ sex: res.nurseGender,
|
|
|
+ hospital: res.hospital,
|
|
|
+ address: res.address,
|
|
|
+ dayCount: res.careDays,
|
|
|
+ remark: res.remark
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log('申请详情Err', err);
|
|
|
+ })
|
|
|
+ },
|
|
|
goChooseHospital() {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/subpack/pages/choose-hospital/choose-hospital'
|
|
@@ -115,7 +150,7 @@
|
|
|
chooseGender() {
|
|
|
uni.showActionSheet({
|
|
|
title: '首选护理人员性别',
|
|
|
- itemList: ['女', '男'],
|
|
|
+ itemList: ['男', '女'],
|
|
|
success: (res) => {
|
|
|
// console.log('选择了第' + (res.tapIndex) + '个选项');
|
|
|
this.formData.sex = res.tapIndex + '';
|
|
@@ -128,7 +163,10 @@
|
|
|
|
|
|
apply() {
|
|
|
uni.showLoading();
|
|
|
- applyUrl({
|
|
|
+ let params = {};
|
|
|
+ if (this.formId) {
|
|
|
+ params = {
|
|
|
+ applyId: this.formId,
|
|
|
address: this.formData.address,
|
|
|
applyDate: dayjs().format('YYYY-MM-DD'),
|
|
|
careDays: this.formData.dayCount,
|
|
@@ -138,25 +176,60 @@
|
|
|
personId: this.formData.personId,
|
|
|
personName: this.formData.name,
|
|
|
remark: this.formData.remark
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: `提交成功`,
|
|
|
- showCancel: false,
|
|
|
- confirmText: '返回首页',
|
|
|
- success: (e) => {
|
|
|
- if (e.confirm) {
|
|
|
- uni.navigateBack()
|
|
|
+ }
|
|
|
+ applyModifyUrl(params)
|
|
|
+ .then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `提交成功`,
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: '返回',
|
|
|
+ success: (e) => {
|
|
|
+ if (e.confirm) {
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- uni.hideLoading();
|
|
|
- console.log(err);
|
|
|
- })
|
|
|
+ .catch(err => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log(err);
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ params = {
|
|
|
+ address: this.formData.address,
|
|
|
+ applyDate: dayjs().format('YYYY-MM-DD'),
|
|
|
+ careDays: this.formData.dayCount,
|
|
|
+ careNeeds: this.formData.demand,
|
|
|
+ hospital: this.formData.hospital,
|
|
|
+ nurseGender: this.formData.sex,
|
|
|
+ personId: this.formData.personId,
|
|
|
+ personName: this.formData.name,
|
|
|
+ remark: this.formData.remark
|
|
|
+ }
|
|
|
+ applyUrl(params)
|
|
|
+ .then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `提交成功`,
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: '返回',
|
|
|
+ success: (e) => {
|
|
|
+ if (e.confirm) {
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log(err);
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
handleSubmit() {
|