123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <template>
- <view class="mask" :class="!maskState ? 'none' : maskState ? 'show' : ''">
- <view class="shadow-bg"></view>
- <view class="mask-content" @click.stop.prevent="stopPrevent">
- <view class="dont-use"><text @click="dontUse">不使用优惠券</text></view>
- <!-- 优惠券页面,仿mt -->
- <view class="coupon-item" v-for="(item, index) in discountList" :key="index" @click="selCoupon(item)">
- <view class="con">
- <view class="left">
- <text class="title">{{ item.name }}</text>
- <text class="time">有效期至{{ $_utils.formatDate(item.endTime, 'yyyy-MM-dd') }}</text>
- </view>
- <view class="right">
- <text class="price">{{ item.reducePrice }}</text>
- <text v-if="item.minPrice==='不限金额'||Number(item.minPrice)===0">无门槛使用</text>
- <text v-else>满{{item.minPrice}}元可用</text>
- </view>
- <view class="circle l"></view>
- <view class="circle r"></view>
- </view>
- <text class="tips">
- {{ item.applyRange === 10 ? '全店商品通用' : item.applyRange === 20 ? '指定分类商品可用' : item.applyRange === 30 ? '指定品牌商品可用' : '' }}
- </text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- maskState: {
- type: Boolean,
- default: false
- },
- discountList: {
- type: Array,
- default: () => {
- return [];
- }
- }
- },
- onLoad() {
- this.discountList()
- },
- data() {
- return {}
- },
- methods: {
- stopPrevent() {},
- //不使用优惠
- dontUse() {
- this.$emit('dontUse');
- },
- // 选择优惠券
- selCoupon(row) {
- this.$emit('selCoupon', row);
- }
- }
- };
- </script>
- <style lang="scss">
- /* 优惠券面板 */
- .mask {
- position: fixed;
- left: 0;
- top: 100%;
- // bottom: 0;
- width: 100%;
- // background: rgba(0, 0, 0, 0);
- z-index: 9995;
- height: 100vh;
- transition: 0.3s;
- .shadow-bg {
- background: rgba(0, 0, 0, 0.4);
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100vh;
- }
- .mask-content {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- min-height: 30vh;
- max-height: 70vh;
- background: #f3f3f3;
- z-index: 9995;
- // transform: translateY(100%);
- transition: 0.3s;
- overflow-y: scroll;
- .dont-use {
- text-align: right;
- color: #666;
- font-size: 24upx;
- padding: 20upx 30upx;
- }
- }
- &.none {
- top: 100%;
- .shadow-bg {
- display: none;
- }
- .mask-content {
- transform: translateY(100%);
- }
- }
- &.show {
- top: 0;
- .shadow-bg {
- display: block;
- }
- .mask-content {
- transform: translateY(0);
- }
- }
- }
- /* 优惠券列表 */
- .coupon-item {
- display: flex;
- flex-direction: column;
- margin: 20upx 24upx;
- background: #fff;
- .con {
- display: flex;
- align-items: center;
- position: relative;
- height: 120upx;
- padding: 0 30upx;
- &:after {
- position: absolute;
- left: 0;
- bottom: 0;
- content: '';
- width: 100%;
- height: 0;
- border-bottom: 1px dashed #f3f3f3;
- transform: scaleY(50%);
- }
- }
- .left {
- display: flex;
- flex-direction: column;
- justify-content: center;
- flex: 1;
- overflow: hidden;
- height: 100upx;
- }
- .title {
- font-size: 32upx;
- color: $font-color-dark;
- margin-bottom: 10upx;
- }
- .time {
- font-size: 24upx;
- color: $font-color-light;
- }
- .right {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-size: 26upx;
- color: $font-color-base;
- height: 100upx;
- }
- .price {
- font-size: 44upx;
- color: $price-color;
- &:before {
- content: '¥';
- font-size: 34upx;
- }
- }
- .tips {
- font-size: 24upx;
- color: $font-color-light;
- line-height: 60upx;
- padding-left: 30upx;
- }
- .circle {
- position: absolute;
- left: -6upx;
- bottom: -10upx;
- z-index: 10;
- width: 20upx;
- height: 20upx;
- background: #f3f3f3;
- border-radius: 100px;
- &.r {
- left: auto;
- right: -6upx;
- }
- }
- }
- </style>
|