|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- // pages/ticketCenter/ticketCenter.js
- const app = getApp()
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- chooseWhich:1,
- dataList:[],//需要展示的数据
- newData:[],
- pageNum:1,//页码,
- count:10,//每页条数
- total:0,//总条数
- total_page:0,//总页数
- scrollHig:0,
- type:"",
- hotType:2,
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (app.globalData.openId){
- this.getDataList();
- }else{
- app.globalData.openidSuccessFuc = this.getDataList;
- }
- console.log(wx.getSystemInfoSync().windowHeight)
- this.setData({
- scrollHig: wx.getSystemInfoSync().windowHeight-44-12,
- });
- },
- getDataList:function(type,hotType){
- if(type || hotType){
- this.data.type = type
- this.data.hotType = hotType
- }else{
- this.data.type = ""
- this.data.hotType = 2
- }
- let params = {
- list_type:2,
- cur_page:this.data.pageNum,
- show_num:this.data.count,
- item_type:this.data.type,
- item_state:1,
- hot_state:this.data.hotType
- }
- app.wxRequest(app.globalData.httpUrl + 'front/sell/listing', params, e => {
- console.log(e)
- if (e.code == 200) {
- for(var i=0;i<e.data.length;i++){
- this.data.newData.push(e.data[i]);
- }
- this.setData({
- dataList:this.data.newData
- })
- this.data.total_page = e.total_page;
- }
- }, this)
- },
- getBot:function(){//scroll触底事件
- if(this.data.pageNum<this.data.total_page){
- this.data.pageNum++;
- this.getDataList();
- }else{
- wx.showToast({
- title: '没有更多数据了',
- icon:"none"
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- },
- chooseFn: function(e){//选择
- this.setData({
- chooseWhich:e.currentTarget.dataset.index
- })
- console.log(this.data.chooseWhich)
- if(this.data.chooseWhich==1){
- this.data.type = "";
- this.data.hotType = 2;
- }else{
- this.data.type = this.data.chooseWhich-1;
- this.data.hotType = "";
- }
- this.data.pageNum = 1;
- this.data.dataList = [];
- this.data.newData = [];
- this.getDataList(this.data.type,this.data.hotType);
- },
-
- skipPage:function(e){//跳转到购买页面
- var id = e.currentTarget.dataset.id
- var type = e.currentTarget.dataset.type
- console.log(e)
- wx.navigateTo({
- url: '../buyTicket/buyTicket?id=' + id+"&type="+type
- })
- },
- })
|