123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <view>
- <view>
- <scroll-view scroll-x class="bg-white nav text-center" style="height: 100vh;">
- <view :class="index==TabCur?'cu-item text-blue cur':'cu-item'" v-for="(item,index) in list" :key="index" @click="tabSelect"
- :data-id="index" style="">
- {{item.name}}
- <text v-if="index == 0">({{notUsed}})</text>
- <text v-if="index == 1">({{used}})</text>
- <text v-if="index == 2">({{invalid}})</text>
- </view>
- <view class="coupon-List" v-if="TabCur == 0">
- <view style="text-align: right;">
- <text>使用规则 ></text>
- </view>
- <view class="margin-top-sm">
- <view class="cu-list menu-avatar padding-tb-sm bg-white">
- <view class="cu-item" v-for="(item,index) in 5" :key="index">
- <view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/img/champion/Taric.png);">
- </view>
- <view class="content">
- <view class="text-grey">
- <text class="text-cut">九折卷</text>
- </view>
- <view class="text-gray text-sm flex">
- <text class="text-cut">满20元可用,优惠上限50元</text>
- </view>
- <view class="text-gray text-sm flex">
- <text class="text-cut">有效期:2020.01.01 11:00:00-2020.01.10 11:00:00</text>
- </view>
- </view>
- <view class="action">
- <!-- <view class="text-grey text-xs">22:20</view>
- <view class="cuIcon-notice_forbid_fill text-gray"></view> -->
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-else-if="TabCur == 1">
- </view>
- <view v-else="TabCur == 2">
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- export default {
- mounted() {
- this.getCouponList()
- },
- data() {
- return {
- notUsed: 1, //未使用
- used: 2, //已使用
- invalid: 3, //过期
- TabCur: 0,
- list: [{
- name: '未使用',
- }, {
- name: '已使用',
- }, {
- name: '已过期',
- }],
- // 因为内部的滑动机制限制,请将tabs组件和swiper组件的current用不同变量赋值
- current: 0, // tabs组件的current值,表示当前活动的tab选项
- swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
- pageindex: 1,
- couponList:[]
- };
- },
- methods: {
- tabSelect(e) {
- this.TabCur = e.currentTarget.dataset.id
- console.log(this.TabCur)
- },
- getCouponList: async function() {
- let res = await this.$request.post("/api/v1/coupon/couponList", {
- page: this.pageindex
- })
- console.log(res)
- if(res.status == 0){
- this.couponList = res.data.data
- }
- }
- },
- onShow() {
- }
- };
- </script>
- <style>
- .coupon-List {
- height: 100%;
- width: 100%;
- background-color: #f9f9f9;
- padding: 20rpx 20rpx 0 20rpx;
- }
- /*卡片*/
- .u-card-wrap {
- background-color: $u-bg-color;
- padding: 1px;
- }
- .u-body-item {
- font-size: 32rpx;
- color: #333;
- padding: 20rpx 10rpx;
- }
- .u-body-item image {
- width: 120rpx;
- flex: 0 0 120rpx;
- height: 120rpx;
- border-radius: 8rpx;
- margin-left: 12rpx;
- }
- </style>
|