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.
171 lines
3.6 KiB
171 lines
3.6 KiB
// pages/member/cleanorder.js
|
|
var app = getApp();
|
|
var netUtil = require("../../utils/requestUtil.js"); //require引入
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
orders:[],
|
|
InputBottom: 0,
|
|
input_focus:false,
|
|
id:0,
|
|
commont:'',
|
|
inputCommont:''
|
|
},
|
|
InputFocus(e) {
|
|
this.setData({
|
|
InputBottom: e.detail.height
|
|
})
|
|
},
|
|
InputBlur(e) {
|
|
this.setData({
|
|
InputBottom: 0,
|
|
})
|
|
},
|
|
|
|
preview:function(e){
|
|
var one = e.currentTarget.dataset.one;
|
|
var two = e.currentTarget.dataset.two;
|
|
var images = this.data.orders[one].picture;
|
|
wx.previewImage({
|
|
current: images[two],
|
|
urls: images,
|
|
success: function (res) {
|
|
//console.log(res)
|
|
}
|
|
})
|
|
},
|
|
goCommont:function(e){
|
|
this.setData({
|
|
input_focus: true,
|
|
id: e.currentTarget.dataset.id,
|
|
index: e.currentTarget.dataset.idx
|
|
})
|
|
},
|
|
//去打扫
|
|
goComplete:function(e){
|
|
wx.navigateTo({
|
|
url: '/pages/clean/complete?order_no='+ e.currentTarget.dataset.orderno +'&id=' + e.currentTarget.dataset.id,
|
|
})
|
|
},
|
|
|
|
submitCommont:function(){
|
|
var that = this;
|
|
var param = {};
|
|
var url = app.globalData.requestUrl + 'index/clean/commont';
|
|
param.id = this.data.id;
|
|
param.commont = this.data.commont;
|
|
param.index = this.data.index;
|
|
if (param.commont.length == 0) {
|
|
wx.showToast({
|
|
title: '请输入评价内容',
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
return false;
|
|
}
|
|
return netUtil.sendPost(url, param)
|
|
.then((res) => {
|
|
if (res.statusCode == 200 && res.data.code == 200) {
|
|
var data = res.data.data;
|
|
that.data.orders[data.index].commont = data
|
|
that.setData({
|
|
orders: that.data.orders,
|
|
input_focus:false,
|
|
inputCommont:''
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.data.msg,
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
}
|
|
}).then(() => {
|
|
this.loading = false;
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
var userInfo = wx.getStorageSync('userInfo');
|
|
options.userInfo = userInfo;
|
|
this.setData(options);
|
|
},
|
|
getInputValue:function(e){
|
|
this.setData({
|
|
commont: e.detail.value.replace(/\s+/g, '')
|
|
});
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
var that = this;
|
|
var url = app.globalData.requestUrl + 'index/clean/info?openid=' + this.data.userInfo.openid + '&order_no=' + this.data.order_no;
|
|
return netUtil.sendGet(url)
|
|
.then((res) => {
|
|
if (res.statusCode == 200 && res.data.code == 200) {
|
|
var data = res.data.data;
|
|
console.log(data);
|
|
that.setData({
|
|
orders:data
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.data.msg,
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
}
|
|
}).then(() => {
|
|
this.loading = false;
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|