buyCard.vue
7.2 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
<template>
<view class="content">
<image class="bg" src="../../static/bg_img@2x(2).png"></image>
<image class="card" src="../../static/card_img@2x.png"></image>
<view class="cardText">
<swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration" :indicator-color="indicatorColor" :indicator-active-color="indicatorActiveColor" @change="swiperChange" :circle="true" circular="true">
<view v-for="(item,index) in cardlist" :key="index">
<swiper-item>
<view class="title">{{item.name}}</view>
<view class="money">{{item.money}}/月</view>
<view class="time" v-if="item.vip_endtime">到期日期:{{item.vip_endtime}}</view>
<view class="btn" @click="buycard" :data-id="item.id">立即购买<image class="icon" src="../../static/dizhi_btn@2x2.png"></image></view>
<!-- <image class="big" src="../../static/juxing.png"></image>
<image class="small" src="../../static/tuoyuan.png"></image> -->
</swiper-item>
</view>
</swiper>
<view class="dots">
<block v-for="(item,index) in cardlist" :key="index">
<view class="dot" :class="index == currentSwiper ? 'active' : ''"></view>
</block>
</view>
</view>
<view class="textBox">
YHA青年旅舍会员卡(一年)是国际青年旅舍联盟会员身份证明,全球通用,也是旅行者入住青年旅舍的凭证。拥有会员卡,可以享受国内外国际青年旅舍住宿价格的优惠,同时部分海外青年旅舍只允许会员入住。
成为YHA青年旅舍会员的好处:
<view>1)入住青年旅舍享受房价上的优惠;</view>
<view>2)在世界各地享有食、住、行、游、购、娱等逾3,000项优惠,如:在全球多个国际机场和车船站,凭会员卡兑换外币可免收手续费;观光、租车、购物、参团、购买车船票等均可能有折扣,折扣率高达50%。单是在澳大利亚,优惠项目便接近800种;</view>
<view>3)以优惠价格参与多项由青年旅舍举办的各类文化、旅游等方面的交流活动;</view>
<view>4)优先参与青年旅舍组织的国际交流活动。</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data(){
return{
name:'',
province_id:'',
city_id:'',
cardlist:[],
background: ['color1', 'color2', 'color3'],
indicatorDots: false,
autoplay: true,
interval: 3000,
duration: 500,
indicatorColor:'rgba(255,255,255,1)',
indicatorActiveColor:'#ffffff',
currentSwiper: 0,
imgUrls:[1,2],
vip_id:''
}
},
methods:{
getcardmsg(){
var that = this
var url = "vip/getVipConf"
var params = {
name:that.name,
province_id:that.name,
city_id:that.name
}
app.post(url,params,"post").then((res)=>{
console.log(res)
that.cardlist=res
}).catch((err)=>{
console.log(err)
})
},
swiperChange: function(e) {
this.currentSwiper= e.detail.current
},
buycard(e){
var that = this
let vip_id=e.currentTarget.dataset.id;
console.log(vip_id)
var url = "vip/buyVip"
var header = {
// token:uni.getStorageSync('token'),
}
var params = {
token:uni.getStorageSync('token'),
vip_id:vip_id
}
console.log(params)
app.post(url,params,"post").then((res)=>{
console.log(res)
that.payment(res)
}).catch((err)=>{
console.log(err)
})
},
payment(res) {
let that = this;
var timeStamp = res.timeStamp.toString();
// console.log(timeStamp);
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: res.signType,
paySign: res.paySign,
success: function(res) {
console.log(res)
that.getcardmsg()
// wx.navigateTo({
// url: '/pages/orderbox/orderbox?index=' + 0
// })
},
fail: function(res) {
console.log(123);
console.log(res);
}
})
},
},
onLoad(){
this.getcardmsg()
}
}
</script>
<style lang="less">
.content{
.bg{
width: 750rpx;
height: 292rpx;
}
.card{
width: 636rpx;
height: 360rpx;
position: absolute;
top: 26rpx;
left: 50%;
transform: translate(-50%);
}
.cardText{
width: 636rpx;
height: 360rpx;
position: absolute;
top: 26rpx;
left: 50%;
transform: translate(-50%);
padding: 30rpx 40rpx;
box-sizing: border-box;
z-index: 777;
.title{
color:rgba(130,75,59,1);
font-size: 50rpx;
}
.money{
color:rgba(130,75,59,1);
font-size: 36rpx;
}
.time{
color:rgba(130,75,59,1);
font-size: 24rpx;
margin-top: 70rpx;
position: absolute;
left:26rpx;
bottom:68rpx
}
.btn{
width:206rpx;
height:60rpx;
background:rgba(130,75,59,1);
opacity:1;
border-radius:42rpx;
color:rgba(255,255,255,1);
font-size:32rpx;
text-align: center;
line-height: 60rpx;
position: absolute;
right: 26rpx;
bottom: 52rpx;
.icon{
width: 15rpx;
height: 27rpx;
margin-left: 10rpx;
}
}
.dots{
position: absolute;
bottom: 36rpx;
left: 50%;
transform: translate(-50%);
width: 50rpx;
height: 10rpx;
z-index: 999;
display: flex;
justify-content: space-between;
.dot{
width: 10rpx;
height: 10rpx;
background-color: #fff;
border-radius:12rpx;
}
.active{
width: 30rpx;
height: 10rpx;
}
}
.big{
width: 24rpx;
height: 8rpx;
position: absolute;
bottom: 10rpx;
left: 298rpx;
}
.small{
width: 8rpx;
height: 8rpx;
position: absolute;
bottom: 10rpx;
left: 330rpx;
}
}
.textBox{
font-size: 24rpx;
width: 640rpx;
margin: 0 auto;
margin-top: 138rpx;
}
}
</style>