choose_meal_f.html
8.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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title></title>
<script src="../../assets/js/fontsize.js"></script>
<!--<link rel="stylesheet" href="../../assets/css/api.css"/>-->
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<style>
body, html {
background-color: transparent !important;
height: 100%;
}
.meal {
display: flex;
flex-direction: column;
justify-content: flex-end;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.meal_title {
text-align: center;
color: #424242;
font-size: 15px;
font-weight: bold;
border-bottom: 1px solid #ccc;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.25rem;
}
.meal_price_box {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
color: #424242;
padding: 0.25rem 10% 0 10%;
}
.meal_price {
color: #d8b25f;
font-size: 9px;
margin-left: 0.1rem;
}
.incer {
color: #ccc;
font-size: 9px;
padding: 0 10%;
}
.sever_list {
display: flex;
align-items: center;
flex-wrap: wrap;
font-size: 12px;
padding: 0.25rem 10%;
}
.sever_list span {
background-color: #f2f2f2;
padding: 0.1rem 0.2rem;
margin: 0 0.2rem 0.2rem 0;
border-radius: 0.07rem;
}
.sever_list .span_active {
background-color: #dbb25f;
color: #fff;
}
.meal_item {
background-color: #fff;
}
.pay_box {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10% 0.25rem 10%;
}
.pay_num {
font-size: 12px;
color: #424242;
}
.pay_btn_box {
display: flex;
align-items: center;
}
.pay_btn_box .iconfont {
font-size: 20px;
color: #ccc;
}
.pay_btn_box input {
width: 0.5rem;
text-align: center;
border: 0;
outline: none;
font-size: 15px;
}
.pay_num .limit {
padding: 0;
font-size: 9px;
color: #ccc;
}
.price {
flex: 1;
text-align: right;
}
.price .meal_price {
font-size: 12px;
}
.price .old_price {
text-decoration: line-through;
color: #ccc;
margin-left: 0.1rem;
}
.pay_btn {
font-size: 15px;
color: #fff;
background-color: #dbb25f;
text-align: center;
padding: 0.2rem 0;
}
.icon-cuohao {
font-size: 15px;
color: #424242;
}
</style>
</head>
<body>
<div id="app" v-cloak>
<div @click="close" class="meal">
<div class="meal_item" @click.stop>
<div class="meal_title"><span></span><span>选择套餐</span><span class="iconfont icon-cuohao"
@click="close"></span></div>
<div class="meal_price_box">
<div><span>服务价格</span><span class="meal_price">优惠价格¥{{Math.abs(priceList.count)?Math.abs(priceList.count):0}}</span>
</div>
<div class="price"><span class="meal_price">¥{{priceList.price?priceList.price:0}}</span><span
class="old_price">原价¥{{priceList.o_price?priceList.o_price:0}}</span></div>
</div>
<div class="incer">此服务由慈界平台优质服务商提供</div>
<div class="sever_list"><span :class="{'span_active':index==active_index}"
v-for="(item,index) in attribute"
@click="choose_sever(item,index)">{{item}}</span></div>
<div class="pay_box">
<span class="pay_num">购买数量 <span
class="limit">(限购<span>{{priceList.limit_num?priceList.limit_num:0}}</span>{{unit}})</span></span>
<div class="pay_btn_box">
<span class="iconfont icon-jian" @click="reduce"></span>
<input type="number" placeholder="" value="1" v-model="num">
<span class="iconfont icon-jikediancanicon09" @click="plus"></span>
</div>
</div>
<div class="pay_btn" @click="pay_go">确定</div>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/swiper-3.4.2.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
num: 1,
sever_list: [
],
active_index: -1,
active_name: '',
priceList: [],
attribute: [],
id: '',
unit: ''
},
created: function () {
apiready = function () {
app.attribute = api.pageParam.attribute;
app.id = api.pageParam.id;
app.unit = api.pageParam.unit;
}
},
methods: {
close: function () {
api.closeFrame();
},
choose_sever: function (attr, index) {
app.active_index = index;
app.active_name = app.attribute[index];
app.attribute_id = app.attribute[index].id;
var post = {
id: app.id,
attribute: attr
};
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'portal/Goods/getPrice', post, header).then(function (res) {
// alert(JSON.stringify(res))
if (res.data.code == 1) {
app.priceList = res.data.data;
} else {
toastMsg(res.msg)
}
})
app.num = 1;
},
reduce: function () {
if (app.num > 1) {
app.num--
}
},
plus: function () {
if (app.num < app.priceList.limit_num) {
app.num++
} else {
toastMsg('不能超过最大限购哦')
}
},
pay_go: function () {
if (app.active_name != '') {
api.sendEvent({
name: 'meal',
extra: {
meal: app.active_name,
num: app.num > app.priceList.limit_num ? app.priceList.limit_num : app.num,
price: app.priceList.price,
attribute_id: app.priceList.attribute_id
}
});
app.close()
} else {
toastMsg('请选择套餐类型')
}
}
}
})
</script>