xinelu-applet-ui/pages/homepage/homepage.vue

474 lines
12 KiB
Vue
Raw Normal View History

2023-09-19 14:58:40 +08:00
<template>
2023-09-27 13:50:42 +08:00
<view class="app">
<view class="content">
2023-11-17 13:14:13 +08:00
<!-- <image src="/static/pageC/homepage.png" mode=""></image> -->
2023-12-28 16:00:04 +08:00
<image :src="baseurl+ '/profile/weChatPicture/mainPage.png'" mode=""></image>
2023-10-23 16:51:32 +08:00
<view class="loginmount" @tap="city">
<image src="../../static/pages/address.png" mode=""></image>
2023-11-13 11:31:54 +08:00
<text>
{{address?address:'请选择城市'}}
2023-10-23 16:51:32 +08:00
</text>
2023-09-27 13:50:42 +08:00
</view>
</view>
2024-03-13 09:15:38 +08:00
<view class="contentcenter" :style="Number(region)==2?'height:450rpx':'height:500rpx'">
2023-10-07 14:23:55 +08:00
<view class="home" @tap="goonline">
2023-11-17 13:14:13 +08:00
<image src="@/static/qianyue.png" mode=""></image>
2023-09-27 14:05:46 +08:00
<view class="name">
2023-09-27 13:50:42 +08:00
家医签约
</view>
</view>
2024-01-03 17:03:57 +08:00
<view class="home" @tap="goHealthrecords">
2023-12-19 14:41:16 +08:00
<image src="@/static/health.png" mode=""></image>
2023-09-27 14:05:46 +08:00
<view class="name">
2023-09-27 13:50:42 +08:00
健康档案
</view>
2024-01-03 17:03:57 +08:00
</view>
2024-03-13 09:15:38 +08:00
<view class="home" @tap="goappoint" v-if="Number(region)!=2">
2023-11-17 13:14:13 +08:00
<image src="@/static/serveappoint.png" mode=""></image>
2023-09-27 14:05:46 +08:00
<view class="name">
2023-09-27 13:50:42 +08:00
服务预约
</view>
</view>
2024-01-22 11:07:48 +08:00
<view class="home" @tap="count" v-if='region==2'>
2024-01-22 12:48:40 +08:00
<image src="@/static/dyexchange.png" mode=""></image>
2024-01-22 11:07:48 +08:00
<view class="name">
2024-02-02 17:17:47 +08:00
东营健康银行
2024-01-22 11:07:48 +08:00
</view>
</view>
<view class="home" @tap="count" v-if='region!=2'>
2023-11-17 13:14:13 +08:00
<image src="@/static/exchange.png" mode=""></image>
2023-09-27 14:05:46 +08:00
<view class="name">
2023-09-27 13:50:42 +08:00
积分兑换
</view>
</view>
2024-03-13 09:15:38 +08:00
<view class="home" @tap="myappointment" v-if="Number(region)!=2">
2023-11-17 13:14:13 +08:00
<image src="@/static/appointmen.png" mode=""></image>
2023-09-27 14:05:46 +08:00
<view class="name">
2023-09-27 13:50:42 +08:00
我的预约
</view>
</view>
2024-03-13 09:15:38 +08:00
<view class="home" @tap="servicerecord" v-if="Number(region)!=2">
2023-11-17 13:14:13 +08:00
<image src="@/static/SERVERECOD.png" mode=""></image>
2023-09-27 14:05:46 +08:00
<view class="name">
2023-09-27 13:50:42 +08:00
服务记录
</view>
</view>
2024-03-13 09:15:38 +08:00
<view class="home" @tap='gothreeHighsAndSixDiseases' v-if="Number(region)==2">
<image src="@/static/zhaohujilu.png" mode=""></image>
2023-11-10 13:57:44 +08:00
<view class="name">
2024-03-13 09:15:38 +08:00
三高六病
2023-12-19 14:41:16 +08:00
</view>
</view>
2024-03-13 09:15:38 +08:00
<view class="home" v-if="Number(region)==2">
2023-12-19 14:41:16 +08:00
<image src="@/static/zhaohujilu.png" mode=""></image>
<view class="name">
2024-03-13 09:15:38 +08:00
自主检测
2023-12-19 14:41:16 +08:00
</view>
</view>
2023-12-20 13:45:32 +08:00
<view class="home" v-if="Number(region)==2">
2023-11-10 13:57:44 +08:00
</view>
2023-09-27 13:50:42 +08:00
</view>
2024-03-13 09:15:38 +08:00
<view class="contentbottom" :style="Number(region)==2?'height:350rpx':''">
2023-09-27 13:50:42 +08:00
<view class="health">
健康管理
</view>
<view class="item">
2024-03-13 09:15:38 +08:00
<view class="signmyself" @tap="sign" v-if="Number(region)!=2">
2023-11-17 13:14:13 +08:00
<image src="@/static/tizheng.png" mode=""></image>
2023-09-27 13:50:42 +08:00
</view>
2024-03-13 09:15:38 +08:00
<view class="sign" :class="Number(region)==2?'notwo':''">
2023-11-17 13:14:13 +08:00
<image @tap="healthtest" src="@/static/healthmyself.png" mode=""></image>
<image @tap="gorecords" src="@/static/records.png" mode=""></image>
2023-09-27 13:50:42 +08:00
</view>
</view>
2023-09-19 14:58:40 +08:00
</view>
2023-10-10 15:28:21 +08:00
<u-toast ref="uToast" />
2023-09-19 14:58:40 +08:00
</view>
</template>
<script>
2023-09-28 16:55:50 +08:00
import {
getOpenId,
2023-10-12 10:40:40 +08:00
detail,
2024-01-31 14:45:23 +08:00
checkSignApply,
wxSportDecrypt,
wxsportadd
2023-09-28 16:55:50 +08:00
} from '@/api/pages/homepage/homepage.js'
2023-11-15 10:31:52 +08:00
import {
mapActions
} from "vuex";
2023-12-28 16:00:04 +08:00
import baseurl from '@/api/baseurl.js'
2023-09-19 14:58:40 +08:00
export default {
data() {
return {
2023-11-09 15:58:45 +08:00
userinfo: null,
2023-11-09 16:59:45 +08:00
infotitle: null,
2023-10-10 15:28:21 +08:00
region: '',
2023-10-12 10:40:40 +08:00
checkSign: null,
2023-10-23 13:59:25 +08:00
address: '',
2023-10-31 10:20:40 +08:00
openid: '',
2023-12-28 16:00:04 +08:00
baseurl: '',
2024-02-01 08:53:44 +08:00
sportlist: [],
2023-09-19 14:58:40 +08:00
}
},
2023-11-13 11:31:54 +08:00
onLoad() {},
2023-10-10 13:21:23 +08:00
onShow() {
2023-12-28 16:00:04 +08:00
this.baseurl = baseurl
2023-11-10 17:26:40 +08:00
this.userinfo = uni.getStorageSync('userinfo')
2023-10-23 13:59:25 +08:00
this.address = uni.getStorageSync('location')
2023-10-31 10:20:40 +08:00
this.openid = uni.getStorageSync('openid');
2024-01-23 11:49:47 +08:00
this.region = Number(uni.getStorageSync('region'))
2023-11-09 16:59:45 +08:00
if (this.userinfo && this.region != 3) {
2024-01-31 14:45:23 +08:00
this.checkSignApplyinfo();
}
if (uni.getStorageSync('userinfo')) {
this.wxSportDecryptinfo();
2024-01-31 14:45:23 +08:00
}
},
methods: {
wxSportDecryptinfo() {
let that = this
let currentDate = new Date();
let year = currentDate.getFullYear();
let month = currentDate.getMonth() + 1;
let day = currentDate.getDate();
month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : "";
let time = `${year}-${month}-${day}`
2024-02-01 08:53:44 +08:00
let identtime = `${this.userinfo.cardNo}${year}-${month}-${day}`
if (uni.getStorageSync('sportlist')) {
if (uni.getStorageSync('sportlist')[0].date != time) {
uni.removeStorageSync('sportlist');
} else {
this.sportlist = uni.getStorageSync('sportlist');
}
}
if (!this.sportlist.some(e => e.text == identtime)) {
2024-01-31 14:45:23 +08:00
wx.getSetting({
success: function(res) {
// 开启微信运动授权
if (res.authSetting['scope.werun']) {
// 在小程序中获取微信步数
wx.login({
success: function(res) {
if (res.code) {
wx.getWeRunData({
success: function(resp) {
that.wxSport(res, resp)
}
});
}
}
});
}
}
})
}
},
wxSport(res, resp) {
let obj = {
code: res.code,
encryptedData: resp.encryptedData,
iv: resp.iv
}
wxSportDecrypt(obj).then(Sportres => {
2024-02-20 10:38:50 +08:00
if (Sportres.data && Sportres.data[0].step >= 5000) {
2024-01-31 14:45:23 +08:00
wxsportadd(this.userinfo.cardNo).then(sportaddres => {
if (sportaddres.code == 200) {
2024-02-01 08:53:44 +08:00
let sportitem = {
text: `${this.userinfo.cardNo}${Sportres.data[0].date}`,
date: Sportres.data[0].date
}
this.sportlist.unshift(sportitem)
uni.setStorageSync('sportlist', this.sportlist);
2024-01-31 14:45:23 +08:00
}
})
}
})
},
checkSignApplyinfo() {
2023-10-16 11:54:32 +08:00
checkSignApply(this.userinfo.cardNo).then(res => {
2023-11-09 15:58:45 +08:00
if (res.data) {
this.checkSign = res.data.code
2023-11-09 16:59:45 +08:00
this.infotitle = res.data.info
2023-10-12 10:40:40 +08:00
}
2023-10-10 15:28:21 +08:00
})
2024-01-31 14:45:23 +08:00
},
2023-11-15 10:31:52 +08:00
...mapActions(["openPopup"]),
2023-11-13 11:31:54 +08:00
//跳转选择地址
2023-10-23 13:59:25 +08:00
city() {
uni.navigateTo({
2024-01-03 17:15:09 +08:00
url: '/pagesB/location/location'
2023-10-23 13:59:25 +08:00
})
},
2023-10-10 13:21:23 +08:00
// 登录
2023-10-10 15:28:21 +08:00
login() {
2023-10-12 10:40:40 +08:00
uni.navigateTo({
2024-02-03 11:23:04 +08:00
url: "/pagesB/login/login"
2023-10-12 10:40:40 +08:00
})
2023-10-10 13:21:23 +08:00
},
gologin() {
2023-10-12 10:46:44 +08:00
this.$refs.uToast.show({
title: '您未登录,请先登录',
type: 'error',
duration: '1000',
2024-02-03 11:23:04 +08:00
url: '/pagesB/login/login'
2023-10-12 10:46:44 +08:00
})
2023-10-07 14:23:55 +08:00
},
2023-10-31 10:20:40 +08:00
// 家医功能提示
family() {
this.$refs.uToast.show({
2024-01-22 16:25:28 +08:00
title: '当前绑定地市不支持,请点击左上角选择城市',
2023-10-31 10:20:40 +08:00
type: 'error',
2024-01-22 14:19:49 +08:00
duration: '1500',
2023-10-31 10:20:40 +08:00
})
},
2023-10-12 10:46:44 +08:00
// 家医签约
goonline() {
2023-11-15 10:31:52 +08:00
this.openPopup();
setTimeout(e => {
if (!this.userinfo) {
this.gologin();
} else if (this.userinfo) {
if (this.region == 3) {
this.family()
} else {
if (this.region == 1 || this.region == 2) {
if (this.checkSign == "0") {
uni.navigateTo({
2024-01-24 10:03:11 +08:00
url: `/pagesC/Onlinesigning/Onlinesigning?checkSign=${this.checkSign}`,
2023-11-15 10:31:52 +08:00
})
// this.$refs.uToast.show({
// title: '未签约,请先签约',
// type: 'error',
// duration:'1500',
// url: "/pagesC/Onlinesigning/Onlinesigning"
// })
2023-11-15 10:31:52 +08:00
} else if (this.checkSign == "01") {
this.$refs.uToast.show({
title: this.infotitle,
2024-01-23 11:49:47 +08:00
duration: '1500',
2023-11-15 10:31:52 +08:00
type: 'error',
})
} else {
uni.navigateTo({
url: "/pagesB/mysigning/mysigning"
})
}
2023-11-09 15:58:45 +08:00
} else {
2023-11-15 10:31:52 +08:00
this.family()
2023-10-31 10:20:40 +08:00
}
}
2023-10-16 09:19:16 +08:00
}
2023-11-15 10:31:52 +08:00
}, 50)
2023-10-10 13:21:23 +08:00
},
// 积分兑换
2023-10-10 15:28:21 +08:00
count() {
2023-10-16 11:54:32 +08:00
if (!this.userinfo) {
this.gologin();
} else {
2023-11-09 16:59:45 +08:00
if (this.region == 3) {
2023-10-31 10:20:40 +08:00
this.family()
2023-11-01 14:30:45 +08:00
} else {
2023-11-10 13:57:44 +08:00
if (this.region == 1 || this.region == 2) {
2023-11-09 15:58:45 +08:00
if (this.checkSign == "0") {
uni.navigateTo({
2024-01-24 10:03:11 +08:00
url: `/pagesC/Onlinesigning/Onlinesigning?checkSign=${this.checkSign}`,
2023-10-31 10:20:40 +08:00
})
// this.$refs.uToast.show({
// title: '未签约,请先签约',
// type: 'error',
// duration:'1500',
// url: "/pagesC/Onlinesigning/Onlinesigning"
// })
2023-11-09 15:58:45 +08:00
} else if (this.checkSign == "01") {
2023-11-08 17:13:05 +08:00
this.$refs.uToast.show({
2023-11-09 16:59:45 +08:00
title: this.infotitle,
2023-11-08 17:13:05 +08:00
type: 'error',
2024-01-23 11:49:47 +08:00
duration: '1500',
2023-11-08 17:13:05 +08:00
})
2023-11-10 17:26:40 +08:00
} else {
2023-10-31 10:20:40 +08:00
uni.navigateTo({
url: '/pagesB/Behaviorpoints/Behaviorpoints'
})
}
} else {
this.family()
}
2023-10-16 11:54:32 +08:00
}
}
2023-10-10 13:21:23 +08:00
},
// 健康档案
goHealthrecords() {
2023-10-12 10:46:44 +08:00
if (!this.userinfo) {
this.gologin();
} else {
2024-01-04 17:11:25 +08:00
if (this.region == 3) {
this.family()
} else {
uni.navigateTo({
url: "/pagesC/Healthrecords/Healthrecords"
})
}
2023-10-12 10:46:44 +08:00
}
2023-10-10 13:21:23 +08:00
},
// 筛查记录
2023-09-28 10:11:05 +08:00
gorecords() {
2023-10-17 16:20:03 +08:00
uni.navigateTo({
url: "/pagesC/Screeningrecords/Screeningrecords"
})
// if (!this.userinfo) {
// this.gologin();
// } else {
// uni.navigateTo({
// url: "/pagesC/Screeningrecords/Screeningrecords"
// })
// }
2023-09-28 10:11:05 +08:00
},
2023-10-07 15:14:34 +08:00
// 健康自评
healthtest() {
2023-10-12 10:46:44 +08:00
if (!this.userinfo) {
this.gologin();
} else {
uni.navigateTo({
url: "/pagesC/healthtest/healthtest"
})
}
2023-10-07 15:14:34 +08:00
},
2023-10-08 13:19:49 +08:00
// 体征检测
2023-10-08 17:03:35 +08:00
sign() {
2024-03-13 09:15:38 +08:00
if (!this.userinfo) {
this.gologin();
} else {
uni.navigateTo({
url: "/pagesC/Physicalexamination/Physicalexamination"
})
}
2023-09-27 16:26:09 +08:00
},
2023-10-12 10:40:40 +08:00
// 服务预约
goappoint() {
2023-11-15 10:31:52 +08:00
this.openPopup();
setTimeout(e => {
if (!this.userinfo) {
this.gologin();
2023-11-10 13:57:44 +08:00
} else {
2023-11-15 10:31:52 +08:00
if (this.region == 3) {
this.family()
} else {
if (this.region == 1 || this.region == 2) {
if (this.checkSign == "0") {
uni.navigateTo({
2024-01-24 10:03:11 +08:00
url: `/pagesC/Onlinesigning/Onlinesigning?checkSign=${this.checkSign}`,
2023-11-15 10:31:52 +08:00
})
// this.$refs.uToast.show({
// title: '未签约,请先签约',
// type: 'error',
// duration:'1500',
// url: "/pagesC/Onlinesigning/Onlinesigning"
// })
2023-11-15 10:31:52 +08:00
} else if (this.checkSign == "01") {
this.$refs.uToast.show({
title: this.infotitle,
2024-01-23 11:49:47 +08:00
duration: '1500',
2023-11-15 10:31:52 +08:00
type: 'error',
})
} else {
uni.navigateTo({
url: "/pagesC/ServiceAppointment/ServiceAppointment"
})
}
2023-11-10 17:26:40 +08:00
} else {
2023-11-15 10:31:52 +08:00
this.family()
2023-11-10 17:26:40 +08:00
}
}
2023-11-10 13:57:44 +08:00
}
2023-11-15 10:31:52 +08:00
}, 50)
2023-10-07 11:08:50 +08:00
},
2023-10-12 10:40:40 +08:00
// 服务记录
servicerecord() {
2023-10-12 10:46:44 +08:00
if (!this.userinfo) {
this.gologin();
} else {
2023-11-09 16:59:45 +08:00
if (this.region == 3) {
2023-10-31 10:20:40 +08:00
this.family()
2023-11-01 14:30:45 +08:00
} else {
2023-11-10 13:57:44 +08:00
if (this.region == 1 || this.region == 2) {
2023-11-09 15:58:45 +08:00
if (this.checkSign == "0") {
uni.navigateTo({
2024-01-24 10:03:11 +08:00
url: `/pagesC/Onlinesigning/Onlinesigning?checkSign=${this.checkSign}`,
2023-11-08 17:13:05 +08:00
})
// this.$refs.uToast.show({
// title: '未签约,请先签约',
// duration:'1500',
// type: 'error',
// url: "/pagesC/Onlinesigning/Onlinesigning"
// })
2023-11-09 15:58:45 +08:00
} else if (this.checkSign == "01") {
2023-11-08 17:13:05 +08:00
this.$refs.uToast.show({
2023-11-09 16:59:45 +08:00
title: this.infotitle,
2023-11-08 17:13:05 +08:00
type: 'error',
2024-01-23 11:49:47 +08:00
duration: '1500',
2023-11-08 17:13:05 +08:00
})
2023-11-09 15:58:45 +08:00
} else {
2023-11-08 17:13:05 +08:00
uni.navigateTo({
url: "/pagesC/servicerecord/servicerecord"
})
}
2023-10-31 10:20:40 +08:00
} else {
this.family()
}
}
2023-10-12 10:46:44 +08:00
}
2023-10-12 10:40:40 +08:00
},
2023-10-07 11:08:50 +08:00
// 我的预约
2023-10-08 17:03:35 +08:00
myappointment() {
2023-10-12 10:46:44 +08:00
if (!this.userinfo) {
this.gologin();
2023-10-10 15:28:21 +08:00
} else {
2023-11-09 16:59:45 +08:00
if (this.region == 3) {
2023-10-31 10:20:40 +08:00
this.family()
2023-11-01 14:30:45 +08:00
} else {
2023-11-10 13:57:44 +08:00
if (this.region == 1 || this.region == 2) {
2023-11-09 15:58:45 +08:00
if (this.checkSign == "0") {
uni.navigateTo({
2024-01-24 10:03:11 +08:00
url: `/pagesC/Onlinesigning/Onlinesigning?checkSign=${this.checkSign}`,
2023-10-31 10:20:40 +08:00
})
// this.$refs.uToast.show({
// title: '未签约,请先签约',
// type: 'error',
// duration:'1500',
// url: "/pagesC/Onlinesigning/Onlinesigning"
// })
2023-11-09 15:58:45 +08:00
} else if (this.checkSign == "01") {
2023-11-08 17:13:05 +08:00
this.$refs.uToast.show({
2023-11-09 16:59:45 +08:00
title: this.infotitle,
2023-11-08 17:13:05 +08:00
type: 'error',
2024-01-23 11:49:47 +08:00
duration: '1500',
2023-11-08 17:13:05 +08:00
})
2023-11-09 15:58:45 +08:00
} else {
2023-10-31 10:20:40 +08:00
uni.navigateTo({
url: "/pagesC/Myappointment/Myappointment"
})
}
} else {
this.family()
}
2023-10-12 10:46:44 +08:00
}
2023-10-10 13:21:23 +08:00
}
2023-10-07 11:08:50 +08:00
},
2024-03-13 09:15:38 +08:00
gothreeHighsAndSixDiseases() {
if (!this.userinfo) {
this.gologin();
} else {
uni.navigateTo({
url: "/pagesB/threeHighsAndSixDiseases/threeHighsAndSixDiseases"
})
}
},
2023-09-19 14:58:40 +08:00
}
}
</script>
2023-09-27 13:50:42 +08:00
<style lang="scss">
@import "./homepage.scss";
2024-02-03 10:21:02 +08:00
</style>