yuhuijuanCenter.vue
8.6 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<template>
<view class="youHuiContents">
<!-- 没有优惠卷的页面 -->
<view class="no-Youhui" v-if="youHuiCenter.length == 0 && ImgIsShow">
<view class="no-youhuiBox">
<view class="no-youhuiImg">
<image src="/static/myImage/ic_money.png" mode="widthFix"></image>
</view>
<view class="no-youhui-text">
商家暂无优惠券
</view>
</view>
</view>
<!-- 没有优惠卷的页面end -->
<!-- 有优惠卷的页面 -->
<view class="have-yohui" v-else>
<!-- 优惠卷内容star -->
<view class="have-yohui-item" v-for="(item,index) in youHuiCenter">
<view class="have-yohui-item-Bgimg relative">
<image style="width: 100%;" src="../../../static/myImage/youhuiBg.png" mode="widthFix"></image>
<view class="have-yohui-item-content absolute">
<view class="yohui-item-content-left">
¥{{item.price}}
</view>
<view class="yohui-item-content-right">
<view class="yohui-item-content-right-left">
<view class="yohui-item-content-right-left-Title" v-if="item.bottom_price != 0">
满{{item.bottom_price}}可用
</view>
<view class="yohui-item-content-right-left-Title" v-else>
无门槛使用
</view>
<view class="yohui-item-content-right-left-Text" v-if="item.category == 1">
自领取之日{{item.rr}}天内有效
</view>
<view class="yohui-item-content-right-left-Text" v-else>
无期限使用
</view>
</view>
<view class="yohui-item-content-right-right">
<view class="yohui-item-content-right-right-title">
{{item.name}}
</view>
<view class="yohui-item-content-right-right-btn"
@click="handle_guanzhuBtn(item.is_receive,item.id,item.category)" v-if="item.category == 1">
领取
</view>
<view class="yohui-item-content-right-right-btn"
@click="handle_guanzhuBtn(item.is_receive,item.id,item.category)" v-else>
{{item.category == 2 ? '入会' : '去关注'}}
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 优惠卷内容end -->
<!-- 立即入会模拟 -->
<u-popup v-model="show" mode="center" border-radius="24" width="560rpx" height="340rpx">
<view class="popup">
<view class="popupTitle">联系客服立即入会</view>
<view class="popupText">
客服微信:
<text class="textlv">{{info}}</text>
</view>
<view class="popupbutton flex justifyA">
<view class="closeBox" @click="close">取消</view>
<view class="openBox" @click="open(info)">一键复制</view>
</view>
</view>
</u-popup>
<!-- 立即入会模拟 -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
star_time: '',
youHuiState: '',
youHuiCenter: [], //后台数据最终版
guanzhu: 0,
is_xinrenBtn: true, //是不是新人
no_xinren: true, //不是新人
show: false, //入会模拟
info: '', //消息内容
isYouHuiJuan: false, //是否有优惠卷
ImgIsShow:false, // 图片显示异常
}
},
onShow() {
// this.isBorth();//是不是新人
this.getWechat();
this.youhuiCenterData();
},
onLoad() {},
methods: {
//获取客服微信
getWechat() {
this.$rqs('/api/index/wechat').then(res => {
this.info = res.data.data;
});
},
youhuiCenterData() {
let that = this;
that.$rqs('/api/coupon/index').then(res => {
let r = res.data.data
for(let key in r){
r[key].price = parseInt(r[key].price)
r[key].bottom_price = parseInt(r[key].bottom_price)
let s = r[key].start_time;
let e = r[key].end_time;
r[key].rr = (e - s) / 60 / 60 / 24;
}
that.youHuiCenter = r
this.ImgIsShow = true;
})
},
close() {
this.show = false;
},
open(info) {
let that = this
uni.setClipboardData({
data: info,
success() {
that.show = false
uni.showToast({
//提示
title: '复制成功',
duration: 1300
});
}
});
},
//优惠卷按钮的跳转事件
handle_guanzhuBtn(e,id,name) {
//e :是1否0领取, name:
// name = 1 领取 name = 2 入会 name = 3 去关注
if (name == 2 && !uni.getStorageSync('is_members')) {
let that = this;
console.log("点击了入会");
that.show = !that.show;
}else if(name == 2 && e == 1){
uni.showToast({
title: "已经入会,请在我的优惠卷中查看",
icon: 'none'
})
}
if (name == 3) {
//未关注情况
if (!uni.getStorageSync('is_focus')) {
uni.navigateTo({
url:'/pages/home/coupon/coupon'
})
} else {
console.log(0);
uni.showToast({
title: "已经关注,请在我的优惠卷中查看",
icon: 'none'
})
}
}
if (name == 1 && !e) {
let that = this;
let data = {
id: id
}
that.$rqs('/api/coupon/receive', data).then(res => {
if(res.data.code == 1){
console.log(res);
uni.showToast({
position: 'center',
title: "领取成功",
icon: "none"
})
}else{
if(res.data.code == 0){
uni.showToast({
title:res.data.msg,
icon:"error"
})
}
}
})
}else if(name == 1 && e == 1){
uni.showToast({
title:'领取成功,请在我的优惠券中心查看',
icon:'none'
})
}
}
}
}
</script>
<style>
page {
width: 100%;
height: 100%;
background-color: #EEEEEE;
}
.youHuiContents {
width: 100%;
height: 100%;
}
.no-Youhui {
height: 100%;
background-color: #FFFFFF;
box-sizing: border-box;
padding-top: 348rpx;
}
.no-youhuiBox {
width: 320rpx;
height: 388rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
margin: 0 auto;
}
.no-youhuiImg {
width: 320rpx;
height: 320rpx;
}
.no-youhui-text {
color: rgba(50, 50, 51, 1);
font-size: 28rpx;
font-weight: 500;
text-align: center;
}
.no-youhuiBox-wraper {
margin: 348rpx auto 0;
}
.have-yohui {
height: 100%;
box-sizing: border-box;
background-color: #ebebeb;
padding: 32rpx 32rpx 0;
}
/* 领卷模块 stra*/
.have-yohui-item {
width: 686rpx;
height: 200rpx;
margin-bottom: 24rpx;
}
.have-yohui-item-Bgimg {
height: 200rpx;
width: 686rpx;
}
.have-yohui-item-content {
display: flex;
top: 0;
left: 0;
}
.yohui-item-content-left {
width: 196rpx;
height: 200rpx;
display: flex;
align-items: center;
justify-content: center;
color: rgba(235, 195, 154, 1);
font-size: 60rpx;
font-weight: 600;
}
.yohui-item-content-right {
width: 490rpx;
height: 200rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 24rpx 32rpx 48rpx 32rpx;
}
.yohui-item-content-right-left {
display: flex;
flex-direction: column;
}
.yohui-item-content-right-left-Title {
height: 44rpx;
color: rgba(19, 26, 20, 0.85);
font-size: 32rpx;
font-weight: 500;
}
.yohui-item-content-right-left-Text {
margin-top: 20rpx;
height: 32rpx;
font-size: 24rpx;
font-weight: 400;
}
.yohui-item-content-right-right {}
.yohui-item-content-right-right-title {
display: flex;
flex-direction: column;
text-align: right;
color: #3E554E;
}
.yohui-item-content-right-right-btn {
width: 158rpx;
height: 48rpx;
border-radius: 72rpx;
margin-top: 40rpx;
border: 0.10rpx solid rgba(0.24313725531101227, 0.3333333432674408, 0.30588236451148987, 1);
line-height: 48rpx;
text-align: center;
color: #3E554E;
}
/* 领卷模块 end*/
.popup {
padding: 32rpx;
}
.popupTitle {
width: 526rpx;
height: 48rpx;
color: rgba(50, 50, 51, 1);
font-size: 32rpx;
font-weight: 600;
font-family: 'PingFang SC';
text-align: center;
line-height: 44rpx;
}
.popupText {
margin-top: 32rpx;
height: 44rpx;
color: rgba(50, 50, 51, 1);
font-size: 32rpx;
font-weight: 400;
font-family: 'PingFang SC';
text-align: center;
line-height: 44rpx;
}
.popupbutton {
margin-top: 60rpx;
}
.closeBox {
width: 200rpx;
height: 80rpx;
color: rgba(50, 50, 51, 1);
font-size: 28rpx;
font-weight: 400;
font-family: 'PingFang SC';
text-align: center;
line-height: 80rpx;
border: 1rpx solid #dcdee0;
background: rgba(255, 255, 255, 1);
}
.openBox {
width: 200rpx;
height: 80rpx;
color: #ffffff;
font-size: 28rpx;
font-weight: 400;
font-family: 'PingFang SC';
text-align: center;
line-height: 80rpx;
background: #3e554e;
}
</style>