mine.vue
11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<template>
<view class="mine">
<NavBar :isShowQrCode="true" :isShowBgColor="navbarColor" :isShowLeft="true" :isShowRight="true" :isplaceholder="false" :examineState="IndexData?.examineState" :showDot="[0, '0', null, undefined].includes(messageNumber) ? false : true" />
<view class="mine-topBg"></view>
<image src="/static/images/mineTopIcon.png" class="mine-topicon" mode="aspectFill" />
<view class="mine-infobox flexA" @click="token ? proxy.$h.jumpUrl(`/pages2/mineinfo/info`) : proxy.$h.relaunchUrl('/pages/login/login')">
<view v-if="![null, '', undefined].includes(UserInfo?.avatar)">
<image :src="proxy.$h.downFile(UserInfo?.avatar)" class="mine-avatar" mode="aspectFill" @click.stop="proxy.$h.previewImage(proxy.$h.downFile(UserInfo.avatar))" />
</view>
<view v-else>
<image src="/static/images/mAvatar.png" class="mine-avatar" mode="aspectFill" @click.stop="proxy.$h.previewImage('/static/images/mAvatar.png')" />
</view>
<view>
<view class="flexA" style="margin-bottom: 10rpx; flex-wrap: wrap">
<view class="mine-username">{{ UserInfo?.nickname ?? '去登录' }}</view>
<view class="mine-toptag flexC" v-if="![null, undefined, ''].includes(UserInfo?.hospitalName)">{{ UserInfo?.hospitalName ?? '去登录' }}</view>
</view>
<view class="flexA" style="margin-bottom: 10rpx">
<view class="flexA" style="font-size: 24rpx; color: #666">
{{ UserInfo?.introduction || '修改简历、特长等资料' }}
<image src="/static/images/edit.png" mode="scaleToFill" style="width: 30rpx; height: 30rpx" />
</view>
</view>
<view class="flexW">
<view class="mine-userTag flexC" v-for="_ in UserInfo?.department">{{ _.name || '空的' }}</view>
</view>
</view>
</view>
<view class="mine-bottombg">
<view class="flexA" style="margin-bottom: 38rpx">
<view class="flexA" style="margin-right: 68rpx">
<u-icon name="thumb-up" color="#484848" size="22"></u-icon>
<view class="graytext mine-centertext">用户评价</view>
<!-- <view class="mine-righttext">{{ UserInfo?.star || 0 }}{{ ![0, '0', '', null, undefined].includes(UserInfo?.star) ? '.0' : '' }}</view> -->
<view class="mine-righttext">{{ UserInfo?.star || 0 }}</view>
</view>
<view class="flexA">
<u-icon name="clock" color="#484848" size="18"></u-icon>
<view class="graytext mine-centertext">平均响应</view>
<view class="mine-righttext">{{ UserInfo?.averageResponseTime || 0 }}分钟</view>
</view>
</view>
<view class="mine-income">
<image class="bg" src="/static/images/incomeBg.png" mode="aspectFill" />
<view class="flexJ Zindex">
<view>
<view class="flexA" style="margin-bottom: 22rpx">
<view class="mine-ictitle">我的收入</view>
<image :src="isShowMoney ? '/static/images/show.png' : '/static/images/hidden.png'" mode="scaleToFill" style="width: 44rpx; height: 44rpx" @click="isShowMoney = !isShowMoney" />
</view>
<u-count-to v-if="isShowMoney" :endVal="UserInfo?.income || 0" separator="," duration="1000" color="#fff" fontSize="22" decimals="2" bold></u-count-to>
<view v-else class="mine-hiddenMoney">*****</view>
</view>
<view class="bluetext mine-toincome flexC" @click="proxy.$h.jumpUrl(`/pages2/money/withdrawDeposit`)">去提现</view>
</view>
</view>
<view class="mine-toorder flexA">
<view v-for="_ in toOrderList" class="box" @click="proxy.$h.jumpUrl(`${_.url}?orderState=${_.orderState}`)">
<image :src="_.bgurl" mode="aspectFill" />
<view class="Zindex">
<view class="title">{{ _.title }}</view>
<view class="text">{{ _.text }}</view>
</view>
</view>
</view>
<view style="background: #fff">
<u-cell-group>
<template v-for="_ in jumpList">
<u-cell :title="_.title" :isLink="true" @click="jumpHandler(_)">
<template #icon>
<image :src="_.iconUrl" class="mine-icon" mode="aspectFill" />
</template>
</u-cell>
</template>
</u-cell-group>
</view>
</view>
<view style="height: 300rpx"></view>
<TurnDown :state="IndexData?.state" :isShowSY="false" :examineState="IndexData?.examineState" />
<Tabbar :index="2" />
</view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, ComponentPublicInstance } from 'vue'
import { onLoad, onShow, onPageScroll } from '@dcloudio/uni-app'
import Tabbar from '@/components/Tabbar'
import NavBar from '@/components/NavBar'
import TurnDown from '@/components/TurnDown'
import { getMy, getCareer, getDepartment, getIndex, getMsg_count, getCustomerServicePhone } from '@/api'
import type { Result, UserInfoType, IndexListType, IndexType, MineJumpListType, MessageCountType } from '../../types'
const { proxy } = getCurrentInstance() as { proxy: ComponentPublicInstance }
uni.hideTabBar()
const isShowMoney = ref<boolean>(false)
const navbarColor = ref<boolean>(false)
const messageNumber = ref<number>(0)
const toOrderList = [
{ title: '问诊订单', text: '查看订单', bgurl: '/static/images/mineorbg1.png', url: '/pages2/order/index', orderState: 0 },
{ title: '处方订单', text: '查看订单', bgurl: '/static/images/mineorbg2.png', url: '/pages2/order/index', orderState: 1 }
]
const jumpList: MineJumpListType[] = [
{ title: '续方订单', iconUrl: '/static/images/mineicon0.png', url: `/pages2/order/renew`, requiredAuth: 'err' },
{ title: '收到评论', iconUrl: '/static/images/mineicon1.png', url: `/pages2/message/mineComment`, requiredAuth: 'err' },
// { title: '问诊记录', iconUrl: '/static/images/mineicon2.png', url: `/pages2/order/record`, requiredAuth: 'err' },
{ title: '问诊记录', iconUrl: '/static/images/mineicon2.png', url: `/pages2/order/index?orderState=0&subOrderState=3&isRecords=success`, requiredAuth: 'err' },
// { title: '问诊价格', iconUrl: '/static/images/mineicon3.png', requiredAuth: 'err' },
{ title: '邀请分享', iconUrl: '/static/images/mineicon4.png', url: `/pages2/mineinfo/qrcode`, requiredAuth: 'success' },
{ title: '账户设置', iconUrl: '/static/images/accountsetting.png', url: `/pages2/money/account`, requiredAuth: 'err' },
{ title: '联系客服', iconUrl: '/static/images/kefu.png', url: `/pages2/money/account`, requiredAuth: 'err', type: 'showModal' }
]
const UserInfo = ref<UserInfoType>()
const IndexData = ref<IndexType>()
const token = uni.getStorageSync('token').length
const getIndexDataHandler = async () => {
const { result }: { result: IndexType } = await getIndex()
uni.setStorageSync('ImUserId', result.myImUserId)
uni.setStorageSync('im_token', result.myImUserToken)
uni.$chat_userID = result.myImUserId
uni.$chat_userSig = result.myImUserToken
IndexData.value = result
}
const jumpHandler = async (_: MineJumpListType) => {
if (_.requiredAuth === 'success' && ![20, '20'].includes(IndexData.value?.examineState)) return uni.$u.toast('请先完成认证')
if (_.type === 'showModal') {
const { result } = await getCustomerServicePhone()
return uni.showModal({
content: result,
showCancel: true,
confirmText: '复制',
success: ({ confirm }) => {
if (confirm) proxy.$h.copyText(result)
}
})
}
proxy.$h.jumpUrl(_.url)
}
const getMessageDataHandler = async () => {
const { result }: { result: MessageCountType } = await getMsg_count()
messageNumber.value = result.sysCount + result.userCount + result.xufangCount
}
onShow(async () => {
if (!token) return
getMessageDataHandler()
const { result }: { result: UserInfoType } = await getMy()
const { result: departmentList }: { result: { records: IndexListType[] } } = await getDepartment({ keyword: '' })
// ![null, undefined, ''].includes(result.career) &&
// (result.career = departmentList.records
// .flatMap(item => item.list)
// .filter(item => result.career.includes(item.id))
// .map(item => item.name)
// .join())
![null, undefined, ''].includes(result.department) && (result.department = departmentList.records.flatMap(item => item.list).filter(item => result.department.includes(item.id)))
uni.setStorageSync('UserInfo', result)
UserInfo.value = result
getIndexDataHandler()
})
onPageScroll(({ scrollTop }) => {
navbarColor.value = scrollTop > 20 ? true : false
})
</script>
<style lang="scss" scoped>
.mine {
&-topBg {
position: fixed;
top: 0;
right: 0;
width: 100%;
height: 600rpx;
z-index: -1;
background: #e7f9f9;
}
&-topicon {
width: 422rpx;
height: 370rpx;
position: fixed;
top: 0;
z-index: -1;
right: 24rpx;
}
&-infobox {
box-sizing: border-box;
padding: 0 32rpx;
margin-bottom: 58rpx;
}
&-avatar {
min-width: 126rpx;
width: 126rpx;
height: 126rpx;
border-radius: 50%;
margin-right: 26rpx;
}
&-username {
font-size: 36rpx;
font-style: normal;
font-weight: 700;
margin-right: 12rpx;
}
&-toptag {
color: #05b8d2;
font-size: 22rpx;
font-weight: 700;
box-sizing: border-box;
padding: 2rpx 10rpx;
border: 2rpx solid #05b8d2;
border-radius: 8rpx;
}
&-userTag {
border-radius: 24rpx;
background: #f4a712;
font-size: 24rpx;
font-weight: 700;
color: #fff;
box-sizing: border-box;
padding: 4rpx 14rpx;
margin-right: 10rpx;
}
&-bottombg {
width: 100%;
background: linear-gradient(180deg, #fff 0%, #f7f8fa 21.68%);
box-sizing: border-box;
padding: 52rpx 24rpx 0;
border-radius: 40rpx 40rpx 0 0;
}
&-centertext {
font-size: 26rpx;
margin: 0 6rpx;
}
&-righttext {
font-size: 26rpx;
}
&-income {
width: 100%;
height: 186rpx;
position: relative;
box-sizing: border-box;
padding: 28rpx 32rpx;
margin-bottom: 22rpx;
.bg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
right: 0;
}
}
&-ictitle {
font-size: 32rpx;
font-weight: 700;
color: #fff;
margin-right: 24rpx;
}
&-toincome {
box-sizing: border-box;
padding: 12rpx 36rpx;
background: #fff;
font-size: 28rpx;
font-weight: 700;
border-radius: 40rpx;
}
&-toorder {
margin-bottom: 22rpx;
.box {
width: 340rpx;
height: 158rpx;
border-radius: 24rpx;
position: relative;
box-sizing: border-box;
padding: 32rpx;
margin-right: 22rpx;
image {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
right: 0;
}
.title {
font-size: 32rpx;
font-weight: 700;
margin-bottom: 12rpx;
}
.text {
color: #00000066;
font-size: 24rpx;
}
}
.box:nth-child(2n) {
margin-right: 0 !important;
}
}
&-icon {
width: 32rpx;
height: 32rpx;
}
&-hiddenMoney {
color: #ffffff;
font-size: 44rpx;
font-weight: 700;
}
}
:deep(.u-cell__body) {
padding: 32rpx;
}
</style>