You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
3.1 KiB
148 lines
3.1 KiB
// pages/member/myclean.js
|
|
var app = getApp();
|
|
var netUtil = require("../../utils/requestUtil.js"); //require引入
|
|
let plugin = requirePlugin('routePlan');
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
orders:[],
|
|
page:1
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
userInfo : wx.getStorageSync('userInfo')
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.getData();
|
|
|
|
},
|
|
|
|
orderView:function(e){
|
|
wx.navigateTo({
|
|
url: '/pages/member/cleanorder?order_no='+e.currentTarget.dataset.orderno,
|
|
})
|
|
},
|
|
|
|
goComplete:function(e){
|
|
wx.navigateTo({
|
|
url: '/pages/clean/complete?order_no=' + e.currentTarget.dataset.orderno,
|
|
})
|
|
},
|
|
|
|
goMap:function(e){
|
|
var hourse = this.data.orders[e.currentTarget.dataset.index];
|
|
var key = 'RRXBZ-DW33W-SPER5-R6WUB-GGYRZ-GWBIL';
|
|
let referer = '租房掌柜-导航';
|
|
console.log(hourse);
|
|
//系统自带地图
|
|
wx.openLocation({
|
|
//使用微信内置地图查看位置。
|
|
latitude: parseFloat(hourse.latitude),//要去的纬度-地址
|
|
longitude: parseFloat(hourse.longitude),//要去的经度-地址
|
|
name: hourse.name
|
|
})
|
|
|
|
// let endPoint = JSON.stringify({ //终点
|
|
// 'name': hourse.name,
|
|
// 'latitude': hourse.latitude,
|
|
// 'longitude': hourse.longitude,
|
|
// 'scale': 28
|
|
// });
|
|
// wx.navigateTo({
|
|
// url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
|
|
// });
|
|
},
|
|
//拨打电话
|
|
phoneCall: function(e) {
|
|
var phone = e.currentTarget.dataset.phone;
|
|
wx.makePhoneCall({
|
|
phoneNumber: phone,
|
|
})
|
|
},
|
|
|
|
getData:function(){
|
|
var that = this;
|
|
var userInfo = wx.getStorageSync('userInfo');
|
|
var url = app.globalData.requestUrl + 'index/clean/my?openid=' + userInfo.openid + '&page='+ this.data.page;
|
|
return netUtil.sendGet(url)
|
|
.then((res) => {
|
|
if (res.statusCode == 200 && res.data.code == 200) {
|
|
var data = res.data.data;
|
|
that.setData({
|
|
orders: that.data.page==1 ? data : that.data.orders.concat(data)
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.data.msg,
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
}
|
|
|
|
}).then(() => {
|
|
this.loading = false;
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
this.setData({ page: 1 });
|
|
this.getData().then(() => {
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
var page = this.data.page
|
|
this.setData({page: ++page});
|
|
this.getData();
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|