| @@ -229,6 +229,11 @@ Page({ | |||||
| showPage:true | showPage:true | ||||
| }) | }) | ||||
| } | } | ||||
| if(res.data.type==7){ | |||||
| wx.setNavigationBarTitle({ | |||||
| title: "卡详情" | |||||
| }) | |||||
| } | |||||
| if (res.data.endTime) { | if (res.data.endTime) { | ||||
| that.countdown(res.data.endTime); | that.countdown(res.data.endTime); | ||||
| //当前时间与优惠券下架时间做计算 | //当前时间与优惠券下架时间做计算 | ||||
| @@ -29,7 +29,7 @@ | |||||
| <text>{{sec}}</text> | <text>{{sec}}</text> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <text class='title'>{{data.title}}</text> | |||||
| <text class='title'>{{data.title}}<text class="elecard">电子卡</text></text> | |||||
| <text class="subTitle">{{data.subTitle}}</text> | <text class="subTitle">{{data.subTitle}}</text> | ||||
| <view class='salePriceStr clearfix'> | <view class='salePriceStr clearfix'> | ||||
| <view class="fl">售价: | <view class="fl">售价: | ||||
| @@ -433,4 +433,15 @@ page { | |||||
| line-height: 95rpx; | line-height: 95rpx; | ||||
| color: #333; | color: #333; | ||||
| text-indent: .5em; | text-indent: .5em; | ||||
| } | |||||
| .elecard{ | |||||
| display: inline-block; | |||||
| margin-left: 6rpx; | |||||
| color: #00c0ff; | |||||
| border: 1px solid #00c0ff; | |||||
| border-radius:8rpx; | |||||
| font-style: normal; | |||||
| font-size: 30rpx; | |||||
| line-height: 50rpx; | |||||
| padding: 0 6rpx; | |||||
| } | } | ||||
| @@ -4,23 +4,7 @@ const Http = require("../../utils/HttpBasics"); | |||||
| let app = getApp(); | let app = getApp(); | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| tabs: [{ | |||||
| key: 0, | |||||
| name: "A卡" | |||||
| }, | |||||
| { | |||||
| key: 1, | |||||
| name: "礼品卡" | |||||
| }, | |||||
| { | |||||
| key: 2, | |||||
| name: "折扣卡" | |||||
| }, | |||||
| { | |||||
| key: 3, | |||||
| name: "D卡" | |||||
| } | |||||
| ], | |||||
| tabs: [], | |||||
| list: [], | list: [], | ||||
| current: "0", | current: "0", | ||||
| current_scroll: "0", | current_scroll: "0", | ||||
| @@ -29,7 +13,7 @@ Page({ | |||||
| loading: true, //"上拉加载"的变量,默认false,隐藏 | loading: true, //"上拉加载"的变量,默认false,隐藏 | ||||
| content: "", | content: "", | ||||
| mystatus: '', | mystatus: '', | ||||
| showPage: false | |||||
| showPage: false, | |||||
| }, | }, | ||||
| onLoad() { | onLoad() { | ||||
| this.getList(0, 1); | this.getList(0, 1); | ||||
| @@ -43,33 +27,64 @@ Page({ | |||||
| wx.hideTabBarRedDot({ | wx.hideTabBarRedDot({ | ||||
| index: 2 | index: 2 | ||||
| }) | }) | ||||
| Http.get({ | |||||
| url: config.api.businessList, | |||||
| data: { | |||||
| pageNum: 1, | |||||
| pageSize: 15, | |||||
| type: 1 | |||||
| } | |||||
| }).then(res => { | |||||
| console.log(res) | |||||
| let businessObj = [{ id: 0, title: "全部", type: 1 }]; | |||||
| that.setData({ | |||||
| tabs: res.data.list.concat(businessObj).sort(compare("id")) | |||||
| }); | |||||
| console.log(that.data.tabs) | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| }, | }, | ||||
| //点击跳转到券详情页面 | //点击跳转到券详情页面 | ||||
| gotouse: function (e) { | gotouse: function (e) { | ||||
| if (this.data.mystatus == '' || this.data.mystatus == 'undefined') { | |||||
| var mystatus = e.currentTarget.dataset.couponorderstatus; | |||||
| } else { | |||||
| var mystatus = this.data.mystatus; | |||||
| } | |||||
| console.log(e.currentTarget.dataset.couponid) | |||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: `/pages/cardListDetail/cardListDetail?quancode=${ | |||||
| e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}` | |||||
| url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.quancode}&couponId=${e.currentTarget.dataset.couponid}` | |||||
| }); | }); | ||||
| }, | }, | ||||
| getList(key, pageNum) { | getList(key, pageNum) { | ||||
| var that = this; | var that = this; | ||||
| // 根据 key == 0 区分全部或其它tab,决定是否传参数 business | |||||
| if (key == 0) { | |||||
| var param = { | |||||
| pageNum: pageNum, | |||||
| pageSize: 6, | |||||
| targetAd: 1, | |||||
| type: "7" | |||||
| }; | |||||
| } else { | |||||
| var param = { | |||||
| pageNum: pageNum, | |||||
| pageSize: 6, | |||||
| business: key, | |||||
| targetAd: 1, | |||||
| type: "7" | |||||
| }; | |||||
| } | |||||
| if (that.data.allow_load) { | if (that.data.allow_load) { | ||||
| that.setData({ | that.setData({ | ||||
| loading: true, | loading: true, | ||||
| content: "小主,我在玩命加载中...", | content: "小主,我在玩命加载中...", | ||||
| }); | }); | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.couponOrderList, | |||||
| data: { | |||||
| pageNum: pageNum, | |||||
| pageSize: 6, | |||||
| couponOrderStatus: key | |||||
| } | |||||
| url: config.api.couponChannelList, | |||||
| data: param | |||||
| }) | }) | ||||
| .then(res => { | .then(res => { | ||||
| if (res.code == 200) { | if (res.code == 200) { | ||||
| @@ -85,6 +100,7 @@ Page({ | |||||
| loading: false | loading: false | ||||
| }); | }); | ||||
| }, 1400); | }, 1400); | ||||
| if (pageNum >= res.data.pages) { | if (pageNum >= res.data.pages) { | ||||
| that.setData({ | that.setData({ | ||||
| allow_load: false | allow_load: false | ||||
| @@ -139,4 +155,17 @@ Page({ | |||||
| }); | }); | ||||
| that.getList(that.data.current_scroll, that.data.page); | that.getList(that.data.current_scroll, that.data.page); | ||||
| } | } | ||||
| }); | |||||
| }) | |||||
| function compare(pro) { | |||||
| return function (obj2, obj1) { | |||||
| var val1 = obj1[pro]; | |||||
| var val2 = obj2[pro]; | |||||
| if (val1 < val2) { | |||||
| return 1; | |||||
| } else if (val1 > val2) { | |||||
| return -1; | |||||
| } else { | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -3,5 +3,5 @@ | |||||
| "i-tab": "../../../dist/tab/index", | "i-tab": "../../../dist/tab/index", | ||||
| "i-tabs": "../../../dist/tabs/index" | "i-tabs": "../../../dist/tabs/index" | ||||
| }, | }, | ||||
| "navigationBarTitleText": "折扣卡列表" | |||||
| "navigationBarTitleText": "优惠卡" | |||||
| } | } | ||||
| @@ -1,11 +1,8 @@ | |||||
| <!-- 折扣卡list页面 --> | <!-- 折扣卡list页面 --> | ||||
| <view class='content'> | <view class='content'> | ||||
| <view class='header'> | |||||
| <image src="./../../assets/img/growthbg.png" mode="widthFix"></image> | |||||
| </view> | |||||
| <view class="market"> | |||||
| <i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> | |||||
| <i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab> | |||||
| <view class="market clearfix"> | |||||
| <i-tabs current="{{current_scroll}}" scroll bindchange="handleChangeScroll"> | |||||
| <i-tab wx:for="{{tabs}}" wx:key="unique" key="{{item.id}}" title="{{item.title}}"></i-tab> | |||||
| </i-tabs> | </i-tabs> | ||||
| <view class='cards'> | <view class='cards'> | ||||
| <view class="nocoupon" wx:if="{{list.length==0}}"> | <view class="nocoupon" wx:if="{{list.length==0}}"> | ||||
| @@ -16,21 +13,20 @@ | |||||
| <button hover-class='active'>前往首页看看</button> | <button hover-class='active'>前往首页看看</button> | ||||
| </navigator> | </navigator> | ||||
| </view> | </view> | ||||
| <view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}"> | |||||
| <view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-couponId='{{item.couponId}}' data-quancode="{{item.id}}"> | |||||
| <view class='mms'> | <view class='mms'> | ||||
| <view class='detail_msg'> | <view class='detail_msg'> | ||||
| <image mode="aspectFill" src='{{item.coverImg}}' mode='widthFix'></image> | <image mode="aspectFill" src='{{item.coverImg}}' mode='widthFix'></image> | ||||
| <text>{{item.title}}</text> | <text>{{item.title}}</text> | ||||
| </view> | </view> | ||||
| <view class='buycardbtn'> | <view class='buycardbtn'> | ||||
| <button>{{item.salePrice}}元 <text>购买</text></button> | |||||
| <button>{{item.salePriceStr}}元 <text>购买</text></button> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="loading" wx:if="{{loading}}"> | |||||
| <image src="./../../assets/img/loading.gif" mode="widthFix"></image>{{content}} | |||||
| </view> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="loading" wx:if="{{loading}}"> | |||||
| <image src="./../../assets/img/loading.gif" mode="widthFix"></image>{{content}} | |||||
| </view> | |||||
| </view> | </view> | ||||
| @@ -32,11 +32,14 @@ | |||||
| .cards>view{ | .cards>view{ | ||||
| margin-bottom: 30rpx; | margin-bottom: 30rpx; | ||||
| } | } | ||||
| .nocoupon{ | |||||
| margin: 0 auto; | |||||
| float: none!important; | |||||
| } | |||||
| .mms { | .mms { | ||||
| background: #fff; | background: #fff; | ||||
| padding: 0; | padding: 0; | ||||
| border-radius: 16rpx; | border-radius: 16rpx; | ||||
| border-top: 8rpx solid #02b7ff; | |||||
| box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.10); | box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.10); | ||||
| } | } | ||||
| @@ -64,14 +67,15 @@ | |||||
| display: block; | display: block; | ||||
| width: 100%; | width: 100%; | ||||
| height: 200rpx!important; | height: 200rpx!important; | ||||
| border-radius: 16rpx; | |||||
| } | } | ||||
| .detail_msg text{ | .detail_msg text{ | ||||
| display: block; | display: block; | ||||
| font-size:28rpx; | font-size:28rpx; | ||||
| height: 80rpx; | |||||
| line-height: 40rpx; | |||||
| color: #666; | |||||
| padding:16rpx 20rpx 0; | |||||
| height: 60rpx; | |||||
| line-height: 60rpx; | |||||
| color: #333; | |||||
| text-align: center; | |||||
| } | } | ||||
| .info view:nth-child(1) { | .info view:nth-child(1) { | ||||
| display: flex; | display: flex; | ||||
| @@ -133,12 +137,8 @@ | |||||
| .buycardbtn button{ | .buycardbtn button{ | ||||
| flex: 1; | flex: 1; | ||||
| font-size: 28rpx; | font-size: 28rpx; | ||||
| height: 70rpx; | |||||
| line-height: 70rpx; | |||||
| background:#02c0ff!important; | |||||
| border:0; | |||||
| color:#fff!important; | |||||
| margin-top: 20rpx; | |||||
| color:#FF3535!important; | |||||
| background: none; | |||||
| } | } | ||||
| .buycardbtn button text{ | .buycardbtn button text{ | ||||
| margin-left: 10rpx; | margin-left: 10rpx; | ||||