Blame view

ceres-uniapp-master/pages_category_page1/coupon/22.vue 6.49 KB
b1d468f9   李宇   1
1
  <template>
8db25941   李宇   2
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
  	<view class="couponList u-skeleton">
  		<Skeleton el-color="#efefef" bg-color="#fff" :loading="loading && isFirstComeIn" :animation="true" />
  		<template v-if="couponList.length>0">
  			<view class="couponItem u-skeleton-fillet flex-items" v-for="item of couponList" :key="item.couponId">
  				<view class="itemLeft u-skeleton-fillet" @click="goProductList(item)">
  					<view class="topIcon"></view>
  					<view class="bottomIcon"></view>
  					<view class="price flex-items">
  						<view class="flex-column flex-end unitBox" v-if="item.discountMode === 1">
  							<view class="unit">¥</view>
  						</view>
  						<view class="priceValue">{{ item.reduceMoney }}{{ item.discountMode === 1 ? '' : '折' }}</view>
  					</view>
  					<text class="fs24 font-color-999">满{{ item.fullMoney }}元可用</text>
  				</view>
  				<view class="itemRight u-skeleton-fillet">
  					<view class="topInfo flex-items flex-sp-between">
  						<view @click="goProductList(item)">
  							<view class="couponTit fs32 font-color-FFF">{{ item.activityName }}</view>
  							<view class="couponDate fs24 font-color-999">{{ item.endTime }}到期</view>
  						</view>
  						<view class="exchangeBtnBox flex-column flex-end">
  							<view class="exchangeBtn fs24 font-color-FFF" v-if="item.state === 0">已领取
  							</view>
  							<wx-send-coupon v-else @success="success" :couponList="[item]">
  								<view class="exchangeBtn fs24 font-color-FFF">{{ item.ifCredit ? '立即兑换' : '立即领取' }}
  								</view>
  							</wx-send-coupon>
  						</view>
  					</view>
  					<view @click="goProductList(item)" class="couponType fs28 font-color-FFF">
  						{{ item.discountMode === 1 ? '满减券' : '折扣券' }}
  					</view>
  				</view>
  			</view>
  			<!-- 触底 -->
  			<view class="reachBottom" v-if="topLeft > 400 && couponList.length>0">
726bc80b   杨鑫   最新
39
  				<image class="reach-icon" src="https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/img//reachBottom.png"
8db25941   李宇   2
40
41
42
43
44
45
  					mode="widthFix"></image>
  				<text class="reach-text">这里到底了哦~~</text>
  			</view>
  		</template>
  		<Empty :show="couponList.length<=0" />
  	</view>
b1d468f9   李宇   1
46
47
48
  </template>
  
  <script>
8db25941   李宇   2
49
50
51
  	import Skeleton from "../../components/Skeleton";
  	import Empty from "../../components/Empty";
  	import WxSendCoupon from "../../components/wx/wxSendCoupon";
b1d468f9   李宇   1
52
  
8db25941   李宇   2
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
  	const NET = require('../../utils/request')
  	const API = require('../../config/api')
  	export default {
  		name: "list",
  		components: {
  			WxSendCoupon,
  			Empty,
  			Skeleton
  		},
  		data() {
  			return {
  				loading: false,
  				isFirstComeIn: true,
  				couponList: [{}, {}, {}, {}, {}, {}], // 优惠券列表getCoupons
  				page: 1,
  				pageSize: 10,
  				loadingType: 0,
  				topLeft: 0
  			}
  		},
  		onLoad() {
  			this.getCouponList()
  		},
  		onReachBottom() {
  			if (this.loadingType == 1) {
  				uni.stopPullDownRefresh()
  			} else {
  				this.page = this.page + 1
  				this.getCouponList()
  			}
  		},
  		onPageScroll(e) {
  			this.topLeft = e.scrollTop
  		},
  		methods: {
  			getCouponList() {
  				// uni.showLoading({
  				//   mask: true,
  				//   title: '加载中...'
  				// })
  				this.loading = true
  				NET.request(API.youhuiquan, {
  					page: this.page,
  					pageSize: this.pageSize,
  					shopId: 154
  				}, 'GET').then(res => {
  					uni.hideLoading()
  					if (res.data.length === 0) {
  						this.loadingType = 1
  					} else {
  						this.couponList = this.couponList.concat(res.data)
  						this.$forceUpdate()
  					}
  					this.couponList = this.couponList.filter(item => JSON.stringify(item) !== '{}')
  					this.loading = false
  					this.isFirstComeIn = false
  				}).catch(res => {
  					uni.hideLoading()
  				})
  				// NET.request(API.getCoupons, {
  				//   page: this.page,
  				//   pageSize: this.pageSize
  				// }, 'GET').then(res => {
  				//   uni.hideLoading()
  				//   if (res.data.list.length === 0) {
  				//     this.loadingType = 1
  				//   } else {
  				//     this.couponList = this.couponList.concat(res.data.list)
  				//     this.$forceUpdate()
  				//   }
  				//   this.couponList = this.couponList.filter(item => JSON.stringify(item) !== '{}')
  				//   this.loading = false
  				//   this.isFirstComeIn = false
  				// }).catch(res => {
  				//   uni.hideLoading()
  				// })
  			},
  			// 跳转到可用商品列表
  			goProductList(item) {
  				console.log(item, 'test')
  				uni.navigateTo({
  					url: `../coupon/product?id=${ item.couponId }&actId=${item.activityId}`
  				})
  			},
  			success() {
  				this.page = 1
  				this.couponList = []
  				this.getCouponList()
  			}
  		}
  	}
b1d468f9   李宇   1
144
145
  </script>
  
8db25941   李宇   2
146
147
148
  <style lang="scss" scoped>
  	page {
  		background: #F8F8F8;
b1d468f9   李宇   1
149
  
8db25941   李宇   2
150
151
152
  		.couponList {
  			padding: 0 20rpx 40upx;
  			margin-top: 30rpx;
b1d468f9   李宇   1
153
  
8db25941   李宇   2
154
155
156
157
158
  			.couponItem {
  				background: #333333;
  				margin-top: 40rpx;
  				padding: 25rpx 35rpx;
  				overflow: hidden;
726bc80b   杨鑫   最新
159
  				background-image: url("https://zhgw-uat.028wlkj.com/cdwlMall/zsfwzxt/file/static/images/borderIcon.png");
8db25941   李宇   2
160
161
162
  				background-repeat: no-repeat;
  				background-size: contain;
  				background-position: right top;
b1d468f9   李宇   1
163
  
8db25941   李宇   2
164
165
166
167
168
  				.itemLeft {
  					padding-right: 10rpx;
  					position: relative;
  					border-right: 2rpx dashed #666666;
  					width: 170rpx;
b1d468f9   李宇   1
169
  
8db25941   李宇   2
170
171
172
173
174
175
176
177
178
  					.topIcon {
  						position: absolute;
  						right: -16rpx;
  						top: -50rpx;
  						width: 32rpx;
  						height: 32rpx;
  						background: #FFFFFF;
  						border-radius: 50%;
  					}
b1d468f9   李宇   1
179
  
8db25941   李宇   2
180
181
182
183
184
185
186
187
188
  					.bottomIcon {
  						position: absolute;
  						right: -16rpx;
  						bottom: -50rpx;
  						width: 32rpx;
  						height: 32rpx;
  						background: #FFFFFF;
  						border-radius: 50%;
  					}
b1d468f9   李宇   1
189
  
8db25941   李宇   2
190
191
192
193
194
195
  					//.price {
  					//  width: 100rpx;
  					//}
  					.unitBox {
  						height: 70rpx;
  					}
b1d468f9   李宇   1
196
  
8db25941   李宇   2
197
198
199
200
  					.unit {
  						color: #FFEBC4;
  						font-size: 36rpx;
  					}
b1d468f9   李宇   1
201
  
8db25941   李宇   2
202
203
204
205
206
  					.priceValue {
  						font-size: 52rpx;
  						color: #FFEBC4;
  					}
  				}
b1d468f9   李宇   1
207
  
8db25941   李宇   2
208
209
210
  				.itemRight {
  					padding-left: 45rpx;
  					flex: 1;
b1d468f9   李宇   1
211
  
8db25941   李宇   2
212
213
214
215
  					.topInfo {
  						padding-bottom: 10rpx;
  						border-bottom: 2rpx solid #444444;
  						margin-bottom: 10rpx;
b1d468f9   李宇   1
216
  
8db25941   李宇   2
217
218
219
  						.couponDate {
  							width: 300rpx;
  						}
b1d468f9   李宇   1
220
  
8db25941   李宇   2
221
222
223
224
  						.exchangeBtnBox {
  							width: 110rpx;
  							height: 70rpx;
  							text-align: center;
b1d468f9   李宇   1
225
  
8db25941   李宇   2
226
227
228
229
230
231
232
233
234
  							.exchangeBtn {
  								padding: 5rpx;
  								border: 2rpx solid #999999;
  							}
  						}
  					}
  				}
  			}
  		}
b1d468f9   李宇   1
235
  
8db25941   李宇   2
236
237
238
239
240
241
242
243
244
245
  		.Put-box1 {
  			.btn {
  				text-align: center;
  				margin-top: 40rpx;
  				border: 2rpx solid #333333;
  				height: 80upx;
  				line-height: 80upx;
  				width: 100%;
  				color: #333333;
  			}
b1d468f9   李宇   1
246
  
8db25941   李宇   2
247
248
249
250
251
252
253
  			.submit {
  				background-color: #333333;
  				color: #FFEBC4;
  				margin-left: 20rpx;
  			}
  		}
  	}
b1d468f9   李宇   1
254
  
8db25941   李宇   2
255
256
257
258
259
260
  	// 触底样式
  	.reachBottom {
  		margin-top: 30rpx;
  		display: flex;
  		flex-direction: column;
  		align-items: center;
b1d468f9   李宇   1
261
  
8db25941   李宇   2
262
263
264
265
  		.reach-icon {
  			width: 150rpx;
  			height: 150rpx;
  		}
b1d468f9   李宇   1
266
  
8db25941   李宇   2
267
268
269
270
271
272
  		.reach-text {
  			margin: 20rpx 0;
  			color: #CCCCCC;
  		}
  	}
  </style>