@@ -4,24 +4,18 @@ Component({ | |||||
* 组件的属性列表 | * 组件的属性列表 | ||||
*/ | */ | ||||
properties: { | properties: { | ||||
paramAtoB: String, | |||||
data: { | data: { | ||||
value: {}, | value: {}, | ||||
type: Object, | |||||
}, | |||||
type: Object | |||||
} | |||||
}, | }, | ||||
/** | /** | ||||
* 组件的初始数据 | * 组件的初始数据 | ||||
*/ | */ | ||||
data: { | |||||
}, | |||||
data: {}, | |||||
methods: { | methods: { | ||||
navigateTo(e){ | |||||
let { id } = e.currentTarget.dataset.date; | |||||
wx.navigateTo({ | |||||
url: `../../pages/coupon/detail/index?id=${id}`, | |||||
}) | |||||
} | |||||
} | } | ||||
}) | |||||
}); |
@@ -1,4 +1,5 @@ | |||||
<navigator url="/pages/coupon/detail/index?id={{data.id}}"> | <navigator url="/pages/coupon/detail/index?id={{data.id}}"> | ||||
<!-- 首页优惠券列表页面 --> | |||||
<view class="coupons"> | <view class="coupons"> | ||||
<view class="coupons-img"> | <view class="coupons-img"> | ||||
<image src="{{data.coverImg}}"></image> | <image src="{{data.coverImg}}"></image> | ||||
@@ -6,21 +7,24 @@ | |||||
<view class="coupons-info"> | <view class="coupons-info"> | ||||
<view class="coupons-info-name">{{data.title}}</view> | <view class="coupons-info-name">{{data.title}}</view> | ||||
<view class="coupons-info-name subtitle ">{{data.subTitle}}</view> | <view class="coupons-info-name subtitle ">{{data.subTitle}}</view> | ||||
<view class="coupons-info-manjian" style="margin-top:10rpx;" wx:if="{{data.type == 1}}"> | |||||
满¥{{data.usePriceStr}}可用 | |||||
</view> | |||||
<view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}"> | |||||
仅限本店使用 | |||||
</view> | |||||
</view> | |||||
<view class="coupons-btn"> | |||||
<!-- 优惠券价格 --> | |||||
<view class="coupons-info-price"> | <view class="coupons-info-price"> | ||||
<text class="coupons-info-price-p">¥{{data.salePrice/100}}</text> | <text class="coupons-info-price-p">¥{{data.salePrice/100}}</text> | ||||
<text class="coupons-info-price-o">¥{{data.price/100}}</text> | <text class="coupons-info-price-o">¥{{data.price/100}}</text> | ||||
</view> | </view> | ||||
<!-- <view class="coupons-info-distance"> | |||||
<text class="iconfont icon-dingweib"></text> | |||||
{{data.salePrice}} | |||||
</view> --> | |||||
<!-- | |||||
<view class="coupons-info-address">{{data.}}</view> | |||||
--> | |||||
</view> | |||||
<view class="coupons-btn"> | |||||
<i-button i-class="coupons-btn-gm" bind:click="navigateTo" data-date='{{data}}'>购买</i-button> | |||||
<i-button i-class="coupons-btn-gm" wx:if="{{data.type==4}}" data-date='{{data}}'>领取</i-button> | |||||
<i-button i-class="coupons-btn-gm" wx:elif="{{data.type == 1||data.type == 2||data.type==3||data.type==4}}" data-date='{{data}}'>购买</i-button> | |||||
</view> | </view> | ||||
<view class="coupons-border"></view> | <view class="coupons-border"></view> | ||||
</view> | </view> | ||||
</navigator> | |||||
</navigator> | |||||
<view class="loading" hidden="{{!searchLoading}}">正在载入更多...</view> | |||||
<view class="loading complete" hidden="{{!searchLoadingComplete}}">已加载全部</view> |
@@ -1,101 +1,161 @@ | |||||
@import "../../app.wxss"; | @import "../../app.wxss"; | ||||
.coupons { | .coupons { | ||||
flex-direction: row; | |||||
display: flex; | |||||
padding: 30rpx; | |||||
position: relative; | |||||
height: 184rpx; | |||||
} | |||||
.coupons-border{ | |||||
height: 1rpx; | |||||
/* width: 100%; */ | |||||
left: 30rpx; | |||||
right: 30rpx; | |||||
background: #F5F5F5; | |||||
position: absolute; | |||||
bottom: 0; | |||||
flex-direction: row; | |||||
display: flex; | |||||
padding: 30rpx; | |||||
position: relative; | |||||
height: 184rpx; | |||||
} | |||||
.coupons-border { | |||||
height: 1rpx; | |||||
/* width: 100%; */ | |||||
left: 30rpx; | |||||
right: 30rpx; | |||||
background: #f5f5f5; | |||||
position: absolute; | |||||
bottom: 0; | |||||
} | } | ||||
.coupons-img { | .coupons-img { | ||||
width: 248rpx; | |||||
height: 184rpx; | |||||
overflow: hidden; | |||||
border-radius: 10rpx; | |||||
width: 248rpx; | |||||
height: 184rpx; | |||||
overflow: hidden; | |||||
border-radius: 10rpx; | |||||
} | } | ||||
.coupons-img image { | .coupons-img image { | ||||
width: 100%; | |||||
height: 100%; | |||||
width: 100%; | |||||
height: 100%; | |||||
} | } | ||||
.coupons-info { | .coupons-info { | ||||
padding-left: 20rpx; | |||||
/* padding-top: 10rpx; */ | |||||
padding-left: 20rpx; | |||||
} | } | ||||
.coupons-info-name { | .coupons-info-name { | ||||
font-size: 30rpx; | |||||
color: #000000; | |||||
letter-spacing: 0; | |||||
line-height: 42rpx; | |||||
font-weight: bold; | |||||
font-size: 30rpx; | |||||
color: #000000; | |||||
letter-spacing: 0; | |||||
line-height: 42rpx; | |||||
font-weight: bold; | |||||
margin-top: 10rpx; | |||||
} | } | ||||
.coupons-info-price{ | |||||
padding:10rpx 0 15rpx; | |||||
height: 50rpx; | |||||
.coupons-info-price { | |||||
padding: 10rpx 0 15rpx; | |||||
height: 88rpx; | |||||
} | } | ||||
.coupons-info-price-p { | .coupons-info-price-p { | ||||
font-size: 36rpx; | |||||
color: #FF3434; | |||||
letter-spacing: 0.96rpx; | |||||
line-height: 50rpx; | |||||
display: block; | |||||
text-align: center; | |||||
font-size: 36rpx; | |||||
color: #ff3434; | |||||
line-height: 50rpx; | |||||
} | } | ||||
.coupons-info-price-o { | .coupons-info-price-o { | ||||
display: inline-block; | |||||
padding-left: 20rpx; | |||||
font-size: 20rpx; | |||||
color: #B4B4B4; | |||||
letter-spacing: 0.96rpx; | |||||
text-decoration: line-through; | |||||
line-height: 24rpx; | |||||
display: block; | |||||
text-align: center; | |||||
font-size: 26rpx; | |||||
color: #b4b4b4; | |||||
letter-spacing: 0.96rpx; | |||||
text-decoration: line-through; | |||||
line-height: 24rpx; | |||||
} | } | ||||
.coupons-info-distance { | .coupons-info-distance { | ||||
font-size: 22rpx; | |||||
color: #C0C0C0; | |||||
letter-spacing: 0; | |||||
padding-bottom: 10rpx; | |||||
line-height: 30rpx; | |||||
font-size: 22rpx; | |||||
color: #c0c0c0; | |||||
letter-spacing: 0; | |||||
padding-bottom: 10rpx; | |||||
line-height: 30rpx; | |||||
} | } | ||||
.coupons-info-address { | .coupons-info-address { | ||||
font-size: 22rpx; | |||||
color: #585858; | |||||
letter-spacing: 0; | |||||
line-height: 30rpx; | |||||
font-size: 22rpx; | |||||
color: #585858; | |||||
letter-spacing: 0; | |||||
line-height: 30rpx; | |||||
} | } | ||||
.coupons-btn { | .coupons-btn { | ||||
position: absolute; | |||||
bottom: 30rpx; | |||||
right: 30rpx; | |||||
position: absolute; | |||||
top: 40rpx; | |||||
right: 30rpx; | |||||
} | } | ||||
.coupons-btn-gm { | .coupons-btn-gm { | ||||
background: #00C0FF !important; | |||||
border-radius: 10rpx !important; | |||||
margin: 0 !important; | |||||
padding: 0 !important; | |||||
font-family: PingFangSC-Semibold; | |||||
font-size: 28rpx; | |||||
color: #FFFFFF !important; | |||||
letter-spacing: 0; | |||||
height: 50rpx !important; | |||||
width: 114rpx !important; | |||||
line-height: 50rpx !important; | |||||
} | |||||
.subtitle{ | |||||
font-size: 26rpx; | |||||
color: #666; | |||||
font-weight:100; | |||||
} | |||||
background: #00c0ff !important; | |||||
border-radius: 10rpx !important; | |||||
margin: 0 !important; | |||||
padding: 0 !important; | |||||
font-family: PingFangSC-Semibold; | |||||
font-size: 28rpx; | |||||
color: #ffffff !important; | |||||
letter-spacing: 0; | |||||
height: 50rpx !important; | |||||
width: 114rpx !important; | |||||
line-height: 50rpx !important; | |||||
} | |||||
.subtitle { | |||||
font-size: 26rpx; | |||||
color: #666; | |||||
font-weight: 100; | |||||
} | |||||
.coupons-info-manjian { | |||||
color: #999; | |||||
font-size: 26rpx; | |||||
line-height: 34rpx; | |||||
font-weight: 100; | |||||
} | |||||
/**上拉加载更多**/ | |||||
.userinfo { | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
} | |||||
.userinfo-avatar { | |||||
width: 128rpx; | |||||
height: 128rpx; | |||||
margin: 20rpx; | |||||
border-radius: 50%; | |||||
} | |||||
.userinfo-nickname { | |||||
color: #aaa; | |||||
} | |||||
.usermotto { | |||||
margin-top: 200px; | |||||
} | |||||
/**/ | |||||
scroll-view { | |||||
width: 100%; | |||||
} | |||||
.item { | |||||
width: 90%; | |||||
height: 300rpx; | |||||
margin: 20rpx auto; | |||||
background: brown; | |||||
overflow: hidden; | |||||
} | |||||
.item .img { | |||||
width: 430rpx; | |||||
margin-right: 20rpx; | |||||
float: left; | |||||
} | |||||
.title { | |||||
font-size: 30rpx; | |||||
display: block; | |||||
margin: 30rpx auto; | |||||
} | |||||
.description { | |||||
font-size: 26rpx; | |||||
line-height: 15rpx; | |||||
} |
@@ -33,7 +33,7 @@ | |||||
} | } | ||||
.i-tabs-tab-title-current { | .i-tabs-tab-title-current { | ||||
color: #00C0FF | |||||
color: #00C0FF; | |||||
} | } | ||||
.i-tabs-tab-scroll { | .i-tabs-tab-scroll { | ||||
@@ -142,7 +142,7 @@ | |||||
line-height: 80rpx; | line-height: 80rpx; | ||||
} | } | ||||
.addpark-back{ | .addpark-back{ | ||||
font-size: 25rpx; | |||||
font-size: 30rpx; | |||||
color: #5aadfb; | color: #5aadfb; | ||||
float: right; | float: right; | ||||
margin: 25rpx 25rpx; | margin: 25rpx 25rpx; | ||||
@@ -1,15 +1,17 @@ | |||||
var config = require('../../../config/config.js'); | |||||
var app = getApp() | |||||
const Http = require("../../../utils/HttpBasics") | |||||
var config = require("../../../config/config.js"); | |||||
var app = getApp(); | |||||
const Http = require("../../../utils/HttpBasics"); | |||||
const util = require("../../../utils/util"); | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
data: {}, | data: {}, | ||||
couponId: null, | couponId: null, | ||||
orderId: '' | |||||
orderId: "", | |||||
day: "", | |||||
hour: "", | |||||
minute: "" | |||||
}, | }, | ||||
onLoad(options) { | onLoad(options) { | ||||
console.log("00000000000000----------"); | |||||
console.log(options); | |||||
let that = this; | let that = this; | ||||
wx.showLoading({ | wx.showLoading({ | ||||
title: "加载中..." | title: "加载中..." | ||||
@@ -25,6 +27,32 @@ Page({ | |||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
console.log(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(); | wx.hideLoading(); | ||||
that.setData({ | that.setData({ | ||||
data: res.data, | data: res.data, | ||||
@@ -39,119 +67,121 @@ Page({ | |||||
payOrderUpdate: (orderId, payOrderId, status, reason) => { | payOrderUpdate: (orderId, payOrderId, status, reason) => { | ||||
// 支付成功 | // 支付成功 | ||||
Http.post({ | Http.post({ | ||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
orderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
orderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log("payOrderUpdate then", res); | console.log("payOrderUpdate then", res); | ||||
wx.showToast({ | wx.showToast({ | ||||
title: '购买成功', | |||||
title: "购买成功", | |||||
duration: 2500 | duration: 2500 | ||||
}) | |||||
}).catch(err => { | |||||
console.log("payOrderUpdate catch", err); | |||||
}); | |||||
}) | }) | ||||
.catch(err => { | |||||
console.log("payOrderUpdate catch", err); | |||||
}); | |||||
}, | }, | ||||
payment: (res) => { | |||||
payment: res => { | |||||
var that = this; | var that = this; | ||||
var payOrderId = '' + res.data.out_trade_no; | |||||
var payOrderId = "" + res.data.out_trade_no; | |||||
wx.requestPayment({ | wx.requestPayment({ | ||||
timeStamp: res.timeStamp, | timeStamp: res.timeStamp, | ||||
nonceStr: res.nonceStr, | nonceStr: res.nonceStr, | ||||
package: res.package, | package: res.package, | ||||
signType: 'MD5', | |||||
signType: "MD5", | |||||
paySign: res.paySign, | paySign: res.paySign, | ||||
'success': (res) => { | |||||
that.payOrderUpdate(that.data.orderId, payOrderId, 1) // 支付成功 | |||||
success: res => { | |||||
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | |||||
console.log(res); | console.log(res); | ||||
console.log('支付成功'); | |||||
console.log("支付成功"); | |||||
wx.showToast({ | wx.showToast({ | ||||
title: '购买成功', | |||||
title: "购买成功", | |||||
duration: 2500 | duration: 2500 | ||||
}) | |||||
}); | |||||
wx.navigateBack({ | wx.navigateBack({ | ||||
delta: 2 | delta: 2 | ||||
}) | |||||
}); | |||||
}, | }, | ||||
'fail': (res) => { | |||||
that.payOrderUpdate(that.data.orderId, payOrderId, 2) // 支付失败 | |||||
console.log(res) | |||||
console.log('支付失败'); | |||||
fail: res => { | |||||
that.payOrderUpdate(that.data.orderId, payOrderId, 2); // 支付失败 | |||||
console.log(res); | |||||
console.log("支付失败"); | |||||
return; | return; | ||||
}, | }, | ||||
'complete': (res) => { | |||||
complete: res => { | |||||
console.log(res); | console.log(res); | ||||
console.log('支付完成'); | |||||
console.log("支付完成"); | |||||
var url = this.data.url; | var url = this.data.url; | ||||
console.log('get url', url) | |||||
if (res.errMsg == 'requestPayment:ok') { | |||||
console.log("get url", url); | |||||
if (res.errMsg == "requestPayment:ok") { | |||||
wx.showModal({ | wx.showModal({ | ||||
title: '提示', | |||||
content: '支付成功' | |||||
title: "提示", | |||||
content: "支付成功" | |||||
}); | }); | ||||
if (url) { | if (url) { | ||||
setTimeout(function() { | setTimeout(function() { | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '/pages' + url | |||||
url: "/pages" + url | |||||
}); | }); | ||||
}, 2000) | |||||
}, 2000); | |||||
} else { | } else { | ||||
setTimeout(() => { | setTimeout(() => { | ||||
wx.navigateBack() | |||||
}, 2000) | |||||
wx.navigateBack(); | |||||
}, 2000); | |||||
} | } | ||||
} else { | } else { | ||||
wx.showModal({ | wx.showModal({ | ||||
title: '错误提示', | |||||
title: "错误提示", | |||||
content: res.errMsg | content: res.errMsg | ||||
}); | }); | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
}) | |||||
}); | |||||
}, | }, | ||||
orderFunc() { | orderFunc() { | ||||
var that = this; | var that = this; | ||||
wx.showLoading({ | wx.showLoading({ | ||||
title: '加载中...', | |||||
}) | |||||
title: "加载中..." | |||||
}); | |||||
Http.post({ | Http.post({ | ||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
return Http.post({ | return Http.post({ | ||||
url: config.api.orderSave, | url: config.api.orderSave, | ||||
data: { | data: { | ||||
couponId: that.data.couponId | couponId: that.data.couponId | ||||
} | } | ||||
}) | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}); | |||||
}) | |||||
.catch(err => { | |||||
console.log(err); | |||||
if (err.code == 11005) { | if (err.code == 11005) { | ||||
// 用户手机未授权 | // 用户手机未授权 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '../../getphoneInfo/index?couponId=' + that.data.couponId, | |||||
}) | |||||
url: "../../getphoneInfo/index?couponId=" + that.data.couponId | |||||
}); | |||||
} | } | ||||
if (err.code == 11006) { | if (err.code == 11006) { | ||||
// 用户手机已加密 | // 用户手机已加密 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '../../phoneinput/phoneinput?couponId=' + that.data.couponId, | |||||
}) | |||||
url: "../../phoneinput/phoneinput?couponId=" + that.data.couponId | |||||
}); | |||||
} | } | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
if (res != "undefined") { | if (res != "undefined") { | ||||
const orderId = '' + res.data.id; | |||||
const orderId = "" + res.data.id; | |||||
that.setData({ | that.setData({ | ||||
orderId: orderId | orderId: orderId | ||||
}) | |||||
}); | |||||
if (res.data.payment > 0) { | if (res.data.payment > 0) { | ||||
// 支付金额不为0 | // 支付金额不为0 | ||||
Http.post({ | Http.post({ | ||||
@@ -160,25 +190,27 @@ Page({ | |||||
orderId: orderId | orderId: orderId | ||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
console.log(res) | |||||
var payOrderId = '' + res.data.out_trade_no; | |||||
console.log(res); | |||||
var payOrderId = "" + res.data.out_trade_no; | |||||
wx.hideLoading(); | wx.hideLoading(); | ||||
//payment(res); | //payment(res); | ||||
that.payOrderUpdate(that.data.orderId, payOrderId, 1) // 支付成功 | |||||
}) | |||||
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | |||||
}); | |||||
} else { | } else { | ||||
// 免费券 | // 免费券 | ||||
that.payOrderUpdate(orderId, "0", 1) // 支付成功 | |||||
that | |||||
.payOrderUpdate(orderId, "0", 1) // 支付成功 | |||||
.then(res => { | .then(res => { | ||||
wx.showToast({ | wx.showToast({ | ||||
title: "支付成功", | title: "支付成功", | ||||
duration: 3000 | duration: 3000 | ||||
}) | |||||
}) | |||||
}); | |||||
}); | |||||
} | } | ||||
} | } | ||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | }) | ||||
}, | |||||
}) | |||||
.catch(err => { | |||||
console.log(err); | |||||
}); | |||||
} | |||||
}); |
@@ -6,7 +6,7 @@ | |||||
<view class='coupons_info'> | <view class='coupons_info'> | ||||
<view> | <view> | ||||
<text>{{data.title}}<text>限购{{data.useLimitQuantity}}件</text></text> | <text>{{data.title}}<text>限购{{data.useLimitQuantity}}件</text></text> | ||||
<text>剩余时间:<text>2天12小时25分钟</text></text> | |||||
<text>剩余时间:<text>{{day}}天</text><text>{{hour}}小时</text><text>{{minute}}分钟</text></text> | |||||
<text>剩余件数:<text>{{data.remainInventory}}件</text></text> | <text>剩余件数:<text>{{data.remainInventory}}件</text></text> | ||||
</view> | </view> | ||||
<view> | <view> | ||||
@@ -47,6 +47,6 @@ | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="buy-view app-border-top"> | <view class="buy-view app-border-top"> | ||||
<button bindtap='orderFunc' class='buy'>立即购买</button> | |||||
<button bindtap='orderFunc' class='buy'>立即购买</button> | |||||
</view> | </view> | ||||
</view> | </view> |
@@ -1,211 +1,214 @@ | |||||
@import "../../../app.wxss"; | @import "../../../app.wxss"; | ||||
.coupons { | .coupons { | ||||
width: 100%; | |||||
height: 100vh; | |||||
background: #f6f6f6; | |||||
position: relative; | |||||
display: flex; | |||||
flex-direction: column; | |||||
overflow: hidden; | |||||
} | |||||
.coupons-body{ | |||||
width: 100%; | |||||
background: #f6f6f6; | |||||
position: relative; | |||||
overflow: hidden; | |||||
padding-bottom: 120rpx; | |||||
} | |||||
.coupons-body { | |||||
flex: 1; | flex: 1; | ||||
overflow: auto; | |||||
/* overflow: auto; */ | |||||
} | } | ||||
.banner { | .banner { | ||||
width: 100%; | |||||
height: 465rpx; | |||||
width: 100%; | |||||
height: 465rpx; | |||||
} | } | ||||
.banner image { | .banner image { | ||||
width: 100%; | |||||
height: 100%; | |||||
width: 100%; | |||||
height: 100%; | |||||
} | } | ||||
.coupons_info { | .coupons_info { | ||||
width: 92%; | |||||
height: 186rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
padding: 0 4%; | |||||
background: #fff; | |||||
width: 92%; | |||||
height: 186rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
padding: 0 4%; | |||||
background: #fff; | |||||
} | } | ||||
.coupons_info view { | .coupons_info view { | ||||
display: flex; | |||||
flex-direction: column; | |||||
display: flex; | |||||
flex-direction: column; | |||||
} | } | ||||
.coupons_info view:nth-child(1) text { | .coupons_info view:nth-child(1) text { | ||||
font-size: 30rpx; | |||||
margin-top: 3%; | |||||
font-size: 30rpx; | |||||
margin-top: 3%; | |||||
} | } | ||||
.coupons_info view:nth-child(1) text:nth-child(1) text { | .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; | |||||
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(2), | ||||
.coupons_info view:nth-child(1) text:nth-child(3) { | .coupons_info view:nth-child(1) text:nth-child(3) { | ||||
color: #b8b8b8; | |||||
font-size: 24rpx; | |||||
margin-top: 4%; | |||||
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(2) text, | ||||
.coupons_info view:nth-child(1) text:nth-child(3) text { | .coupons_info view:nth-child(1) text:nth-child(3) text { | ||||
color: #ff3434; | |||||
font-size: 24rpx; | |||||
color: #ff3434; | |||||
font-size: 24rpx; | |||||
} | } | ||||
.coupons_info view:nth-child(2) text:nth-child(1) { | .coupons_info view:nth-child(2) text:nth-child(1) { | ||||
font-size: 36rpx; | |||||
color: #ff3434; | |||||
margin-top: 40rpx; | |||||
font-weight: bold; | |||||
font-size: 36rpx; | |||||
color: #ff3434; | |||||
margin-top: 40rpx; | |||||
font-weight: bold; | |||||
} | } | ||||
.coupons_info view:nth-child(2) text:nth-child(2) { | .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; | |||||
font-size: 24rpx; | |||||
color: #b4b4b4; | |||||
text-decoration: line-through; | |||||
padding-left: 10rpx; | |||||
padding-top: 4rpx; | |||||
} | } | ||||
.posi { | .posi { | ||||
width: 92%; | |||||
display: flex; | |||||
flex-direction: column; | |||||
padding: 0 4%; | |||||
background: #fff; | |||||
margin-top: 2%; | |||||
width: 92%; | |||||
display: flex; | |||||
flex-direction: column; | |||||
padding: 0 4%; | |||||
background: #fff; | |||||
margin-top: 2%; | |||||
} | } | ||||
.posi>view:nth-child(2) { | .posi>view:nth-child(2) { | ||||
width: 100%; | |||||
height: 87rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
border-top: 1px solid #f6f6f6; | |||||
line-height: 87rpx; | |||||
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) { | .posi>view:nth-child(2) text:nth-child(1) { | ||||
font-size: 30rpx; | |||||
color: #a9a9a9; | |||||
font-size: 30rpx; | |||||
color: #a9a9a9; | |||||
} | } | ||||
.posi>view:nth-child(2) text:nth-child(2) { | .posi>view:nth-child(2) text:nth-child(2) { | ||||
font-size: 30rpx; | |||||
color: #a9a9a9; | |||||
font-size: 30rpx; | |||||
color: #a9a9a9; | |||||
} | } | ||||
.posi_logo { | .posi_logo { | ||||
width: 100%; | |||||
height: 156rpx; | |||||
display: flex; | |||||
margin-top: 30rpx; | |||||
width: 100%; | |||||
height: 156rpx; | |||||
display: flex; | |||||
margin-top: 30rpx; | |||||
} | } | ||||
.posi_logo view:nth-child(1) { | .posi_logo view:nth-child(1) { | ||||
width: 126rpx; | |||||
height: 126rpx; | |||||
border-radius: 50%; | |||||
overflow: hidden; | |||||
flex: 2; | |||||
width: 126rpx; | |||||
height: 126rpx; | |||||
border-radius: 50%; | |||||
overflow: hidden; | |||||
flex: 2; | |||||
} | } | ||||
.posi_logo view:nth-child(1) image { | .posi_logo view:nth-child(1) image { | ||||
width: 100%; | |||||
height: 100%; | |||||
width: 100%; | |||||
height: 100%; | |||||
} | } | ||||
.posi_logo view:nth-child(2) { | .posi_logo view:nth-child(2) { | ||||
display: flex; | |||||
flex-direction: column; | |||||
flex: 8; | |||||
padding-top: 20rpx; | |||||
padding-left: 30rpx; | |||||
display: flex; | |||||
flex-direction: column; | |||||
flex: 8; | |||||
padding-top: 20rpx; | |||||
padding-left: 30rpx; | |||||
} | } | ||||
.posi_logo view:nth-child(2) text:nth-child(1) { | .posi_logo view:nth-child(2) text:nth-child(1) { | ||||
font-size: 30rpx; | |||||
font-size: 30rpx; | |||||
} | } | ||||
.posi_logo view:nth-child(2) text:nth-child(2) { | .posi_logo view:nth-child(2) text:nth-child(2) { | ||||
font-size: 24rpx; | |||||
color: #b8b8b8; | |||||
padding-top: 10rpx; | |||||
font-size: 24rpx; | |||||
color: #b8b8b8; | |||||
padding-top: 10rpx; | |||||
} | } | ||||
.notes { | .notes { | ||||
margin-top: 2%; | |||||
margin-top: 2%; | |||||
} | } | ||||
.notes view:nth-child(1) { | .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; | |||||
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 { | .notes view:nth-child(1) text { | ||||
font-size: 30rpx; | |||||
font-weight: bold; | |||||
font-size: 30rpx; | |||||
font-weight: bold; | |||||
} | } | ||||
.notes view:nth-child(2) { | .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%; | |||||
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 { | .notes view:nth-child(2)>text { | ||||
font-size: 28rpx; | |||||
color: #A9A9A9; | |||||
line-height: 56rpx; | |||||
font-size: 28rpx; | |||||
color: #a9a9a9; | |||||
line-height: 56rpx; | |||||
} | } | ||||
.spot { | .spot { | ||||
width: 12rpx; | |||||
height: 12rpx; | |||||
display: inline-block; | |||||
background: #A9A9A9; | |||||
margin-right: 16rpx; | |||||
position: relative; | |||||
bottom: 4rpx; | |||||
border-radius: 50%; | |||||
width: 12rpx; | |||||
height: 12rpx; | |||||
display: inline-block; | |||||
background: #a9a9a9; | |||||
margin-right: 16rpx; | |||||
position: relative; | |||||
bottom: 4rpx; | |||||
border-radius: 50%; | |||||
} | } | ||||
.buy-view { | .buy-view { | ||||
width: 100%; | |||||
padding: 10rpx; | |||||
/* position: fixed; */ | |||||
/* bottom: 0; */ | |||||
background: #fff; | |||||
box-sizing: border-box; | |||||
background: #fff; | |||||
position: fixed; | |||||
padding-top: 10rpx; | |||||
height:98rpx; | |||||
bottom: 0rpx; | |||||
left: 0; | |||||
right: 0; | |||||
} | } | ||||
.buy { | .buy { | ||||
/* width: 100%; */ | |||||
height: 88rpx; | |||||
background: #00C0FF; | |||||
color: #fff; | |||||
font-size: 36rpx; | |||||
line-height: 88rpx; | |||||
border-radius: 0; | |||||
} | |||||
background: #00c0ff; | |||||
height: 88rpx; | |||||
width: 98%; | |||||
margin: 0 auto; | |||||
color: #fff; | |||||
font-size: 36rpx; | |||||
line-height: 88rpx; | |||||
border-radius: 6rpx; | |||||
} |
@@ -30,7 +30,7 @@ Page({ | |||||
}).then(res => { | }).then(res => { | ||||
console.log(res); | console.log(res); | ||||
that.setData({ | that.setData({ | ||||
data: res.data.data | |||||
data: res.data | |||||
}); | }); | ||||
that.setData({ | that.setData({ | ||||
expiredTime: util.fmtDate(that.data.data.expiredTime), | expiredTime: util.fmtDate(that.data.data.expiredTime), | ||||
@@ -44,9 +44,9 @@ Page({ | |||||
phone: function() { | phone: function() { | ||||
let that = this; | let that = this; | ||||
console.log(that.data); | console.log(that.data); | ||||
if (that.data.data.merchantLinkPhone) { | |||||
if (that.data.merchantLinkPhone) { | |||||
wx.makePhoneCall({ | wx.makePhoneCall({ | ||||
phoneNumber: that.data.data.merchantLinkPhone //仅为示例,并非真实的电话号码 | |||||
phoneNumber: that.data.merchantLinkPhone //仅为示例,并非真实的电话号码 | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
@@ -1,4 +1,3 @@ | |||||
<!--index.wxml--> | |||||
<view class="container page"> | <view class="container page"> | ||||
<view class="coupon_detail clearfix"> | <view class="coupon_detail clearfix"> | ||||
<image class="fl" src="{{data.coverImg}}" mode="widthFix" /> | <image class="fl" src="{{data.coverImg}}" mode="widthFix" /> | ||||
@@ -23,7 +22,7 @@ | |||||
<image src="./../../../assets/img/tui.png" mode="widthFix"></image> | <image src="./../../../assets/img/tui.png" mode="widthFix"></image> | ||||
</view> | </view> | ||||
<view class="pane2" wx:if="{{data.couponOrderStatus==3}}"> | <view class="pane2" wx:if="{{data.couponOrderStatus==3}}"> | ||||
<image src="./../../../assets/img/tui.jpg" mode="widthFix"></image> | |||||
<image src="./../../../assets/img/guoqi.jpg" mode="widthFix"></image> | |||||
</view> | </view> | ||||
<view class="panel" wx:if="{{data.couponOrderStatus==0}}"> | <view class="panel" wx:if="{{data.couponOrderStatus==0}}"> | ||||
<view class="barcode"> | <view class="barcode"> | ||||
@@ -2,7 +2,6 @@ const format = require("../../../utils/util.js"); | |||||
const config = require("../../../config/config.js"); | const config = require("../../../config/config.js"); | ||||
const app = getApp(); | const app = getApp(); | ||||
const Http = require("../../../utils/HttpBasics"); | const Http = require("../../../utils/HttpBasics"); | ||||
//1535126400000 | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
tabs: [ | tabs: [ | ||||
@@ -24,11 +23,11 @@ Page({ | |||||
} | } | ||||
], | ], | ||||
list: [], | list: [], | ||||
current: "", | |||||
current_scroll: "1" | |||||
current: "0", | |||||
current_scroll: "0" | |||||
}, | }, | ||||
onLoad() { | onLoad() { | ||||
this.getList(1, 1); | |||||
this.getList(0, 0); | |||||
}, | }, | ||||
//点击跳转到券详情页面 | //点击跳转到券详情页面 | ||||
@@ -4,29 +4,29 @@ | |||||
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab> | <i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab> | ||||
</i-tabs> | </i-tabs> | ||||
<view> | <view> | ||||
<view class="nocoupon" wx:if="{{list.length==0}}"> | <view class="nocoupon" wx:if="{{list.length==0}}"> | ||||
<image src="./../../../assets/img/cou.png" mode="widthFix" /> | <image src="./../../../assets/img/cou.png" mode="widthFix" /> | ||||
<text>没有优惠券哦</text> | <text>没有优惠券哦</text> | ||||
</view> | </view> | ||||
<view class='section' wx:for='{{list}}' wx:key='{{index}}'> | |||||
<view class='detail_msg'> | |||||
<view class='logo'> | |||||
<image src='{{item.coverImg}}'></image> | |||||
</view> | |||||
<view class='info'> | |||||
<view> | |||||
<text>{{item.title}}</text> | |||||
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}"> | |||||
<view class='detail_msg'> | |||||
<view class='logo'> | |||||
<image src='{{item.coverImg}}'></image> | |||||
</view> | </view> | ||||
<view> | |||||
<text class="txt1">有效期至:</text> | |||||
<text class="txt2">{{item.expiredTime}}</text> | |||||
<view class='info'> | |||||
<view> | |||||
<text>{{item.title}}</text> | |||||
</view> | |||||
<view> | |||||
<text class="txt1">有效期至:</text> | |||||
<text class="txt2">{{item.expiredTime}}</text> | |||||
</view> | |||||
<view wx:if="{{item.couponOrderStatus==0}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">立即使用</view> | |||||
<view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view> | |||||
</view> | </view> | ||||
<view wx:if="{{item.couponOrderStatus==0}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">立即使用</view> | |||||
<view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">查看</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | |||||
</view> | </view> | ||||
</view> | </view> |
@@ -1,14 +1,13 @@ | |||||
// pages/index/sw/index.js | // pages/index/sw/index.js | ||||
let config = require('../../../config/config.js') | |||||
let Http = require('../../../utils/HttpBasics') | |||||
let app = getApp() | |||||
let config = require("../../../config/config.js"); | |||||
let Http = require("../../../utils/HttpBasics"); | |||||
let app = getApp(); | |||||
// 请求数据 | |||||
Component({ | Component({ | ||||
/** | /** | ||||
* 组件的属性列表 | * 组件的属性列表 | ||||
*/ | */ | ||||
properties: { | |||||
}, | |||||
properties: {}, | |||||
/** | /** | ||||
* 组件的初始数据 | * 组件的初始数据 | ||||
@@ -16,34 +15,45 @@ Component({ | |||||
data: { | data: { | ||||
tabs: [], | tabs: [], | ||||
list: [], | list: [], | ||||
current: '1', | |||||
current_scroll: '1', | |||||
current: "0", | |||||
current_scroll: "0", | |||||
pageNum: 1, // 设置加载的第几次,默认是第一次 | |||||
pageSize: 10, //返回数据的个数 | |||||
searchLoading: false, //"上拉加载"的变量,默认false,隐藏 | |||||
searchLoadingComplete: false //“没有数据”的变量,默认false,隐藏 | |||||
}, | }, | ||||
/** | /** | ||||
* 组件的方法列表 | * 组件的方法列表 | ||||
*/ | */ | ||||
methods: { | methods: { | ||||
handleChange({ | |||||
detail | |||||
}) { | |||||
handleChange({ detail }) { | |||||
this.setData({ | this.setData({ | ||||
current: detail.key | current: detail.key | ||||
}); | }); | ||||
}, | }, | ||||
handleChangeScroll({ | |||||
detail | |||||
}) { | |||||
handleChangeScroll({ detail }) { | |||||
this.setData({ | this.setData({ | ||||
current_scroll: detail.key | current_scroll: detail.key | ||||
}); | }); | ||||
}, | }, | ||||
//滚动到底部触发事件 | |||||
searchScrollLower() { | |||||
// let that = this; | |||||
console.log("00000000"); | |||||
// if(that.data.searchLoading && !that.data.searchLoadingComplete){ | |||||
// that.setData({ | |||||
// searchPageNum: that.data.searchPageNum+1, | |||||
// isFromSearch: false | |||||
// }); | |||||
// that.fetchSearchList(); | |||||
// } | |||||
} | |||||
}, | }, | ||||
ready() { | ready() { | ||||
var that = this | |||||
app.couponListCallback = token =>{ | |||||
Http.setToken(token) | |||||
var that = this; | |||||
app.couponListCallback = token => { | |||||
Http.setToken(token); | |||||
// business获取 | // business获取 | ||||
Http.get({ | Http.get({ | ||||
url: config.api.businessList, | url: config.api.businessList, | ||||
@@ -52,29 +62,29 @@ Component({ | |||||
pageSize: 10, | pageSize: 10, | ||||
type: 1 | type: 1 | ||||
} | } | ||||
}) | |||||
.then(res => { | |||||
console.log(res) | |||||
that.setData({ | |||||
tabs: res.data.list | |||||
}) | |||||
}) | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | |||||
tabs: res.data.list | |||||
}); | |||||
}); | |||||
// 券list获取 | // 券list获取 | ||||
Http.get({ | Http.get({ | ||||
url: config.api.couponList, | url: config.api.couponList, | ||||
data: { | data: { | ||||
pageNum: 1, | pageNum: 1, | ||||
pageSize: 10 | |||||
pageSize: 20 | |||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
console.log(res); | console.log(res); | ||||
that.setData({ | that.setData({ | ||||
list: res.data.list | list: res.data.list | ||||
}) | |||||
}) | |||||
} | |||||
}); | |||||
}); | |||||
}; | |||||
if (app.globalData.token && app.globalData.token != null) { | if (app.globalData.token && app.globalData.token != null) { | ||||
app.couponListCallback(app.globalData.token) | |||||
app.couponListCallback(app.globalData.token); | |||||
} | } | ||||
} | } | ||||
}) | |||||
}); |
@@ -2,7 +2,7 @@ | |||||
<i-tabs current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> | <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-tab wx:for="{{tabs}}" wx:key="unique" key="{{item.id}}" title="{{item.title}}"></i-tab> | ||||
</i-tabs> | </i-tabs> | ||||
<view> | |||||
<c-coupons wx:for="{{list}}" wx:key="unique" data="{{item}}" /> | |||||
</view> | |||||
<scroll-view scroll-y="true" bindscrolltolower="searchScrollLower"> | |||||
<c-coupons wx:for="{{list}}" paramAtoB="{{scrollHeight}}" wx:key="unique" data="{{item}}" /> | |||||
</scroll-view> | |||||
</view> | </view> |
@@ -1,29 +1,27 @@ | |||||
const Http = require("../../utils/HttpBasics") | |||||
const Http = require("../../utils/HttpBasics"); | |||||
//获取应用实例 | //获取应用实例 | ||||
const app = getApp() | |||||
const app = getApp(); | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
market: app.globalData.market, | market: app.globalData.market, | ||||
imgUrls: [ | imgUrls: [ | ||||
'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg', | |||||
'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg', | |||||
'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' | |||||
"http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||||
"http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||||
"http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" | |||||
], | ], | ||||
swiperCurrent: 0, | swiperCurrent: 0, | ||||
scrollTop: 0 | scrollTop: 0 | ||||
}, | }, | ||||
swiperChange: function (e) { | |||||
swiperChange: function(e) { | |||||
this.setData({ | this.setData({ | ||||
swiperCurrent: e.detail.current | swiperCurrent: e.detail.current | ||||
}) | |||||
}); | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
onLoad: function (options) { | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function() {}, | |||||
onLoad: function(options) { | |||||
var that = this; | var that = this; | ||||
if (app.globalData.token && app.globalData.token != null) { | if (app.globalData.token && app.globalData.token != null) { | ||||
console.log("index ++ " + app.globalData.token); | console.log("index ++ " + app.globalData.token); | ||||
@@ -32,29 +30,30 @@ Page({ | |||||
// 所以此处加入 callback 以防止这种情况 | // 所以此处加入 callback 以防止这种情况 | ||||
app.tokenCallback = token => { | app.tokenCallback = token => { | ||||
console.log("index + " + token); | console.log("index + " + token); | ||||
} | |||||
}; | |||||
} | } | ||||
wx.showLoading({ | wx.showLoading({ | ||||
title: '加载中', | |||||
}) | |||||
title: "加载中" | |||||
}); | |||||
var scene = decodeURIComponent(options.scene); | var scene = decodeURIComponent(options.scene); | ||||
var that = this; | var that = this; | ||||
setTimeout(function () { | |||||
wx.hideLoading() | |||||
}, 2200) | |||||
setTimeout(function() { | |||||
wx.hideLoading(); | |||||
}, 2200); | |||||
}, | }, | ||||
// 用户点击右上角分享 | // 用户点击右上角分享 | ||||
onShareAppMessage: function () { | |||||
onShareAppMessage: function() { | |||||
return { | return { | ||||
title: '富茂链客', | |||||
desc: '分享个小程序,希望你喜欢', | |||||
success: function (res) { | |||||
title: "富茂链客", | |||||
desc: "分享个小程序,希望你喜欢", | |||||
success: function(res) { | |||||
wx.showToast({ | wx.showToast({ | ||||
title: "分享成功", | title: "分享成功", | ||||
duration: 1000, | duration: 1000, | ||||
icon: "success" | icon: "success" | ||||
}) | |||||
}); | |||||
} | } | ||||
} | |||||
}; | |||||
} | } | ||||
}) | |||||
}); |
@@ -1,13 +1,13 @@ | |||||
{ | { | ||||
"usingComponents": { | "usingComponents": { | ||||
"c-banner":"../../components/banner/index", | |||||
"c-rushToBuy":"./rushToBuy/index", | |||||
"c-coupons":"./coupons/index" | |||||
}, | |||||
"enablePullDownRefresh":false, | |||||
"c-banner": "../../components/banner/index", | |||||
"c-rushToBuy": "./rushToBuy/index", | |||||
"c-coupons": "./coupons/index" | |||||
}, | |||||
"enablePullDownRefresh": false, | |||||
"navigationBarBackgroundColor": "#ffffff", | "navigationBarBackgroundColor": "#ffffff", | ||||
"navigationBarTextStyle": "black", | "navigationBarTextStyle": "black", | ||||
"navigationBarTitleText": "首页", | "navigationBarTitleText": "首页", | ||||
"backgroundColor": "#eeeeee", | "backgroundColor": "#eeeeee", | ||||
"backgroundTextStyle": "light" | "backgroundTextStyle": "light" | ||||
} | |||||
} |
@@ -1,9 +1,9 @@ | |||||
<view class="container"> | <view class="container"> | ||||
<view class="index-position"> | |||||
<!-- <view class="index-position"> | |||||
<navigator url="/pages/market/index"> | <navigator url="/pages/market/index"> | ||||
<text class="iconfont icon-dingweib txt"></text> {{market.name}} <text class="iconfont icon-choose"></text> | <text class="iconfont icon-dingweib txt"></text> {{market.name}} <text class="iconfont icon-choose"></text> | ||||
</navigator> | </navigator> | ||||
</view> | |||||
</view> --> | |||||
<c-banner imgUrls="{{imgUrls}}" /> | <c-banner imgUrls="{{imgUrls}}" /> | ||||
<c-rushToBuy /> | <c-rushToBuy /> | ||||
<c-coupons /> | <c-coupons /> |
@@ -1,75 +1,73 @@ | |||||
// pages/index/sw/index.js | // pages/index/sw/index.js | ||||
let config = require('../../../config/config.js') | |||||
let Http = require('../../../utils/HttpBasics') | |||||
const app = getApp() | |||||
let config = require("../../../config/config.js"); | |||||
let Http = require("../../../utils/HttpBasics"); | |||||
const app = getApp(); | |||||
Component({ | Component({ | ||||
/** | |||||
* 组件的属性列表 | |||||
*/ | |||||
properties: { | |||||
/** | |||||
* 组件的属性列表 | |||||
*/ | |||||
properties: {}, | |||||
}, | |||||
/** | |||||
* 组件的初始数据 | |||||
*/ | |||||
data: { | |||||
list: [ | |||||
// { | |||||
// img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
// { | |||||
// img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
// { | |||||
// img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
// { | |||||
// img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
] | |||||
}, | |||||
/** | |||||
* 组件的初始数据 | |||||
*/ | |||||
data: { | |||||
list: [ | |||||
// { | |||||
// img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
// { | |||||
// img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
// { | |||||
// img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
// { | |||||
// img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||||
// name: "海鲜焗饭", | |||||
// time: "2天12小时25分钟", | |||||
// oPrice: "59.00", | |||||
// pPrice: "1.00", | |||||
// }, | |||||
] | |||||
}, | |||||
/** | |||||
* 组件的方法列表 | |||||
*/ | |||||
methods: { | |||||
}, | |||||
ready() { | |||||
app.couponChannelListCallback = token => { | |||||
console.log("couponChannelList init"); | |||||
Http.setToken(token); | |||||
Http.get({ | |||||
url: config.api.couponChannelList, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
} | |||||
}).then(res => { | |||||
this.setData({ | |||||
list: res.data.list | |||||
}) | |||||
}) | |||||
} | |||||
if (app.globalData.token && app.globalData.token != null) { | |||||
console.log("couponChannelList init 1"); | |||||
app.couponChannelListCallback(app.globalData.token) | |||||
/** | |||||
* 组件的方法列表 | |||||
*/ | |||||
methods: {}, | |||||
ready() { | |||||
app.couponChannelListCallback = token => { | |||||
console.log("couponChannelList init"); | |||||
Http.setToken(token); | |||||
Http.get({ | |||||
url: config.api.couponChannelList, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
} | } | ||||
} | |||||
}) | |||||
}).then(res => { | |||||
console.log(res); | |||||
this.setData({ | |||||
list: res.data.list | |||||
}); | |||||
}); | |||||
}; | |||||
if (app.globalData.token && app.globalData.token != null) { | |||||
console.log("couponChannelList init 1"); | |||||
app.couponChannelListCallback(app.globalData.token); | |||||
} | |||||
} | |||||
}); |
@@ -3,13 +3,12 @@ | |||||
<scroll-view scroll-x class="index-scroll-view"> | <scroll-view scroll-x class="index-scroll-view"> | ||||
<view class="commodity" wx:for="{{list}}" wx:key="unique"> | <view class="commodity" wx:for="{{list}}" wx:key="unique"> | ||||
<navigator url="/pages/coupon/detail/index"> | <navigator url="/pages/coupon/detail/index"> | ||||
<image class="commodity-img" src="{{item.img}}" /> | |||||
<image class="commodity-img" src="{{item.coverImg}}" /> | |||||
<view class="commodity-info"> | <view class="commodity-info"> | ||||
<view class="commodity-info-name">{{item.name}}</view> | |||||
<view class="commodity-info-time">{{item.time}}</view> | |||||
<view class="commodity-info-name">{{item.subTitle}}</view> | |||||
<view class="commodity-info-price"> | <view class="commodity-info-price"> | ||||
<text class="commodity-info-price-p">¥{{item.pPrice}}</text> | |||||
<text class="commodity-info-price-o">¥{{item.oPrice}}</text> | |||||
<text class="commodity-info-price-p">¥{{item.salePriceStr}}</text> | |||||
<text class="commodity-info-price-o">¥{{item.salePriceStr}}</text> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</navigator> | </navigator> | ||||
@@ -4,12 +4,11 @@ | |||||
} | } | ||||
.index-rushToBuy-title { | .index-rushToBuy-title { | ||||
font-size: 36rpx; | |||||
font-size: 32rpx; | |||||
color: #000000; | color: #000000; | ||||
letter-spacing: 0.75rpx; | letter-spacing: 0.75rpx; | ||||
padding-top: 20rpx; | padding-top: 20rpx; | ||||
padding-left: 30rpx; | padding-left: 30rpx; | ||||
padding-bottom: 30rpx | |||||
} | } | ||||
.index-scroll-view { | .index-scroll-view { | ||||
@@ -41,7 +40,7 @@ | |||||
} | } | ||||
.index-scroll-view .commodity-info { | .index-scroll-view .commodity-info { | ||||
padding: 20rpx; | |||||
padding:5rpx 20rpx; | |||||
overflow: hidden; | overflow: hidden; | ||||
} | } | ||||
@@ -58,14 +57,9 @@ | |||||
line-height: 42rpx; | line-height: 42rpx; | ||||
} | } | ||||
.index-scroll-view .commodity-info-price { | |||||
padding-top: 11rpx; | |||||
} | |||||
.index-scroll-view .commodity-info-price-p { | .index-scroll-view .commodity-info-price-p { | ||||
font-size: 36rpx; | |||||
font-size: 30rpx; | |||||
color: #FF3434; | color: #FF3434; | ||||
letter-spacing: 0.96rpx; | |||||
} | } | ||||
.index-scroll-view .commodity-info-price-o { | .index-scroll-view .commodity-info-price-o { | ||||
display: inline-block; | display: inline-block; | ||||
@@ -1,72 +1,56 @@ | |||||
Page({ | Page({ | ||||
/** | /** | ||||
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
user:{ | |||||
avatar:'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg' | |||||
user: { | |||||
avatar: | |||||
"http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" | |||||
} | } | ||||
}, | }, | ||||
navigateTo(){ | |||||
navigateTo() { | |||||
console.log("object"); | console.log("object"); | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `../login/index`, | |||||
}) | |||||
url: `../login/index` | |||||
}); | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function (options) { | |||||
}, | |||||
onLoad: function(options) {}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
*/ | */ | ||||
onReady: function () { | |||||
}, | |||||
onReady: function() {}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
*/ | */ | ||||
onShow: function () { | |||||
}, | |||||
onShow: function() {}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
*/ | */ | ||||
onHide: function () { | |||||
}, | |||||
onHide: function() {}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面卸载 | * 生命周期函数--监听页面卸载 | ||||
*/ | */ | ||||
onUnload: function () { | |||||
}, | |||||
onUnload: function() {}, | |||||
/** | /** | ||||
* 页面相关事件处理函数--监听用户下拉动作 | * 页面相关事件处理函数--监听用户下拉动作 | ||||
*/ | */ | ||||
onPullDownRefresh: function () { | |||||
}, | |||||
onPullDownRefresh: function() {}, | |||||
/** | /** | ||||
* 页面上拉触底事件的处理函数 | * 页面上拉触底事件的处理函数 | ||||
*/ | */ | ||||
onReachBottom: function () { | |||||
}, | |||||
onReachBottom: function() {}, | |||||
/** | /** | ||||
* 用户点击右上角分享 | * 用户点击右上角分享 | ||||
*/ | */ | ||||
onShareAppMessage: function () { | |||||
} | |||||
}) | |||||
onShareAppMessage: function() {} | |||||
}); |