123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- // pages/my/myService/myService.js
- const App = getApp();
- const util = require("../../utils/util");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tabs: [
- {
- i: 0,
- title: "全部",
- },
- {
- i: 1,
- title: "待处理",
- },
- {
- i: 2,
- title: "处理中",
- },
- {
- i: 3,
- title: "已拒绝",
- },
- {
- i: 4,
- title: "已完成",
- },
- ],
- currentTab: 0,
- status: 0,
- list: [],
- queryParams: {
- page: 1,
- limit: 10,
- },
- total: 0,
- totalPage: 0,
- currPage: 0,
- nodata: util.nodata(),
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- if (options && options.status) {
- this.setData({
- status: options.status,
- currentTab: options.status
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {},
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.init();
- },
- tabChange(e) {
- console.log(e);
- if (e.currentTarget.dataset.index == this.data.currentTab) {
- return;
- }
- this.setData({
- currentTab: e.currentTarget.dataset.index,
- status: e.currentTarget.dataset.index,
- total: 0,
- totalPage: 0,
- currPage: 0,
- });
- this.init();
- },
- init() {
- this.setData({
- list: [],
- queryParams: {
- page: 1,
- limit: 10,
- },
- });
- this.getList();
- },
- // 获取列表数据
- getList() {
- if (this.data.queryParams.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(
- "expert_workbench/myServicePage",
- {
- ...this.data.queryParams,
- status: this.data.status,
- 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) => {}
- );
- },
- toServiceDetail(e) {
- wx.navigateTo({
- url:
- "/workbench/service/service?meetId=" + e.currentTarget.dataset.meetid,
- });
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- this.setData({
- queryParams: {
- page: ++this.data.queryParams.page,
- limit: 10,
- },
- });
- this.getList();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {},
- });
|