index.vue
16.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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<template>
<u-sticky zIndex="99999999999999999">
<NavBar :isShowQrCode="false" :isShowBgColor="navbarColor" :isShowLeft="false" :isShowRight="true" :isplaceholder="false" :showDot="[0, '0', null, undefined].includes(showRedDotNumber) ? false : true" />
</u-sticky>
<view class="index">
<image src="/static/images/inbg.png" mode="aspectFill" class="index-topBg" />
<image src="/static/images/inperson.png" class="index-topicon" mode="aspectFill" />
<view class="Zindex">
<view class="index-title">宠物问诊医生端</view>
<view class="index-personcard">
<view class="flexJ" style="align-items: flex-end; margin-bottom: 30rpx">
<view class="flexA">
<image
v-if="![null, '', undefined].includes(IndexData?.avatar)"
@click="proxy.$h.previewImage(proxy.$h.downFile(IndexData?.avatar))"
class="index-avatar"
:src="proxy.$h.downFile(IndexData?.avatar) ?? '/static/images/mAvatar.png'"
mode="aspectFill"
/>
<image v-else @click.stop="proxy.$h.previewImage('/static/images/mAvatar.png')" class="index-avatar" src="/static/images/mAvatar.png" mode="aspectFill" />
<view style="width: 62vw">
<view @click="proxy.$h.jumpUrl(`/pages2/mineinfo/info`)" class="index-username ffftext" v-if="[null, undefined, ''].includes(IndexData?.nickname) && LoginState">{{ '未设置用户名' }}</view>
<view @click="proxy.$h.jumpUrl(`/pages2/mineinfo/info`)" class="index-username ffftext" v-if="![null, undefined, ''].includes(IndexData?.nickname) && LoginState">{{ IndexData.nickname }}</view>
<view @click="proxy.$h.jumpUrl(`/pages2/mineinfo/info`)" class="index-username ffftext" v-if="!LoginState && [null, undefined, ''].includes(IndexData?.nickname)">{{ '未登录' }}</view>
<view class="ffftext flexJ" style="font-size: 26rpx; width: 100%; flex: 1">
<view @click="proxy.$h.jumpUrl(`/pages2/mineinfo/info`)">在线认证资质</view>
<view class="flexA" @click="clickAuthHandler">
<view class="ffftext">{{ proxy.$h.optObjectValue('examineState', IndexData?.examineState, 0) }}</view>
<u-icon name="arrow-right" color="#fff" size="18"></u-icon>
</view>
</view>
</view>
</view>
</view>
<view class="index-fffbg">
<view class="blueline"></view>
<up-row customStyle="margin-bottom: 10px">
<up-col span="6">
<view class="flexCCol">
<view class="flexACol wzNum bluetext" @click="proxy.$h.jumpUrl(`/pages2/order/index?orderState=0&subOrderState=1`)">
<view>{{ IndexData?.pendingConsultationNum || 0 }}</view>
<view>待问诊</view>
</view>
<view class="flexJ wzCard br24" @click="proxy.$h.jumpUrl(`/pages2/order/consultationFee`)">
<view class="bluetext">诊费明细</view>
<u-icon name="arrow-right" color="#05B8D2" size="18"></u-icon>
</view>
</view>
</up-col>
<up-col span="6">
<view class="flexCCol">
<view class="flexACol wzNum bluetext" @click="proxy.$h.jumpUrl(`/pages2/order/index?orderState=0&subOrderState=2&isJump=success`)">
<view>{{ IndexData?.consultationNum || 0 }}</view>
<view>问诊中</view>
</view>
<view class="flexJ wzCard br24" @click="proxy.$h.jumpUrl(`/pages2/order/index?orderState=1`)">
<view class="bluetext">处方订单</view>
<u-icon name="arrow-right" color="#05B8D2" size="18"></u-icon>
</view>
</view>
</up-col>
</up-row>
</view>
</view>
<view class="index-incomeCard">
<view class="flexJ" style="margin-bottom: 46rpx">
<view class="title">我的收入</view>
<view class="btn flexC" @click="proxy.$h.jumpUrl(`/pages2/money/withdrawDeposit`)">去提现</view>
</view>
<up-row customStyle="margin-bottom: 10px" @click="proxy.$h.jumpUrl(`/pages2/money/income`)">
<up-col span="6">
<view class="flexA cardmonet">
<image src="/static/images/indexmoney.png" mode="aspectFill" />
<view class="grattext">当前收入(元)</view>
</view>
<u-count-to :decimals="2" :endVal="IndexData?.income || 0" separator="," duration="2000" color="#000" fontSize="22" decimals="2" bold></u-count-to>
</up-col>
<up-col span="6">
<view class="flexA cardmonet">
<image src="/static/images/inqv.png" mode="aspectFill" />
<view class="grattext">昨日收入(元)</view>
</view>
<u-count-to :decimals="2" :endVal="IndexData?.yesIncome || 0" separator="," duration="2000" color="#05B8D2" fontSize="22" decimals="2" bold></u-count-to>
</up-col>
</up-row>
</view>
<view class="index-numCard" @click="proxy.$h.jumpUrl(`/pages2/datatotal/index`)">
<view class="flexJ" style="margin-bottom: 46rpx">
<view class="title">我的接诊量</view>
</view>
<up-row customStyle="margin-bottom: 10px" gutter="10">
<up-col span="6">
<view class="flexCCol br24 card">
<u-count-to :endVal="IndexData?.receiveNum || 0" duration="1000" color="#323233" fontSize="22" bold></u-count-to>
<view class="graytext">积累接诊量</view>
</view>
</up-col>
<up-col span="6">
<view class="flexCCol br24 card">
<u-count-to :endVal="IndexData?.yesReceiveNum || 0" duration="1000" color="#323233" fontSize="22" bold></u-count-to>
<view class="graytext">昨日接诊量</view>
</view>
</up-col>
</up-row>
</view>
<!-- <button @click="viewtoken">666</button> -->
<view class="index-numCard">
<view class="flexJ" style="margin-bottom: 46rpx">
<view class="title flexA" @click="showEvaluateState = true">
<view style="margin-right: 6rpx">我的评价</view>
<u-icon name="info-circle" size="18" color="#c1c1c6"></u-icon>
</view>
<view class="flexA" @click="proxy.$h.jumpUrl(`/pages2/datatotal/index`)">
<view style="margin-right: 6rpx; color: #ffc525">{{ IndexData?.star || 0 }}分</view>
<u-rate :count="5" v-model="value" allowHalf activeColor="#ffc525" readonly></u-rate>
</view>
</view>
<up-row customStyle="margin-bottom: 10px" gutter="10" @click="proxy.$h.jumpUrl(`/pages2/datatotal/index`)">
<up-col span="6">
<view class="flexCCol br24 card">
<u-count-to :endVal="IndexData?.good || 0" duration="1000" color="#323233" fontSize="22" bold></u-count-to>
<view class="graytext">好评</view>
</view>
</up-col>
<up-col span="6">
<view class="flexCCol br24 card">
<u-count-to :endVal="IndexData?.bad || 0" duration="1000" color="#323233" fontSize="22" bold></u-count-to>
<view class="graytext">差评</view>
</view>
</up-col>
</up-row>
</view>
<TurnDown :isShowSY="false" :state="IndexData?.state" :examineState="IndexData?.examineState" />
</view>
<Tabbar :index="1" />
</view>
<u-popup :show="isShowAuth" @close="isShowAuth = false" round="16" mode="bottom" closeIconPos="top-left" :closeable="true">
<FillOutInfo @close="(state: boolean) => isShowAuth = state" />
</u-popup>
<u-popup :show="authStore.submitAuthState" @close="authStore.submitAuthState = false" round="16" mode="bottom">
<image src="/static/images/submitauth.png" style="height: 554rpx; width: 100%" mode="aspectFill" @click="authStore.submitAuthState = false" />
</u-popup>
<u-popup :show="showEvaluateState" @close="showEvaluateState = false" mode="bottom" round="20">
<view class="evaluateBox">
<view class="flexC title">我的评价</view>
<u-parse :content="evaluateContent"></u-parse>
<up-button color="#3477fb" shape="circle" text="我知道了" throttleTime="1500" @click="showEvaluateState = false" :customStyle="{ marginTop: '24rpx', fontSize: '32rpx' }"></up-button>
</view>
</u-popup>
<u-modal :show="showMessageState" :title="``" showCancelButton @confirm="proxy.$h.jumpUrl(`/pages2/message/index`, () => (showMessageState = false))" @cancel="showMessageState = false" cancelText="暂不处理" confirmText="去处理">
<view class="slot-content" style="font-weight: 700">您有{{ messageNumber }}条消息未处理</view>
</u-modal>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, ComponentPublicInstance } from 'vue'
import { onLoad, onShow, onPageScroll } from '@dcloudio/uni-app'
import { getIndex, getPingJiaRemark, getMsg_count } from '../../api'
import type { IndexType, getPingJiaRemarkType, MessageCountType } from '../../types'
import { useAuthStore } from '@/store/auth'
import Tabbar from '@/components/Tabbar'
import NavBar from '@/components/NavBar'
import TurnDown from '@/components/TurnDown'
import FillOutInfo from './com/FillOutInfo'
uni.hideTabBar()
const authStore = useAuthStore()
const { proxy } = getCurrentInstance() as { proxy: ComponentPublicInstance }
const offsetTop = ref(44 + uni.$u.sys().statusBarHeight)
const navbarColor = ref<boolean>(false)
const value = ref<number>(0)
const isShowAuth = ref<boolean>(false) // 认证信息状态
const authState = ref(20)
const LoginState = ref<boolean>(!uni.getStorageSync('token').length ? false : true)
const IndexData = ref<IndexType>()
const showEvaluateState = ref<boolean>(false)
const evaluateContent = ref<string>('<div style="font-size: 14px; color: #666666">暂无评价</div>')
const messageNumber = ref<number>(0)
const showRedDotNumber = ref<number>(0)
const showMessageState = ref<boolean>(false)
onLoad(() => {
if (!LoginState.value) return
getMessageDataHandler()
})
onShow(() => {
if (!LoginState.value) return
getIndexDataHandler()
})
// test
function viewtoken() {
uni.getPushClientId({
success: res => {
console.log(res)
console.log(res.cid, 'cid')
uniCloud
.callFunction({
name: 'push', // 你的云函数名称
data: {
queryStringParameters: {
title: '测试一下',
cid: res.cid,
content: '测试内容',
payload: {
text: '体验一下uni-push2.0'
}
}
}
})
.then(res => {
console.log(res, 'callFunction res')
})
.catch(err => {
console.log(err, 'callFunction err')
// 处理错误
})
}
})
// uni.createPushMessage({
// title: '测试',
// content: 'ceshineir ',
// payload: {
// text: '体验一下uni-push2.0'
// }
// // sound: "system",
// // cover: false
// })
// #ifdef APP-PLUS
// 获取cid信息
// 监听消息推送
// uni.onPushMessage(res => {
// console.log('收到推送消息', res)
// const { data } = res
// // 创建通知栏消息,并监听到推送时显示
// if (res.type === 'receive') {
// uni.createPushMessage({
// title: data.payload.title,
// content: data.payload.content,
// payload: data.payload,
// // sound: "system",
// cover: false
// })
// } else if (res.type === 'click') {
// // click 点击状态栏的消息时,进行跳转页面
// console.log(res)
// uni.navigateTo({
// url: '/pages2/order/index?orderState=0&subOrderState=1'
// })
// }
// })
// uni.onPushMessage(pushMessageCallback)
// #endif
}
const getMessageDataHandler = async () => {
const { result }: { result: MessageCountType } = await getMsg_count()
messageNumber.value = result.userCount + result.xufangCount
showRedDotNumber.value = result.userCount + result.xufangCount + result.sysCount
if (messageNumber.value === 0 || ![20].includes(authState.value)) return
showMessageState.value = true
}
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
authState.value = Number(result.examineState)
// authState.value = 20
if (['0', null].includes(result.examineState)) isShowAuth.value = true
value.value = result.star || 0
const { result: PJ }: { result: getPingJiaRemarkType } = await getPingJiaRemark()
evaluateContent.value = ![null, undefined, ''].includes(PJ.content) ? PJ.content : '<div style="font-size: 14px; color: #666666">暂无评价</div>'
}
const clickAuthHandler = () => proxy.$h.jumpUrl(authState.value === 0 ? `/pages2/auth/step` : `/pages2/auth/audit?authState=${authState.value}&title=${authState.value === 20 ? '认证成功' : ''}&examineStateFailReason=${IndexData.value?.examineStateFailReason}`)
onPageScroll(({ scrollTop }) => {
navbarColor.value = scrollTop > 20 ? true : false
})
</script>
<style>
page {
background: #f7f8fa !important;
}
</style>
<style lang="scss" scoped>
.evaluateBox {
background: linear-gradient(161deg, #deebff 22.88%, #fff 47.76%);
box-sizing: border-box;
padding: 56rpx 44rpx;
border-radius: 20rpx 20rpx 0 0;
.title {
color: #323233;
font-size: 40rpx;
font-weight: 700;
margin-bottom: 24rpx;
}
}
.index {
box-sizing: border-box;
padding: 28rpx 24rpx 0;
&-topBg {
position: fixed;
top: 0;
right: 0;
width: 100%;
height: 608rpx;
}
&-topicon {
width: 254rpx;
height: 298rpx;
position: fixed;
top: 0;
right: 40rpx;
}
&-title {
color: #323233;
font-size: 52rpx;
font-weight: 700;
margin-bottom: 54rpx;
}
&-personcard {
box-sizing: border-box;
padding: 32rpx;
border-radius: 24rpx;
border: 2rpx solid #fff;
background: #05b8d2;
margin-bottom: 26rpx;
.wzNum {
font-size: 30rpx;
font-weight: 700;
margin-bottom: 30rpx;
}
.wzCard {
box-sizing: border-box;
padding: 16rpx 20rpx;
background: #f1faf9;
width: 85%;
font-size: 26rpx;
font-weight: 700;
}
}
&-avatar {
width: 124rpx;
height: 124rpx;
min-width: 124rpx;
min-width: 124rpx;
border-radius: 50%;
margin-right: 28rpx;
}
&-username {
font-size: 36rpx;
font-style: normal;
font-weight: 700;
margin-bottom: 10rpx;
}
&-fffbg {
background: #fff;
border-radius: 24rpx;
box-sizing: border-box;
padding: 26rpx 24rpx 20rpx;
position: relative;
}
&-numCard {
border-radius: 24rpx;
box-sizing: border-box;
background: #fff;
padding: 28rpx 28rpx 50rpx;
font-size: 26rpx;
margin-bottom: 28rpx;
.title {
color: #323233;
font-size: 36rpx;
font-weight: 700;
}
.card {
width: 100%;
box-sizing: border-box;
padding: 34rpx 0 30rpx;
background: #f9f9f9;
}
.numtext {
color: #323233;
font-size: 44rpx;
font-weight: 700;
margin-bottom: 8rpx;
}
}
&-incomeCard {
border-radius: 24rpx;
background: linear-gradient(190deg, #e1fbff 7.34%, #fff 26.76%);
box-sizing: border-box;
padding: 28rpx 28rpx 50rpx;
margin-bottom: 28rpx;
.title {
color: #323233;
font-size: 36rpx;
font-weight: 700;
}
.btn {
color: #05b8d2;
font-size: 26rpx;
font-weight: 700;
box-sizing: border-box;
padding: 12rpx 34rpx;
border: 1rpx solid #05b8d2;
border-radius: 32rpx;
}
.cardmonet {
font-size: 26rpx;
image {
width: 40rpx;
height: 40rpx;
margin-right: 4rpx;
}
}
}
}
.blueline {
width: 2rpx;
height: 62rpx;
background: #05b8d2;
z-index: 999;
position: absolute;
top: 40rpx;
left: 50%;
transform: translate(-50%);
}
</style>