123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- const util = require("../../../utils/util");
- const api = require('../../../api/api.js');
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- today: '',
- orderList: [],
- showType: 0,
- page: 1,
- limit: 10,
- totalPages: 1,
- addressInfo: {}
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let that = this
- try {
- var tab = wx.getStorageSync('tabQuick');
- if (tab) {
- this.setData({
- showType: tab == 3 ? 0 : tab
- });
- }
- } catch (e) {}
- },
- getOrderList() {
- let that = this;
- wx.showLoading();
- util.request(api.BookHmList, {
- showType: that.data.showType,
- page: that.data.page,
- limit: that.data.limit
- }).then(function (res) {
- wx.hideLoading();
- if (res.errno === 0) {
- console.log(res.data);
- that.setData({
- orderList: that.data.orderList.concat(res.data.list),
- totalPages: res.data.pages
- });
- }
- });
- },
- switchTab: function (event) {
- let showType = event.currentTarget.dataset.index;
- wx.setStorageSync('tabQuick', showType);
- this.setData({
- orderList: [],
- showType: showType,
- page: 1,
- limit: 10,
- totalPages: 1
- });
- this.getOrderList();
- },
- onReachBottom() {
- if (this.data.totalPages > this.data.page) {
- this.setData({
- page: this.data.page + 1
- });
- this.getOrderList();
- } else {
- wx.showToast({
- title: '没有更多预检单了',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- },
- makeCall(e) {
- let mobile = e.currentTarget.dataset.mobile;
- wx.makePhoneCall({
- phoneNumber: mobile,
- })
- },
- goProblemAdd(e) {
- let id = e.currentTarget.dataset.id;
- if (id) {
- wx.navigateTo({
- url: '/pages/problem/list/list?bookTradeNo=' + id,
- })
- } else {
- wx.navigateTo({
- url: '/pages/problem/list/list',
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- if (app.globalData.hasLogin == false) {
- wx.navigateTo({
- url: '/pages/index/index',
- })
- return;
- }
- this.setData({
- orderList: [],
- showType: this.data.showType,
- page: 1,
- limit: 10,
- totalPages: 1,
- today: util.formatDate(new Date()),
- });
- this.getOrderList();
- },
- openMap(e) { //打开地图
- let address = e.currentTarget.dataset.address;
- let lng = e.currentTarget.dataset.lng;
- let lat = e.currentTarget.dataset.lat;
- // console.info(lng)
- // console.info(lat)
- // console.info(address)
- wx.openLocation({
- latitude: lat,
- longitude: lng,
- name: address,
- address: address,
- scale: 28
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|