租房掌柜微信小程序Api以及小程序前端模板
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.
 
 
 
 
 
 

134 lines
2.7 KiB

// pages/clean/complete.js
const app = getApp();
var netUtil = require("../../utils/requestUtil.js"); //require引入
var util = require("../../utils/util.js");
Page({
/**
* 页面的初始数据
*/
data: {
imgList:[],
date:''
},
dateChange:function(e){
this.setData({
date : e.detail.value
});
},
formSubmit:function(){
var that = this;
var userInfo = wx.getStorageSync('userInfo');
var param = {};
var url = app.globalData.requestUrl + 'index/clean/complete';
param.openid = userInfo.openid;
param.images = this.data.imgList
param.id = this.data.id;
param.order_no = this.data.order_no;
param.complete_time = this.data.date;
return netUtil.sendPost(url,param)
.then((res) => {
if (res.statusCode == 200 && res.data.code == 200) {
wx.navigateBack();
} else {
wx.showToast({
title: res.data.msg,
icon: 'none',
duration: 3000
})
}
}).then(() => {
this.loading = false;
})
},
chooseImage:function(){
var that = this;
wx.chooseImage({
success:function(res){
var url = app.globalData.requestUrl + 'index/upload/plupload';
let tempFilePaths = res.tempFilePaths;
for (var i in tempFilePaths) {
wx.uploadFile({
url: url,
filePath: tempFilePaths[i],
name: 'file',
success: function (res) {
//赋值操作
var data = JSON.parse(res.data);
that.setData({
imgList: that.data.imgList.concat(data.url)
});
},
});
}
}
});
},
delImg:function(e){
this.data.imgList.splice(e.currentTarget.dataset.index, 1)
this.setData({
imgList: this.data.imgList
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData(options);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
var date = util.formatTime(new Date()).substring(0, 11).replace(/\//g,'-');
this.setData({
date:date
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})