|
@@ -1,6 +1,7 @@ |
|
|
var config = require("../../config/config.js"); |
|
|
var config = require("../../config/config.js"); |
|
|
const Http = require("../../utils/HttpBasics"); |
|
|
const Http = require("../../utils/HttpBasics"); |
|
|
const imgurl = require("../../utils/imgurl"); |
|
|
const imgurl = require("../../utils/imgurl"); |
|
|
|
|
|
const { spellStatus02 } = require("../../utils/spell"); |
|
|
Page({ |
|
|
Page({ |
|
|
/** |
|
|
/** |
|
|
* 页面的初始数据 |
|
|
* 页面的初始数据 |
|
@@ -8,8 +9,8 @@ Page({ |
|
|
data: { |
|
|
data: { |
|
|
bannerUrl: imgurl.banner.url, |
|
|
bannerUrl: imgurl.banner.url, |
|
|
loadingUrl: imgurl.loading.url, |
|
|
loadingUrl: imgurl.loading.url, |
|
|
bargaingoods: true, |
|
|
|
|
|
mybargain: false, |
|
|
|
|
|
|
|
|
spellList: true, |
|
|
|
|
|
myspellList: false, |
|
|
list: [], |
|
|
list: [], |
|
|
lists: [], |
|
|
lists: [], |
|
|
myLists:[], |
|
|
myLists:[], |
|
@@ -20,7 +21,7 @@ Page({ |
|
|
myorder: false, |
|
|
myorder: false, |
|
|
actUrl: imgurl.act.url, |
|
|
actUrl: imgurl.act.url, |
|
|
loadingUrl: imgurl.loading.url, |
|
|
loadingUrl: imgurl.loading.url, |
|
|
flag: 'bargaingoods', |
|
|
|
|
|
|
|
|
flag: 'spellList', |
|
|
}, |
|
|
}, |
|
|
onLoad: function () { |
|
|
onLoad: function () { |
|
|
let that = this; |
|
|
let that = this; |
|
@@ -29,26 +30,30 @@ Page({ |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
todayDate: todayDate |
|
|
todayDate: todayDate |
|
|
}) |
|
|
}) |
|
|
that.getList(1, "bargaingoods"); |
|
|
|
|
|
|
|
|
that.getList(1, "spellList"); |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
flag: "bargaingoods", |
|
|
|
|
|
bargaingoods: true, |
|
|
|
|
|
mybargain: false |
|
|
|
|
|
|
|
|
flag: "spellList", |
|
|
|
|
|
spellList: true, |
|
|
|
|
|
myspellList: false |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//切换拼团列表 |
|
|
//切换拼团列表 |
|
|
getSpellList(){ |
|
|
getSpellList(){ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
flag: "bargaingoods" |
|
|
|
|
|
|
|
|
flag: "spellList", |
|
|
|
|
|
page:1, |
|
|
|
|
|
allow_load:true |
|
|
}) |
|
|
}) |
|
|
this.getList(1, "bargaingoods") |
|
|
|
|
|
|
|
|
this.getList(1, "spellList") |
|
|
}, |
|
|
}, |
|
|
//切换我的拼团 |
|
|
//切换我的拼团 |
|
|
getmyList(){ |
|
|
getmyList(){ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
flag: "mybargain" |
|
|
|
|
|
|
|
|
flag: "myspellList", |
|
|
|
|
|
page: 1, |
|
|
|
|
|
allow_load: true |
|
|
}) |
|
|
}) |
|
|
this.getList(1, "mybargain") |
|
|
|
|
|
|
|
|
this.getList(1, "myspellList") |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* banner |
|
|
* banner |
|
@@ -67,31 +72,43 @@ Page({ |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
changeStatus(status){ |
|
|
|
|
|
return spellStatus02.filter(item=>status==item.value)[0].name |
|
|
|
|
|
}, |
|
|
|
|
|
gotoEdit(e){ |
|
|
|
|
|
console.log(e.currentTarget.dataset.status) |
|
|
|
|
|
let status = e.currentTarget.dataset.status |
|
|
|
|
|
if (status==10){ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
getList(pageNum, flag) { |
|
|
getList(pageNum, flag) { |
|
|
var that = this; |
|
|
var that = this; |
|
|
console.log(pageNum) |
|
|
console.log(pageNum) |
|
|
if (that.data.allow_load) { |
|
|
if (that.data.allow_load) { |
|
|
/** |
|
|
/** |
|
|
* mybargain: 我的砍价 |
|
|
|
|
|
* bargaingoods: 砍价商品 |
|
|
|
|
|
|
|
|
* myspellList: 我的砍价 |
|
|
|
|
|
* spellList: 砍价商品 |
|
|
*/ |
|
|
*/ |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
loading: true, |
|
|
loading: true, |
|
|
content: '小主,我在玩命加载中...' |
|
|
content: '小主,我在玩命加载中...' |
|
|
}) |
|
|
}) |
|
|
var param = {}; |
|
|
var param = {}; |
|
|
if (flag == 'mybargain') { |
|
|
|
|
|
|
|
|
if (flag == 'myspellList') { |
|
|
|
|
|
console.log(22222222) |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
flag: "mybargain" |
|
|
|
|
|
|
|
|
flag: "myspellList" |
|
|
}) |
|
|
}) |
|
|
var param = { |
|
|
var param = { |
|
|
pageNum: pageNum, |
|
|
pageNum: pageNum, |
|
|
pageSize: 10 |
|
|
pageSize: 10 |
|
|
}; |
|
|
}; |
|
|
var url = config.api.getMySepllList; |
|
|
var url = config.api.getMySepllList; |
|
|
} else if (flag == 'bargaingoods') { |
|
|
|
|
|
|
|
|
} else if (flag == 'spellList') { |
|
|
|
|
|
console.log(111111) |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
flag: "bargaingoods" |
|
|
|
|
|
|
|
|
flag: "spellList" |
|
|
}) |
|
|
}) |
|
|
var param = { |
|
|
var param = { |
|
|
pageNum: pageNum, |
|
|
pageNum: pageNum, |
|
@@ -129,15 +146,18 @@ Page({ |
|
|
lists: [], |
|
|
lists: [], |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
if (flag == 'bargaingoods') { |
|
|
|
|
|
|
|
|
if (flag == 'spellList') { |
|
|
var tmpArr = that.data.lists; |
|
|
var tmpArr = that.data.lists; |
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
lists: tmpArr |
|
|
lists: tmpArr |
|
|
}) |
|
|
}) |
|
|
} else if (flag == 'mybargain') { |
|
|
|
|
|
|
|
|
} else if (flag == 'myspellList') { |
|
|
console.log(res.data.list) |
|
|
console.log(res.data.list) |
|
|
var tmpArr = that.data.lists; |
|
|
var tmpArr = that.data.lists; |
|
|
|
|
|
res.data.list.map((item,index)=>{ |
|
|
|
|
|
item.statusText = that.changeStatus(item.status) |
|
|
|
|
|
}) |
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
console.log(tmpArr) |
|
|
console.log(tmpArr) |
|
|
let lists = []; |
|
|
let lists = []; |
|
@@ -219,35 +239,35 @@ Page({ |
|
|
// let orderId = e.currentTarget.dataset.id; |
|
|
// let orderId = e.currentTarget.dataset.id; |
|
|
that.orderSave(couponId, couponChannelId) |
|
|
that.orderSave(couponId, couponChannelId) |
|
|
}, |
|
|
}, |
|
|
mybargain: function () { |
|
|
|
|
|
|
|
|
myspellList: function () { |
|
|
let that = this; |
|
|
let that = this; |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
bargaingoods: false, |
|
|
|
|
|
mybargain: true, |
|
|
|
|
|
flag: "mybargain", |
|
|
|
|
|
|
|
|
spellList: false, |
|
|
|
|
|
myspellList: true, |
|
|
|
|
|
flag: "myspellList", |
|
|
allow_load: true, |
|
|
allow_load: true, |
|
|
loading: false, |
|
|
loading: false, |
|
|
content: "", |
|
|
content: "", |
|
|
page: 1 |
|
|
page: 1 |
|
|
}) |
|
|
}) |
|
|
that.getList(1, 'mybargain'); |
|
|
|
|
|
|
|
|
that.getList(1, 'myspellList'); |
|
|
wx.setNavigationBarTitle({ |
|
|
wx.setNavigationBarTitle({ |
|
|
title: '我的砍价' |
|
|
title: '我的砍价' |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
bargaingoods: function () { |
|
|
|
|
|
|
|
|
spellList: function () { |
|
|
let that = this; |
|
|
let that = this; |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
bargaingoods: true, |
|
|
|
|
|
mybargain: false, |
|
|
|
|
|
flag: "bargaingoods", |
|
|
|
|
|
|
|
|
spellList: true, |
|
|
|
|
|
myspellList: false, |
|
|
|
|
|
flag: "spellList", |
|
|
allow_load: true, |
|
|
allow_load: true, |
|
|
loading: false, |
|
|
loading: false, |
|
|
page: 1, |
|
|
page: 1, |
|
|
content: "" |
|
|
content: "" |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
that.getList(1, 'bargaingoods'); |
|
|
|
|
|
|
|
|
that.getList(1, 'spellList'); |
|
|
wx.setNavigationBarTitle({ |
|
|
wx.setNavigationBarTitle({ |
|
|
title: '砍价专场' |
|
|
title: '砍价专场' |
|
|
}) |
|
|
}) |
|
@@ -279,24 +299,24 @@ Page({ |
|
|
*/ |
|
|
*/ |
|
|
onPullDownRefresh: function (e) { |
|
|
onPullDownRefresh: function (e) { |
|
|
let that = this; |
|
|
let that = this; |
|
|
if (that.data.flag == 'bargaingoods') { |
|
|
|
|
|
|
|
|
if (that.data.flag == 'spellList') { |
|
|
that.getBannerlist(); |
|
|
that.getBannerlist(); |
|
|
var todayDate = new Date().getTime(); |
|
|
var todayDate = new Date().getTime(); |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
todayDate: todayDate |
|
|
todayDate: todayDate |
|
|
}) |
|
|
}) |
|
|
that.getList(1, "bargaingoods"); |
|
|
|
|
|
|
|
|
that.getList(1, "spellList"); |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
flag: "bargaingoods", |
|
|
|
|
|
bargaingoods: true, |
|
|
|
|
|
mybargain: false |
|
|
|
|
|
|
|
|
flag: "spellList", |
|
|
|
|
|
spellList: true, |
|
|
|
|
|
myspellList: false |
|
|
}) |
|
|
}) |
|
|
} else if (that.data.flag == 'mybargain') { |
|
|
|
|
|
that.getList(1, "mybargain"); |
|
|
|
|
|
|
|
|
} else if (that.data.flag == 'myspellList') { |
|
|
|
|
|
that.getList(1, "myspellList"); |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
flag: "mybargain", |
|
|
|
|
|
bargaingoods: false, |
|
|
|
|
|
mybargain: true |
|
|
|
|
|
|
|
|
flag: "myspellList", |
|
|
|
|
|
spellList: false, |
|
|
|
|
|
myspellList: true |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |