index.vue
6.0 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
<template>
<view class="app-container">
<up-navbar placeholder :leftIconSize="0" title="广西车险投保登记平台" :titleStyle="titleStyle" bgColor="transparent" />
<view class="car_list">
<view class="title">车辆管理</view>
<carCard v-for="carItem in carList" :key="carItem.id" :tipContent="carItem.status" :carInfo="carItem">
<template #header>
<navTop :carNum="carItem.licensePlateNumber" />
</template>
<template #center>
<centerLine :leftContent="carItem.frameNumber" fontColor="#999" :rightContent="carItem.engineNumber"></centerLine>
</template>
<template #footer>
<view style="display: flex;align-items: center;gap: 20rpx;">
<view style="color: #3680FE;font-size: 24rpx;" @click="lookCarInfo(carItem.id)">查看详情</view>
<view v-if="carItem.status === '已完成'" style="color: #3680FE;font-size: 24rpx;" @click="lookFeedback(carItem.processInstanceId)">查看单号</view>
</view>
</template>
</carCard>
<view class="addBtn" @click="addCarInfo">登记车辆保险信息</view>
</view>
<!-- 背景 -->
<view class="bg_bx">
<image class="bgImg" src="@/static/commonImage/bg_bx_1.jpg" mode="widthFix"></image>
</view>
<up-modal :show="showFeedback" title="保单号" @confirm="showFeedback = false" >
<view class="feedback">
<view class="feedbackNumber">
<text>交强险保单号:{{ feedbakcForm.strongInsurancePolicyNumber }}</text>
<text>商业险保单号:{{ feedbakcForm.commercialInsurancePolicyNumber }}</text>
</view>
</view>
</up-modal>
<up-popup :show="userStore.isShowAdver" mode="center" :safeAreaInsetBottom="false" round="20" @close="userStore.isShowAdver = false">
<view class="notice">
<view class="notice_title">{{ advertisingTitle }}</view>
<view class="notice_content">
<up-parse :content="advertisingContent"></up-parse>
</view>
<view class="btn" @click="confirm">确认</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onShow, onPullDownRefresh, onLoad } from '@dcloudio/uni-app'
import { getUserCarInfo, getAdverList } from '@/api/user.js'
import { queryMyList, queryResult } from '@/api/work.js'
import carCard from '@/components/carCard.vue';
import centerLine from '@/components/centerLine.vue';
import navTop from '@/components/navTop.vue';
import useUserStore from '@/store/modules/user';
const carList = ref([])
const advertisingTitle = ref('')
const advertisingContent = ref('')
const myTotal = ref('0')
const showFeedback = ref(false)
const feedbakcForm = ref({
strongInsurancePolicyNumber: '',
commercialInsurancePolicyNumber: ''
})
const titleStyle = ref({
color: '#fff',
fontWeight: 500
})
const userStore = useUserStore()
const queryParams = reactive({
pageNum: 1,
pageSize: 20
})
const getMyList = async () => {
const { data } = await getUserCarInfo(queryParams)
carList.value = data.records
const { data: peopleList } = await queryMyList({
pageNum: 1,
pageSize: 20,
type: 1
})
const { data: buinessList } = await queryMyList(queryParams)
myTotal.value = (peopleList.total + buinessList.total).toString()
}
const addCarInfo = () => {
uni.navigateTo({
url: '/pages/carDetail/carDetail'
})
}
const lookCarInfo = (id) => {
uni.navigateTo({
url: `/pages/carDetail/carDetail?carInfoId=${id}`
})
}
const confirm = () => {
userStore.isShowAdver = false
}
// 获取广告列表
const getNoticeDetail = async () => {
const { rows } = await getAdverList(queryParams)
advertisingContent.value = rows[0].noticeContent
advertisingTitle.value = rows[0].noticeTitle
userStore.isShowAdver = true
}
getNoticeDetail()
// 用户下拉刷新
onPullDownRefresh(async () => {
carList.value = []
//调用获取数据方法
await getMyList()
uni.stopPullDownRefresh()
})
// 查看保单号
const lookFeedback = (processInstanceId) => {
queryResult({ processInstanceId}).then((res) => {
feedbakcForm.value.strongInsurancePolicyNumber = res?.data?.strongInsurancePolicyNumber;
feedbakcForm.value.commercialInsurancePolicyNumber = res?.data?.commercialInsurancePolicyNumber;
showFeedback.value = true;
});
}
onShow(async () => {
await getMyList()
if(myTotal.value !== '0') {
uni.setTabBarBadge({
index: 1,
text: myTotal.value
})
}else {
uni.removeTabBarBadge({
index: 1
})
}
})
</script>
<style lang="scss" scoped>
.app-container{
width: 100%;
min-height: 100vh;
padding: 0 30rpx 30rpx;
background: url('http://bxhd.crgx.net/profile/avatar/2024/09/25/bg-index_20240925113012A004.png') no-repeat;
background-size: 100% 100%;
overflow: hidden;
background-attachment: fixed;
.car_list{
position: relative;
display: flex;
flex-direction: column;
gap: 20rpx;
z-index: 10;
.title{
font-size: 32rpx;
line-height: 42rpx;
color: #fff;
}
.addBtn{
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size: 28rpx;
color: #3d3d3d;
font-weight: 500;
background: #FFFFFF;
box-shadow: 0rpx 8rpx 40rpx 0rpx rgba(10,22,44,0.06);
border-radius: 20rpx;
}
}
}
.notice{
position: relative;
width: 690rpx;
max-height: 600rpx;
min-height: 200rpx;
height: auto;
background: #FFFFFF;
padding: 40rpx 30rpx 0;
border-radius: 20rpx;
overflow: hidden;
.notice_title{
text-align: center;
font-size: 36rpx;
line-height: 48rpx;
color: #3D3D3D;
margin-bottom: 40rpx;
}
.notice_content{
font-size: 28rpx;
line-height: 38rpx;
min-height: 200rpx;
max-height: 375rpx;
height: auto;
color: #999;
overflow-y: scroll;
padding-bottom: 100rpx;
image{
width: 100%;
}
}
.btn{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
line-height: 100rpx;
text-align: center;
height: 100rpx;
color: #3680FE;
font-size: 28rpx;
background-color: #fff;
border-top: 2rpx solid #eee;
}
}
.bg_bx{
position: fixed;
bottom: 100rpx;
left: 50%;
transform: translateX(-50%);
.bgImg{
width: 400rpx;
}
}
.feedback{
width: 100%;
.feedbackNumber{
display: flex;
flex-direction: column;
gap: 20rpx;
margin-bottom: 20rpx;
}
}
</style>