Blame view

src/pages/cart/cart.vue 9.62 KB
0db291810   BigBoss   “-mcomfirmOder页面
1
2
  <template>
  	<view class="content">
ab4209caf   喻鹏   update
3
4
5
  		
  		<view class="card">
  			<view class="cardHeader">
ab4209caf   喻鹏   update
6
7
8
  				<block v-if="pIsoPen">
  					<view class="partentChecked" @click="pChange(pIsoPen)">
  						<span class="status correct"></span>
6111092e8   BigBoss   update cart
9
  					</view>
ab4209caf   喻鹏   update
10
11
12
13
14
15
16
17
18
  				</block>
  				<block v-else>
  					<view class="partentCheck" @click="pChange(pIsoPen)"></view>
  				</block>
  				<image src="../../static/store.png" mode="aspectFill"></image>
  				<text>非常戴镜</text>
  			</view>
  			
  			<view class="cardBody">
ab4209caf   喻鹏   update
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  				<template v-if="childIsOpen.child1">
  					<view class="partentChecked" @click="cChange(childIsOpen.child1,'child1')">
  						<span class="status correct"></span>
  					</view>
  				</template>
  				<template v-else>
  					<view class="partentCheck" @click="cChange(childIsOpen.child1,'child1')"></view>
  				</template>
  				<view class="goodInfo">
  					<view class="imageWrap">
  						<image src="../../static/img/detail/d1.png" mode="aspectFill" style="width: 188rpx;height: 168rpx;"></image>
  					</view>
  					<view class="infoRight">
  						<text class="goodName">眼镜名称眼镜名称眼镜名称眼镜名称</text>
  						<view class="describ"><text>颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 … </text>
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
34
  						<view class="icon"></view>
ab4209caf   喻鹏   update
35
36
  						</view>
  						<view class="priceBox">
eab89b254   喻鹏   updates
37
  							<view class="price">¥{{198}}</view>
ab4209caf   喻鹏   update
38
39
40
41
42
  							<text>(限购{{maxCount}}副)</text>
  							<view class="counter">
  								<view class="btn" disabled="this.addDisabled" type="default" @click="counter(false)">-</view>
  								<text>{{count}}</text>
  								<view class="btn" disabled="this.desDisabled" type="default" @click="counter(true)">+</view>
6111092e8   BigBoss   update cart
43
44
45
46
  							</view>
  						</view>
  					</view>
  				</view>
ab4209caf   喻鹏   update
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  			</view>
  		<view class="cardBody">
  			<!-- <MyCheckbox :isOpenProp="controlCheck.child1"></MyCheckbox> -->
  			<template v-if="childIsOpen.child2">
  				<view class="partentChecked" @click="cChange(childIsOpen.child2,'child2')">
  					<span class="status correct"></span>
  				</view>
  			</template>
  			<template v-else>
  				<view class="partentCheck" @click="cChange(childIsOpen.child2,'child2')"></view>
  			</template>
  			<view class="goodInfo">
  				<view class="imageWrap">
  					<image src="../../static/img/detail/d1.png" mode="aspectFill" style="width: 188rpx;height: 168rpx;"></image>
  				</view>
  				<view class="infoRight">
  					<text class="goodName">眼镜名称眼镜名称眼镜名称眼镜名称</text>
  					<view class="describ"><text>颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 … </text>
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
65
  					<view class="icon"></view>
ab4209caf   喻鹏   update
66
67
  					</view>
  					<view class="priceBox">
eab89b254   喻鹏   updates
68
  						<view class="price">¥198</view>
ab4209caf   喻鹏   update
69
70
71
72
73
74
75
76
77
78
79
  						<text>(限购{{maxCount}}副)</text>
  						<view class="counter">
  							<view class="btn" disabled="this.addDisabled" type="default" @click="counter(false)">-</view>
  							<text>{{count}}</text>
  							<view class="btn" disabled="this.desDisabled" type="default" @click="counter(true)">+</view>
  						</view>
  					</view>
  				</view>
  			</view>
  		</view>
  		</view>
6111092e8   BigBoss   update cart
80
81
82
83
  		
  		<view class="footer">
  			<view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view>
  			<view class="footerRight">
ab4209caf   喻鹏   update
84
85
86
  				<navigator url="/pages/myOrderPaying/myOrderPaying" hover-class="navigator-hover">
  					<view class="paybtn">立即支付</view>
  				</navigator>
6111092e8   BigBoss   update cart
87
  			</view>
0db291810   BigBoss   “-mcomfirmOder页面
88
  		</view>
ab4209caf   喻鹏   update
89
  		
0db291810   BigBoss   “-mcomfirmOder页面
90
91
92
93
  	</view>
  </template>
  
  <script>
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
94
95
  	import store from '@/store';
  	
0db291810   BigBoss   “-mcomfirmOder页面
96
  	export default {
ab4209caf   喻鹏   update
97
  
0db291810   BigBoss   “-mcomfirmOder页面
98
99
  		data() {
  			return {
6111092e8   BigBoss   update cart
100
101
102
  				totalPrice: 360,
  				count:1,
  				maxCount:20,
ab4209caf   喻鹏   update
103
104
105
106
107
  				pIsoPen: false,
  				childIsOpen:{
  					"child1":true,
  					"child2":true
  				},
0db291810   BigBoss   “-mcomfirmOder页面
108
109
  			}
  		},
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
110
111
112
113
114
115
116
117
118
119
120
121
  		computed:{
  			cartList() {
  			  // 也可以从 getters 获取
  			    console.log('cart-list', this.$store.state.cart.cartList);
  			    return this.$store.state.cart.cartList;
  			}
  		},
  		onLoad: function() {
  			store.dispatch('cart/getCartList',{
  				uid: 1, //用户id
  			});
  		},
0db291810   BigBoss   “-mcomfirmOder页面
122
  		methods: {
6111092e8   BigBoss   update cart
123
124
125
126
127
128
129
  			counter(isadd){
  				if(isadd){
  					this.count >= this.maxCount? this.addDisabled = true:this.count++;
  				}else{
  					this.count <= 1? this.desDisabled = true:this.count--;
  				}
  			},
ab4209caf   喻鹏   update
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
  			pChange(isopen){
  				// console.log(isopen)
  				this.pIsoPen=!isopen
  				this.childIsOpen.child1=!isopen
  				this.childIsOpen.child2=!isopen
  			},
  			cChange(isopen,child){
  				// console.log(child)
  				if(child==='child1'){
  					this.childIsOpen.child1=!isopen
  				}
  				if(child==='child2'){
  					this.childIsOpen.child2=!isopen
  				}
  			}
0db291810   BigBoss   “-mcomfirmOder页面
145
146
147
148
  		}
  	}
  </script>
  
6111092e8   BigBoss   update cart
149
  <style lang="scss">
0db291810   BigBoss   “-mcomfirmOder页面
150
  	.content {
6111092e8   BigBoss   update cart
151
  		min-height: 100vh;
ab4209caf   喻鹏   update
152
  		background-color: #f2f2f2;
0db291810   BigBoss   “-mcomfirmOder页面
153
154
155
  		display: flex;
  		flex-direction: column;
  		align-items: center;
6111092e8   BigBoss   update cart
156
157
158
159
  		justify-content: space-between;
  		padding: 20rpx 40rpx;
  		box-sizing: border-box;
  		
ab4209caf   喻鹏   update
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
  		.partentCheck{
  			width: 16px;
  			height: 16px;
  			border-radius: 18px;
  			border: 1px solid #CFCFCF;
  			background-color: #FFFFFF;
  		}
  		.partentChecked{
  			width: 18px;
  			height: 18px;
  			border-radius: 18px;
  			background-color: #FF6B4A;
  			.correct {
  				display: inline-block;
  				width: 5px;
  				height: 1px;
  				background: #FFFFFF;
  				line-height: 0;
  				font-size: 0;
  				position: relative;
eab89b254   喻鹏   updates
180
  				top: -6px;
ab4209caf   喻鹏   update
181
182
183
184
185
186
187
188
189
190
191
192
193
  				left: 4px;
  				-webkit-transform: rotate(45deg);
  			}
  			.correct:after {
  				content: '/';
  				display: block;
  				width: 8px;
  				height: 1px;
  				background: #FFFFFF;
  				-webkit-transform: rotate(-90deg) translateY(50%) translateX(50%);
  			}
  		}
  		
6111092e8   BigBoss   update cart
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
  		.card{
  			background-color: #FFFFFF;
  			border-radius: 16rpx;
  			box-sizing: border-box;
  			padding: 36rpx 36rpx 36rpx 18rpx;
  			display: flex;
  			flex-direction: column;
  			align-items: center;
  			justify-content: space-between;
  			.cardHeader{
  				width: 100%;
  				height: 36rpx;
  				display: flex;
  				align-items: center;
  				justify-content: flex-start;
  				image{
  					height: 32rpx;
  					width: 32rpx;
ab4209caf   喻鹏   update
212
213
214
215
216
217
218
219
  					padding-left: 6px;
  					padding-right: 10px;
  				}
  				text{
  					// font-family: PingFangSC-Regular;
  					font-size: 14px;
  					color: #333333;
  					letter-spacing: -0.26px;
6111092e8   BigBoss   update cart
220
221
222
223
224
225
226
227
228
229
230
231
232
  				}
  			}
  			.cardBody{
  				width: 100%;
  				height: 300rpx;
  				display: flex;
  				align-items: center;
  				justify-content: space-between;
  				.goodInfo{
  					width: 95%;
  					display: flex;
  					flex-direction: row;
  					justify-content: flex-start;
ab4209caf   喻鹏   update
233
  					padding-left: 6px;
6111092e8   BigBoss   update cart
234
235
236
  					.imageWrap{
  						height: 188rpx;
  						width: 188rpx;
ab4209caf   喻鹏   update
237
  						margin-right: 28rpx;
6111092e8   BigBoss   update cart
238
  						image{
ab4209caf   喻鹏   update
239
  							border-radius: 4px;
6111092e8   BigBoss   update cart
240
241
242
243
244
245
246
247
248
  							height: 188rpx;
  							width: 188rpx;
  						}
  					}
  					.infoRight{
  						display: flex;
  						flex-direction: column;
  						align-items: flex-start;
  						justify-content: space-between;
ab4209caf   喻鹏   update
249
  						height: 240rpx;
6111092e8   BigBoss   update cart
250
251
252
253
254
255
256
257
258
259
260
261
  						.goodName{
  							font-size: 28rpx;
  							color: #333333;
  						}
  						.describ{
  							width: 100%;
  							height: 80rpx;
  							box-sizing: border-box;
  							padding: 10rpx;
  							font-size: 20rpx;
  							color: #999999;
  							background: #F2F2F2;
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
262
263
264
  							display: flex;
  							justify-content: center;
  							align-items: center;
6111092e8   BigBoss   update cart
265
266
267
268
269
270
271
272
273
274
275
  							text{
  								 text-overflow: -o-ellipsis-lastline;
  								  overflow: hidden;
  								  text-overflow: ellipsis;
  								  display: -webkit-box;
  								  -webkit-line-clamp: 2;
  								  line-clamp: 2;
  								  -webkit-box-orient: vertical;
  							}
  							// .icon{
  							// 	transform: rotate(90deg);
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
276
277
278
  							// 	height: 13px;
  							// 	width: 20px;
  
6111092e8   BigBoss   update cart
279
  							// }
7d2bdf29e   喻鹏   修改镜片选购逻辑 添加购物车和用户...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
  							.icon{
  							width: 0;
  							height: 0;
  							border-left: 5px transparent;
  							border-right: 5px transparent;
  							border-top: 5px #979797;
  							border-bottom: 0 transparent;
  							border-style: solid;
  							position: relative;
  							margin-left: 10px;
  							// transform: scaleY(-1);
  							}
  							.icon::after{
  							    content: '';
  							    position: absolute;
  							    top: -6.5px;
  							    left: -5px;
  								border-left: 5px transparent;
  								border-right: 5px transparent;
  								border-top: 5px #FFFFFF;
  								border-bottom: 0 transparent;
  								border-style: solid;
  							}
6111092e8   BigBoss   update cart
303
304
305
306
307
  						}
  						.priceBox{
  							display: flex;
  							justify-content: space-between;
  							align-items: center;
ab4209caf   喻鹏   update
308
  							// margin-top: 26px;
6111092e8   BigBoss   update cart
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
  							width: 100%;
  							font-size: 14px;
  							color: #999999;
  							.price{
  								color: #FF6B4A;
  								font-size: 28rpx;
  							}
  							.counter{
  								display: flex;
  								flex-direction: row;
  								justify-content: space-between;
  								align-items: center;
  								font-size: 28rpx;
  								color: #333333;
  								width: 122rpx;
  								.btn{
  									display: flex;
  									justify-content: center;
  									line-height: 32rpx;
  									height: 32rpx;
  									width: 32rpx;
  									background-color: #F2F2F2;
  									color: #CFCFCF;
  								}
  							}
  						}
  					}
  				}
  			}
  		}
  		
  		.footer{
  			position: fixed;
  			left: 0;
eab89b254   喻鹏   updates
343
  			bottom: 0px;
6111092e8   BigBoss   update cart
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
  			height: 112rpx;
  			width: 100%;
  			background-color: #FFFFFF;
  			font-size: 16px;
  			display: flex;
  			justify-content: space-between;
  			align-items: center;
  			.footerLeft{
  				display: flex;
  				justify-content: center;
  				align-items: center;
  				width: 50%;
  				color: #333333;
  				text{
  					color: #FF6B4A;
  				}
  			}
  			.footerRight{
  				display: flex;
  				justify-content: flex-end;
  				align-items: center;
  				width: 50%;
  				margin-right: 26rpx;
  				.paybtn{
  					display: flex;
  					justify-content: center;
  					align-items: center;
  					background: #FF6B4A;
  					border-radius: 20px;
  					border-radius: 20px;
  					color: #FFFFFF;
  					width: 204rpx;
  					height: 80rpx;
  				}
  			}
  				
  		}
0db291810   BigBoss   “-mcomfirmOder页面
381
  	}
6111092e8   BigBoss   update cart
382
  	
ab4209caf   喻鹏   update
383
384
  	
  	
a2408fc3f   BigBoss   init
385
  </style>