From 865132c2be3ca5ec791fecd29176d24404fa3932 Mon Sep 17 00:00:00 2001 From: "271556543@qq.com" <271556543@qq.com> Date: Fri, 30 Sep 2022 14:33:14 +0800 Subject: [PATCH] 2022-9-30 --- common/config.js | 2 +- pages/detailNursing/detailNursing.vue | 240 ++++++++++++++++---------- pages/home/home.vue | 8 +- pages/list/list.vue | 29 +++- pages/map/map.vue | 8 +- pages/todayNursing/todayNursing.vue | 109 ++++++------ 6 files changed, 240 insertions(+), 156 deletions(-) diff --git a/common/config.js b/common/config.js index e40357d..2207b79 100644 --- a/common/config.js +++ b/common/config.js @@ -1,4 +1,4 @@ -const mode = 'development'; +const mode = process.env.NODE_ENV; let ROOTPATH = ''; //域名 switch (mode) { case 'development': diff --git a/pages/detailNursing/detailNursing.vue b/pages/detailNursing/detailNursing.vue index 901eedd..fa2790a 100644 --- a/pages/detailNursing/detailNursing.vue +++ b/pages/detailNursing/detailNursing.vue @@ -7,7 +7,8 @@ - + {{detail.customer.name}} @@ -57,7 +58,7 @@ - + 今日护理 @@ -65,12 +66,12 @@ - - - {{item.sku_info.name}} + + + {{item.name}} - @@ -82,22 +83,27 @@ - + 过程打卡 - (3) + ({{detail.logs_count + 1}}) - + 签到 {{$u.timeFormat(time,'hh:MM:ss')}} - + 签退 {{$u.timeFormat(time,'hh:MM:ss')}} - + 更新定位 {{$u.timeFormat(time,'hh:MM:ss')}} + + 护理已完成 + @@ -117,7 +123,8 @@ export default { data() { return { - type: '', + id: '', + flag: false, //未开始护理时,是否更新过定位(真为更新过定位) qqmapsdk: null, inputStyle: { fontSize: "24rpx", @@ -145,10 +152,11 @@ type: '', upload_list: [], }, - subForm: { - id: '', - sku_time_list: [] - }, + skuList: [], + // subForm: { + // id: '', + // sku_time_list: [] + // }, detail: {}, time: new Date(), @@ -166,13 +174,16 @@ id }) this.detail = res - this.subForm.schedule_list_id = res.sku.map(item => { + this.skuList = res.sku.map(item => { return { - isSelect: false, - sku_id: item.id, - time: '' + id: item.id, + name: item.sku_info?.name, + isSelect: item.time ? true : false, + sku_id: item.sku_id, + time: item.time || '' } }) + this.form.schedule_list_id = this.id }, //获取当前定位信息 @@ -183,6 +194,8 @@ this.location.lat = res[1]?.latitude this.location.lng = res[1]?.longitude this.location.time = this.time + this.form.lat = this.location.lat + this.form.lng = this.location.lng this.qqmapsdk.reverseGeocoder({ location: { @@ -191,6 +204,7 @@ }, success: (res) => { this.location.address = res.result.address + this.form.address = this.location.address resolve(res) }, fail: (err) => { @@ -253,87 +267,128 @@ }, - //签到 - sign() { + //打卡 + clock(type) { + let title; + switch (type) { + case 1: + title = '签到成功' + break; + case 2: + title = `第${this.detail.logs_count+1}次打卡成功` + break; + case 3: + title = '签退成功' + break; + default: + title = '操作成功' + } this.uploadImgs().then(res => { this.form.upload_list = res.map(item => { return { upload_id: JSON.parse(item.data).id } }) - + this.form.type = type console.log(this.form); + this.$u.api.processSave(this.form).then(res => { + uni.showToast({ + icon: 'success', + title + }) + this.getDeatil(this.id) + }).catch(err => { + uni.showToast({ + title: '操作失败,请重试' + }) + }) }) }, - // save(type) { - // this.$u.api.nurseSave({ - // id: this.detail.id, - // sku_time_list: this.form.filter(item => { - // return item.isSelect - // }), - // logs: [{ - // lat: this.location.lat, - // lng: this.location.lng, - // address: this.location.address, - // type - // }] - // }).then(res => { - // if (type === 1) { - // uni.showToast({ - // icon: 'success', - // title: '打卡成功' - // }) - // } - // if (type === 2) { - // uni.showToast({ - // icon: 'success', - // title: '更新定位成功' - // }) - // } - // }) - // }, - // punch() { - // this.$u.throttle(() => { - // this.type = 1 - // this.isClick = true - // this.save(1) - // setTimeout(() => { - // this.isClick = false - // }, 10000) - // }, 10000) - - // }, - //更新定位 - // locate() { - // this.$u.throttle(() => { - // this.type = 2 - // this.isClick = true - // setTimeout(() => { - // this.isClick = false - // }, 10000) - // uni.getLocation().then(res => { - // this.location.lat = res[1]?.latitude - // this.location.lng = res[1]?.longitude - // this.location.time = this.time - - // new Promise((reject, resolve) => { - // this.qqmapsdk.reverseGeocoder({ - // location: { - // latitude: this.location.lat, - // longitude: this.location.lng - // }, - // success: (r) => { - // reject(r) - // } - // }) - // }).then(res => { - // this.location.address = res.result.address - - // this.save(2) - // }) - // }) - // }, 10000) - // }, + + //保存服务项目 + saveSku() { + return new Promise((resolve, reject) => { + let list = this.skuList.filter(item => { + return item.isSelect + }) + + this.$u.api.nurseSave({ + id: this.id, + sku_time_list: list + }).then(res => { + resolve(res) + }).catch(err => { + reject(err) + }) + }) + }, + + //签到 + sign() { + this.clock(1) + }, + + //过程打卡 + clockIn() { + //验证是否有选择服务项目并填写 + let flag = false + for (let i of this.skuList) { + if (i.isSelect && i.time) { + flag = true + } + } + if (!flag) { + uni.showToast({ + icon: 'none', + title: `请选择并填写服务项目与时间` + }) + return + } + this.saveSku().then(res => { + this.clock(2) + }).catch(err => { + console.log(err); + uni.showToast({ + icon: 'none', + title: '请重试' + }) + }) + }, + + //签退 + signOut() { + if (this.detail.logs_count < 3) { + uni.showToast({ + icon: 'none', + title: `请先完成3次打卡,再签退。当前完成打卡次数${this.detail.logs_count}` + }) + return + } + //验证是否有选择服务项目并填写 + let flag = false + for (let i of this.skuList) { + if (i.isSelect && i.time) { + flag = true + } + } + if (!flag) { + uni.showToast({ + icon: 'none', + title: `请选择并填写服务项目与时间` + }) + return + } + + this.saveSku().then(() => { + this.clock(3) + }).catch(err => { + console.log(err); + uni.showToast({ + icon: 'none', + title: '请重试' + }) + }) + } }, computed: { ageComputed() { @@ -353,6 +408,7 @@ this.load() this.getDeatil(option.id) + this.id = option.id this.getLoaction() diff --git a/pages/home/home.vue b/pages/home/home.vue index 3ed0fb2..5e47f95 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -55,12 +55,12 @@ 数据展示 - + @@ -120,12 +120,12 @@ 信息提醒 - + diff --git a/pages/list/list.vue b/pages/list/list.vue index bc2f948..c5b1838 100644 --- a/pages/list/list.vue +++ b/pages/list/list.vue @@ -6,7 +6,8 @@ - + @@ -15,7 +16,7 @@ - + @@ -35,9 +36,9 @@ {{item.start_time}} + :class="{icon1:item.status === 0,icon2:item.status === 2,icon3:item.status === 1}"> - 进行中 + 进行中 待护理 已完成 @@ -164,6 +165,7 @@ lng: '', start_time: '', end_time: '', + keyword: '', }, } }, @@ -181,11 +183,17 @@ this.select.page = 1 this.select.start_time = e.startDate this.select.end_time = `${e.endDate} 23:59:59` - this.$refs['dropdown'].close() this.nursingList = [] this.getList() }, + searchInput(e) { + this.select.keyword = e + + this.nursingList = [] + this.select.page = 1 + this.$u.debounce(this.getList, 1000) + }, async getList() { this.$u.throttle(async () => { let res = await this.$u.api.nurseList(this.select) @@ -230,7 +238,14 @@ } } }, - onShow() { + watch: { + isShowCalendar(val) { + if (!val) { + this.$refs.uDropdown.close() + } + }, + }, + mounted() { uni.getLocation().then(res => { this.select.lat = res[1]?.latitude this.select.lng = res[1]?.longitude @@ -261,7 +276,7 @@ justify-content: space-between !important; } - /deep/.u-flex { + /deep/.u-dropdown__menu__item .u-flex { flex: 1; } diff --git a/pages/map/map.vue b/pages/map/map.vue index 750a25d..5d24c79 100644 --- a/pages/map/map.vue +++ b/pages/map/map.vue @@ -35,7 +35,7 @@ - {{selectMarker.info.customer.address}} + {{selectMarker.info.customer_address.address}} @@ -155,8 +155,8 @@ this.covers = res.data.map((item, index) => { return { id: index, - latitude: Number(item.customer.lat), - longitude: Number(item.customer.lng), + latitude: Number(item.customer_address.lat), + longitude: Number(item.customer_address.lng), width: 14, height: 18, iconPath: this.iconMap.get(item.status), @@ -188,7 +188,7 @@ uni.openLocation({ latitude: this.selectMarker.latitude, longitude: this.selectMarker.longitude, - name: this.selectMarker.info.customer.address + name: this.selectMarker.info.customer_address.address }) }) } diff --git a/pages/todayNursing/todayNursing.vue b/pages/todayNursing/todayNursing.vue index 0d4428a..d23dc8b 100644 --- a/pages/todayNursing/todayNursing.vue +++ b/pages/todayNursing/todayNursing.vue @@ -11,70 +11,79 @@ - - - - {{item.start_time}} - - + + + + + + {{item.start_time}} + + + + 进行中 + 待护理 + 已完成 - 进行中 - 待护理 - 已完成 - - + - - - - - @@ -84,6 +93,7 @@ export default { data() { return { + refreshStatus: false, select: { page: 1, page_size: 999, @@ -114,11 +124,14 @@ }, async getToday() { + this.refreshStatus = true let res = await this.$u.api.nurseList(this.select) console.log(res); this.nursingList = res.data + this.refreshStatus = false }, + toThere(item) { this.$u.throttle(() => { uni.openLocation({