|
@@ -9,6 +9,7 @@ Page({
|
|
|
size:6,
|
|
|
TabCur:0,
|
|
|
scrollLeft:0,
|
|
|
+ userInfo:{},
|
|
|
tabList:["待接任务","已确认","已交付","已完成"],
|
|
|
list:[
|
|
|
]
|
|
@@ -17,16 +18,24 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function ( opt) {
|
|
|
- let TabCur = +opt.tab||0
|
|
|
+ let TabCur = app.globalData.taskTab||0;
|
|
|
+ console.log( "TabCur", TabCur)
|
|
|
this.setData( {TabCur} )
|
|
|
app.checkLogin( ()=>{
|
|
|
- this.loadData()
|
|
|
+ this.getuserInfo( this.loadData)
|
|
|
+ } )
|
|
|
+ },
|
|
|
+ getuserInfo( cb ){
|
|
|
+ app.getMakerInfo( (userInfo)=>{
|
|
|
+ this.setData({userInfo})
|
|
|
+ cb&&cb()
|
|
|
} )
|
|
|
},
|
|
|
tabSelect(e){
|
|
|
this.setData({
|
|
|
TabCur: e.currentTarget.dataset.id,
|
|
|
list:[],
|
|
|
+ from:0,
|
|
|
scrollLeft: (e.currentTarget.dataset.id - 1) * 80
|
|
|
})
|
|
|
this.getTaskList(0)
|
|
@@ -36,17 +45,29 @@ Page({
|
|
|
let item = this.data.list[index]
|
|
|
util.http("/wx/applyWxTask", {id:item.id}, (err, res) =>{
|
|
|
if( err != 0) return;
|
|
|
- item.is_bid = 1
|
|
|
+ item.maker_id = 1
|
|
|
this.setData({ list: this.data.list})
|
|
|
- util.showMsg("抢单子成功");
|
|
|
+ util.showSuccess("抢单子成功");
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
onPullDownRefresh: function () {
|
|
|
+ console.log( "onPullDownRefresh")
|
|
|
this.getTaskList( 0, ()=>{
|
|
|
wx.stopPullDownRefresh();
|
|
|
})
|
|
|
},
|
|
|
+ onShow(){
|
|
|
+ let action = app.getAction()
|
|
|
+ if( action && action.action=="addDeliverImg"){
|
|
|
+ let list = this.data.list;
|
|
|
+ let {id, url} = action.data;
|
|
|
+ list = list.map((item)=>{
|
|
|
+ if( item.id == id) item.deliver_img = url
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ this.setData({list});
|
|
|
+ }
|
|
|
+ },
|
|
|
onReachBottom: function () {
|
|
|
var that = this
|
|
|
let newFrom = that.data.from
|
|
@@ -78,6 +99,8 @@ Page({
|
|
|
if( err != 0) return;
|
|
|
if (newFrom == 0) list = [];
|
|
|
let newlist = res.list.map( item =>{
|
|
|
+ item.created_at = item.created_at&&item.created_at.substr(0,19).replace("T", " ")||'---';
|
|
|
+ item.finish_at = item.finish_at&&item.finish_at.substr(0,19).replace("T", " ")||'---';
|
|
|
return item
|
|
|
});
|
|
|
that.setData({
|
|
@@ -90,6 +113,12 @@ Page({
|
|
|
loadData :function( ){
|
|
|
this.getTaskList(0)
|
|
|
},
|
|
|
+ goDetail(e){
|
|
|
+ let id = e.target.dataset.id;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/pages/task/info/info?id=${id}`,
|
|
|
+ })
|
|
|
+ },
|
|
|
previewImage: function (e) {
|
|
|
var current = e.target.dataset.src;
|
|
|
wx.previewImage({
|
|
@@ -99,19 +128,25 @@ Page({
|
|
|
} ,
|
|
|
uplodImg: function(e ){
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
- console.log("uplodImg", e.currentTarget.dataset)
|
|
|
- this.setData({index});
|
|
|
- wx.chooseImage({
|
|
|
- count: 1,
|
|
|
- sizeType: ['compressed'],
|
|
|
- sourceType: ['album', 'camera'],
|
|
|
- success: (res) =>{
|
|
|
- var tempImagePath = res.tempFilePaths[0];
|
|
|
- util.uploadFile( tempImagePath, this.doUpload )
|
|
|
- },
|
|
|
- fail:()=>{
|
|
|
- app.showMsg('选择失败')
|
|
|
- }
|
|
|
+ let {id,title} = this.data.list[index]
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/pages/task/submit/subtask?id=${id}&title=${title}`,
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+ // console.log("uplodImg", e.currentTarget.dataset)
|
|
|
+ // this.setData({index});
|
|
|
+ // wx.chooseImage({
|
|
|
+ // count: 1,
|
|
|
+ // sizeType: ['compressed'],
|
|
|
+ // sourceType: ['album', 'camera'],
|
|
|
+ // success: (res) =>{
|
|
|
+ // var tempImagePath = res.tempFilePaths[0];
|
|
|
+ // util.uploadFile( tempImagePath, this.doUpload )
|
|
|
+ // },
|
|
|
+ // fail:()=>{
|
|
|
+ // app.showMsg('选择失败')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
}
|
|
|
})
|