OrderCard.vue
11.5 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
<template>
<view class="orderCard">
<view class="flexJ" style="margin-bottom: 50rpx" @click="clickOrderItemHandler">
<view class="flexA">
<image :src="proxy.$h.downFile(props.item?.user?.avatar) || '/static/images/mAvatar.png'" mode="aspectFill" />
<view>
<view class="flexA" style="margin-bottom: 8rpx">
<view class="username">{{ props.item?.nickName || '' }}</view>
<view class="blueTag tag">{{ proxy.$h.optObjectValue('consultationWay', props.item?.consultationWay) || '未设置' }}</view>
</view>
<view class="graytext">{{ props.item?.time || '' }}</view>
</view>
</view>
<view class="blueSText" v-if="!props.isPrescriptionDrug" :style="{ color: [40, '40'].includes(props.item?.orderState) ? '#999' : '#05b8d2' }">{{ proxy.$h.optObjectValue('orderState', props.item?.orderState) || '未知' }}</view>
<view class="blueSText" v-else>{{ proxy.$h.optObjectValue('state', props.item?.orderState) || '未知' }}</view>
</view>
<view style="margin-bottom: 16rpx; display: flex" @click="clickOrderItemHandler">
<view class="messagetext flex1">
<text class="graytext">就诊宠物:</text>
<!-- 蓝猫/2岁/女绝/育/1kg -->
{{ props.item?.petName || '姓名未知' }}/{{ props.item?.petClass || '姓名未知' }}/{{ props.item?.age || '年龄未知' }}/ {{ proxy.$h.optObjectValue('petSex', props.item?.petSex) || '性别未知' }} /
{{ proxy.$h.optObjectValue('isSterilization', props.item?.isSterilization) || '是否绝育未知' }}/
{{ props.item?.weight ? props.item?.weight + 'kg' : '体重未知' }}
</view>
<view class="repeatPay flexC" v-if="props.item?.isAgainInformation === 1">复诊</view>
<view class="repeatPay flexC" v-if="props.item?.isAgain === 1">续方</view>
</view>
<view class="flexA" v-if="!props.isPrescriptionDrug" @click="clickOrderItemHandler">
<view class="messagetext">
<text class="graytext">病情描述:</text>
{{ props.item?.supplement || '暂无' }}
</view>
</view>
<view v-if="props.isPrescriptionDrug" class="flexA PrescriptionDrug" @click.stop="showPrescriptionDetailHandler">
<view>已开具处方药({{ props.item?.drugList.length }}个)</view>
<u-icon name="arrow-right" size="16" color="#05B8D2"></u-icon>
</view>
<u-line margin="32rpx 0 22rpx 0"></u-line>
<view class="moneytext flexD" v-if="!props.isPrescriptionDrug && !props.isRecord">¥{{ props.item?.award || 0 }}/预计收入</view>
<view class="flexD">
<view class="flexW" v-if="!props.isPrescriptionDrug">
<up-button type="info" v-if="props.item?.orderId !== null" shape="circle" text="处方单" throttleTime="1500" :customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }" @click="showPrHandler"></up-button>
<up-button type="info" @click="clickOrderItemHandler" shape="circle" text="查看症状" throttleTime="1500" :customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }"></up-button>
<up-button type="info" v-if="props.isRecords === 'success'" @click="AcceptHandler('success')" shape="circle" text="问诊记录" throttleTime="1500" :customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }"></up-button>
<up-button color="#05B8D2" v-if="[20, '20'].includes(props.item?.orderState)" @click="AcceptHandler('err')" shape="circle" text="接诊" throttleTime="1500" :customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }"></up-button>
<up-button
color="#05B8D2"
v-if="[30, '30'].includes(props.item?.orderState) && [null, undefined, ''].includes(props.item?.orderId)"
@click="
() => {
sendPrescriptionState = true
isOneP = 1
emit('editIsJumpHandler', 'err')
}
"
shape="circle"
text="填写处方单"
throttleTime="1500"
:customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }"
></up-button>
<up-button
color="#05B8D2"
v-if="[30, '30'].includes(props.item?.orderState)"
@click="getEndInformationHandler"
plain
shape="circle"
text="结束问诊"
throttleTime="1500"
:customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx', fontWeight: 700 }"
></up-button>
</view>
<view class="flexA" v-else>
<up-button
type="info"
shape="circle"
v-if="[null, '', undefined].includes(props.item?.expressNo) && [1, '1', 2, '2'].includes(props.item?.orderState)"
text="上传单号"
throttleTime="1500"
:customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }"
@click="proxy.$h.jumpUrl(`/pages2/order/PrescriptionDetail?id=${props.item.id}&isShowUpload=success&orderRenewId=${props.item.orderRenewId}&isRenew=${props.item?.isAgain == 1 ? 'success' : 'err'}&order=Prescription`)"
></up-button>
<up-button type="info" shape="circle" text="查看详情" throttleTime="1500" :customStyle="{ width: '170rpx', height: '64rpx', marginRight: '20rpx' }" @click="clickOrderItemHandler"></up-button>
</view>
</view>
</view>
<u-modal :show="showPrescriptionDetailState" :title="`处方单详情`" @confirm="showPrescriptionDetailState = false">
<ViewPrescription :orderId="props.item?.id" @click="showPrescriptionDetailState = false" />
</u-modal>
<u-popup :show="sendPrescriptionState" @close="sendPrescriptionState = false" mode="bottom" closeIconPos="top-right" closeable round="20">
<SendPrescription :orderId="props.item?.id" @closeSendPrescriptionHandler="closeSendPrescriptionHandler" />
</u-popup>
<u-popup :show="showPrescriptionState" @close="showPrescriptionState = false" mode="bottom" closeIconPos="top-right" closeable round="20">
<Prescription
:showTopState="false"
:PrescriptionDetail="PrescriptionDetail"
bg="linear-gradient(188deg, #E0FFF4 5.54%, #FFF 24.89%)"
:title="`${PrescriptionDetail?.user?.nickname}的处方单`"
:isRenew="props.item.isAgain == 1 ? 'success' : 'err'"
:showStep="`err`"
:isAgainInformation="props.item?.isAgainInformation"
/>
</u-popup>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, ComponentPublicInstance, onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { useOrderStore } from '@/store/order'
import { getPrescription_detail_information, getEndInformation, getReceive_diagnosis, getPrescription_detail, getPrescription_detail_information_renew, getOrder_chat } from '../../../api'
import { PrescriptionDetailType } from '../../../types'
import SendPrescription from '@/components/SendPrescription'
import ViewPrescription from '@/components/ViewPrescription'
import Prescription from './prescription.vue'
import { imlogin } from '../../../hooks/imLogin'
const { proxy } = getCurrentInstance() as { proxy: ComponentPublicInstance }
const emit = defineEmits(['showPrescription', 'fetchOrderListHandler', 'editIsJumpHandler'])
const orderStore = useOrderStore()
const showPrescriptionDetailState = ref<boolean>(false)
const { orderStateList, orderState, subOrderState, page, orderList } = storeToRefs(orderStore)
interface IProps {
isPrescriptionDrug: boolean
isRecord: boolean
bg: string
item: any
isRecords?: string
}
const props = withDefaults(defineProps<IProps>(), {
isPrescriptionDrug: false,
isRecord: false,
bg: '#fff',
item: {},
isRecords: 'err'
})
const isOneP = ref<number>(0)
const sendPrescriptionState = ref<boolean>(isOneP.value === 0 ? false : true)
const CustomBackground = ref(props.bg)
const showPrescriptionState = ref<boolean>(false)
const PrescriptionDetail = ref<PrescriptionDetailType>()
const showPrescriptionDetailHandler = async () => {
if (props.item?.isAgain == 1) {
getRenewDetailHandler()
} else {
getDetailHandler()
}
showPrescriptionState.value = true
}
const showPrHandler = async () => {
const { result } = await getPrescription_detail_information({ id: props.item?.id })
PrescriptionDetail.value = result
showPrescriptionState.value = true
}
const closeSendPrescriptionHandler = () => {
sendPrescriptionState.value = false
emit('fetchOrderListHandler')
}
const AcceptHandler = async (historyFlag: string) => {
uni.setStorageSync('history', historyFlag)
await getReceive_diagnosis({ id: props.item.id })
uni.setStorageSync('inUserInfo', props.item?.user)
const { consultationWay, imUserId, id } = props.item
// imlogin(consultationWay, imUserId, id)
uni.navigateTo({
url: `/TUIKit/TUIPages/TUIConversation/index?imUserId=${imUserId}&consultationWay=${consultationWay}&orderId=${id}`
})
}
const clickOrderItemHandler = () => {
const isAgain = props.item?.isAgain == 1 ? 'success' : 'err'
const orderRenewId = props.item?.orderRenewId
const order = 'Prescription'
const url = { 0: `/pages2/order/symptomDetail?id=${props.item.id}`, 1: `/pages2/order/PrescriptionDetail?id=${props.item.id}&orderRenewId=${orderRenewId}&isRenew=${isAgain}&order=${order}` }
proxy.$h.jumpUrl(url[orderState.value])
}
const getRenewDetailHandler = async () => {
const { result } = await getPrescription_detail_information_renew({ orderRenewId: props.item?.orderRenewId })
PrescriptionDetail.value = result
}
const getDetailHandler = async () => {
const { result }: { result: PrescriptionDetailType } = await getPrescription_detail({ id: props.item?.id })
PrescriptionDetail.value = result
}
const getEndInformationHandler = async () => {
uni.showModal({
title: '提示',
content: '您确定要结束问诊吗',
success: async function (res: any) {
if (res.confirm) {
try {
await getEndInformation({ id: props.item.id })
emit('fetchOrderListHandler')
} catch (error) {
uni.$u.toast(error)
}
}
}
})
}
</script>
<style lang="scss" scoped>
.mb24 {
margin-bottom: 24rpx;
}
.text {
color: #323233;
font-size: 28rpx;
font-weight: 700;
}
.blacktext {
color: #323233;
font-size: 30rpx;
font-weight: 700;
}
.graytext {
color: #999999;
font-size: 24rpx;
font-weight: 700;
}
.list {
width: 460rpx;
box-sizing: border-box;
padding: 34rpx 28rpx;
background: #f8f8fa;
margin-bottom: 32rpx;
}
.orderCard {
box-sizing: border-box;
padding: 28rpx 24rpx 24rpx;
background: v-bind(CustomBackground);
border-radius: 24rpx;
margin-bottom: 22rpx;
.repeatPay {
box-sizing: border-box;
padding: 0 8rpx;
border-radius: 6rpx;
background: #faf4e9;
color: #f4a712;
font-size: 24rpx;
font-weight: 700;
margin-left: 16rpx;
height: min-content;
}
.tag {
color: #05b8d2;
font-size: 22rpx;
font-weight: 700;
}
.moneytext {
color: #f33f2e;
font-size: 28rpx;
font-weight: 700;
margin-bottom: 24rpx;
}
.PrescriptionDrug {
color: #05b8d2;
font-size: 26rpx;
font-weight: 700;
}
.messagetext {
color: #666666;
font-size: 26rpx;
font-weight: 700;
@include oneLine(2);
}
.graytext {
color: #999999;
font-size: 26rpx;
}
.username {
color: #323233;
font-size: 30rpx;
font-weight: 700;
margin-right: 16rpx;
}
.blueSText {
color: #05b8d2;
font-size: 26rpx;
font-weight: 700;
}
.graySText {
color: #999999;
font-size: 26rpx;
font-weight: 700;
}
image {
width: 92rpx;
height: 92rpx;
margin-right: 16rpx;
border-radius: 50%;
}
}
</style>