@@ -17,7 +17,7 @@ Component({ | |||||
}, | }, | ||||
methods: { | methods: { | ||||
onLogin(e){ | |||||
navigateTo(e){ | |||||
let { id } = e.currentTarget.dataset.date; | let { id } = e.currentTarget.dataset.date; | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `../../pages/coupons/details/index?id=${id}`, | url: `../../pages/coupons/details/index?id=${id}`, | ||||
@@ -1,21 +1,23 @@ | |||||
<view class="coupons"> | |||||
<view class="coupons-img"> | |||||
<image src="{{data.coverImg}}"></image> | |||||
</view> | |||||
<view class="coupons-info"> | |||||
<view class="coupons-info-name">{{data.name}}</view> | |||||
<view class="coupons-info-price"> | |||||
<text class="coupons-info-price-p">¥{{data.salePrice}}</text> | |||||
<text class="coupons-info-price-o">¥{{data.price}}</text> | |||||
<navigator url="/pages/coupons/details/index?id={{data.id}}"> | |||||
<view class="coupons"> | |||||
<view class="coupons-img"> | |||||
<image src="{{data.coverImg}}"></image> | |||||
</view> | </view> | ||||
<view class="coupons-info-distance"> | |||||
<text class="iconfont icon-dingweib"></text> | |||||
{{data.salePrice}} | |||||
<view class="coupons-info"> | |||||
<view class="coupons-info-name">{{data.name}}</view> | |||||
<view class="coupons-info-price"> | |||||
<text class="coupons-info-price-p">¥{{data.salePrice}}</text> | |||||
<text class="coupons-info-price-o">¥{{data.price}}</text> | |||||
</view> | |||||
<view class="coupons-info-distance"> | |||||
<text class="iconfont icon-dingweib"></text> | |||||
{{data.salePrice}} | |||||
</view> | |||||
<view class="coupons-info-address">{{data.salePrice}}</view> | |||||
</view> | </view> | ||||
<view class="coupons-info-address">{{data.salePrice}}</view> | |||||
</view> | |||||
<view class="coupons-btn"> | |||||
<i-button i-class="coupons-btn-gm" bind:click="onLogin" data-date='{{data}}'>购买</i-button> | |||||
<view class="coupons-btn"> | |||||
<i-button i-class="coupons-btn-gm" bind:click="navigateTo" data-date='{{data}}'>购买</i-button> | |||||
</view> | |||||
<view class="coupons-border"></view> | |||||
</view> | </view> | ||||
<view class="coupons-border"></view> | |||||
</view> | |||||
</navigator> |
@@ -3,20 +3,24 @@ var app = getApp() | |||||
const Http = require("../../../utils/HttpBasics") | const Http = require("../../../utils/HttpBasics") | ||||
Page({ | Page({ | ||||
data: { | data: { | ||||
list: {}, | |||||
data: {}, | |||||
couponId: null, | couponId: null, | ||||
orderId: '' | orderId: '' | ||||
}, | }, | ||||
onLoad(e) { | onLoad(e) { | ||||
console.log(e.id) | |||||
console.log(e) | |||||
wx.showLoading({ | |||||
title: '加载中...', | |||||
}) | |||||
Http.get({ | Http.get({ | ||||
url: Http.config.api.couponDetail, | url: Http.config.api.couponDetail, | ||||
data: { | data: { | ||||
id: e.id | id: e.id | ||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
wx.hideLoading(); | |||||
this.setData({ | this.setData({ | ||||
list: res, | |||||
data: res, | |||||
couponId: e.id | couponId: e.id | ||||
}) | }) | ||||
}) | }) | ||||
@@ -52,10 +56,11 @@ Page({ | |||||
if (res.payment > 0) { | if (res.payment > 0) { | ||||
return Http.post({ url: Http.config.api.payOrderCreate, data: { orderId: orderId } }) | return Http.post({ url: Http.config.api.payOrderCreate, data: { orderId: orderId } }) | ||||
} else { | } else { | ||||
// 免费卷 | |||||
this.payOrderUpdate(orderId, "0", 1) // 支付成功 | this.payOrderUpdate(orderId, "0", 1) // 支付成功 | ||||
.then(res => { | .then(res => { | ||||
wx.showToast({ | wx.showToast({ | ||||
title: "支付状态更新成功", | |||||
title: "支付成功", | |||||
duration: 3000 | duration: 3000 | ||||
}) | }) | ||||
}) | }) | ||||
@@ -1,15 +1,16 @@ | |||||
<view class='coupons'> | <view class='coupons'> | ||||
<view class="coupons-body"> | |||||
<view class='banner'> | <view class='banner'> | ||||
<image src='http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg'></image> | |||||
<image src='{{data.coverImg}}'></image> | |||||
</view> | </view> | ||||
<view class='coupons_info'> | <view class='coupons_info'> | ||||
<view> | <view> | ||||
<text>黑椒牛排<text>限购一件</text></text> | |||||
<text>{{data.title}}<text>限购一件</text></text> | |||||
<text>剩余时间:<text>2天12小时25分钟</text></text> | <text>剩余时间:<text>2天12小时25分钟</text></text> | ||||
<text>剩余件数:<text>19件</text></text> | <text>剩余件数:<text>19件</text></text> | ||||
</view> | </view> | ||||
<view> | <view> | ||||
<text>¥1.00</text> | |||||
<text>¥{{data.salePriceStr}}</text> | |||||
<text>¥59.00</text> | <text>¥59.00</text> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
@@ -42,5 +43,8 @@ | |||||
<text><text class='spot'></text>每桌限用2张</text> | <text><text class='spot'></text>每桌限用2张</text> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<button bindtap='newOrderfunc' class='buy'>立即购买</button> | |||||
</view> | |||||
<view class="buy-view app-border-top"> | |||||
<button bindtap='newOrderfunc' class='buy'>立即购买</button> | |||||
</view> | |||||
</view> | </view> |
@@ -1,190 +1,210 @@ | |||||
@import '../../../app.wxss'; | @import '../../../app.wxss'; | ||||
.coupons { | .coupons { | ||||
width: 100%; | |||||
height: 100%; | |||||
position: absolute; | |||||
background: #f6f6f6; | |||||
width: 100%; | |||||
height: 100vh; | |||||
background: #f6f6f6; | |||||
position: relative; | |||||
display: flex; | |||||
flex-direction: column; | |||||
} | |||||
.coupons-body{ | |||||
flex: 1; | |||||
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) { | |||||
width: 126rpx; | |||||
height: 126rpx; | |||||
border-radius: 50%; | |||||
overflow: hidden; | |||||
flex: 2; | |||||
.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(1) image { | |||||
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; | |||||
} | |||||
.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; | |||||
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 { | .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 { | |||||
width: 100%; | |||||
padding: 10rpx; | |||||
/* position: fixed; */ | |||||
/* bottom: 0; */ | |||||
background: #fff; | |||||
box-sizing: border-box; | |||||
} | } | ||||
.buy { | .buy { | ||||
width: 100%; | |||||
height: 88rpx; | |||||
background: #00C0FF; | |||||
color: #fff; | |||||
font-size: 36rpx; | |||||
line-height: 88rpx; | |||||
/* width: 100%; */ | |||||
height: 88rpx; | |||||
background: #00C0FF; | |||||
color: #fff; | |||||
font-size: 36rpx; | |||||
line-height: 88rpx; | |||||
border-radius: 0; | |||||
} | } |
@@ -1,4 +1,5 @@ | |||||
// pages/index/sw/index.js | // pages/index/sw/index.js | ||||
let Http = require('../../../utils/HttpBasics') | |||||
Component({ | Component({ | ||||
/** | /** | ||||
* 组件的属性列表 | * 组件的属性列表 | ||||
@@ -12,34 +13,34 @@ Component({ | |||||
*/ | */ | ||||
data: { | data: { | ||||
list: [ | 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", | |||||
}, | |||||
// { | |||||
// 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", | |||||
// }, | |||||
] | ] | ||||
}, | }, | ||||
@@ -48,5 +49,17 @@ Component({ | |||||
*/ | */ | ||||
methods: { | methods: { | ||||
}, | |||||
ready() { | |||||
Http.get({ | |||||
url: "/wxCouponChannel/list", data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
} | |||||
}).then(res=>{ | |||||
this.setData({ | |||||
list: res.list | |||||
}) | |||||
}) | |||||
} | } | ||||
}) | }) |