activeDetail.vue
4.61 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
<template>
<view>
<view class="whitebg">
<image class="ccover" mode="aspectFit" :src="config.baseUrl_api+form.activityPic"></image>
<view class="name">{{form.activityName}}
<view v-if="isBuy" style="font-size: 32rpx;color: #1EC886;display: inline-block;float: right;">
<uni-icons color="#1EC886" size="22" type="checkbox-filled"></uni-icons>已报名
</view>
</view>
<view class="text-warning pp" v-if="form.isFree==1">
<text v-if="form.allGold>0">金币{{form.allGold}}</text>
<text v-if="form.allGold>0&&form.allScore>0">/</text>
<text v-if="form.allScore>0">积分{{form.allScore}}</text>
<text v-if="form.gold>0">/金币{{form.gold}}+积分{{form.score}}</text>
</view>
<view v-else class="text-warning pp">免费</view>
<view class="pp">活动时间:{{form.startTime}} ~ {{form.endTime}}</view>
<view class="pp">活动地址:{{form.address}}</view>
</view>
<view class="plane">
<view class="phead">
<view>
<image class="tag01" src="@/course/img/tag01.png" style="width:30rpx;height: 30rpx;"></image>
活动介绍
</view>
<view class="text-warning">讲师:{{form.speaker}}</view>
</view>
<view class="pbody">
{{form.description}}
</view>
</view>
<view style="height: 100rpx;"></view>
<view class="fixedBottom">
<button class="btn btn-submit" v-if="isBuy">已报名</button>
<button class="btn btn-submit" v-else @click="goBill">立即报名</button>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onShow,onShareAppMessage
} from '@dcloudio/uni-app';
import config from '@/config.js';
import {
ref,
getCurrentInstance
} from 'vue';
import * as api from '@/common/api.js';
const currUser = uni.getStorageSync('currUser');
const form = ref({})
const isBuy = ref(false)
let shareId = '0'
let goodsId
onLoad((option) => {
uni.showLoading({
title: '加载中'
})
if (option.id) {
goodsId = option.id
}
if (option.shareId) {
console.log(option.shareId)
shareId = option.shareId
}
})
onShow(() => {
if (goodsId)
getData(goodsId)
})
onShareAppMessage(() => {
return {
title: form.value.activityName,
path: `/course/activeDetail?id=${goodsId}&shareId=${currUser.userId}`,
imageUrl: config.baseUrl_api+form.value.activityPic
};
});
function getData(id) {
api.getActiveById(id).then(res => {
form.value = res.data
uni.hideLoading()
api.getUserIsPay({
orderType: 1,
goodsId: goodsId
}).then(Response => {
isBuy.value = Response.data
})
})
}
function goBill() {
if(form.value.isFree=='1'){
const obj = encodeURIComponent(JSON.stringify(form.value))
let path = `/course/courseBill?form=${obj}&shareId=${shareId}`
uni.navigateTo({
url: path
});
} else {
api.submitOrder({
orderType: 1,
goodsId: form.value.activityId,
shareId:shareId,
payType: "0"
}).then(res => {
uni.showModal({
content:'报名成功!',
success:function(respons){
if(respons.confirm){
getData(goodsId)
}
}
})
})
}
}
</script>
<style scoped lang="scss">
.whitebg {
background: #fff;
padding: 25rpx;
}
.plane {
background: #fff;
width: 700rpx;
border-radius: 15rpx;
margin: 30rpx auto;
padding: 25rpx;
box-sizing: border-box;
.phead {
border-bottom: 1rpx solid #eee;
display: flex;
justify-content: space-between;
padding: 0 0 15rpx;
align-items: center;
font-size: 30rpx;
box-sizing: border-box;
.text-warning {
font-size: 28rpx;
}
.tag01 {}
}
.pbody {
padding: 15rpx 0;
box-sizing: border-box;
line-height: 40rpx;
font-size: 28rpx;
color: #4C5359;
}
}
.wList {
background: #fff;
padding: 36rpx 23rpx;
box-sizing: border-box;
border-radius: 15rpx;
width: 700rpx;
margin: 0 auto 30rpx;
position: relative;
.pp {
display: flex;
color: #8F8E94;
font-size: 24rpx;
align-items: center;
image {
margin-right: 6rpx;
}
}
.name {
color: #2B3133;
font-size: 30rpx;
margin: 15rpx 0 0;
}
.playBtn {
position: absolute;
right: 24rpx;
top: 0;
bottom: 0;
margin: auto;
height: 48rpx;
}
}
.ccover {
width: 700rpx;
margin: 0 auto 30rpx;
display: block;
height: 320rpx;
border-radius: 15rpx;
}
.whitebg {
.name {
font-size: 32rpx;
}
.pp {
color: #8F8E94;
font-size: 26rpx;
margin: 10rpx 0 0;
}
.text-warning {
color: #F39800;
}
}
</style>