|
|
@@ -30,9 +30,9 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- logoUrl: '',
|
|
|
- categoryOne: [],
|
|
|
- banner: [],
|
|
|
+ logoUrl: '', // 左上方 logo
|
|
|
+ categoryOne: [], // 分类列表/活动列表 (目前只有一个,就是“活动”)
|
|
|
+ banner: [], // 顶部 banner
|
|
|
itemNew: [], // 跑马灯列表
|
|
|
menus: [],
|
|
|
getCouponList: [], //@deprecated
|
|
|
@@ -48,19 +48,19 @@ Page({
|
|
|
lovely: [], //@deprecated
|
|
|
info: {
|
|
|
fastList: [],
|
|
|
- bastBanner: [],
|
|
|
- firstList: [],
|
|
|
- bastList: []
|
|
|
+ bastBanner: [], // 精品推荐 banner
|
|
|
+ firstList: [], // 首发新品
|
|
|
+ bastList: [] // 精品推荐
|
|
|
},
|
|
|
avtiveIndex: 0, // 轮播图索引
|
|
|
- likeInfo: [],
|
|
|
- benefit: [],
|
|
|
- hostProduct: [],
|
|
|
+ likeInfo: [], // 热门榜单
|
|
|
+ benefit: [], // 促销单品
|
|
|
+ hotProducts: [], // 海量精品 ?
|
|
|
indicatorDots: false, // 跑马灯轮播图不带点
|
|
|
- circular: true,
|
|
|
+ circular: true, // 轮播图圆点
|
|
|
autoplay: true, // 跑马灯轮播图自动播放
|
|
|
- intervalNew: 3500,
|
|
|
- durationNew: 700,
|
|
|
+ intervalNew: 3500, // 轮播图自动播放间隔
|
|
|
+ durationNew: 700, // 轮播图自动播放时长
|
|
|
parameter: {
|
|
|
'navbar': '0',
|
|
|
'return': '0',
|
|
|
@@ -71,7 +71,7 @@ Page({
|
|
|
isAuto: true, // 是否自动授权;
|
|
|
iShidden: true, // 是否隐藏;
|
|
|
isGoIndex: false, // 是否返回首页;
|
|
|
- navH: "",
|
|
|
+ navH: "", // 标题栏高度
|
|
|
recommend: {
|
|
|
loadend: false,
|
|
|
loading: false,
|
|
|
@@ -89,7 +89,6 @@ Page({
|
|
|
loading: false, // 是否正在加载
|
|
|
loadTitle: '加载更多',
|
|
|
productList: [],
|
|
|
- categoryActive: 0,
|
|
|
activeTabIndex: 0,
|
|
|
countDownHour: "00",
|
|
|
countDownMinute: "00",
|
|
|
@@ -99,7 +98,7 @@ Page({
|
|
|
timerNotification: null,
|
|
|
newGoodsBananr: '', //@deprecated
|
|
|
cpnMine: null, // 挖礦組件
|
|
|
- liveList: [],
|
|
|
+ liveList: [], // 直播列表
|
|
|
liveInfo: {}
|
|
|
},
|
|
|
|
|
|
@@ -116,6 +115,7 @@ Page({
|
|
|
iShidden: false
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
@@ -243,13 +243,14 @@ Page({
|
|
|
},
|
|
|
|
|
|
getLiveList: function () {
|
|
|
+ let that = this
|
|
|
getLiveList(1, 20).then(res => {
|
|
|
if (res.data.length == 1) {
|
|
|
- this.setData({
|
|
|
+ that.setData({
|
|
|
liveInfo: res.data[0]
|
|
|
});
|
|
|
} else {
|
|
|
- this.setData({
|
|
|
+ that.setData({
|
|
|
liveList: res.data
|
|
|
});
|
|
|
}
|
|
|
@@ -286,25 +287,28 @@ Page({
|
|
|
* 获取我的推荐
|
|
|
*/
|
|
|
get_hot_product: function (isPage) {
|
|
|
- var that = this;
|
|
|
- if (that.data.recommend.loadend) return;
|
|
|
- if (that.data.recommend.loading) return;
|
|
|
- if (isPage === true) that.setData({
|
|
|
- hostProduct: []
|
|
|
- });
|
|
|
- that.setData({
|
|
|
+ if (this.data.recommend.loadend) return;
|
|
|
+ if (this.data.recommend.loading) return;
|
|
|
+ if (isPage === true) {
|
|
|
+ this.setData({
|
|
|
+ hotProducts: []
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
'recommend.loading': true,
|
|
|
'recommend.loadTitle': ''
|
|
|
});
|
|
|
- getProductHot(that.data.recommend.page, that.data.recommend.limit).then(res => {
|
|
|
+
|
|
|
+ let that = this;
|
|
|
+ getProductHot(this.data.recommend.page, this.data.recommend.limit).then(res => {
|
|
|
let list = res.data;
|
|
|
- let hostProduct = app.SplitArray(list, that.data.hostProduct);
|
|
|
+ let hotProducts = app.SplitArray(list, that.data.hotProducts);
|
|
|
let loadend = list.length < that.data.recommend.limit;
|
|
|
that.setData({
|
|
|
'recommend.loadend': loadend,
|
|
|
'recommend.loading': false,
|
|
|
'recommend.loadTitle': loadend ? '已全部加载' : '加载更多',
|
|
|
- hostProduct: hostProduct,
|
|
|
+ hotProducts: hotProducts,
|
|
|
['recommend.page']: that.data.recommend.page + 1,
|
|
|
});
|
|
|
}).catch(err => {
|
|
|
@@ -317,22 +321,22 @@ Page({
|
|
|
|
|
|
/** 点击上方活动标签按钮 */
|
|
|
onTapCategoryTabItem: function (event) {
|
|
|
- let activeTabIndex = event.detail.index;
|
|
|
- if (activeTabIndex <= 0 || activeTabIndex > this.data.categoryOne.children.length) {
|
|
|
+ let tabIndex = event.detail.index;
|
|
|
+ if (tabIndex <= 0 || tabIndex > this.data.categoryOne.children.length) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- this.setData({
|
|
|
- activeTabIndex: activeTabIndex
|
|
|
- })
|
|
|
-
|
|
|
- if (this.data.categoryOne.children[activeTabIndex - 1].id === 199) {
|
|
|
+ if (this.data.categoryOne.children[tabIndex - 1].id === 199) {
|
|
|
// 黑洞
|
|
|
+ let mine = null
|
|
|
if (this.data.cpnMine == null) {
|
|
|
- this.setData({
|
|
|
- cpnMine: this.selectComponent('#mine'),
|
|
|
- })
|
|
|
+ mine = this.selectComponent('#mine')
|
|
|
}
|
|
|
+ this.setData({
|
|
|
+ activeTabIndex: tabIndex,
|
|
|
+ cpnMine: mine,
|
|
|
+ })
|
|
|
+
|
|
|
var _ = this.data.cpnMine && this.data.cpnMine.show()
|
|
|
return
|
|
|
} else {
|
|
|
@@ -340,42 +344,43 @@ Page({
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
+ activeTabIndex: tabIndex,
|
|
|
'where.page': 1,
|
|
|
loadend: false,
|
|
|
loading: false,
|
|
|
'where.cid': this.data.categoryOne.id,
|
|
|
- 'where.sid': this.data.categoryOne.children[activeTabIndex - 1].id,
|
|
|
- categoryActive: 0
|
|
|
+ 'where.sid': this.data.categoryOne.children[tabIndex - 1].id,
|
|
|
})
|
|
|
this.get_product_list(true);
|
|
|
},
|
|
|
|
|
|
- productTap: function (e) {
|
|
|
- let index = e.currentTarget.dataset.indexn;
|
|
|
- this.setData({
|
|
|
- categoryActive: index,
|
|
|
- 'where.page': 1,
|
|
|
- loadend: false,
|
|
|
- loading: false,
|
|
|
- 'where.sid': this.data.categoryOne[this.data.activeTabIndex - 1].children[index].id
|
|
|
- })
|
|
|
- this.get_product_list(true);
|
|
|
- },
|
|
|
+ // productTap: function (e) {
|
|
|
+ // let index = e.currentTarget.dataset.indexn;
|
|
|
+ // this.setData({
|
|
|
+ // 'where.page': 1,
|
|
|
+ // loadend: false,
|
|
|
+ // loading: false,
|
|
|
+ // 'where.sid': this.data.categoryOne[this.data.activeTabIndex - 1].children[index].id
|
|
|
+ // })
|
|
|
+ // this.get_product_list(true);
|
|
|
+ // },
|
|
|
|
|
|
get_product_list: function (isPage) {
|
|
|
- var that = this;
|
|
|
- if (that.data.loading) return;
|
|
|
- if (that.data.loadend) return;
|
|
|
- if (isPage === true) that.setData({
|
|
|
- productList: []
|
|
|
- });
|
|
|
+ if (this.data.loading) return;
|
|
|
+ if (this.data.loadend) return;
|
|
|
+ if (isPage) {
|
|
|
+ this.setData({
|
|
|
+ productList: []
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- that.setData({
|
|
|
+ this.setData({
|
|
|
loading: true,
|
|
|
loadTitle: ''
|
|
|
});
|
|
|
|
|
|
- getProductslist(that.data.where).then(res => {
|
|
|
+ var that = this;
|
|
|
+ getProductslist(this.data.where).then(res => {
|
|
|
let list = res.data;
|
|
|
let productList = app.SplitArray(list, that.data.productList);
|
|
|
let loadend = list.length < that.data.where.limit;
|
|
|
@@ -414,14 +419,14 @@ Page({
|
|
|
// },
|
|
|
|
|
|
// 页面事件, 不再使用
|
|
|
- setTime: function (e) {
|
|
|
- let index = e.currentTarget.dataset.index;
|
|
|
- this.setData({
|
|
|
- killIndex: index,
|
|
|
- status: that.data.timeList[index].status
|
|
|
- })
|
|
|
- // that.getSeckillLists();
|
|
|
- },
|
|
|
+ // setTime: function (e) {
|
|
|
+ // let index = e.currentTarget.dataset.index;
|
|
|
+ // this.setData({
|
|
|
+ // killIndex: index,
|
|
|
+ // status: that.data.timeList[index].status
|
|
|
+ // })
|
|
|
+ // // that.getSeckillLists();
|
|
|
+ // },
|
|
|
|
|
|
// 不再触发
|
|
|
// getSeckillLists: function () {
|