couponUseLayer.vue
2.56 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
<template>
<view class="coupon-use-layer">
ajsdklfjalksdjflakjsdflkajsdlfkjalskdfjalskdjf
<view class="layer-box" @tap="hideLayer">
<view class="box" @tap="stopPropagation">
<view class="main-box">
<view class="bg-box">
<image src="/static/img/coupon_use_bg.png" class="img"></image>
</view>
<view class="quota-box">
<view class="title-box">
<text class="title">获得</text>
<text class="number">{{quota.discount}}</text>
<text class="title">元店铺优惠券</text>
</view>
<view class="sub-title-box">
<text class="title">满</text>
<text class="number">{{quota.filled}}</text>
<text class="title">元可用</text>
</view>
</view>
<view class="buttons-box">
<view class="buttons-center-box">
<view class="btn btn-gray-out">
<button class="func-button" @tap="hideLayer">
<text class="text">继续抢</text>
</button>
</view>
<view class="btn btn-gray">
<button class="func-button" @tap="go(coupons)">
<text class="text">去使用</text>
</button>
</view>
</view>
</view>
</view>
<view class="close-box" @tap="hideLayer">
<image src="/static/img/close_layer.png" class="img"></image>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data: function () {
return {
isShow: true,
stop: false
}
},
props: ["coupons", "quota", "funcs"],
methods: {
/**
* 显示提示用户升级层
*/
showLayer() {
// 设置浮层显示
this.isShow = true;
},
/**
* 隐藏提示用户升级层
*/
hideLayer() {
// 判断是否阻止事件冒泡
if (!this.stop) {
// 设置浮层隐藏
this.isShow = false;
} else {
// 恢复阻止事件冒泡变量
this.stop = false;
}
},
/**
* 阻止事件冒泡
*/
stopPropagation() {
// 阻止事件冒泡
this.stop = true;
},
/**
* 使用优惠券
*/
go(item) {
// 判断是否有参数
if (item) {
// 隐藏提示框
this.isShow = false;
if (typeof this.funcs === "object" && typeof this.funcs.go === "object" && typeof this.funcs.go.func === "function") {
this.funcs.go.func(item);
}
}
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less">
@import './coupon_use_layer';
</style>