Browse Source

[券包增加去领券按钮][增加]:我的券包增加“去领券”按钮

tags/2.2.4
meo 6 years ago
parent
commit
0df386298a
13 changed files with 375 additions and 33 deletions
  1. +1
    -0
      app.json
  2. +8
    -0
      components/banner/index.js
  3. +1
    -1
      components/banner/index.wxml
  4. +66
    -0
      pages/bannerdetail/index.js
  5. +3
    -0
      pages/bannerdetail/index.json
  6. +52
    -0
      pages/bannerdetail/index.wxml
  7. +213
    -0
      pages/bannerdetail/index.wxss
  8. +1
    -1
      pages/coupon/detail/index.js
  9. +4
    -1
      pages/couponorder/index/index.wxml
  10. +9
    -3
      pages/couponorder/index/index.wxss
  11. +2
    -2
      pages/index/coupons/index.js
  12. +14
    -24
      pages/rushToBuy/index.js
  13. +1
    -1
      pages/rushToBuy/index.wxml

+ 1
- 0
app.json View File

@@ -1,6 +1,7 @@
{
"pages": [
"pages/index/index",
"pages/bannerdetail/index",
"pages/getuserinfo/index",
"pages/getphoneInfo/index",
"pages/market/index",


+ 8
- 0
components/banner/index.js View File

@@ -17,6 +17,7 @@ Component({
swiperCurrent: 0,
},


/**
* 组件的方法列表
*/
@@ -28,5 +29,12 @@ Component({
swiperCurrent: e.detail.current
})
},
gotobannerdetail:function(e){
console.log("我要点击进入banner详情页面")
console.log(e.currentTarget.dataset.id);
wx.navigateTo({
url: `/pages/bannerdetail/index?id=${e.currentTarget.dataset.id}`,
})
}
}
})

+ 1
- 1
components/banner/index.wxml View File

@@ -2,7 +2,7 @@
<swiper class="index-slide" bindchange="swiperChange" circular="true" autoplay="true" interval="3000" duration="500">
<block wx:for="{{list}}" wx:key="unique">
<swiper-item>
<image data-id="{{item.id}}" src="{{item.coverImg}}" class="index-slide-image" />
<image data-id="{{item.id}}" bindtap='gotobannerdetail' src="{{item.coverImg}}" class="index-slide-image" />
</swiper-item>
</block>
</swiper>


+ 66
- 0
pages/bannerdetail/index.js View File

@@ -0,0 +1,66 @@
let config = require("../../config/config.js");
let app = getApp();
const Http = require("../../utils/HttpBasics");
const util = require("../../utils/util");
Page({
data: {
data: {},
couponId: null,
orderId: "",
day: "",
hour: "",
minute: ""
},
onLoad(options) {
let that = this;
console.log(options.id);
wx.showLoading({
title: "加载中..."
});

if (options.flag) {
this.orderFunc();
} else {
Http.get({
url: config.api.couponDetail,
data: {
couponId: options.id,
targetAd:options.targetAd
}
}).then(res => {
console.log(res);
//当前时间与优惠券下架时间做计算
var startTime = util.fmtDate(res.data.sendEndDate);
console.log(startTime);
var s1 = new Date(startTime.replace(/-/g, "/"));
var s2 = new Date();
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000);
var year = Math.floor(runTime / 86400 / 365);
var runTime = runTime % (86400 * 365);
var month = Math.floor(runTime / 86400 / 30);
var runTime = runTime % (86400 * 30);
var day = Math.floor(runTime / 86400);
var runTime = runTime % 86400;
var hour = Math.floor(runTime / 3600);
var runTime = runTime % 3600;
var minute = Math.floor(runTime / 60);
var runTime = runTime % 60;
var second = runTime;
console.log(year, month, day, hour, minute, second);
that.setData({
year: year,
month: month,
day: day,
hour: hour,
minute: minute
});
console.log(that.data.day);
wx.hideLoading();
that.setData({
data: res.data,
couponId: options.id
});
});
}
}
});

+ 3
- 0
pages/bannerdetail/index.json View File

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "活动详情"
}

+ 52
- 0
pages/bannerdetail/index.wxml View File

@@ -0,0 +1,52 @@
<!-- banner活动详情页面 -->
<view class='coupons'>
<view class="coupons-body">
<view class='banner'>
<image src='{{data.coverImg}}'></image>
</view>
<view class='coupons_info'>
<view>
<text>{{data.title}}<text>限购{{data.useLimitQuantity}}件</text></text>
<text>剩余时间:<text>{{day}}天</text><text>{{hour}}小时</text><text>{{minute}}分钟</text></text>
<text>剩余件数:<text>{{data.remainInventory}}件</text></text>
</view>
<view>
<text>¥{{data.salePriceStr}}</text>
<text>¥{{data.priceStr}}</text>
</view>
</view>

<view class='posi'>
<view class='posi_logo'>
<view>
<image src='{{data.merChantImgUrl}}'></image>
</view>
<view>
<text>{{data.merchantName}}</text>
<text>{{data.addr}}{{data.buildingName}}{{data.floorName}}</text>
</view>
</view>
<!-- <view>
<text>更多适用门店</text>
<text class='iconfont icon-right'></text>
</view> -->
</view>
<view class='notes'>
<view>
<text>购买须知</text>
</view>
<view>
<text><text class='spot'></text>有效期2018.01.16 至 2018.09.20</text>
<text><text class='spot'></text>除特价酒水及特价菜外全场通用</text>
<text><text class='spot'></text>无需预约,消费g高峰时可能需要等位</text>
<text><text class='spot'></text>没人最多购买2张</text>
<text><text class='spot'></text>不可使用包间</text>
<text><text class='spot'></text>堂食外带均可,可免费打包</text>
<text><text class='spot'></text>每桌限用2张</text>
</view>
</view>
</view>
<view class="buy-view app-border-top">
<button bindtap='orderFunc' class='buy'>立即购买</button>
</view>
</view>

+ 213
- 0
pages/bannerdetail/index.wxss View File

@@ -0,0 +1,213 @@
@import "../../app.wxss";
.coupons {
width: 100%;
background: #f6f6f6;
position: relative;
overflow: hidden;
padding-bottom: 120rpx;
}

.coupons-body {
flex: 1;
/* overflow: auto; */
}

.banner {
width: 100%;
height: 465rpx;
}

.banner image {
width: 100%;
height: 100%;
}

.coupons_info {
width: 92%;
height: 186rpx;
display: flex;
justify-content: space-between;
padding: 0 4%;
background: #fff;
}

.coupons_info view {
display: flex;
flex-direction: column;
}

.coupons_info view:nth-child(1) text {
font-size: 30rpx;
margin-top: 3%;
}

.coupons_info view:nth-child(1) text:nth-child(1) text {
color: #ff3434;
font-size: 24rpx;
border: 1px solid #ff3434;
border-radius: 6rpx;
margin-left: 2%;
padding: 0 5rpx;
}

.coupons_info view:nth-child(1) text:nth-child(2),
.coupons_info view:nth-child(1) text:nth-child(3) {
color: #b8b8b8;
font-size: 24rpx;
margin-top: 4%;
}

.coupons_info view:nth-child(1) text:nth-child(2) text,
.coupons_info view:nth-child(1) text:nth-child(3) text {
color: #ff3434;
font-size: 24rpx;
}

.coupons_info view:nth-child(2) text:nth-child(1) {
font-size: 36rpx;
color: #ff3434;
margin-top: 40rpx;
font-weight: bold;
}

.coupons_info view:nth-child(2) text:nth-child(2) {
font-size: 24rpx;
color: #b4b4b4;
text-decoration: line-through;
padding-left: 10rpx;
padding-top: 4rpx;
}

.posi {
width: 92%;
display: flex;
flex-direction: column;
padding: 0 4%;
background: #fff;
margin-top: 2%;
}

.posi>view:nth-child(2) {
width: 100%;
height: 87rpx;
display: flex;
justify-content: space-between;
border-top: 1px solid #f6f6f6;
line-height: 87rpx;
}

.posi>view:nth-child(2) text:nth-child(1) {
font-size: 30rpx;
color: #a9a9a9;
}

.posi>view:nth-child(2) text:nth-child(2) {
font-size: 30rpx;
color: #a9a9a9;
}

.posi_logo {
width: 100%;
height: 156rpx;
display: flex;
margin-top: 30rpx;
}

.posi_logo view:nth-child(1) {
width: 126rpx;
height: 126rpx;
border-radius: 50%;
overflow: hidden;
flex: 2;
}

.posi_logo view:nth-child(1) image {
width: 100%;
height: 100%;
}

.posi_logo view:nth-child(2) {
display: flex;
flex-direction: column;
flex: 8;
padding-top: 20rpx;
padding-left: 30rpx;
}

.posi_logo view:nth-child(2) text:nth-child(1) {
font-size: 30rpx;
}

.posi_logo view:nth-child(2) text:nth-child(2) {
font-size: 24rpx;
color: #b8b8b8;
padding-top: 10rpx;
}

.notes {
margin-top: 2%;
}

.notes view:nth-child(1) {
width: 92%;
height: 87rpx;
padding: 0 4%;
line-height: 87rpx;
background: #fff;
border-bottom: 1rpx solid #f5f5f5;
border-top: 1rpx solid #f5f5f5;
}

.notes view:nth-child(1) text {
font-size: 30rpx;
font-weight: bold;
}

.notes view:nth-child(2) {
width: 92%;
height: 400rpx;
padding: 0 4%;
background: #fff;
border-bottom: 1rpx solid #f5f5f5;
display: flex;
flex-direction: column;
padding-top: 2%;
}

.notes view:nth-child(2)>text {
font-size: 28rpx;
color: #a9a9a9;
line-height: 56rpx;
}

.spot {
width: 12rpx;
height: 12rpx;
display: inline-block;
background: #a9a9a9;
margin-right: 16rpx;
position: relative;
bottom: 4rpx;
border-radius: 50%;
}

.buy-view {
background: #fff;
position: fixed;
padding-top: 10rpx;
height:98rpx;
bottom: 0rpx;
left: 0;
right: 0;
}

.buy {
background: #00c0ff;
height: 88rpx;
width: 98%;
margin: 0 auto;
color: #fff;
font-size: 36rpx;
line-height: 88rpx;
border-radius: 6rpx;
}

+ 1
- 1
pages/coupon/detail/index.js View File

@@ -31,7 +31,7 @@ Page({
}).then(res => {
console.log(res);
//当前时间与优惠券下架时间做计算
var startTime = util.fmtDate(res.data.sendEndDate);
var startTime = util.fmtDate(res.data.endTime);
console.log(startTime);
var s1 = new Date(startTime.replace(/-/g, "/"));
var s2 = new Date();


+ 4
- 1
pages/couponorder/index/index.wxml View File

@@ -6,7 +6,10 @@
<view>
<view class="nocoupon" wx:if="{{list.length==0}}">
<image src="./../../../assets/img/cou.png" mode="widthFix" />
<text>没有优惠券哦</text>
<text>暂无优惠券可用</text>
<navigator url="/pages/index/index" open-type="switchTab" hover-class="other-navigator-hover">
<button>去领券</button>
</navigator>
</view>
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}">
<view class='detail_msg'>


+ 9
- 3
pages/couponorder/index/index.wxss View File

@@ -93,7 +93,7 @@
}

.nocoupon image{
width: 100rpx;
width: 203rpx;
display: block;
margin: 200rpx auto 0;
}
@@ -101,6 +101,12 @@
display: block;
text-align: center;
font-size:30rpx;
color: #999;
color: #00C0FF;
}
.nocoupon button{
background: #00C0FF;
color: #fff;
font-style: 30rpx;
width: 70%;
margin: 30rpx auto 0;
}


+ 2
- 2
pages/index/coupons/index.js View File

@@ -79,13 +79,13 @@ Component({
if (key == 0) {
var param = {
pageNum: pageNum,
pageSize: 2,
pageSize: 8,
targetAd: 1
};
} else {
var param = {
pageNum: pageNum,
pageSize: 2,
pageSize: 8,
business: key,
targetAd: 1
};


+ 14
- 24
pages/rushToBuy/index.js View File

@@ -14,21 +14,14 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {},

/**
* 生命周期函数--监听页面初次渲染完成
*/

/**
* 生命周期函数--监听页面显示
*/
onReady: function() {
//列表
getList: function(page) {
app.couponChannelListCallback = token => {
Http.setToken(token);
Http.get({
url: config.api.couponChannelList,
data: {
pageNum: 2,
pageNum: page,
pageSize: 2,
targetAd: 2
}
@@ -45,14 +38,20 @@ Page({
app.couponChannelListCallback(app.globalData.token);
}
},
onReady: function() {
let that = this;
that.getList(2);
},
//限时抢购的强请页面
gotodetail: function(e) {
console.log(e)
console.log("姐姐在测试")
console.log(e);
console.log("姐姐在测试");
console.log(e.currentTarget.dataset.couponid);
console.log(e.currentTarget.dataset.targetad);
wx.navigateTo({
url: `/pages/coupon/detail/index?id=${e.currentTarget.dataset.couponid}&targetAd=${e.currentTarget.dataset.targetad}`,
url: `/pages/coupon/detail/index?id=${
e.currentTarget.dataset.couponid
}&targetAd=${e.currentTarget.dataset.targetad}`,
success: function(res) {
// success
},
@@ -64,27 +63,18 @@ Page({
}
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
console.log("");
console.log("000");
},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
console.log("姐姐在搞上啦加载");
},

/**


+ 1
- 1
pages/rushToBuy/index.wxml View File

@@ -1,4 +1,4 @@
<!-- 限时抢购 详情 -->
<!-- 限时抢购 查看更多对应的页面 -->
<view class='flashSale'>
<view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" wx:key="index">
<view class='flashSaleItem'>


Loading…
Cancel
Save