瀏覽代碼

[限时抢购,红色的字体颜色色号修改,banner详情][增加,修改]:限时抢购的列表上拉加载,banner详情页面增加

tags/2.2.4
meo 6 年之前
父節點
當前提交
f0e229ddb3
共有 11 個文件被更改,包括 137 次插入108 次删除
  1. +44
    -48
      pages/bannerdetail/index.js
  2. +7
    -17
      pages/bannerdetail/index.wxml
  3. +1
    -2
      pages/bannerdetail/index.wxss
  4. +1
    -1
      pages/couponorder/detail/index.wxml
  5. +5
    -9
      pages/index/coupons/index.js
  6. +5
    -3
      pages/index/rushToBuy/index.js
  7. +1
    -0
      pages/index/rushToBuy/index.wxml
  8. +1
    -1
      pages/index/rushToBuy/index.wxss
  9. +51
    -18
      pages/rushToBuy/index.js
  10. +3
    -2
      pages/rushToBuy/index.wxml
  11. +18
    -7
      pages/rushToBuy/index.wxss

+ 44
- 48
pages/bannerdetail/index.js 查看文件

@@ -14,53 +14,49 @@ Page({
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
});
});
}
// wx.showLoading({
// title: "加载中..."
// });
// 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
// });
// });
}
});

+ 7
- 17
pages/bannerdetail/index.wxml 查看文件

@@ -2,21 +2,21 @@
<view class='coupons'>
<view class="coupons-body">
<view class='banner'>
<image src='{{data.coverImg}}'></image>
<image src='./../../assets/img/timg.jpg' mode="widthFix"></image>
</view>
<view class='coupons_info'>
<view>
<text>{{data.title}}<text>限购{{data.useLimitQuantity}}件</text></text>
<text>大餐券<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>
<text>¥100</text>
<text>¥10000</text>
</view>
</view>

<view class='posi'>
<!-- <view class='posi'>
<view class='posi_logo'>
<view>
<image src='{{data.merChantImgUrl}}'></image>
@@ -26,23 +26,13 @@
<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>
<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>
<text><text class='spot'></text>有效期2018.01.16 至 2018.09.20的话不得不大半夜的吧大本营的被的夜班的不的夜班的也别的也好不到大本营</text>
</view>
</view>
</view>


+ 1
- 2
pages/bannerdetail/index.wxss 查看文件

@@ -14,12 +14,11 @@

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

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

.coupons_info {


+ 1
- 1
pages/couponorder/detail/index.wxml 查看文件

@@ -7,7 +7,7 @@
<view class="money">
<text>¥{{data.salePrice/100}}</text>
<del>¥{{data.price/100}}</del>
<text wx:if="data.usePrice=='undefined'" class="manjian">满{{data.usePrice}}元可用</text>
<text wx:if="data.usePrice=='undefined'" class="manjian">满{{data.usePrice/100}}元可用</text>
</view>
</view>
</view>


+ 5
- 9
pages/index/coupons/index.js 查看文件

@@ -67,10 +67,6 @@ Component({

// 券list获取
if (that.data.allow_load) {
/**
* 用户在点击切换时 不showloadimg
* 只有用户在下拉加载的时候 showloading
*/
wx.showLoading({
title: "飞速加载中"
});
@@ -97,10 +93,10 @@ Component({
}).then(res => {
console.log(res);
if (pageNum >= res.data.pages) {
// wx.showToast({
// title: "加载完成喽",
// icon: "success"
// });
wx.showToast({
title: "加载完成喽",
icon: "success"
});
that.setData({
allow_load: false
});
@@ -148,7 +144,7 @@ Component({
});
};
if (app.globalData.token && app.globalData.token != null) {
app.couponListCallback(app.globalData.token);
app.businessListCallback(app.globalData.token);
}
that.getList(0, 1);
}


+ 5
- 3
pages/index/rushToBuy/index.js 查看文件

@@ -35,11 +35,13 @@ Component({
},
gotodetail: function(e) {
console.log(e);
console.log("出错啦 大哥")
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}`
});
}
},
@@ -50,7 +52,7 @@ Component({
url: config.api.couponChannelList,
data: {
pageNum: 1,
pageSize: 2,
pageSize: 5,
targetAd: 2
}
}).then(res => {


+ 1
- 0
pages/index/rushToBuy/index.wxml 查看文件

@@ -5,6 +5,7 @@
<view bindtap="gotodetail" data-couponId="{{item.couponId}}" data-targetAd="{{item.targetAd}}">
<image class="commodity-img" src="{{item.coverImg}}" />
<view class="commodity-info">
<view class="commodity-info-name">{{item.title}}</view>
<view class="commodity-info-name">{{item.subTitle}}</view>
<view class="commodity-info-price">
<text class="commodity-info-price-p">¥{{item.salePriceStr}}</text>


+ 1
- 1
pages/index/rushToBuy/index.wxss 查看文件

@@ -65,7 +65,7 @@

.index-scroll-view .commodity-info-price-p {
font-size: 30rpx;
color: #FF3434;
color: #f96563;
}
.index-scroll-view .commodity-info-price-o {
display: inline-block;


+ 51
- 18
pages/rushToBuy/index.js 查看文件

@@ -7,7 +7,9 @@ Page({
* 页面的初始数据
*/
data: {
list: []
list: [],
page: 2,
allow_load: true
},

/**
@@ -16,22 +18,48 @@ Page({
onLoad: function(options) {},
//列表
getList: function(page) {
let that = this;


app.couponChannelListCallback = token => {
Http.setToken(token);
Http.get({
url: config.api.couponChannelList,
data: {
pageNum: page,
pageSize: 2,
targetAd: 2
}
}).then(res => {
console.log(res);
console.log("限时抢购页面");
this.setData({
list: res.data.list
/**
* 判断用户是否加载完成
*/
if (that.data.allow_load) {
wx.showLoading({
title: "加载中"
});
setTimeout(function() {
wx.hideLoading();
}, 1200);
Http.get({
url: config.api.couponChannelList,
data: {
pageNum: page,
pageSize: 5,
targetAd: 2
}
}).then(res => {
console.log(res);
if (page >= res.data.pages) {
wx.showToast({
title: "加载完成喽",
icon: "success"
});
that.setData({
allow_load: false
});
}
that.data.list = that.data.list.concat(res.data.list);
that.setData({
list: that.data.list
});
});
});
} else {
console.info("allow_load==false 已禁止加载");
}
};
if (app.globalData.token && app.globalData.token != null) {
console.log("couponChannelList init 1");
@@ -40,6 +68,9 @@ Page({
},
onReady: function() {
let that = this;
that.setData({
list: []
});
that.getList(2);
},
//限时抢购的强请页面
@@ -66,15 +97,17 @@ Page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
console.log("000");
},
onPullDownRefresh: function() {},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
console.log("姐姐在搞上啦加载");
let that = this;
that.data.page++;
console.log(that.data.page);
that.getList(that.data.page);
console.log("这是第:" + that.data.page);
},

/**


+ 3
- 2
pages/rushToBuy/index.wxml 查看文件

@@ -1,6 +1,7 @@
<!-- 限时抢购 查看更多对应的页面 -->
<view class='flashSale'>
<view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" wx:key="index">
<view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail"
wx:key="index">
<view class='flashSaleItem'>
<view class='flashSaleItemTop'>
<view class='flashSaleItemTopL'>
@@ -20,7 +21,7 @@
<view class='flashSaleItemBottom'>
<view class='flashSaleItemBottomTop'><text class='remainingTime'>剩余时间:</text><text class='realRemainingTime'>2天 12小时25分钟</text></view>
<view class='flashSaleItemBottomBottm'>
<view><text class="remainingNumber">剩余件数:</text><text class='realnumber'>{{item.remainInventory}}件</text></view>
<view class="view1"><text class="remainingNumber">剩余件数:</text><text class='realnumber'>{{item.remainInventory}}件</text></view>
<view class='buy'>购买</view>
</view>



+ 18
- 7
pages/rushToBuy/index.wxss 查看文件

@@ -9,7 +9,6 @@
width: 100%;
height: 410rpx;
border-top: 1rpx solid #ededed;
border-bottom: 1rpx solid #ededed;
}
.flashSaleItem{
width: 90%;
@@ -45,8 +44,13 @@
flex-direction: column;
}
.foodname{
font-size: 34rpx;
font-size: 32rpx;
height: 40rpx;
line-height: 40rpx;
color: #000;
display: inline-block;
width: 406rpx;
overflow: hidden;
}
.small{
font-size: 24rpx;
@@ -58,7 +62,7 @@
}
.presentPrice{
font-size: 36rpx;
color: #FF3434;
color: #f96563;
}
.originalPrice{
margin-left: 20rpx;
@@ -68,6 +72,7 @@
}
.flashSaleItemBottom{
margin-top: 20rpx;
position: relative;
}
.remainingTime{
font-size: 28rpx;
@@ -75,23 +80,31 @@
}
.realRemainingTime{
margin-left: 10rpx;
color:#FF3434;
color:#f96563;
font-size: 28rpx;
}
.flashSaleItemBottomBottm{
display: flex;
flex-direction: row;
}
.view1{
width: 550rpx;
display: block;
}
.remainingNumber{
font-size: 28rpx;
color: #B4B4B4;
}
.realnumber{
margin-left: 10rpx;
color: #FF3434;
color: #f96563;
font-size: 28rpx;
}
.buy{
position: absolute;
top: 34rpx;
bottom: 0;
right: 20rpx;
width:114rpx;
height: 50rpx;
line-height: 50rpx;
@@ -99,7 +112,5 @@
background: #00C0FF;
color: #fff;
border-radius: 10rpx;
margin-left: 350rpx;
font-size: 28rpx;
margin-top: -23rpx;
}

Loading…
取消
儲存