Files
xk-doctor-wx/pages/pharmacist/pharmacist-my.vue

234 lines
5.4 KiB
Vue
Raw Normal View History

2024-09-19 12:57:55 +08:00
<template>
<!-- 药师我的主页审方 Tab 壳下的个人中心对齐 my-pharmacist 能力 -->
2024-09-19 12:57:55 +08:00
<view class="safe-area-inset-bottom">
<u-navbar title="我的" :is-back="false" title-size="34" title-color="#fff" :background="{
background:'linear-gradient(90deg, #00BFA6 0%, #6ACDBB 93%)'}">
</u-navbar>
<view class="head">
<view class="info">
<image :src="list.avatar || '/static/image/nv.png'" mode=""></image>
<view class="name">
<text>{{list.name}}</text>
<text>药师</text>
</view>
</view>
<view class="store">
职业机构
</view>
<view class="store">
{{(list.store && list.store.name) || ' '}}
2024-09-19 12:57:55 +08:00
</view>
</view>
<!-- 菜单卡绑定微信 / 个人资料 / 设置 / 切换账号对齐医生与 my-pharmacist -->
2024-09-19 12:57:55 +08:00
<view class="card">
<view class="wx-bind-wrap">
<wx-bind-entry ref="wxBindEntry" />
</view>
2024-09-19 12:57:55 +08:00
<view class="setup" @click="toInfo">
个人资料
<u-icon name="arrow-right" color="#A7ABB0"></u-icon>
</view>
<view class="setup" @click="toSetup">
设置
<u-icon name="arrow-right" color="#A7ABB0"></u-icon>
</view>
<view class="account-switch-wrap">
<account-switch-entry />
</view>
2024-09-19 12:57:55 +08:00
</view>
<!-- 独立绿色退出按钮设置页已上提必须挂在本页否则药师无退出入口 -->
<view class="logout-wrap">
<u-button :throttle-time="0" shape="circle"
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff', height: '96rpx' }"
@click="logout">退出登录</u-button>
</view>
2024-09-19 12:57:55 +08:00
<u-tabbar v-model="current" :list="listed" active-color="#6ACDBB" @change="changed"></u-tabbar>
<d-loading-page :loading="loading"></d-loading-page>
</view>
</template>
<script>
/**
* 药师端我的审方 Tab 实际入口
* 补齐绑定微信 / 切换账号 / 退出登录 pages/my/my-pharmacist.vue 能力对齐
*/
import { my, logout } from '@/api/all.js'
import WxBindEntry from '@/components/wx-bind-entry/wx-bind-entry.vue'
import AccountSwitchEntry from '@/components/account-switch/account-switch-entry.vue'
2024-09-19 12:57:55 +08:00
export default {
components: { WxBindEntry, AccountSwitchEntry },
2024-09-19 12:57:55 +08:00
data() {
return {
keyword: "",
show: false,
identity: uni.getStorageSync("identity") || 2,
index: 0,
navbarHeight: this.$navbarHeight,
statusBarHeight: this.$statusBarHeight,
loading: true,
userInfo: uni.getStorageSync("userInfo") || {},
list: {},
2024-09-19 12:57:55 +08:00
waitList: [],
is_req: false,
current: 1,
listed: '',
};
},
onShow() {
// 从设置/资料返回或切换账号后,刷新微信绑定展示状态
this.refreshWxBind()
2024-09-19 12:57:55 +08:00
},
onLoad() {
this.listed = [{
iconPath: require("../../static/image/w-sf.png"),
selectedIconPath: require("../../static/image/sf.png"),
text: '审方',
current: 0
},
{
iconPath: require("../../static/image/w-wd.png"),
selectedIconPath: require("../../static/image/wd.png"),
text: '我的',
current: 1
}
]
},
methods: {
changed(index) {
this.current = index;
if (this.current == 0) {
uni.switchTab({
url: '/pages/pharmacist/index',
})
}
},
/** 拉取药师资料(头像、姓名、执业机构) */
2024-09-19 12:57:55 +08:00
async getList() {
let res = {};
res = await my({
store_id: uni.getStorageSync('store_id') || '11001',
})
this.list = {};
2024-09-19 12:57:55 +08:00
if (res.errcode == 0) {
this.list = res.data;
this.$nextTick(() => {
this.loading = false;
});
} else {
this.$toast(res.msg);
this.loading = false;
}
},
/** 刷新绑定微信入口状态(组件内部按手机号/账号判断) */
refreshWxBind() {
if (this.$refs.wxBindEntry) {
this.$refs.wxBindEntry.refresh()
}
},
/** 退出登录:清本地会话并回登录页 */
logout() {
logout({ store_id: uni.getStorageSync('store_id') || 11001 }).then((res) => {
if (res.errcode != -1) {
uni.clearStorage()
uni.clearStorageSync()
this.$go('/pages/login/index', 2)
} else {
this.$toast(res.msg);
}
})
},
2024-09-19 12:57:55 +08:00
toInfo() {
this.$go('../../subPackages/sub_pharmacist/pharmacist_info')
},
toSetup() {
this.$go('../../subPackages/sub_pharmacist/pharmacist_setInfo')
}
},
mounted() {
this.getList()
this.refreshWxBind()
2024-09-19 12:57:55 +08:00
}
};
</script>
<style>
page {
background-color: #f9fafb;
}
</style>
<style lang="scss" scoped>
.head {
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #232323;
width: 710rpx;
height: 304rpx;
background: #FFFFFF;
margin: 0 auto;
padding: 18rpx 20rpx;
.info {
display: flex;
align-items: center;
margin-bottom: 40rpx;
image {
border-radius: 50%;
width: 116rpx;
height: 116rpx;
}
.name {
display: flex;
flex-direction: column;
text {
margin: 10rpx 20rpx;
}
}
}
.store {
height: 50rpx;
line-height: 50rpx;
}
}
.card {
width: 710rpx;
background: #FFFFFF;
margin: 30rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #232323;
.setup {
height: 88rpx;
line-height: 88rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30rpx;
border-bottom: 1rpx solid #f0f0f0;
2024-09-19 12:57:55 +08:00
}
}
.wx-bind-wrap {
border-bottom: 1rpx solid #f0f0f0;
padding: 0 30rpx;
}
.account-switch-wrap {
padding: 8rpx 30rpx 16rpx;
}
.logout-wrap {
width: 710rpx;
margin: 0 auto 32rpx;
}
2024-09-19 12:57:55 +08:00
</style>