...
|
...
|
@@ -17,22 +17,22 @@ Page({ |
|
|
page: 1, //页数
|
|
|
price: 'price desc', //价格排序方式
|
|
|
paynum: 'paynum desc', //销量排序方式
|
|
|
stick:0,
|
|
|
activity:[],
|
|
|
xianshilist:[],
|
|
|
day:'',
|
|
|
hou :'',
|
|
|
min :'',
|
|
|
sec :'',
|
|
|
endTime:'',
|
|
|
activitystatus:'',
|
|
|
showtime:false,
|
|
|
status1:'',
|
|
|
status2:'',
|
|
|
title2:''
|
|
|
stick: 0,
|
|
|
activity: [],
|
|
|
xianshilist: [],
|
|
|
day: '',
|
|
|
hou: '',
|
|
|
min: '',
|
|
|
sec: '',
|
|
|
endTime: '',
|
|
|
activitystatus: '',
|
|
|
showtime: false,
|
|
|
status1: '',
|
|
|
status2: '',
|
|
|
title2: ''
|
|
|
},
|
|
|
|
|
|
scroll(e){
|
|
|
scroll(e) {
|
|
|
// console.log(e.detail.scrollTop)
|
|
|
// if (e.detail.scrollTop >300){
|
|
|
// console.log(8888)
|
...
|
...
|
@@ -47,14 +47,32 @@ Page({ |
|
|
|
|
|
// console.log(this.data.stick)
|
|
|
},
|
|
|
moremiao(){
|
|
|
moremiao() {
|
|
|
let token = wx.getStorageSync("token")
|
|
|
if (token == '') {
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: '请先登录',
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/register/register',
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
}else{
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/xianshi/xianshi',
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 控制活动专区和限时抢购显示隐藏
|
|
|
ishow(){
|
|
|
ishow() {
|
|
|
let that = this
|
|
|
let url = '//wb/wb';
|
|
|
let data = {
|
...
|
...
|
@@ -62,7 +80,7 @@ Page({ |
|
|
|
|
|
}
|
|
|
app.post(url, data, "POST").then((r) => {
|
|
|
console.log('4456789',r)
|
|
|
console.log('4456789', r)
|
|
|
that.setData({
|
|
|
status1: r.msg.status1,
|
|
|
status2: r.msg.status2,
|
...
|
...
|
@@ -71,16 +89,16 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
}).catch((err) => { })
|
|
|
}).catch((err) => {})
|
|
|
},
|
|
|
|
|
|
// 限时抢购
|
|
|
getxianshi(){
|
|
|
getxianshi() {
|
|
|
let that = this
|
|
|
let url = '/special/get_all';
|
|
|
let data = {
|
|
|
page:1,
|
|
|
pageNum:4
|
|
|
page: 1,
|
|
|
pageNum: 4
|
|
|
|
|
|
}
|
|
|
app.post(url, data, "POST").then((r) => {
|
...
|
...
|
@@ -89,7 +107,7 @@ Page({ |
|
|
that.setData({
|
|
|
xianshilist: r.msg.list,
|
|
|
endTime: r.msg.residue_time,
|
|
|
activitystatus:r.msg.status
|
|
|
activitystatus: r.msg.status
|
|
|
})
|
|
|
var time = that.date_format(r.msg.residue_time);
|
|
|
console.log(time)
|
...
|
...
|
@@ -103,10 +121,10 @@ Page({ |
|
|
|
|
|
// console.log(that.data.messagelist)
|
|
|
|
|
|
}).catch((err) => { })
|
|
|
}).catch((err) => {})
|
|
|
},
|
|
|
|
|
|
date_format(micro_second) {
|
|
|
date_format(micro_second) {
|
|
|
// 总秒数
|
|
|
var second = micro_second;
|
|
|
// var second = Math.floor(micro_second / 1000);
|
...
|
...
|
@@ -124,9 +142,9 @@ date_format(micro_second) { |
|
|
// 倒计时
|
|
|
countDown() {
|
|
|
var that = this;
|
|
|
console.log('999',that.data.endTime)
|
|
|
console.log('999', that.data.endTime)
|
|
|
var time = that.data.endTime;
|
|
|
var interval = setInterval(function () {
|
|
|
var interval = setInterval(function() {
|
|
|
// 秒数
|
|
|
let day = parseInt(time / (60 * 60 * 24));
|
|
|
let hou = parseInt(time % (60 * 60 * 24) / 3600);
|
...
|
...
|
@@ -153,7 +171,7 @@ date_format(micro_second) { |
|
|
},
|
|
|
|
|
|
//获取活动专区列表
|
|
|
getzhuanqulist(){
|
|
|
getzhuanqulist() {
|
|
|
let that = this
|
|
|
let url = '/activity/get_all';
|
|
|
let data = {
|
...
|
...
|
@@ -163,7 +181,7 @@ date_format(micro_second) { |
|
|
app.post(url, data, "POST").then((r) => {
|
|
|
console.log(r)
|
|
|
that.setData({
|
|
|
activity:r.msg
|
|
|
activity: r.msg
|
|
|
})
|
|
|
|
|
|
console.log(that.data.activity)
|
...
|
...
|
@@ -173,18 +191,35 @@ date_format(micro_second) { |
|
|
|
|
|
// console.log(that.data.messagelist)
|
|
|
|
|
|
}).catch((err) => { })
|
|
|
}).catch((err) => {})
|
|
|
},
|
|
|
|
|
|
// 活动专区查看更多
|
|
|
seeactive(e){
|
|
|
let id=e.currentTarget.dataset.id
|
|
|
seeactive(e) {
|
|
|
let id = e.currentTarget.dataset.id
|
|
|
let token = wx.getStorageSync("token")
|
|
|
if (token == '') {
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: '请先登录',
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/zhuanqu/zhuanqu?id='+id,
|
|
|
url: '/pages/register/register',
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/zhuanqu/zhuanqu?id=' + id,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
more(){
|
|
|
more() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/classify/classify',
|
|
|
})
|
...
|
...
|
@@ -212,9 +247,24 @@ date_format(micro_second) { |
|
|
},
|
|
|
//轮播图
|
|
|
look_more(e) {
|
|
|
let token = wx.getStorageSync("token")
|
|
|
let id = e.currentTarget.dataset.id
|
|
|
let style = e.currentTarget.dataset.style
|
|
|
if(style == 2){
|
|
|
if (token == '') {
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: '请先登录',
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/register/register',
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
if (style == 2) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
|
|
|
})
|
...
|
...
|
@@ -223,6 +273,8 @@ date_format(micro_second) { |
|
|
url: '/pages/shop_detail/shop_detail?id=' + id
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
@@ -312,12 +364,12 @@ date_format(micro_second) { |
|
|
pid: pid
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log('88776654',res)
|
|
|
console.log('88776654', res)
|
|
|
wx.hideLoading()
|
|
|
if (type == 1) {
|
|
|
let obj={
|
|
|
name:'首页',
|
|
|
id:''
|
|
|
let obj = {
|
|
|
name: '首页',
|
|
|
id: ''
|
|
|
}
|
|
|
res.msg.unshift(obj)
|
|
|
that.setData({
|
...
|
...
|
@@ -325,7 +377,7 @@ date_format(micro_second) { |
|
|
})
|
|
|
that.get_info(res.msg[0].id, 2)
|
|
|
} else if (type == 2) {
|
|
|
console.log('666',res)
|
|
|
console.log('666', res)
|
|
|
// let obj = {
|
|
|
// name: '全部',
|
|
|
// id: ''
|
...
|
...
|
@@ -384,17 +436,17 @@ date_format(micro_second) { |
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
let that=this
|
|
|
let that = this
|
|
|
this.get_banner()
|
|
|
this.get_info(0, 1);
|
|
|
// 获取活动专区
|
|
|
this.getzhuanqulist();
|
|
|
this.getxianshi();
|
|
|
setTimeout(function(){
|
|
|
setTimeout(function() {
|
|
|
that.setData({
|
|
|
showtime:true
|
|
|
showtime: true
|
|
|
})
|
|
|
},990)
|
|
|
}, 990)
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -438,7 +490,7 @@ date_format(micro_second) { |
|
|
// })
|
|
|
|
|
|
let newlist = [];
|
|
|
r.msg.forEach(function (value, index, array) {
|
|
|
r.msg.forEach(function(value, index, array) {
|
|
|
console.log(newlist)
|
|
|
if (value.status == 1) {
|
|
|
newlist.push(value)
|
...
|
...
|
@@ -449,7 +501,7 @@ date_format(micro_second) { |
|
|
if (newlist.length != 0) {
|
|
|
wx.showTabBarRedDot({
|
|
|
index: 1,
|
|
|
success: function (red) {
|
|
|
success: function(red) {
|
|
|
|
|
|
wx.setTabBarBadge({
|
|
|
index: 1,
|
...
|
...
|
@@ -460,7 +512,7 @@ date_format(micro_second) { |
|
|
}
|
|
|
|
|
|
|
|
|
}).catch((err) => { })
|
|
|
}).catch((err) => {})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
...
|
...
|
|