...
|
...
|
@@ -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,40 +47,58 @@ Page({ |
|
|
|
|
|
// console.log(this.data.stick)
|
|
|
},
|
|
|
moremiao(){
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/xianshi/xianshi',
|
|
|
})
|
|
|
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 = {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
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,
|
|
|
title2: r.msg.title2
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}).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,12 +107,12 @@ 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)
|
|
|
|
|
|
that.countDown()
|
|
|
that.countDown()
|
|
|
|
|
|
console.log(that.data.xianshilist)
|
|
|
// that.setData({
|
...
|
...
|
@@ -103,12 +121,12 @@ Page({ |
|
|
|
|
|
// console.log(that.data.messagelist)
|
|
|
|
|
|
}).catch((err) => { })
|
|
|
}).catch((err) => {})
|
|
|
},
|
|
|
|
|
|
date_format(micro_second) {
|
|
|
date_format(micro_second) {
|
|
|
// 总秒数
|
|
|
var second = micro_second;
|
|
|
var second = micro_second;
|
|
|
// var second = Math.floor(micro_second / 1000);
|
|
|
// 天数
|
|
|
var day = Math.floor(second / 3600 / 24);
|
...
|
...
|
@@ -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);
|
...
|
...
|
@@ -151,19 +169,19 @@ date_format(micro_second) { |
|
|
timeFormat(param) {
|
|
|
return param < 10 ? '0' + param : param;
|
|
|
},
|
|
|
|
|
|
|
|
|
//获取活动专区列表
|
|
|
getzhuanqulist(){
|
|
|
getzhuanqulist() {
|
|
|
let that = this
|
|
|
let url = '/activity/get_all';
|
|
|
let data = {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
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
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/zhuanqu/zhuanqu?id='+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/register/register',
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/zhuanqu/zhuanqu?id=' + id,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
more(){
|
|
|
more() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/classify/classify',
|
|
|
})
|
...
|
...
|
@@ -212,17 +247,34 @@ 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){
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
|
|
|
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/shop_detail/shop_detail?id=' + id
|
|
|
})
|
|
|
if (style == 2) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
|
|
|
})
|
|
|
} else {
|
|
|
wx.navigateTo({
|
|
|
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,21 +436,21 @@ 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
//获取购物车数量
|
|
|
get_shopnum() {
|
...
|
...
|
@@ -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) => {})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
...
|
...
|
|