diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 769faaa..781f8c7 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -229,6 +229,11 @@ Page({ showPage:true }) } + if(res.data.type==7){ + wx.setNavigationBarTitle({ + title: "卡详情" + }) + } if (res.data.endTime) { that.countdown(res.data.endTime); //当前时间与优惠券下架时间做计算 diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index c2caf4e..9c40712 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -29,7 +29,7 @@ {{sec}} - {{data.title}} + {{data.title}}电子卡 {{data.subTitle}} 售价: diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index a477b15..002c4dd 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -433,4 +433,15 @@ page { line-height: 95rpx; color: #333; 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; } \ No newline at end of file diff --git a/pages/discountCardList/discountCardList.js b/pages/discountCardList/discountCardList.js index ed5149b..a783e76 100644 --- a/pages/discountCardList/discountCardList.js +++ b/pages/discountCardList/discountCardList.js @@ -4,23 +4,7 @@ const Http = require("../../utils/HttpBasics"); let app = getApp(); Page({ data: { - tabs: [{ - key: 0, - name: "A卡" - }, - { - key: 1, - name: "礼品卡" - }, - { - key: 2, - name: "折扣卡" - }, - { - key: 3, - name: "D卡" - } - ], + tabs: [], list: [], current: "0", current_scroll: "0", @@ -29,7 +13,7 @@ Page({ loading: true, //"上拉加载"的变量,默认false,隐藏 content: "", mystatus: '', - showPage: false + showPage: false, }, onLoad() { this.getList(0, 1); @@ -43,33 +27,64 @@ Page({ wx.hideTabBarRedDot({ 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) { - 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({ - 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) { 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) { that.setData({ loading: true, content: "小主,我在玩命加载中...", }); Http.get({ - url: config.api.couponOrderList, - data: { - pageNum: pageNum, - pageSize: 6, - couponOrderStatus: key - } + url: config.api.couponChannelList, + data: param }) .then(res => { if (res.code == 200) { @@ -85,6 +100,7 @@ Page({ loading: false }); }, 1400); + if (pageNum >= res.data.pages) { that.setData({ allow_load: false @@ -139,4 +155,17 @@ Page({ }); that.getList(that.data.current_scroll, that.data.page); } -}); \ No newline at end of file +}) +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; + } + } +} \ No newline at end of file diff --git a/pages/discountCardList/discountCardList.json b/pages/discountCardList/discountCardList.json index 6080989..3e3cbf1 100644 --- a/pages/discountCardList/discountCardList.json +++ b/pages/discountCardList/discountCardList.json @@ -3,5 +3,5 @@ "i-tab": "../../../dist/tab/index", "i-tabs": "../../../dist/tabs/index" }, - "navigationBarTitleText": "折扣卡列表" + "navigationBarTitleText": "优惠卡" } \ No newline at end of file diff --git a/pages/discountCardList/discountCardList.wxml b/pages/discountCardList/discountCardList.wxml index 9c7d592..4c8e352 100644 --- a/pages/discountCardList/discountCardList.wxml +++ b/pages/discountCardList/discountCardList.wxml @@ -1,11 +1,8 @@ - - - - - - + + + @@ -16,21 +13,20 @@ - - + {{item.title}} - + - - {{content}} - + + {{content}} + \ No newline at end of file diff --git a/pages/discountCardList/discountCardList.wxss b/pages/discountCardList/discountCardList.wxss index 2803473..d585027 100644 --- a/pages/discountCardList/discountCardList.wxss +++ b/pages/discountCardList/discountCardList.wxss @@ -32,11 +32,14 @@ .cards>view{ margin-bottom: 30rpx; } +.nocoupon{ + margin: 0 auto; + float: none!important; +} .mms { background: #fff; padding: 0; border-radius: 16rpx; - border-top: 8rpx solid #02b7ff; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.10); } @@ -64,14 +67,15 @@ display: block; width: 100%; height: 200rpx!important; + border-radius: 16rpx; } .detail_msg text{ display: block; 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) { display: flex; @@ -133,12 +137,8 @@ .buycardbtn button{ flex: 1; 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{ margin-left: 10rpx;