couponUseLayer.vue 2.56 KB
<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>