Merge pull request 'zhy' (#254) from zhy into master
Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/254
This commit is contained in:
		
						commit
						080f0c6d86
					
				| @ -271,12 +271,13 @@ export default { | |||||||
| 				}); | 				}); | ||||||
| 			}, | 			}, | ||||||
| 			// 我的优惠券(已有的)
 | 			// 我的优惠券(已有的)
 | ||||||
| 			getMemberCouponList({ store_id, gc_id, type, status }) { | 			getMemberCouponList({ store_id, gc_id, type, status, page }) { | ||||||
| 				return vm.$u.post('Coupon/getMemberCouponList', { | 				return vm.$u.post('Coupon/getMemberCouponList', { | ||||||
| 					store_id: store_id, | 					store_id: store_id, | ||||||
| 					gc_id: gc_id, | 					gc_id: gc_id, | ||||||
| 					type: type, | 					type: type, | ||||||
| 					status: status, | 					status: status, | ||||||
|  | 					page: page, | ||||||
| 				}); | 				}); | ||||||
| 			}, | 			}, | ||||||
| 			// 获取直播列表
 | 			// 获取直播列表
 | ||||||
|  | |||||||
| @ -3,13 +3,14 @@ | |||||||
| 		<u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="32" :show-bar="false" @change="tabsChange" height="88" ></u-tabs-swiper> | 		<u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="32" :show-bar="false" @change="tabsChange" height="88" ></u-tabs-swiper> | ||||||
| 		<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }"> | 		<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }"> | ||||||
| 			<swiper-item class="swiper-item" v-for="(_, index) in list" :key="index"> | 			<swiper-item class="swiper-item" v-for="(_, index) in list" :key="index"> | ||||||
| 				<scroll-view scroll-y class="scroll-coupon"> | 				<scroll-view scroll-y class="scroll-coupon" @scrolltolower="onreachBottom"> | ||||||
| 					<view v-if="couponList[index]"> | 					<view v-if="couponList[index]"> | ||||||
| 						<view class="coupon-item" v-for="(coupon, c_index) in couponList[index]" :key="c_index"> | 						<view class="coupon-item" v-for="(coupon, c_index) in couponList[index]" :key="c_index"> | ||||||
| 							<Coupon :couponInfo="coupon" :status='index' @use="useCoupon($event)" :goodsClass="goodsClass"></Coupon> | 							<Coupon :couponInfo="coupon" :status='index' @use="useCoupon($event)" :goodsClass="goodsClass"></Coupon> | ||||||
| 						</view> | 						</view> | ||||||
| 					</view> | 					</view> | ||||||
| 					<u-empty text="暂无优惠券" mode="coupon" v-if="!couponList[index] || !couponList[index].length"></u-empty> | 					<u-empty text="暂无优惠券" mode="coupon" v-if="!couponList[index] || !couponList[index].length"></u-empty> | ||||||
|  | 					<u-loadmore :status="loadStatus[current]" bgColor="#FFFFFF" font-size="14" margin-top="20" margin-bottom="20" @loadmore="onreachBottom" v-if="!couponList[index] || couponList[index].length>=pageSize"></u-loadmore> | ||||||
| 				</scroll-view> | 				</scroll-view> | ||||||
| 			</swiper-item> | 			</swiper-item> | ||||||
| 		</swiper> | 		</swiper> | ||||||
| @ -32,6 +33,10 @@ export default { | |||||||
| 			swiperHeight: '', | 			swiperHeight: '', | ||||||
| 			couponList: [], | 			couponList: [], | ||||||
| 			goodsClass: [], | 			goodsClass: [], | ||||||
|  | 			pageSize: 6, | ||||||
|  | 			page: 0, | ||||||
|  | 			timer: true, | ||||||
|  | 			loadStatus: ['loadmore', 'loadmore', 'loadmore'], | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
| 	components: { | 	components: { | ||||||
| @ -46,8 +51,7 @@ export default { | |||||||
| 	}, | 	}, | ||||||
| 	watch: { | 	watch: { | ||||||
| 		current(value) { | 		current(value) { | ||||||
| 			let status = value + 1; | 			this.getMemberCouponList(value); | ||||||
| 			this.getMemberCouponList(status); |  | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
| 	methods: { | 	methods: { | ||||||
| @ -56,20 +60,34 @@ export default { | |||||||
| 				this.goodsClass = res.data; | 				this.goodsClass = res.data; | ||||||
| 			}) | 			}) | ||||||
| 		}, | 		}, | ||||||
| 		getMemberCouponList(current) { | 		async getMemberCouponList({ load = 'reload' }) { | ||||||
| 			this.$u.api.getMemberCouponList({ | 			const res = await this.$u.api.getMemberCouponList({ | ||||||
| 				status: current | 				status: this.current + 1, // 代金券状态 1:未用 2:已用 3:过期 4:收回 | ||||||
| 			}).then(res => { | 				page: this.page, | ||||||
| 				if(res.errCode == 0) { | 			}) | ||||||
| 					this.couponList[this.current] = res.data; | 			this.timer = true; | ||||||
| 				} else { | 			if(load == 'reload') this.couponList[this.current] = res.data; | ||||||
| 					this.couponList[this.current] = []; | 			else if(load == 'loadmore') this.couponList[this.current].push(...res.data); | ||||||
| 				} |  | ||||||
| 			this.$forceUpdate(); | 			this.$forceUpdate(); | ||||||
|  | 			// console.log(this.couponList); | ||||||
|  | 			return res.data.length; | ||||||
|  | 		}, | ||||||
|  | 		onreachBottom() { | ||||||
|  | 			if(!this.timer) return false; | ||||||
|  | 			this.timer = false; | ||||||
|  | 			this.loadStatus.splice(this.current, 1, "loading"); | ||||||
|  | 			this.page++; | ||||||
|  | 			this.getMemberCouponList({ load: 'loadmore' }).then(length => { | ||||||
|  | 				this.loadStatus.splice(this.current, 1, "nomore"); | ||||||
|  | 				if(length == 0) this.page--; | ||||||
|  | 			}).catch(() => { | ||||||
|  | 				this.loadStatus.splice(this.current, 1, "nomore"); | ||||||
|  | 				console.log(this.loadStatus[this.current]); | ||||||
|  | 				this.page--; | ||||||
| 			}) | 			}) | ||||||
| 		}, | 		}, | ||||||
| 		useCoupon(coupon) { | 		useCoupon(coupon) { | ||||||
| 			console.log(coupon); | 			// console.log(coupon); | ||||||
| 			// if(coupon.type == 1) { | 			// if(coupon.type == 1) { | ||||||
| 			// 	this.$u.route({ | 			// 	this.$u.route({ | ||||||
| 			// 		type: 'switchTab', | 			// 		type: 'switchTab', | ||||||
|  | |||||||
| @ -293,8 +293,12 @@ export default { | |||||||
| 			this.loadStatu = "loading"; | 			this.loadStatu = "loading"; | ||||||
| 			this.page++; | 			this.page++; | ||||||
| 			this.getOrderList({ load: 'loadmore' }).then(length => { | 			this.getOrderList({ load: 'loadmore' }).then(length => { | ||||||
|  | 				if(length == 0) { | ||||||
|  | 					this.page--; | ||||||
| 					this.loadStatu = "nomore"; | 					this.loadStatu = "nomore"; | ||||||
| 				if(length == 0) this.page--; | 				} else { | ||||||
|  | 					this.loadStatu = "loadmore"; | ||||||
|  | 				} | ||||||
| 			}).catch(() => { | 			}).catch(() => { | ||||||
| 				this.loadStatu = "nomore"; | 				this.loadStatu = "nomore"; | ||||||
| 				this.page--; | 				this.page--; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user