2023-11-01 00:33:57 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
// 引入依赖
|
|
|
|
|
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
|
|
|
|
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
|
|
|
|
import { onLoad,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
|
|
|
|
|
// import mySwiper from "@/components/mySwiper.vue"
|
|
|
|
|
import {ref,onMounted,nextTick,watch} from "vue"
|
|
|
|
|
import api from '@/api/index.js'
|
|
|
|
|
import util from "@/utils/index.js"
|
|
|
|
|
import {useStore} from '@/store/index.js'
|
2023-11-05 18:19:14 +08:00
|
|
|
|
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
|
|
|
|
import ccNewsTabs from '@/uni_modules/cc-newsTabs/components/cc-newsTabs/cc-newsTabs.vue'
|
2023-11-01 00:33:57 +08:00
|
|
|
|
const store = useStore()
|
2023-12-29 10:51:00 +08:00
|
|
|
|
import emptyCard from "@/components/emptyCard.vue"
|
2023-11-01 00:33:57 +08:00
|
|
|
|
// 生命周期
|
|
|
|
|
onLoad((e) => {
|
2023-12-29 02:23:35 +08:00
|
|
|
|
if(uni.getStorageSync('userInfo')) {
|
|
|
|
|
user_info.value = JSON.parse(uni.getStorageSync('userInfo'))
|
|
|
|
|
}
|
2023-11-05 18:19:14 +08:00
|
|
|
|
c_index.value = parseInt(e.state_index)
|
|
|
|
|
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
|
|
|
|
|
if(store.systemInfo) {
|
|
|
|
|
swiper_h.value = store.systemInfo.windowHeight
|
|
|
|
|
}
|
2023-11-01 00:33:57 +08:00
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
onPullDownRefresh(()=> { // 下拉刷新
|
|
|
|
|
init()
|
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
onReachBottom(() => { // 上滑触底
|
2023-11-05 18:19:14 +08:00
|
|
|
|
list_box.value[c_index.value].queryParams.page++
|
2023-11-01 00:33:57 +08:00
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
// 变量
|
2023-12-29 02:23:35 +08:00
|
|
|
|
const user_info = ref(null)
|
2023-11-05 18:19:14 +08:00
|
|
|
|
const inputDialog = ref()
|
|
|
|
|
const state_index = ref(0)
|
|
|
|
|
const swiper_h = ref(0)
|
2023-11-01 00:33:57 +08:00
|
|
|
|
const list = ref([])
|
2023-11-05 18:19:14 +08:00
|
|
|
|
const list_box = ref([
|
|
|
|
|
{
|
|
|
|
|
show_index:0,
|
|
|
|
|
state:1,
|
|
|
|
|
list:[],
|
|
|
|
|
queryParams:{
|
|
|
|
|
page:1,
|
|
|
|
|
pageSize:10,
|
|
|
|
|
isFinish:1
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
show_index:1,
|
|
|
|
|
state:0,
|
|
|
|
|
list:[],
|
|
|
|
|
queryParams:{
|
|
|
|
|
page:1,
|
|
|
|
|
pageSize:10,
|
|
|
|
|
isFinish:1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
])
|
2023-11-01 00:33:57 +08:00
|
|
|
|
const queryParams = ref({
|
|
|
|
|
page:1,
|
|
|
|
|
pageSize:10,
|
|
|
|
|
isFinish:1
|
|
|
|
|
})
|
2023-11-05 18:19:14 +08:00
|
|
|
|
const c_index = ref(-1)
|
|
|
|
|
const tabArr = ref([
|
|
|
|
|
{
|
|
|
|
|
name: '已完成',
|
|
|
|
|
id: '1',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '待完成',
|
|
|
|
|
id: '2',
|
|
|
|
|
}
|
|
|
|
|
])
|
2023-11-01 00:33:57 +08:00
|
|
|
|
// 函数
|
2024-03-21 18:17:06 +08:00
|
|
|
|
function subscribeFunc() {
|
|
|
|
|
uni.requestSubscribeMessage({
|
|
|
|
|
tmplIds: ['PgxoZOOSDgBcmIGd_EVLDnYUmL3eu6NQTAZCsHQeuWY'],
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
},
|
|
|
|
|
fail(res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2023-11-01 00:33:57 +08:00
|
|
|
|
function init(){
|
2023-11-05 18:19:14 +08:00
|
|
|
|
// list.value = []
|
|
|
|
|
list_box.value[c_index.value].list = []
|
|
|
|
|
list_box.value[c_index.value].queryParams.page = 1
|
|
|
|
|
list_box.value[c_index.value].queryParams.pageSize = 10
|
|
|
|
|
}
|
|
|
|
|
function queryStateInitFunc() {
|
|
|
|
|
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
|
2023-11-01 00:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
async function getList() {
|
2023-11-05 18:19:14 +08:00
|
|
|
|
uni.showLoading({
|
|
|
|
|
mask:true
|
|
|
|
|
})
|
2023-12-29 10:51:00 +08:00
|
|
|
|
list_box.value[c_index.value].queryParams.userId = user_info.value?.userId || 0
|
2023-12-29 02:23:35 +08:00
|
|
|
|
const res = await api.getTodoist(list_box.value[c_index.value].queryParams,user_info.value?.userId || 0)
|
2023-11-05 18:19:14 +08:00
|
|
|
|
uni.hideLoading();
|
2023-11-01 00:33:57 +08:00
|
|
|
|
if(res.code === 0) {
|
|
|
|
|
if(res.data && res.data.length > 0) {
|
2023-12-29 02:23:35 +08:00
|
|
|
|
// list_box.value[c_index.value].list.push(...res.data)
|
|
|
|
|
list_box.value[c_index.value].list = res.data
|
2023-11-01 00:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
else{
|
2023-11-05 18:19:14 +08:00
|
|
|
|
list_box.value[c_index.value].queryParams.page--
|
2023-11-01 00:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uni.showToast({
|
2023-11-05 18:19:14 +08:00
|
|
|
|
title:res.msg,
|
2023-11-01 00:33:57 +08:00
|
|
|
|
icon:"error",
|
2023-11-05 18:19:14 +08:00
|
|
|
|
duration:2000,
|
|
|
|
|
mask:true,
|
|
|
|
|
success() {
|
|
|
|
|
if(res.code === 7) // 登录失败
|
|
|
|
|
{
|
|
|
|
|
store.afterFailLogin(2000)
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-01 00:33:57 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2023-11-05 18:19:14 +08:00
|
|
|
|
}
|
|
|
|
|
function tabChange(currentIndex) {
|
|
|
|
|
c_index.value = currentIndex
|
|
|
|
|
// if(list_box.value[c_index.value].list.length === 0) {
|
|
|
|
|
// queryStateInitFunc()
|
|
|
|
|
// getList()
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function scroll_func(e) {
|
|
|
|
|
c_index.value = e.detail.current
|
|
|
|
|
if(list_box.value[c_index.value].list.length === 0) {
|
|
|
|
|
queryStateInitFunc()
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const handle_info = ref(null)
|
|
|
|
|
const handle_info_index = ref(0)
|
|
|
|
|
function handle_func(item,i) {
|
|
|
|
|
handle_info.value = item
|
|
|
|
|
handle_info_index.value = i
|
|
|
|
|
inputDialog.value.open()
|
2024-03-21 18:17:06 +08:00
|
|
|
|
subscribeFunc()
|
2023-11-05 18:19:14 +08:00
|
|
|
|
}
|
|
|
|
|
function finishFunc() {
|
|
|
|
|
// api.todoFinished
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title:'温馨提示',
|
|
|
|
|
content:"确定要完成该事务吗?",
|
|
|
|
|
success:async function(res) {
|
|
|
|
|
if(res.confirm) {
|
|
|
|
|
const res_ = await api.todoFinished({
|
|
|
|
|
id:handle_info.value.ID,
|
|
|
|
|
isFinish:1
|
|
|
|
|
})
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title:res_.msg,
|
2024-03-21 16:07:51 +08:00
|
|
|
|
icon:"success",
|
2023-11-05 18:19:14 +08:00
|
|
|
|
duration:2000,
|
|
|
|
|
mask:true,
|
|
|
|
|
success() {
|
|
|
|
|
if(res_.code === 0) {
|
|
|
|
|
list_box.value[c_index.value].list.splice(handle_info_index.value,1)
|
|
|
|
|
list_box.value[0].list = []
|
|
|
|
|
inputDialog.value.close()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-11-01 00:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<view class="todoBox page-box">
|
2023-11-05 18:19:14 +08:00
|
|
|
|
<cc-newsTabs :tabArr="tabArr" :o_index="c_index" @tabChange="tabChange"></cc-newsTabs>
|
|
|
|
|
<swiper :current="c_index" @change="scroll_func" :style="{'--size':swiper_h+'px'}" class="swiper" circular :indicator-dots="false" :autoplay="false" >
|
|
|
|
|
<swiper-item v-for="(item1,i1) in list_box">
|
|
|
|
|
<view class="todoBox">
|
2023-12-29 10:51:00 +08:00
|
|
|
|
<view v-for="(item,i) in item1.list" v-if="item1.list.length>0" @tap="handle_func(item,i)" class="td-item swiper-item uni-bg-green">
|
2023-11-05 18:19:14 +08:00
|
|
|
|
<view class="td-content text-ellipsis-2">
|
|
|
|
|
{{item.content}}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="td-info small-text">
|
|
|
|
|
{{util.timestampToDate(item.CreatedAt)}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-12-29 10:51:00 +08:00
|
|
|
|
<emptyCard v-else></emptyCard>
|
2023-11-05 18:19:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
</swiper-item>
|
|
|
|
|
</swiper>
|
|
|
|
|
<uni-popup ref="inputDialog" >
|
|
|
|
|
<view class="pop-box">
|
|
|
|
|
<view class="pb-title">完善手术信息</view>
|
|
|
|
|
<view class="pb-content">
|
|
|
|
|
<view class="pb-item">
|
|
|
|
|
<view class="pb-item-left">事项说明</view>
|
|
|
|
|
<view class="pb-item-right">
|
|
|
|
|
{{handle_info?.content}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-03-21 16:07:51 +08:00
|
|
|
|
<view class="pb-item">
|
|
|
|
|
<view class="pb-item-left">待办状态</view>
|
|
|
|
|
<view class="pb-item-right">
|
|
|
|
|
{{handle_info?.remindPeriod?'手术前':'手术后'}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="pb-item">
|
|
|
|
|
<view class="pb-item-left">用药频率</view>
|
|
|
|
|
<view class="pb-item-right">
|
|
|
|
|
{{handle_info?.frequency}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="pb-item">
|
|
|
|
|
<view class="pb-item-left">提醒时间</view>
|
|
|
|
|
<view class="pb-item-right">
|
|
|
|
|
{{handle_info?.remindTime}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-05 18:19:14 +08:00
|
|
|
|
<view class="pb-item">
|
|
|
|
|
<view class="pb-item-left">创建时间</view>
|
|
|
|
|
<view class="pb-item-right">
|
|
|
|
|
{{util.timestampToDate(handle_info?.CreatedAt)}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-11-07 00:12:02 +08:00
|
|
|
|
<view v-if="!handle_info?.isFinish" class="pb-item pb-item-btn" @tap="finishFunc">完成该事务</view>
|
2023-11-05 18:19:14 +08:00
|
|
|
|
</view>
|
2023-11-01 00:33:57 +08:00
|
|
|
|
</view>
|
2023-11-05 18:19:14 +08:00
|
|
|
|
</uni-popup>
|
2023-11-01 00:33:57 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<style scoped lang="scss">
|
2023-11-05 18:19:14 +08:00
|
|
|
|
.swiper{
|
|
|
|
|
height: var(--size);
|
|
|
|
|
}
|
2023-11-01 00:33:57 +08:00
|
|
|
|
.todoBox{
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
.td-item{
|
|
|
|
|
padding: 20rpx 0;
|
|
|
|
|
border-bottom: 2rpx solid #eaeaea;
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
.td-content{
|
|
|
|
|
padding-bottom:20rpx;
|
|
|
|
|
}
|
|
|
|
|
.td-info{
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-05 18:19:14 +08:00
|
|
|
|
}
|
|
|
|
|
.pb-item-btn{
|
|
|
|
|
padding: 20rpx 0;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: white;
|
|
|
|
|
background: #26758d;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 66%;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
.pop-box{
|
|
|
|
|
.pb-title{
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-bottom: 40rpx;
|
2023-11-07 00:12:02 +08:00
|
|
|
|
padding-top: 20rpx;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
font-weight: 900;
|
2023-11-05 18:19:14 +08:00
|
|
|
|
}
|
|
|
|
|
background-color: white;
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
width: 80%;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
border-radius: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
.pb-item{
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 40rpx;
|
|
|
|
|
// justify-content: space-between;
|
|
|
|
|
.pb-item-left{
|
|
|
|
|
width: 30%;
|
|
|
|
|
color: gray;
|
|
|
|
|
}
|
|
|
|
|
.pb-item-right{
|
|
|
|
|
position: relative;
|
|
|
|
|
margin-left: 10rpx;
|
|
|
|
|
width: 75%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
:deep(){
|
|
|
|
|
.uni-popup__wrapper{
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2023-11-01 00:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
</style>
|