Просмотр исходного кода

[首页限时抢购列表,首页优惠券列表][修改]:限时抢购页面的渲染,和首页列表按钮样式修改

tags/2.2.4
meo 6 лет назад
Родитель
Сommit
e6c82d629f
24 измененных файлов: 3276 добавлений и 496 удалений
  1. Двоичные данные
      assets/img/guoqi.jpg
  2. Двоичные данные
      assets/img/guoqi.png
  3. +6
    -12
      components/coupons/index.js
  4. +15
    -11
      components/coupons/index.wxml
  5. +130
    -70
      components/coupons/index.wxss
  6. +1
    -1
      dist/tab/index.wxss
  7. +1
    -1
      pages/addPark/addPark.wxss
  8. +100
    -68
      pages/coupon/detail/index.js
  9. +2
    -2
      pages/coupon/detail/index.wxml
  10. +126
    -123
      pages/coupon/detail/index.wxss
  11. +3
    -3
      pages/couponorder/detail/index.js
  12. +1
    -2
      pages/couponorder/detail/index.wxml
  13. +3
    -4
      pages/couponorder/index/index.js
  14. +15
    -15
      pages/couponorder/index/index.wxml
  15. +42
    -32
      pages/index/coupons/index.js
  16. +3
    -3
      pages/index/coupons/index.wxml
  17. +25
    -26
      pages/index/index.js
  18. +6
    -6
      pages/index/index.json
  19. +2
    -2
      pages/index/index.wxml
  20. +68
    -70
      pages/index/rushToBuy/index.js
  21. +4
    -5
      pages/index/rushToBuy/index.wxml
  22. +3
    -9
      pages/index/rushToBuy/index.wxss
  23. +15
    -31
      pages/user/index.js
  24. +2705
    -0
      typings/wx.d.ts

Двоичные данные
assets/img/guoqi.jpg Просмотреть файл

До После
Ширина: 510  |  Высота: 581  |  Размер: 28 KiB

Двоичные данные
assets/img/guoqi.png Просмотреть файл

До После
Ширина: 200  |  Высота: 200  |  Размер: 34 KiB

+ 6
- 12
components/coupons/index.js Просмотреть файл

@@ -4,24 +4,18 @@ Component({
* 组件的属性列表
*/
properties: {
paramAtoB: String,
data: {
value: {},
type: Object,
},
type: Object
}
},

/**
* 组件的初始数据
*/
data: {

},
data: {},
methods: {
navigateTo(e){
let { id } = e.currentTarget.dataset.date;
wx.navigateTo({
url: `../../pages/coupon/detail/index?id=${id}`,
})
}
}
})
});

+ 15
- 11
components/coupons/index.wxml Просмотреть файл

@@ -1,4 +1,5 @@
<navigator url="/pages/coupon/detail/index?id={{data.id}}">
<!-- 首页优惠券列表页面 -->
<view class="coupons">
<view class="coupons-img">
<image src="{{data.coverImg}}"></image>
@@ -6,21 +7,24 @@
<view class="coupons-info">
<view class="coupons-info-name">{{data.title}}</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">
<text class="coupons-info-price-p">¥{{data.salePrice/100}}</text>
<text class="coupons-info-price-o">¥{{data.price/100}}</text>
</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 class="coupons-border"></view>
</view>
</navigator>
</navigator>
<view class="loading" hidden="{{!searchLoading}}">正在载入更多...</view>
<view class="loading complete" hidden="{{!searchLoadingComplete}}">已加载全部</view>

+ 130
- 70
components/coupons/index.wxss Просмотреть файл

@@ -1,101 +1,161 @@
@import "../../app.wxss";
.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 {
width: 248rpx;
height: 184rpx;
overflow: hidden;
border-radius: 10rpx;
width: 248rpx;
height: 184rpx;
overflow: hidden;
border-radius: 10rpx;
}

.coupons-img image {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}

.coupons-info {
padding-left: 20rpx;
/* padding-top: 10rpx; */
padding-left: 20rpx;
}

.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 {
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 {
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 {
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 {
font-size: 22rpx;
color: #585858;
letter-spacing: 0;
line-height: 30rpx;
font-size: 22rpx;
color: #585858;
letter-spacing: 0;
line-height: 30rpx;
}

.coupons-btn {
position: absolute;
bottom: 30rpx;
right: 30rpx;
position: absolute;
top: 40rpx;
right: 30rpx;
}

.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;
}

+ 1
- 1
dist/tab/index.wxss Просмотреть файл

@@ -33,7 +33,7 @@
}

.i-tabs-tab-title-current {
color: #00C0FF
color: #00C0FF;
}

.i-tabs-tab-scroll {


+ 1
- 1
pages/addPark/addPark.wxss Просмотреть файл

@@ -142,7 +142,7 @@
line-height: 80rpx;
}
.addpark-back{
font-size: 25rpx;
font-size: 30rpx;
color: #5aadfb;
float: right;
margin: 25rpx 25rpx;


+ 100
- 68
pages/coupon/detail/index.js Просмотреть файл

@@ -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({
data: {
data: {},
couponId: null,
orderId: ''
orderId: "",
day: "",
hour: "",
minute: ""
},
onLoad(options) {
console.log("00000000000000----------");
console.log(options);
let that = this;
wx.showLoading({
title: "加载中..."
@@ -25,6 +27,32 @@ Page({
}
}).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,
@@ -39,119 +67,121 @@ Page({
payOrderUpdate: (orderId, payOrderId, status, reason) => {
// 支付成功
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 => {
console.log("payOrderUpdate then", res);
wx.showToast({
title: '购买成功',
title: "购买成功",
duration: 2500
})
}).catch(err => {
console.log("payOrderUpdate catch", err);
});
})
.catch(err => {
console.log("payOrderUpdate catch", err);
});
},
payment: (res) => {
payment: res => {
var that = this;
var payOrderId = '' + res.data.out_trade_no;
var payOrderId = "" + res.data.out_trade_no;
wx.requestPayment({
timeStamp: res.timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: 'MD5',
signType: "MD5",
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('支付成功');
console.log("支付成功");
wx.showToast({
title: '购买成功',
title: "购买成功",
duration: 2500
})
});
wx.navigateBack({
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;
},
'complete': (res) => {
complete: res => {
console.log(res);
console.log('支付完成');
console.log("支付完成");
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({
title: '提示',
content: '支付成功'
title: "提示",
content: "支付成功"
});
if (url) {
setTimeout(function() {
wx.redirectTo({
url: '/pages' + url
url: "/pages" + url
});
}, 2000)
}, 2000);
} else {
setTimeout(() => {
wx.navigateBack()
}, 2000)
wx.navigateBack();
}, 2000);
}
} else {
wx.showModal({
title: '错误提示',
title: "错误提示",
content: res.errMsg
});
}
return;
}
})
});
},
orderFunc() {
var that = this;
wx.showLoading({
title: '加载中...',
})
title: "加载中..."
});
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
return Http.post({
url: config.api.orderSave,
data: {
couponId: that.data.couponId
}
})
}).catch(err => {
console.log(err)
});
})
.catch(err => {
console.log(err);
if (err.code == 11005) {
// 用户手机未授权
wx.redirectTo({
url: '../../getphoneInfo/index?couponId=' + that.data.couponId,
})
url: "../../getphoneInfo/index?couponId=" + that.data.couponId
});
}
if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: '../../phoneinput/phoneinput?couponId=' + that.data.couponId,
})
url: "../../phoneinput/phoneinput?couponId=" + that.data.couponId
});
}
})
.then(res => {
if (res != "undefined") {
const orderId = '' + res.data.id;
const orderId = "" + res.data.id;
that.setData({
orderId: orderId
})
});
if (res.data.payment > 0) {
// 支付金额不为0
Http.post({
@@ -160,25 +190,27 @@ Page({
orderId: orderId
}
}).then(res => {
console.log(res)
var payOrderId = '' + res.data.out_trade_no;
console.log(res);
var payOrderId = "" + res.data.out_trade_no;
wx.hideLoading();
//payment(res);
that.payOrderUpdate(that.data.orderId, payOrderId, 1) // 支付成功
})
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功
});
} else {
// 免费券
that.payOrderUpdate(orderId, "0", 1) // 支付成功
that
.payOrderUpdate(orderId, "0", 1) // 支付成功
.then(res => {
wx.showToast({
title: "支付成功",
duration: 3000
})
})
});
});
}
}
}).catch(err => {
console.log(err)
})
},
})
.catch(err => {
console.log(err);
});
}
});

+ 2
- 2
pages/coupon/detail/index.wxml Просмотреть файл

@@ -6,7 +6,7 @@
<view class='coupons_info'>
<view>
<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>
</view>
<view>
@@ -47,6 +47,6 @@
</view>
</view>
<view class="buy-view app-border-top">
<button bindtap='orderFunc' class='buy'>立即购买</button>
<button bindtap='orderFunc' class='buy'>立即购买</button>
</view>
</view>

+ 126
- 123
pages/coupon/detail/index.wxss Просмотреть файл

@@ -1,211 +1,214 @@
@import "../../../app.wxss";

.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;
overflow: auto;
/* overflow: auto; */
}

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

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

.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 {
display: flex;
flex-direction: column;
display: flex;
flex-direction: column;
}

.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 {
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(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(3) text {
color: #ff3434;
font-size: 24rpx;
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;
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;
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%;
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;
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;
font-size: 30rpx;
color: #a9a9a9;
}

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

.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;
width: 126rpx;
height: 126rpx;
border-radius: 50%;
overflow: hidden;
flex: 2;
}

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

.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) {
font-size: 30rpx;
font-size: 30rpx;
}

.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 {
margin-top: 2%;
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;
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;
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%;
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: 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%;
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;
background: #fff;
position: fixed;
padding-top: 10rpx;
height:98rpx;
bottom: 0rpx;
left: 0;
right: 0;
}

.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;
}

+ 3
- 3
pages/couponorder/detail/index.js Просмотреть файл

@@ -30,7 +30,7 @@ Page({
}).then(res => {
console.log(res);
that.setData({
data: res.data.data
data: res.data
});
that.setData({
expiredTime: util.fmtDate(that.data.data.expiredTime),
@@ -44,9 +44,9 @@ Page({
phone: function() {
let that = this;
console.log(that.data);
if (that.data.data.merchantLinkPhone) {
if (that.data.merchantLinkPhone) {
wx.makePhoneCall({
phoneNumber: that.data.data.merchantLinkPhone //仅为示例,并非真实的电话号码
phoneNumber: that.data.merchantLinkPhone //仅为示例,并非真实的电话号码
});
}
}


+ 1
- 2
pages/couponorder/detail/index.wxml Просмотреть файл

@@ -1,4 +1,3 @@
<!--index.wxml-->
<view class="container page">
<view class="coupon_detail clearfix">
<image class="fl" src="{{data.coverImg}}" mode="widthFix" />
@@ -23,7 +22,7 @@
<image src="./../../../assets/img/tui.png" mode="widthFix"></image>
</view>
<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 class="panel" wx:if="{{data.couponOrderStatus==0}}">
<view class="barcode">


+ 3
- 4
pages/couponorder/index/index.js Просмотреть файл

@@ -2,7 +2,6 @@ const format = require("../../../utils/util.js");
const config = require("../../../config/config.js");
const app = getApp();
const Http = require("../../../utils/HttpBasics");
//1535126400000
Page({
data: {
tabs: [
@@ -24,11 +23,11 @@ Page({
}
],
list: [],
current: "",
current_scroll: "1"
current: "0",
current_scroll: "0"
},
onLoad() {
this.getList(1, 1);
this.getList(0, 0);
},

//点击跳转到券详情页面


+ 15
- 15
pages/couponorder/index/index.wxml Просмотреть файл

@@ -4,29 +4,29 @@
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab>
</i-tabs>


<view>
<view class="nocoupon" wx:if="{{list.length==0}}">
<image src="./../../../assets/img/cou.png" mode="widthFix" />
<text>没有优惠券哦</text>
</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>
<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 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>

+ 42
- 32
pages/index/coupons/index.js Просмотреть файл

@@ -1,14 +1,13 @@
// 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({
/**
* 组件的属性列表
*/
properties: {

},
properties: {},

/**
* 组件的初始数据
@@ -16,34 +15,45 @@ Component({
data: {
tabs: [],
list: [],
current: '1',
current_scroll: '1',
current: "0",
current_scroll: "0",
pageNum: 1, // 设置加载的第几次,默认是第一次
pageSize: 10, //返回数据的个数
searchLoading: false, //"上拉加载"的变量,默认false,隐藏
searchLoadingComplete: false //“没有数据”的变量,默认false,隐藏
},

/**
* 组件的方法列表
*/
methods: {
handleChange({
detail
}) {
handleChange({ detail }) {
this.setData({
current: detail.key
});
},

handleChangeScroll({
detail
}) {
handleChangeScroll({ detail }) {
this.setData({
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() {
var that = this
app.couponListCallback = token =>{
Http.setToken(token)
var that = this;
app.couponListCallback = token => {
Http.setToken(token);
// business获取
Http.get({
url: config.api.businessList,
@@ -52,29 +62,29 @@ Component({
pageSize: 10,
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获取
Http.get({
url: config.api.couponList,
data: {
pageNum: 1,
pageSize: 10
pageSize: 20
}
}).then(res => {
console.log(res);
that.setData({
list: res.data.list
})
})
}
});
});
};
if (app.globalData.token && app.globalData.token != null) {
app.couponListCallback(app.globalData.token)
app.couponListCallback(app.globalData.token);
}
}
})
});

+ 3
- 3
pages/index/coupons/index.wxml Просмотреть файл

@@ -2,7 +2,7 @@
<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-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>

+ 25
- 26
pages/index/index.js Просмотреть файл

@@ -1,29 +1,27 @@
const Http = require("../../utils/HttpBasics")
const Http = require("../../utils/HttpBasics");
//获取应用实例
const app = getApp()
const app = getApp();
Page({
data: {
market: app.globalData.market,
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,
scrollTop: 0
},
swiperChange: function (e) {
swiperChange: function(e) {
this.setData({
swiperCurrent: e.detail.current
})
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
onLoad: function (options) {
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
onLoad: function(options) {
var that = this;
if (app.globalData.token && app.globalData.token != null) {
console.log("index ++ " + app.globalData.token);
@@ -32,29 +30,30 @@ Page({
// 所以此处加入 callback 以防止这种情况
app.tokenCallback = token => {
console.log("index + " + token);
}
};
}
wx.showLoading({
title: '加载中',
})
title: "加载中"
});
var scene = decodeURIComponent(options.scene);
var that = this;
setTimeout(function () {
wx.hideLoading()
}, 2200)
setTimeout(function() {
wx.hideLoading();
}, 2200);
},

// 用户点击右上角分享
onShareAppMessage: function () {
onShareAppMessage: function() {
return {
title: '富茂链客',
desc: '分享个小程序,希望你喜欢',
success: function (res) {
title: "富茂链客",
desc: "分享个小程序,希望你喜欢",
success: function(res) {
wx.showToast({
title: "分享成功",
duration: 1000,
icon: "success"
})
});
}
}
};
}
})
});

+ 6
- 6
pages/index/index.json Просмотреть файл

@@ -1,13 +1,13 @@
{
"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",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "首页",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light"
}
}

+ 2
- 2
pages/index/index.wxml Просмотреть файл

@@ -1,9 +1,9 @@
<view class="container">
<view class="index-position">
<!-- <view class="index-position">
<navigator url="/pages/market/index">
<text class="iconfont icon-dingweib txt"></text> {{market.name}} <text class="iconfont icon-choose"></text>
</navigator>
</view>
</view> -->
<c-banner imgUrls="{{imgUrls}}" />
<c-rushToBuy />
<c-coupons />

+ 68
- 70
pages/index/rushToBuy/index.js Просмотреть файл

@@ -1,75 +1,73 @@
// 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({
/**
* 组件的属性列表
*/
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);
}
}
});

+ 4
- 5
pages/index/rushToBuy/index.wxml Просмотреть файл

@@ -3,13 +3,12 @@
<scroll-view scroll-x class="index-scroll-view">
<view class="commodity" wx:for="{{list}}" wx:key="unique">
<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-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">
<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>
</navigator>


+ 3
- 9
pages/index/rushToBuy/index.wxss Просмотреть файл

@@ -4,12 +4,11 @@
}

.index-rushToBuy-title {
font-size: 36rpx;
font-size: 32rpx;
color: #000000;
letter-spacing: 0.75rpx;
padding-top: 20rpx;
padding-left: 30rpx;
padding-bottom: 30rpx
}

.index-scroll-view {
@@ -41,7 +40,7 @@
}

.index-scroll-view .commodity-info {
padding: 20rpx;
padding:5rpx 20rpx;
overflow: hidden;
}

@@ -58,14 +57,9 @@
line-height: 42rpx;
}

.index-scroll-view .commodity-info-price {
padding-top: 11rpx;
}

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


+ 15
- 31
pages/user/index.js Просмотреть файл

@@ -1,72 +1,56 @@
Page({

/**
* 页面的初始数据
*/
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");
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() {}
});

+ 2705
- 0
typings/wx.d.ts
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


Загрузка…
Отмена
Сохранить