123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- // pages/my/meet/meet.js
- var App = getApp();
- const util = require("../../utils/util");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tabs: [
- {
- i: 0,
- label: "全部",
- },
- {
- i: 1,
- label: "拼团中",
- },
- {
- i: 2,
- label: "预约中",
- },
- {
- i: 3,
- label: "处理中",
- },
- {
- i: 4,
- label: "已完成",
- },
- ],
- currentTab: 0,
- meetType: "",
- queryPage: {
- page: 1,
- limit: 10,
- },
- list: [],
- total: null,
- totalPage: null,
- currPage: null,
- nodata: util.nodata(),
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {},
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {},
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.init();
- },
- tabChange(e) {
- console.log(e);
- if (this.data.currentTab == e.currentTarget.dataset.index) {
- return;
- }
- // 0 拼团中 1预约中 2处理中 3已完成
- let type = "";
- if (e.currentTarget.dataset.index == 0) {
- type = "";
- } else if (e.currentTarget.dataset.index == 1) {
- type = 0;
- } else if (e.currentTarget.dataset.index == 2) {
- type = 1;
- } else if (e.currentTarget.dataset.index == 3) {
- type = 2;
- } else {
- type = 3;
- }
- this.setData({
- currentTab: e.currentTarget.dataset.index,
- meetType: type,
- });
- this.init();
- },
- toMeetDetail(e) {
- wx.navigateTo({
- url:
- "/meet/meet/detail?meetId=" +
- e.currentTarget.dataset.meetid +
- "&expertId=" +
- e.currentTarget.dataset.expertid,
- });
- },
- init() {
- this.setData({
- list: [],
- queryPage: {
- page: 1,
- limit: 10,
- },
- });
- this.getlist();
- },
- // 约见列表
- getlist() {
- if (this.data.queryPage.page > 1) {
- if (this.data.total > 0 && this.data.currPage == this.data.totalPage) {
- wx.showToast({
- title: "没有更多了~",
- icon: "none",
- });
- return false;
- }
- }
- wx.showLoading({
- title: "努力加载中...",
- });
- App._get(
- "myMeet/myAppointmentPage",
- {
- ...this.data.queryPage,
- meetType: this.data.meetType,
- memberId: util.getUserId(),
- },
- (res) => {
- if (res.code === 0) {
- this.setData({
- list: [...this.data.list, ...res.page.list],
- total: res.page.totalCount,
- totalPage: res.page.totalPage,
- currPage: res.page.currPage,
- });
- wx.hideLoading();
- }
- },
- (err) => {
- wx.showToast({
- icon: "error",
- title: "服务端异常",
- });
- },
- (complete) => {}
- );
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- this.init();
- setTimeout(() => {
- wx.stopPullDownRefresh();
- }, 500);
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- this.setData({
- queryPage: {
- page: ++this.data.queryPage.page,
- limit: 10,
- },
- });
- this.getlist();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {},
- });
|