detail.vue
9.41 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
<template>
<view style="padding-bottom: 60rpx;">
<swiper class="swiper" circular autoplay="true">
<swiper-item v-for="(pic,index) in form.photos?.split(',')" :key="index">
<image class="cover" mode="aspectFill" :src="pic"></image>
</swiper-item>
</swiper>
<view class="whitepobox">
<view>{{form.name}}</view>
<view class="pp"><image src="./img/tag01.png" class="iconSquera"/>{{form.hdStart?.substring(0, 10)}} — {{form.hdEnd?.substring(0, 10)}}</view>
<view class="pp"><image src="./img/tag02.png" class="iconSquera"/>{{form.address}}</view>
</view>
<view class="whiteItem">
<view class="tt"> 预订说明</view>
<view class="pp" :class="allNow?'autoHeight':'onelineHeight'" v-html="form.reserveDes"></view>
<view class="formore" @click="changeIntroductionHeight" v-show="form.reserveDes?.length>20">
<view v-show="!allNow">展开详情 <uni-icons type="bottom" color='#1EC886' size="12"></uni-icons></view>
<view v-show="allNow"> 收起 <uni-icons type="top" color='#1EC886' size="12"></uni-icons></view>
</view>
</view>
<view class="whiteItem">
<view class="qbox">
<image class="m1" v-if="form.isJdView == 1" @click="gohotelList" src="./img/btn01.png"></image>
<image class="m1" v-else style="filter: grayscale(1);" src="./img/btn01.png"></image>
<image class="m2" v-if="form.isCarView == 1" @click="gocarList" src="./img/btn02.png"></image>
<image class="m2" v-else style="filter: grayscale(1);" src="./img/btn02.png"></image>
<image class="m3" v-if="form.isFoodView == 1" @click="gomealList" src="./img/btn03.png"></image>
<image class="m3" v-else style="filter: grayscale(1);" src="./img/btn03.png"></image>
</view>
</view>
<view class="whiteItem">
<view class="tt">其他事项</view>
<view class="myList">
<uni-list :border="false">
<uni-list-item :border="true" title="活动简介" showArrow :clickable="true" @click="goIllustrate">
<template v-slot:header>
<view class="slot-box">
<image class="slot-image" src="./img/qt01.png" mode="widthFix"></image>
</view>
</template>
</uni-list-item>
<uni-list-item :border="true" title="发票开具" showArrow :clickable="true" @click="goInvoice">
<template v-slot:header>
<view class="slot-box">
<image class="slot-image" src="./img/qt02.png" mode="widthFix"></image>
</view>
</template>
</uni-list-item>
<uni-list-item :border="true" title="联系电话" showArrow :clickable="true" @click="callphone(form.phone)">
<template v-slot:header>
<view class="slot-box">
<image class="slot-image" src="./img/qt03.png" mode="widthFix"></image>
</view>
</template>
</uni-list-item>
<uni-list-item :border="true" title="在线客服" :clickable="true">
<template v-slot:header>
<view class="slot-box">
<image class="slot-image" src="./img/qt04.png" mode="widthFix"></image>
</view>
</template>
<template v-slot:footer>
<button size="mini" class="kfbtn" open-type="contact" bindcontact="handleContact" @contact="contactBack" session-from="sessionFrom">
<uni-icons type="forward" color="#bbb" size="16"></uni-icons>
</button>
</template>
</uni-list-item>
</uni-list>
</view>
</view>
</view>
<view class="myEnter" @click="goMycenter"><image src="./img/user.png" mode="aspectFill"></image></view>
<uni-popup class="popYanZhengBox" ref="popYanZheng" type="center">
<view class="popup-content">
<view class="t">温馨提示</view>
<view class="p">该微信未绑定系统内手机号,绑定手机号后正常使用。</view>
<button class="start" type="default" open-type="getPhoneNumber"
@getphonenumber="decryptPhoneNumber">绑定手机号</button>
</view>
</uni-popup>
</template>
<script setup>
import {
reactive,
toRefs,ref,
getCurrentInstance
} from 'vue';
import * as hotel from '@/common/hotel.js';
import * as loginServer from '@/common/login.js';
import {
getWxUser,
getWxUserPhone
} from '@/common/login.js';
import {
onLoad,
onShow,
onShareAppMessage,
onShareTimeline,onPullDownRefresh
} from '@dcloudio/uni-app';
const app = getApp();
const popYanZheng = ref(null);
const loading = ref(false);
const data = reactive({
id: null,
form:{},
allNow:false
})
const {
id,form,allNow
} = toRefs(data);
onLoad(option => {
if (option.id) {
id.value = option.id
}
if(option.scene){
id.value = decodeURIComponent(option.scene);
}
app.globalData.showFirst = true
})
onShow(option => {
if (app.globalData.isLogin) {
getActivity()
} else {
app.firstLoadCallback = () => {
getActivity()
};
}
})
onPullDownRefresh(() => {
getActivity()
})
let goPath
let currUser
function checkUserPhone(path) {
currUser = uni.getStorageSync('currUser')
if(!currUser){
loginServer.pcLogin().then(()=>{
currUser = uni.getStorageSync('currUser')
if (currUser.phonenumber) {
// debugger
return true
} else {
popYanZheng.value.open()
goPath = path
return false;
}
});
} else {
if (currUser.phonenumber) {
return true
} else {
popYanZheng.value.open()
goPath = path
return false;
}
}
}
function decryptPhoneNumber(res) {
// console.log(res)
loading.value = true
if (res.detail.errMsg.indexOf('ok') > -1) {
getWxUserPhone(res.detail).then((data) => {
console.log(data)
popYanZheng.value.close()
uni.redirectTo({
url: goPath
})
}).finally(() => {
loading.value = false
});
} else {
loading.value = false
}
}
function getActivity() {
hotel.getActivityDetail(id.value).then(res => {
form.value = res.data
app.globalData.carStart = res.data.carStart
app.globalData.carEnd = res.data.carEnd
app.globalData.foodStart = res.data.foodStart
app.globalData.foodEnd = res.data.foodEnd
})
}
function gohotelList() {
let path = `/pages_hotel/hotel/hotelList?id=${id.value}`;
if (checkUserPhone(path)) {
uni.navigateTo({
url: path
});
}
}
function gocarList() {
let path = `/pages_hotel/car/index?activeId=${id.value}`;
if (checkUserPhone(path)) {
uni.navigateTo({
url: path
});
}
}
function gomealList() {
let path = `/pages_hotel/eat/index?activeId=${id.value}`;
if (checkUserPhone(path)) {
uni.navigateTo({
url: path
});
}
}
function goInvoice(){
const remarks = encodeURIComponent(JSON.stringify(form.value.remarks))
let path = `/pages_hotel/hotel/invoice?activeId=${id.value}&remarks=${remarks}&kpType=${form.value.kpType}`;
if (checkUserPhone(path)) {
uni.navigateTo({
url: path
});
}
}
function goIllustrate(){
let path = `/pages_hotel/hotel/illustrate?activeId=${id.value}`;
if (checkUserPhone(path)) {
uni.navigateTo({
url: path
});
}
}
function callphone(number){
uni.makePhoneCall({
phoneNumber: number
});
}
function handleContact(e){
console.log(e.detail.path)
console.log(e.detail.query)
}
function contactBack(e){
console.log(e)
}
function changeIntroductionHeight(){
allNow.value = !allNow.value
}
function goMycenter(){
let path = `/pages_hotel/hotel/mycenter`;
if (checkUserPhone(path)) {
uni.navigateTo({
url: path
});
}
}
</script>
<style lang="scss" scoped>
:deep(.uni-list-item__container){align-items: center;padding: 12rpx 30rpx;}
.myList{margin: 30rpx 0 0;}
.iconSquera{width: 40rpx;height: 40rpx; position: relative;
top: 10rpx;}
.cover {width: 750rpx;height: 360rpx;}
.whitepobox{width: 700rpx;padding: 26rpx;box-shadow: 0rpx 0rpx 27rpx 0rpx #DEDEDE;
border-radius: 15rpx;background: #fff; box-sizing: border-box;margin: -40rpx auto 26rpx;
position: relative;z-index: 1;}
.whiteItem {
width: 700rpx;
box-sizing: border-box;
margin: 0 auto 26rpx;
padding: 26rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 27rpx 0rpx #DEDEDE;
border-radius: 15rpx;
.tt {line-height: 1;border-left: 4rpx solid #1EC886;color: #1EC886;padding-left: 14rpx;}
.m1 {
width: 314rpx;
height: 225rpx;
}
.m2 {
width: 315rpx;
height: 103rpx;
float: right;
}
.m3 {
width: 315rpx;
height: 103rpx;
position: absolute;
right: 0;
bottom: 0;
}
}
.qbox {
height: 225rpx;
position: relative;
width: 100%;
}
.slot-image {
width: 60rpx;
height: 60rpx;
margin-right: 30rpx;
}
.kfbtn{font-size: 30rpx;background: transparent;padding: 0 0 0 50%; margin-right: -10rpx;}
.kfbtn::after{
border: none;
}
.formore{border-top: 1px solid #eee;text-align: center;color: #1EC886;
font-size: 24rpx;padding: 20rpx 0 0;}
.autoHeight{height: auto;}
.onelineHeight{height: 40rpx;overflow: hidden;}
.myEnter{position: fixed;right: 0;bottom: 10%;
image{width: 150rpx;height: 150rpx;}
}
.popYanZhengBox {
text-align: center;
.popup-content {
width: 550rpx;
height: 450rpx;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 15rpx;
}
.t {
font-weight: 500;
font-size: 34rpx;
color: #7B7F83;
}
.p {
line-height: 1.8;
font-size: 30rpx;
color: #1A1A1A;
margin-top: 50rpx;
}
button {
width: 268rpx;
height: 80rpx;
color: #FFFFFF;
font-size: 32rpx;
border: none;
background: linear-gradient(270deg, #54E1B9, #00CAA6);
border-radius: 40rpx;
margin-top: 60rpx;
}
}
</style>