BaseDetail.vue
6.3 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
<template>
<div class="base_detail">
<div class="header">
<van-swipe class="my-swipe" indicator-color="white" v-if="detailData.coverList && detailData.coverList.length > 0">
<van-swipe-item v-for="n in detailData.coverList" :key="n.id">
<video
v-if="n.cover_url.indexOf('.mp4') > -1"
id="video"
:src="n.cover_url"
poster=""
controls="controls"
windowlessvideo="true"
playsinline="true"
webkit-playsinline="true"
x5-playsinline="true"
x-webkit-airplay="allow"
width="100%"
height="260px"
type="video/mp4"
></video>
<img v-if="n.cover_url.indexOf('.mp4') == -1" :src="n.cover_url" />
</van-swipe-item>
</van-swipe>
<img v-else src="@/assets/service/defCoure.jpg" alt="" />
</div>
<div class="uni_text">
<p class="course_name">{{ detailData.baseName }}</p>
<p class="course_info">{{ detailData.baseInfo }}</p>
<!-- 商品标签 -->
<div class="tag_box">
<template v-for="(tag, index) in detailData.baseLabel">
<span class="tag" v-if="tag != ''" :key="index">{{ tag }}</span>
</template>
</div>
<p class="address" v-if="detailData.signAddress" @click="handleAddress">
{{ detailData.signAddress }}
<span>导航 <van-icon class="icon" name="guide-o" /></span>
</p>
</div>
<!-- 商品详情 -->
<base-des v-if="detailData" :detailData="detailData"></base-des>
<div class="Collection">
<div class="box">
<div class="btn" @click="handleShare"></div>
<div class="btn" @click="handleContact"></div>
</div>
</div>
<div class="share_mask" v-if="showShareDes" @click="showShareDes = false">
<img class="share_des" src="@/assets/home/share.png" alt="" />
</div>
</div>
</template>
<script>
import BaseDes from './c_BaseDes.vue'
import './BaseDetail.scss'
export default {
name: 'ServiceBaseDetail',
data() {
return {
courseId: '',
BindType: '', //普通出行1 定制出行2
detailData: '',
packageData: [], //未处理过格式的套餐表
packageActive: 0,
packageTypeActive: 0,
packageArr: [], //套餐时间价格
initPackageArr: false, //packageArr已生成
showCourseTable: true,
showCustomized: false, //我要定制弹窗
AagentUser: '', //代理人联系方式
unionId: '',
appId: '',
centerNo: '',
copyUrl: '', //达人分享链接
showShareDes: false,
}
},
mounted() {
this.baseId = this.$route.query.baseId
localStorage.setItem('prePage', 'ServiceBaseDetail')
localStorage.setItem('prePageQuery', JSON.stringify({ baseId: this.baseId }))
if (process.env.NODE_ENV === 'production' && this.common.isWeiXin()) {
let openId = localStorage.getItem('openId')
if (!openId) {
this.$router.push({ name: 'Authorize'})
return
}
this.unionId = localStorage.getItem('unionId')
this.getUserInfo()
} else {
this.unionId = this.TestUnionId
this.getUserInfo()
}
this.GetBaseDetail()
},
methods: {
// 获取用户信息
getUserInfo() {
let userInfo = localStorage.getItem('userInfo')
if (userInfo) {
userInfo = JSON.parse(userInfo)
this.centerNo = userInfo.centerNo
} else {
this.$toast.loading({
message: '加载中...',
duration: 0,
forbidClick: true,
})
this.yxAxios.get(`${this.proxyUrl}/api/wx/${this.appId}/getUserInfo?unionId=${this.unionId}`).then((res) => {
this.$toast.clear()
if (res.data.data) {
this.centerNo = res.data.data.centerNo
localStorage.setItem('userInfo', JSON.stringify(res.data.data))
if (res.data.data.schoolNames || res.data.data.schoolNames == [] || res.data.data.schoolNames == 'null') {
localStorage.setItem('schoolNames', JSON.stringify(res.data.data.schoolNames))
this.$store.commit('changeSchool', res.data.data.schoolNames)
if (!localStorage.getItem('schoolNamesChoose')) {
localStorage.setItem('schoolNamesChoose', JSON.stringify(res.data.data.schoolNames[0]))
}
} else {
localStorage.setItem('schoolNames', [])
this.$store.commit('changeSchool', [])
}
}
})
}
},
// 获取产品详情
GetBaseDetail() {
if (!this.baseId) {
this.$toast.fail('基地id缺失,请从正确的途径访问')
return
}
this.$toast.loading({
message: '加载中...',
duration: 0,
forbidClick: true,
})
this.yxAxios.get(`${this.yanxueUrl}/api/Manage/GetOneBase?id=${this.baseId}`).then((res) => {
this.$toast.clear()
if (res.data.status == 1) {
this.detailData = res.data.data
this.ReadBase()
this.BaseVisit()
} else {
this.$toast.fail(res.data.message)
}
})
},
// 分享
handleShare() {
// this.yxAxios.post(`https://zlyx.shunzhi.net/api/BaseManage/ZlBaseShareRecord`,{
this.yxAxios.post(`https://zlyx.shunzhi.net/api/BaseManage/ZlBaseShareRecord`,{
baseId: this.baseId,
baseName:this.detailData.baseName,
location:this.detailData.address,
area:this.detailData.area
})
this.showShareDes = true
},
// 浏览量
ReadBase() {
this.yxAxios.get(`${this.yanxueUrl}/api/Manage/ReadBase?id=${this.baseId}`)
},
//浏览量
BaseVisit() {
this.yxAxios.post(`${this.yanxueUrl}/api/BaseManage/BaseVisit`, {
baseId: this.baseId,
userId: this.centerNo,
})
},
// 点击地址
handleAddress() {
console.log(111)
window.location.href = `http://uri.amap.com/marker?position=${this.detailData.signLong},${this.detailData.signLat}&name=${this.detailData.signAddress}&coordinate=gaode&callnative=1`
},
// 点击联系方式
handleContact() {
let mobile = this.detailData.mobile[0]
if (mobile) {
window.location.href = `tel:${mobile}`
} else {
this.$toast('暂无联系方式')
}
},
},
components: {
BaseDes,
},
}
</script>