| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <template>
- <view class="container">
- <!-- 分段器区域 -->
- <view class="segmented">
- <view class="segmented_box">
- <uni-segmented-control :current="activeCurrent" :values="headerList" style-type="text" active-color="#096562" @clickItem="onClickItem" />
- </view>
- </view>
- <!-- 领券中心横幅区域 -->
- <view class="banner">
- <img mode="aspectFill" src="../../static/my/banner.png" />
- <view class="banner_title">领券中心</view>
- <view class="banner_msg">
- <view class="msg_top">关注领券中心</view>
- <view>系统会不定时发放代金券</view>
- </view>
- <view class="banner_btn" @click="handleGoPage('/pages/couponCenter/couponCenter')">去逛逛</view>
- </view>
- <!-- 代金券列表区域 -->
- <scroll-view class="body" scroll-y @scrolltolower="handlePull">
- <!-- 每一个代金券区域 -->
- <view class="body_box" v-for="item in list" :key="item.id">
- <!-- 代金券类型区域 -->
- <img src="../../static/my/couponTitle.png" />
- <view class="box_title">
- <view class="title_type">{{ item.type }}</view>
- <view class="title_num">x{{ item.count }}张</view>
- </view>
- <!-- 代金券信息区域 -->
- <view class="box_info">
- <view class="info_left">
- <view class="left_top">{{ item.name }}</view>
- <view class="left_bottom">
- <view class="tag">有限期至{{ item.time }}</view>
- <view class="tag">可通用</view>
- <view class="tag">全民宿</view>
- </view>
- </view>
- <view class="info_right">
- <view class="right_top">{{ item.msg }}</view>
- <view class="right_bottom" :class="{ color: item.info === '无门槛' }">{{ item.info }}</view>
- </view>
- </view>
- <!-- 代金券按钮区域 -->
- <view class="box_btn">去使用</view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 分段器当前激活索引
- activeCurrent: 0,
- // 分段器数组
- headerList: ['全部', '代金券', '折扣券'],
- list: [
- {
- id: 1,
- type: '折扣券',
- count: 5,
- name: '7.5折折扣卷',
- time: '2023.09.01',
- msg: '7.5折',
- info: '满200可用'
- },
- {
- id: 2,
- type: '代金券',
- count: 2,
- name: '20元代金券',
- time: '2023.10.01',
- msg: '¥10',
- info: '无门槛'
- },
- {
- id: 1,
- type: '折扣券',
- count: 5,
- name: '7.5折折扣卷',
- time: '2023.09.01',
- msg: '7.5折',
- info: '满200可用'
- },
- {
- id: 2,
- type: '代金券',
- count: 2,
- name: '20元代金券',
- time: '2023.10.01',
- msg: '¥10',
- info: '无门槛'
- },
- {
- id: 1,
- type: '折扣券',
- count: 5,
- name: '7.5折折扣卷',
- time: '2023.09.01',
- msg: '7.5折',
- info: '满200可用'
- },
- {
- id: 2,
- type: '代金券',
- count: 2,
- name: '20元代金券',
- time: '2023.10.01',
- msg: '¥10',
- info: '无门槛'
- }
- ]
- }
- },
- methods: {
- // 切换分段器回调
- onClickItem(e) {
- if (this.current !== e.currentIndex) {
- this.current = e.currentIndex
- }
- },
- // 列表下拉到底部回调
- handlePull() {
- console.log(111)
- },
- // 跳转页面回调
- handleGoPage(url) {
- uni.navigateTo({
- url
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- height: 100vh;
- background-color: #f2f3f5;
- overflow: hidden;
- .segmented {
- box-sizing: border-box;
- padding-bottom: 28rpx;
- height: 100rpx;
- background-color: #fff;
- .segmented_box {
- width: 50%;
- }
- }
- .banner {
- position: relative;
- padding: 0 20rpx;
- height: 158rpx;
- img {
- margin-top: 31rpx;
- width: 710rpx;
- height: 95rpx;
- }
- .banner_title {
- position: absolute;
- top: 42rpx;
- left: 55rpx;
- color: #fff;
- font-size: 50rpx;
- font-weight: bold;
- }
- .banner_msg {
- position: absolute;
- top: 46rpx;
- left: 280rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding-left: 15rpx;
- height: 61rpx;
- color: #fff;
- font-size: 20rpx;
- border-left: 1rpx dotted #fff;
- .msg_top {
- margin-top: -5rpx;
- }
- }
- .banner_btn {
- position: absolute;
- top: 46rpx;
- left: 556rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 133rpx;
- height: 61rpx;
- color: #000;
- font-size: 28rpx;
- border-radius: 12rpx;
- background: linear-gradient(90deg, #ffeb3b 0%, #ffb300 100%);
- }
- }
- .body {
- box-sizing: border-box;
- padding: 0 30rpx 20rpx;
- height: calc(100vh - 258rpx);
- .body_box {
- position: relative;
- margin-bottom: 20rpx;
- height: 218rpx;
- border-radius: 15rpx;
- background-color: #fff;
- img {
- width: 135rpx;
- height: 36rpx;
- }
- .box_title {
- position: absolute;
- top: 0;
- left: 16rpx;
- display: flex;
- align-items: center;
- color: #fff;
- .title_type {
- font-size: 24rpx;
- font-weight: bold;
- }
- .title_num {
- margin-left: 5rpx;
- margin-top: 10rpx;
- font-size: 16rpx;
- }
- }
- .box_info {
- display: flex;
- padding: 0 30rpx 0 25rpx;
- .info_left {
- flex: 4;
- .left_top {
- margin: 12rpx 0;
- font-size: 36rpx;
- }
- .left_bottom {
- display: flex;
- color: #808080;
- font-size: 24rpx;
- .tag {
- margin-right: 32rpx;
- }
- }
- }
- .info_right {
- flex: 1;
- color: #ff5733;
- .right_top {
- margin: 10rpx 0;
- text-align: end;
- font-size: 36rpx;
- }
- .right_bottom {
- text-align: end;
- font-size: 20rpx;
- }
- .color {
- color: #a6a6a6;
- }
- }
- }
- .box_btn {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-right: 30rpx;
- margin-top: 11rpx;
- margin-left: auto;
- width: 98rpx;
- height: 40rpx;
- color: #fff;
- font-size: 24rpx;
- border-radius: 6rpx;
- background-color: #096562;
- }
- }
- }
- }
- </style>
|